summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-06 10:37:18 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-06 10:37:18 +0900
commit3f7490c2053090bfd54de2fcb4df23c5be7b5ffd (patch)
tree6d50a903068e8afd93da281f40e712d029c0c095 /qt-ui/divelistview.cpp
parentcd7488491ff2a3be57ba018c4fb8f1a30d749679 (diff)
downloadsubsurface-3f7490c2053090bfd54de2fcb4df23c5be7b5ffd.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp11
1 files changed, 10 insertions, 1 deletions
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<void*>();
+ 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());