From 56db02a6850baa8866edc8149fdad05f82d02df9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 18 Feb 2020 16:12:12 -0800 Subject: mobile UI: only show context menu when viewing a dive In add and edit mode this is confusing and wrong. There is a bug in Kirigami that creates lots of bogus error message about missing mainFlickable. That needs to be patched out. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveDetails.qml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 46e9952a2..44c64042e 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -59,6 +59,20 @@ Kirigami.Page { background: Rectangle { color: subsurfaceTheme.backgroundColor } width: rootItem.colWidth + property QtObject removeDiveFromTripAction: Kirigami.Action { text: qsTr ("Remove dive from trip ") } + property QtObject addDiveToTripAction: Kirigami.Action { text: qsTr ("Add dive to trip ") } + 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, addDiveToTripAction, undoAction, redoAction ] + states: [ State { name: "view" @@ -68,6 +82,7 @@ Kirigami.Page { right: deleteAction left: currentItem ? (currentItem.modelData && currentItem.modelData.gps !== "" ? mapAction : null) : null } + contextualActions: contextactions } }, State { @@ -78,6 +93,7 @@ Kirigami.Page { right: cancelAction left: null } + contextualActions: [] } }, State { @@ -88,6 +104,7 @@ Kirigami.Page { right: cancelAction left: null } + contextualActions: [] } } ] @@ -191,20 +208,6 @@ Kirigami.Page { } } - contextualActions: [ - Kirigami.Action { - text: qsTr("Undo") + " " + manager.undoText - enabled: manager.undoText !== "" - onTriggered: manager.undo() - }, - Kirigami.Action { - text: qsTr("Redo") + " " + manager.redoText - enabled: manager.redoText !== "" - onTriggered: manager.redo() - } - ] - - onBackRequested: { if (state === "edit") { endEditMode() -- cgit v1.2.3-70-g09d2