core: fix undo of dive merging

When merging two dives, if a divesite is chosen that doesn't
have a GPS location, but another divesite has a GPS location,
then the GPS location of the former is set to that of the
latter.

However, that was done outside of the undo system, so that
it is not undone and the frontend is not made aware of the
change.

Fix this. To simplify things, move the code from the undo
machinery to the core.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-09-01 14:12:05 +02:00 committed by Michael Keller
parent 27a89b0232
commit cc55c442a3
6 changed files with 81 additions and 44 deletions

View file

@ -267,6 +267,7 @@ private:
void undoit() override;
void redoit() override;
bool workToBeDone() override;
void swapDivesite(); // Common code for undo and redo.
// For redo
// Add one and remove a batch of dives
@ -284,6 +285,8 @@ private:
// For undo and redo
QVector<QPair<dive *, int>> divesToRenumber;
dive_site *site;
location_t location;
};
} // namespace Command