diff options
Diffstat (limited to 'desktop-widgets/command_divesite.cpp')
-rw-r--r-- | desktop-widgets/command_divesite.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/desktop-widgets/command_divesite.cpp b/desktop-widgets/command_divesite.cpp index 28d47d603..b3a4911e5 100644 --- a/desktop-widgets/command_divesite.cpp +++ b/desktop-widgets/command_divesite.cpp @@ -62,6 +62,28 @@ static std::vector<OwningDiveSitePtr> removeDiveSites(std::vector<dive_site *> & return res; } +AddDiveSite::AddDiveSite(const QString &name) +{ + setText(tr("add dive site")); + sitesToAdd.emplace_back(alloc_dive_site()); + sitesToAdd.back()->name = copy_qstring(name); +} + +bool AddDiveSite::workToBeDone() +{ + return true; +} + +void AddDiveSite::redo() +{ + sitesToRemove = std::move(addDiveSites(sitesToAdd)); +} + +void AddDiveSite::undo() +{ + sitesToAdd = std::move(removeDiveSites(sitesToRemove)); +} + DeleteDiveSites::DeleteDiveSites(const QVector<dive_site *> &sites) : sitesToRemove(sites.toStdVector()) { setText(tr("delete %n dive site(s)", "", sites.size())); |