From ca336d13e52ccde64f2d0e2962ee7dbd3fbea4f1 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 13 Dec 2019 06:33:12 +0100 Subject: 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 --- desktop-widgets/divelistview.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'desktop-widgets/divelistview.cpp') diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 7050863bf..9407fa3f0 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -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(); @@ -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); -- cgit v1.2.3-70-g09d2