Add undo/redo commands for importing dive sites

ImportDiveSites adds the provided dive sites to the core dive site table
and stores the source data so it can be undone.

Signed-off-by: Doug Junkins <junkins@foghead.com>
This commit is contained in:
Doug Junkins 2019-05-04 20:40:27 -07:00 committed by bstoeger
parent c38a86bebf
commit 704ff9f82e
4 changed files with 59 additions and 1 deletions

View file

@ -21,10 +21,26 @@ private:
// Note: we only add one dive site. Nevertheless, we use vectors so that we
// can reuse the dive site deletion code.
// For redo
// For undo
std::vector<dive_site *> sitesToRemove;
// For redo
std::vector<OwningDiveSitePtr> sitesToAdd;
};
class ImportDiveSites : public Base {
public:
// Note: the dive site table is consumed after the call it will be empty.
ImportDiveSites(struct dive_site_table *sites, const QString &source);
private:
bool workToBeDone() override;
void undo() override;
void redo() override;
// For undo
std::vector<dive_site *> sitesToRemove;
// For redo
std::vector<OwningDiveSitePtr> sitesToAdd;
};