Undo: update notes field if changed by undo commands

To keep the UI in a consistent state, update the notes field if
it is changed by an undo command. To that purpose, add a new
signal to diveListNotifier with a list of dives and a field-id
as payload.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-01-27 22:08:13 +01:00 committed by Dirk Hohndel
parent 9e603cbe2b
commit 45ef879546
5 changed files with 67 additions and 12 deletions

View file

@ -5,6 +5,7 @@
#define COMMAND_EDIT_H
#include "command_base.h"
#include "core/subsurface-qt/DiveListNotifier.h"
#include <QVector>
@ -43,6 +44,7 @@ protected:
virtual void set(struct dive *d, T) const = 0;
virtual T data(struct dive *d) const = 0;
virtual QString fieldName() const = 0; // Name of the field, used to create the undo menu-entry
virtual DiveField fieldId() const = 0;
};
class EditNotes : public EditBase<QString> {
@ -51,6 +53,7 @@ public:
void set(struct dive *d, QString s) const override;
QString data(struct dive *d) const override;
QString fieldName() const override;
DiveField fieldId() const override;
};
} // namespace Command