undo: switch to dive after replan / profile edit

It is confusing when undoing a command and nothing happens
in the UI. Therefore, switch to the corresponding dive when
undoing/redoing a replan or profile edit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-02-19 11:42:19 +01:00
parent ea0c030770
commit c5c8bfec65

View file

@ -859,6 +859,8 @@ void ReplanDive::undo()
emit diveListNotifier.cylindersReset(divesToNotify); emit diveListNotifier.cylindersReset(divesToNotify);
emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE | emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE |
DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS); DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS);
if (!placingCommand())
setSelection({ d }, d);
} }
// Redo and undo do the same // Redo and undo do the same
@ -930,6 +932,8 @@ void EditProfile::undo()
QVector<dive *> divesToNotify = { d }; QVector<dive *> divesToNotify = { d };
emit diveListNotifier.divesChanged(divesToNotify, DiveField::DURATION | DiveField::DEPTH); emit diveListNotifier.divesChanged(divesToNotify, DiveField::DURATION | DiveField::DEPTH);
if (!placingCommand())
setSelection({ d }, d);
} }
// Redo and undo do the same // Redo and undo do the same