diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-02-20 21:39:30 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | ffdcc8bf307e73f8896f219973a27ce3c5f44ed1 (patch) | |
tree | 05521f2b988c86029c349708c653e02fd366757d | |
parent | 2c8f962ecc32dc5b5d3c9f3218568ff1c6b4064f (diff) | |
download | subsurface-ffdcc8bf307e73f8896f219973a27ce3c5f44ed1.tar.gz |
mobile UI: add context menu to dive list
This one exposes undo/redo as well as some basic trip manipulations, very similar
to what's already available on the dive details page. Except that here it also
makes sense to add a selected dive to a trip above or below (if those exist and
the dive isn't already in a trip).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 65fb0a03c..7ecd9287a 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -239,6 +239,41 @@ Kirigami.ScrollablePage { } } + property alias currentItem: diveListView.currentItem + + property QtObject removeDiveFromTripAction: Kirigami.Action { + text: visible ? qsTr ("Remove dive %1 from trip").arg(currentItem.myData.number) : "" + visible: currentItem && currentItem.myData && currentItem.myData.diveInTrip === true + onTriggered: { + manager.removeDiveFromTrip(currentItem.myData.id) + } + } + property QtObject addDiveToTripAboveAction: Kirigami.Action { + text: visible ? qsTr ("Add dive %1 to trip above").arg(currentItem.myData.number) : "" + visible: currentItem && currentItem.myData && !currentItem.myData.diveInTrip && currentItem.myData.tripAbove !== -1 + onTriggered: { + manager.addDiveToTrip(currentItem.myData.id, currentItem.myData.tripAbove) + } + } + property QtObject addDiveToTripBelowAction: Kirigami.Action { + text: visible ? qsTr ("Add dive %1 to trip below").arg(currentItem.myData.number) : "" + visible: currentItem && currentItem.myData && !currentItem.myData.diveInTrip && currentItem.myData.tripBelow !== -1 + onTriggered: { + manager.addDiveToTrip(currentItem.myData.id, currentItem.myData.tripBelow) + } + } + property QtObject undoAction: Kirigami.Action { + text: qsTr("Undo") + " " + manager.undoText + enabled: manager.undoText !== "" + onTriggered: manager.undo() + } + property QtObject redoAction: Kirigami.Action { + text: qsTr("Redo") + " " + manager.redoText + enabled: manager.redoText !== "" + onTriggered: manager.redo() + } + property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, undoAction, redoAction ] + StartPage { id: startPage anchors.fill: parent @@ -252,6 +287,7 @@ Kirigami.ScrollablePage { page.actions.main = page.downloadFromDCAction page.actions.right = page.addDiveAction page.actions.left = page.filterToggleAction + page.contextualActions = contextactions page.title = qsTr("Dive list") if (diveListView.count === 0) showPassiveNotification(qsTr("Please tap the '+' button to add a dive (or download dives from a supported dive computer)"), 3000) @@ -259,6 +295,7 @@ Kirigami.ScrollablePage { page.actions.main = null page.actions.right = null page.actions.left = null + page.contextualActions = null page.title = qsTr("Cloud credentials") } } |