From c6dbbe1aacf4dc3c6b18b318428113a3d0050625 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 19 Apr 2016 04:51:19 -0700 Subject: QML UI: adapt for latest Kirigami In commit 50ebdd020e3c of the Kirigami project the syntax with which actions are added to pages has changed. This commit tracks that, adds the new file that was added in Kirigami and also removes the now obsolete context menus (since we have a working back button on iOS now) Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveDetails.qml | 32 +++++++------------------------- mobile-widgets/qml/DiveList.qml | 4 ++-- mobile-widgets/qml/GpsList.qml | 12 ------------ mobile-widgets/qml/Preferences.qml | 18 ++++++++++-------- mobile-widgets/qml/mobile-resources.qrc | 1 + 5 files changed, 20 insertions(+), 47 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 31fe8ce8d..2de542b6e 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -38,17 +38,20 @@ Kirigami.Page { states: [ State { name: "view" - PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ deleteAction, backAction ] : [ deleteAction ] } + PropertyChanges { + target: diveDetailsPage; + actions { + right: deleteAction + } + } PropertyChanges { target: detailsEditScroll; opened: false } }, State { name: "edit" - PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null } PropertyChanges { target: detailsEditScroll; opened: true } }, State { name: "add" - PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null } PropertyChanges { target: detailsEditScroll; opened: true } } @@ -70,28 +73,7 @@ Kirigami.Page { } } - property QtObject cancelAction: Kirigami.Action { - text: state === "edit" ? "Cancel edit" : "Cancel dive add" - iconName: "dialog-cancel" - onTriggered: { - contextDrawer.close() - if (state === "add") - returnTopPage() - else - endEditMode() - } - } - - property QtObject backAction: Action { - text: "Back to dive list" - iconName: "go-previous" - onTriggered: { - contextDrawer.close() - returnTopPage() - } - } - - mainAction: Action { + actions.main: Action { iconName: state !== "view" ? "document-save" : "document-edit" onTriggered: { if (state === "edit" || state === "add") { diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index a89b05c8b..6d76cb864 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -216,10 +216,10 @@ Kirigami.ScrollablePage { Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } onVisibleChanged: { if (visible) { - page.mainAction = page.saveAction + page.actions.main = page.saveAction title = "Cloud credentials" } else { - page.mainAction = page.addDiveAction + page.actions.main = page.addDiveAction title = "Dive list" } } diff --git a/mobile-widgets/qml/GpsList.qml b/mobile-widgets/qml/GpsList.qml index 6903acd80..8866160d9 100644 --- a/mobile-widgets/qml/GpsList.qml +++ b/mobile-widgets/qml/GpsList.qml @@ -15,18 +15,6 @@ Kirigami.ScrollablePage { objectName: "gpsList" title: "GPS Fixes" -/* this can be done by hitting the back key - contextualActions: [ - Action { - text: "Close GPS list" - iconName: "dialog-cancel" - onTriggered: { - stackView.pop() - contextDrawer.close() - } - } - ] - */ Component { id: gpsDelegate Kirigami.SwipeListItem { diff --git a/mobile-widgets/qml/Preferences.qml b/mobile-widgets/qml/Preferences.qml index 979a49b1d..f7767b4d7 100644 --- a/mobile-widgets/qml/Preferences.qml +++ b/mobile-widgets/qml/Preferences.qml @@ -9,14 +9,16 @@ import org.subsurfacedivelog.mobile 1.0 Kirigami.Page { title: "Preferences" - mainAction: Action { - text: "Save" - iconName: "document-save" - onTriggered: { - manager.distanceThreshold = distanceThreshold.text - manager.timeThreshold = timeThreshold.text - manager.savePreferences() - stackView.pop() + actions { + main: Action { + text: "Save" + iconName: "document-save" + onTriggered: { + manager.distanceThreshold = distanceThreshold.text + manager.timeThreshold = timeThreshold.text + manager.savePreferences() + stackView.pop() + } } } diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index 3735c40ab..e54e1e458 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -51,6 +51,7 @@ kirigami/private/EdgeShadow.qml kirigami/private/MenuIcon.qml kirigami/private/PageStack.js + kirigami/private/PageActionPropertyGroup.qml kirigami/private/PassiveNotification.qml kirigami/private/RefreshableScrollView.qml kirigami/icons/go-next.svg -- cgit v1.2.3-70-g09d2