Undo: make dive site removal undoable

Create a new undo-command for deleting dive sites. If there are dives
associated with that site, the dives will be removed. The frontend
is not yet updated in such a case, as that infrastructure is in a
different PR.

Connect the trashcan icon of the dive site table to the undo command.
Currently, this code is in the dive site model, which makes little
sense, but is how the TableView class works. We might want to change
that when cylinder and weight editing are made undoable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-12 22:35:43 +01:00 committed by Dirk Hohndel
parent e99c4c9059
commit 8e1f736d2b
7 changed files with 153 additions and 1 deletions

View file

@ -42,6 +42,8 @@ class DiveSiteSortedModel : public QSortFilterProxyModel {
private:
bool filterAcceptsRow(int sourceRow, const QModelIndex &source_parent) const override;
bool lessThan(const QModelIndex &i1, const QModelIndex &i2) const override;
public slots:
void remove(const QModelIndex &index);
public:
DiveSiteSortedModel();
QStringList allSiteNames() const;