summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-12-13 06:33:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-20 15:20:44 -0700
commitca336d13e52ccde64f2d0e2962ee7dbd3fbea4f1 (patch)
tree3d7e5544497bb0f91cb0ad67a1887f2677cad588 /desktop-widgets
parent65acd9976c35689ae4b8faafd3ca29a4b9c1905d (diff)
downloadsubsurface-ca336d13e52ccde64f2d0e2962ee7dbd3fbea4f1.tar.gz
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.cpp10
-rw-r--r--desktop-widgets/divelistview.h1
2 files changed, 10 insertions, 1 deletions
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<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);
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index 275e26779..a0ead2de3 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -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();