From 66fd93c9ccc958b080d902fb06fff0aa34ae8a36 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 26 Mar 2020 12:12:38 -0700 Subject: mobile/dive-list: add ability to create trip This adds a context menu entry for top level dives that allows the user to create a trip for that dive. Unfortunately this creates a new string to translate right before a release... Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qml/DiveList.qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index cda60bf59..72d9d2da9 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -271,6 +271,15 @@ Kirigami.ScrollablePage { manager.addDiveToTrip(currentItem.myData.id, currentItem.myData.tripBelow) } } + property QtObject createTripForDiveAction: Kirigami.Action { + text: visible ? qsTr("Create trip with dive %1").arg(currentItem.myData.number) : "" + icon { name: ":/icons/list-add" } + visible: currentItem && currentItem.myData && !currentItem.myData.isTrip && currentItem.myData.isTopLevel + onTriggered: { + manager.addTripForDive(currentItem.myData.id) + } + } + property QtObject toggleInvalidAction: Kirigami.Action { text: currentItem && currentItem.myData && currentItem.myData.isInvalid ? qsTr("Mark dive as valid") : qsTr("Mark dive as invalid") // icon: { name: "TBD" } @@ -316,7 +325,7 @@ Kirigami.ScrollablePage { enabled: manager.redoText !== "" onTriggered: manager.redo() } - property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, toggleInvalidAction, deleteAction, mapAction, tripDetailsEdit, undoAction, redoAction ] + property variant contextactions: [ removeDiveFromTripAction, createTripForDiveAction, addDiveToTripAboveAction, addDiveToTripBelowAction, toggleInvalidAction, deleteAction, mapAction, tripDetailsEdit, undoAction, redoAction ] function setupActions() { if (Backend.cloud_verification_status === Enums.CS_VERIFIED || Backend.cloud_verification_status === Enums.CS_NOCLOUD) { -- cgit v1.2.3-70-g09d2