diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-05-24 21:17:22 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-06-15 11:20:49 -0700 |
commit | f51e402e04bc1f15da7b9e4d4f57a4e4c5c28490 (patch) | |
tree | bb642535124892ae64e14b33c35d9242e594cddb /desktop-widgets/command_base.cpp | |
parent | 944a9aed54b7dfdac606f5503578b46f6c0e8235 (diff) | |
download | subsurface-f51e402e04bc1f15da7b9e4d4f57a4e4c5c28490.tar.gz |
Undo: only show warning message if dives were actually edited
The multiple-dives-edited message was shown even if the value was
not changed. Notably, when tab-flipping through the dive fields.
Therefore, changed the execute_edit() function to return zero
when no command was executed. For this, return a boolean from
the execute() function indicating whether the command was really
executed or trashed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_base.cpp')
-rw-r--r-- | desktop-widgets/command_base.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/desktop-widgets/command_base.cpp b/desktop-widgets/command_base.cpp index 26a587f7c..9316135dd 100644 --- a/desktop-widgets/command_base.cpp +++ b/desktop-widgets/command_base.cpp @@ -38,12 +38,15 @@ QAction *redoAction(QObject *parent) return undoStack.createRedoAction(parent, QCoreApplication::translate("Command", "&Redo")); } -void execute(Base *cmd) +bool execute(Base *cmd) { - if (cmd->workToBeDone()) + if (cmd->workToBeDone()) { undoStack.push(cmd); - else + return true; + } else { delete cmd; + return false; + } } } // namespace Command |