diff --git a/commands/command.h b/commands/command.h index 19908ca7c..303915ea7 100644 --- a/commands/command.h +++ b/commands/command.h @@ -26,6 +26,7 @@ bool isClean(); // Any changes need to be saved? QAction *undoAction(QObject *parent); // Create an undo action. QAction *redoAction(QObject *parent); // Create an redo action. QString changesMade(); // return a string with the texts from all commands on the undo stack -> for commit message +bool placingCommand(); // Currently executing a new command -> might not have to update the field the user just edited. // 2) Dive-list related commands diff --git a/commands/command_base.cpp b/commands/command_base.cpp index 8ebbf9be5..1110699a9 100644 --- a/commands/command_base.cpp +++ b/commands/command_base.cpp @@ -91,10 +91,13 @@ QString changesMade() return changeTexts; } +static bool executingCommand = false; bool execute(Base *cmd) { if (cmd->workToBeDone()) { + executingCommand = true; undoStack.push(cmd); + executingCommand = false; emit diveListNotifier.commandExecuted(); return true; } else { @@ -103,6 +106,11 @@ bool execute(Base *cmd) } } +bool placingCommand() +{ + return executingCommand; +} + } // namespace Command