Dive list: add option to mark dives valid

If the dive the user clicked on is invalid show an option to
make the dive valid.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-12-13 06:33:12 +01:00 committed by Dirk Hohndel
parent 65acd9976c
commit ca336d13e5
2 changed files with 10 additions and 1 deletions

View file

@ -841,6 +841,11 @@ void DiveListView::markDiveInvalid()
Command::editInvalid(true, false);
}
void DiveListView::markDiveValid()
{
Command::editInvalid(false, false);
}
void DiveListView::deleteDive()
{
struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value<struct dive *>();
@ -920,7 +925,10 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
}
if (d) {
popup.addAction(tr("Delete dive(s)"), this, &DiveListView::deleteDive);
popup.addAction(tr("Mark dive(s) invalid"), this, &DiveListView::markDiveInvalid);
if (d->invalid)
popup.addAction(tr("Mark dive(s) valid"), this, &DiveListView::markDiveValid);
else
popup.addAction(tr("Mark dive(s) invalid"), this, &DiveListView::markDiveInvalid);
}
if (amount_selected > 1 && consecutive_selected())
popup.addAction(tr("Merge selected dives"), this, &DiveListView::mergeDives);

View file

@ -47,6 +47,7 @@ slots:
void removeFromTrip();
void deleteDive();
void markDiveInvalid();
void markDiveValid();
void rowsInserted(const QModelIndex &parent, int start, int end) override;
void reset() override;
void mergeTripAbove();