From 476ecb8d72e0441bdb1b3c657b84f0006b7b483d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 21 Feb 2020 10:35:44 -0800 Subject: mobile UI: more context actions in dive list This adds the ability to delete a dive and to show its location on the map directly from the dive list. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index f09609a73..7969412d6 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -274,6 +274,20 @@ Kirigami.ScrollablePage { manager.addDiveToTrip(currentItem.myData.id, currentItem.myData.tripBelow) } } + property QtObject deleteAction: Kirigami.Action { + text: qsTr("Delete dive") + icon { name: ":/icons/trash-empty.svg" } + onTriggered: manager.deleteDive(currentItem.myData.id) + } + property QtObject mapAction: Kirigami.Action { + text: qsTr("Show on map") + icon { name: ":/icons/gps" } + visible: currentItem && currentItem.myData && currentItem.myData.gps !== "" + onTriggered: { + showMap() + mapPage.centerOnDiveSite(currentItem.myData.diveSite) + } + } property QtObject undoAction: Kirigami.Action { text: qsTr("Undo") + " " + manager.undoText enabled: manager.undoText !== "" @@ -284,8 +298,7 @@ Kirigami.ScrollablePage { enabled: manager.redoText !== "" onTriggered: manager.redo() } - property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, undoAction, redoAction ] - + property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, deleteAction, mapAction, undoAction, redoAction ] StartPage { id: startPage anchors.fill: parent -- cgit v1.2.3-70-g09d2