Undo: make editing of dive number undoable

When pressing F2 in the dive list, the number can be edited.
Make this action undoable by implementing a EditNumber command.

This command is differs from the other undo commands, as not the
currently selected dives are changed. This means that the EditCommand
needs an alternative constructor taking a single dive. This constructor
was implemented in the base class so that all edit commands can now
be called with a single dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-17 15:49:45 +02:00 committed by Dirk Hohndel
parent 658ac2bb78
commit 726d08c2f7
5 changed files with 55 additions and 2 deletions

View file

@ -163,6 +163,11 @@ int editMode(int index, int newValue, bool currentDiveOnly)
return execute_edit(new EditMode(index, newValue, currentDiveOnly));
}
int editNumber(int newValue, bool currentDiveOnly)
{
return execute_edit(new EditNumber(newValue, currentDiveOnly));
}
int editSuit(const QString &newValue, bool currentDiveOnly)
{
return execute_edit(new EditSuit(newValue, currentDiveOnly));