diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-14 00:00:54 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | 4d183e0d75a3ae5b536abb6ea254ba224d713f72 (patch) | |
tree | 2be4630d6cb83c2930da6c9c4fd081c09b658273 /desktop-widgets/command_divesite.cpp | |
parent | 2bb2643ae4d4c1b6d0c32c9a18e2225eed0b5936 (diff) | |
download | subsurface-4d183e0d75a3ae5b536abb6ea254ba224d713f72.tar.gz |
Undo: implement undo of dive site notes editing
Simply copy the code of description editing.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_divesite.cpp')
-rw-r--r-- | desktop-widgets/command_divesite.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop-widgets/command_divesite.cpp b/desktop-widgets/command_divesite.cpp index b3a4911e5..5d32a902d 100644 --- a/desktop-widgets/command_divesite.cpp +++ b/desktop-widgets/command_divesite.cpp @@ -159,4 +159,27 @@ void EditDiveSiteDescription::undo() redo(); } +EditDiveSiteNotes::EditDiveSiteNotes(dive_site *dsIn, const QString ¬es) : ds(dsIn), + value(notes) +{ + setText(tr("Edit dive site notes")); +} + +bool EditDiveSiteNotes::workToBeDone() +{ + return value != QString(ds->notes); +} + +void EditDiveSiteNotes::redo() +{ + swap(ds->notes, value); + emit diveListNotifier.diveSiteChanged(ds, LocationInformationModel::NOTES); // Inform frontend of changed dive site. +} + +void EditDiveSiteNotes::undo() +{ + // Undo and redo do the same + redo(); +} + } // namespace Command |