diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/command.cpp | 5 | ||||
-rw-r--r-- | commands/command.h | 1 | ||||
-rw-r--r-- | commands/command_edit.cpp | 21 | ||||
-rw-r--r-- | commands/command_edit.h | 9 |
4 files changed, 36 insertions, 0 deletions
diff --git a/commands/command.cpp b/commands/command.cpp index fe55b20d6..1fb968778 100644 --- a/commands/command.cpp +++ b/commands/command.cpp @@ -168,6 +168,11 @@ int editMode(int index, int newValue, bool currentDiveOnly) return execute_edit(new EditMode(index, newValue, currentDiveOnly)); } +int editInvalid(int newValue, bool currentDiveOnly) +{ + return execute_edit(new EditInvalid(newValue, currentDiveOnly)); +} + int editSuit(const QString &newValue, bool currentDiveOnly) { return execute_edit(new EditSuit(newValue, currentDiveOnly)); diff --git a/commands/command.h b/commands/command.h index 5663da157..e19d093cb 100644 --- a/commands/command.h +++ b/commands/command.h @@ -66,6 +66,7 @@ void purgeUnusedDiveSites(); int editNotes(const QString &newValue, bool currentDiveOnly); int editSuit(const QString &newValue, bool currentDiveOnly); int editMode(int index, int newValue, bool currentDiveOnly); +int editInvalid(int newValue, bool currentDiveOnly); int editRating(int newValue, bool currentDiveOnly); int editVisibility(int newValue, bool currentDiveOnly); int editWaveSize(int newValue, bool currentDiveOnly); diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 7fd56e0d2..a880f9f2f 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -574,6 +574,27 @@ DiveField EditMode::fieldId() const return DiveField::MODE; } +// ***** Invalid ***** +void EditInvalid::set(struct dive *d, int invalid) const +{ + d->invalid = invalid; +} + +int EditInvalid::data(struct dive *d) const +{ + return d->invalid; +} + +QString EditInvalid::fieldName() const +{ + return tr("invalid"); +} + +DiveField EditInvalid::fieldId() const +{ + return DiveField::INVALID; +} + // ***** Tag based commands ***** EditTagsBase::EditTagsBase(const QStringList &newListIn, bool currentDiveOnly) : EditDivesBase(currentDiveOnly), diff --git a/commands/command_edit.h b/commands/command_edit.h index 101c8b79b..cbbd0d968 100644 --- a/commands/command_edit.h +++ b/commands/command_edit.h @@ -222,6 +222,15 @@ public: DiveField fieldId() const override; }; +class EditInvalid : public EditBase<int> { +public: + using EditBase<int>::EditBase; // Use constructor of base class. + void set(struct dive *d, int number) const override; + int data(struct dive *d) const override; + QString fieldName() const override; + DiveField fieldId() const override; +}; + // Fields that work with tag-lists (tags, buddies, divemasters) work differently and therefore // have their own base class. In this case, it's not a template, as all these lists are base // on strings. |