diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-02-20 13:25:44 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | 2c8f962ecc32dc5b5d3c9f3218568ff1c6b4064f (patch) | |
tree | c2e7cd8fe009b8317a4ade3fe8103105148e5c4f | |
parent | a4043401c90c41322aa257cec7dee70592db59d8 (diff) | |
download | subsurface-2c8f962ecc32dc5b5d3c9f3218568ff1c6b4064f.tar.gz |
mobile UI: allow adding a dive to a trip from context menu
Right now this is only available on the DiveDetails screen. The menu entries
are only enabled if there is such a trip to add the dive to (and if the dive
isn't already part of a trip).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 5bed0f5ef..f1feeedd7 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -61,13 +61,28 @@ Kirigami.Page { property QtObject removeDiveFromTripAction: Kirigami.Action { text: qsTr ("Remove this dive from trip") - enabled: currentItem && currentItem.modelData.diveInTrip + enabled: currentItem && currentItem.modelData && currentItem.modelData.diveInTrip onTriggered: { manager.appendTextToLog("remove dive #" + currentItem.modelData.number + " from its trip") manager.removeDiveFromTrip(currentItem.modelData.id) } } - property QtObject addDiveToTripAction: Kirigami.Action { text: qsTr ("Add dive to trip <TBD>") } + property QtObject addDiveToTripAboveAction: Kirigami.Action { + text: qsTr ("Add dive to trip above") + enabled: currentItem && currentItem.modelData && !currentItem.modelData.diveInTrip && currentItem.modelData.tripAbove !== -1 + onTriggered: { + manager.appendTextToLog("add dive #" + currentItem.modelData.number + " to trip with id " + currentItem.modelData.tripAbove) + manager.addDiveToTrip(currentItem.modelData.id, currentItem.modelData.tripAbove) + } + } + property QtObject addDiveToTripBelowAction: Kirigami.Action { + text: qsTr ("Add dive to trip below") + enabled: currentItem && currentItem.modelData && !currentItem.modelData.diveInTrip && currentItem.modelData.tripBelow !== -1 + onTriggered: { + manager.appendTextToLog("add dive #" + currentItem.modelData.number + " to trip with id " + currentItem.modelData.tripBelow) + manager.addDiveToTrip(currentItem.modelData.id, currentItem.modelData.tripBelow) + } + } property QtObject undoAction: Kirigami.Action { text: qsTr("Undo") + " " + manager.undoText enabled: manager.undoText !== "" @@ -78,7 +93,7 @@ Kirigami.Page { enabled: manager.redoText !== "" onTriggered: manager.redo() } - property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAction, undoAction, redoAction ] + property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, undoAction, redoAction ] states: [ State { |