From 72c6b838662f1fb79a806ac2264c7215efa0aa67 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 8 Nov 2019 22:47:38 +0100 Subject: Undo: make weight editing undoable Implement the EditWeight undo command. Since there is common code (storage of the old weight), this creates a common base class for RemoveWeight and EditWeight. The model calls directly into the undo command, which is somewhat unfortunate as it feels like a layering violation. It's the easy thing to do for now. Signed-off-by: Berthold Stoeger --- commands/command.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'commands/command.cpp') diff --git a/commands/command.cpp b/commands/command.cpp index 9417eec0e..9ea0e860f 100644 --- a/commands/command.cpp +++ b/commands/command.cpp @@ -278,6 +278,11 @@ int removeWeight(int index, bool currentDiveOnly) return execute_edit(new RemoveWeight(index, currentDiveOnly)); } +int editWeight(int index, weightsystem_t ws, bool currentDiveOnly) +{ + return execute_edit(new EditWeight(index, ws, currentDiveOnly)); +} + // Trip editing related commands void editTripLocation(dive_trip *trip, const QString &s) { -- cgit v1.2.3-70-g09d2