aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelistview.cpp25
-rw-r--r--qt-ui/divelistview.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index b905b32be..57fae2955 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -459,6 +459,28 @@ void DiveListView::removeFromTrip()
reload(currentLayout, false);
}
+void DiveListView::newTripAbove()
+{
+ dive_trip_t *trip;
+ int idx;
+ struct dive *d = (struct dive *) contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void*>();
+ if (!d) // shouldn't happen as we only are setting up this action if this is a dive
+ return;
+ rememberSelection();
+ trip = create_and_hookup_trip_from_dive(d);
+ if (d->selected) {
+ for_each_dive(idx, d) {
+ if (!d->selected)
+ continue;
+ add_dive_to_trip(d, trip);
+ }
+ }
+ trip->expanded = 1;
+ mark_divelist_changed(TRUE);
+ reload(currentLayout, false);
+ restoreSelection();
+}
+
void DiveListView::deleteDive()
{
int nr;
@@ -506,7 +528,8 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
popup.addAction(tr("collapse all"), this, SLOT(collapseAll()));
collapseAction = popup.addAction(tr("collapse"), this, SLOT(collapseAll()));
if (d) {
- popup.addAction(tr("remove dive from trip"), this, SLOT(removeFromTrip()));
+ popup.addAction(tr("Remove dive from trip"), this, SLOT(removeFromTrip()));
+ popup.addAction(tr("Create new trip above"), this, SLOT(newTripAbove()));
}
if (trip) {
popup.addAction(tr("Merge trip with trip above"), this, SLOT(mergeTripAbove()));
diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h
index 222a9929a..d03167635 100644
--- a/qt-ui/divelistview.h
+++ b/qt-ui/divelistview.h
@@ -42,6 +42,7 @@ public slots:
void fixMessyQtModelBehaviour();
void mergeTripAbove();
void mergeTripBelow();
+ void newTripAbove();
void mergeDives();
void saveSelectedDivesAs();
void exportSelectedDivesAsUDDF();