summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();