From 3f7490c2053090bfd54de2fcb4df23c5be7b5ffd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 6 Jun 2013 10:37:18 +0900 Subject: Add delete dive context menu entry Getting closer to the way this should work. Adjusted the call to reload to not switch back to tree view and resort (oops). Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'qt-ui/divelistview.cpp') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index eb718fc83..bc6eee87b 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -279,7 +279,15 @@ void DiveListView::removeFromTrip() if (!d) // shouldn't happen as we only are setting up this action if this is a dive return; remove_dive_from_trip(d); - reload(); + reload(currentLayout, false); +} + +void DiveListView::deleteDive() +{ + struct dive *d = (struct dive *) contextMenuIndex.data(TreeItemDT::DIVE_ROLE).value(); + if (d) + delete_single_dive(get_index_for_dive(d)); + reload(currentLayout, false); } void DiveListView::testSlot() @@ -312,6 +320,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) popup.addAction(tr("remove dive from trip"), this, SLOT(removeFromTrip())); } } + popup.addAction(tr("delete dive"), this, SLOT(deleteDive())); // "collapse all" really closes all trips, // "collapse" keeps the trip with the selected dive open QAction * actionTaken = popup.exec(event->globalPos()); -- cgit v1.2.3-70-g09d2