From 56dcbd9588fa3b7d70a4b639b71cb18e1c462067 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 13 Mar 2019 20:58:25 +0100 Subject: Undo: implement undo of dive site addition Implement a dive site addition undo command and connect it to the add dive site button. The added dive site has a default name ("new dive site"). Signed-off-by: Berthold Stoeger --- desktop-widgets/command_divesite.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'desktop-widgets/command_divesite.h') diff --git a/desktop-widgets/command_divesite.h b/desktop-widgets/command_divesite.h index 78622862e..f436a84b4 100644 --- a/desktop-widgets/command_divesite.h +++ b/desktop-widgets/command_divesite.h @@ -11,6 +11,23 @@ // We put everything in a namespace, so that we can shorten names without polluting the global namespace namespace Command { +class AddDiveSite : public Base { +public: + AddDiveSite(const QString &name); +private: + bool workToBeDone() override; + void undo() override; + void redo() override; + + // Note: we only add one dive site. Nevertheless, we use vectors so that we + // can reuse the dive site deletion code. + // For redo + std::vector sitesToRemove; + + // For undo + std::vector sitesToAdd; +}; + class DeleteDiveSites : public Base { public: DeleteDiveSites(const QVector &sites); -- cgit v1.2.3-70-g09d2