From 4e47cdfa2c611e0e02f46b84d76d29f1fab74e20 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 12 Dec 2019 23:07:17 +0100 Subject: Undo: implement invalidate-dive command Connect command to context menu. Signed-off-by: Berthold Stoeger --- desktop-widgets/divelistview.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 1f3a20455..7050863bf 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -838,22 +838,7 @@ void DiveListView::addToTrip(int delta) void DiveListView::markDiveInvalid() { - int i; - struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value(); - if (!d) - return; - for_each_dive (i, d) { - if (!d->selected) - continue; - //TODO: this should be done in the future - // now mark the dive invalid... how do we do THAT? - // d->invalid = true; - } - mark_divelist_changed(true); - MainWindow::instance()->refreshDisplay(); - if (prefs.display_invalid_dives == false) { - clearSelection(); - } + Command::editInvalid(true, false); } void DiveListView::deleteDive() @@ -935,9 +920,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) } if (d) { popup.addAction(tr("Delete dive(s)"), this, &DiveListView::deleteDive); -#if 0 - popup.addAction(tr("Mark dive(s) invalid", this, &DiveListView::markDiveInvalid); -#endif + 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