diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-19 04:51:19 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-19 05:14:44 -0700 |
commit | c6dbbe1aacf4dc3c6b18b318428113a3d0050625 (patch) | |
tree | 85209460aef1726028ac72fbe666198e2b63f6e7 /mobile-widgets/qml | |
parent | fe62da3a6b52b1367a8484ddeabc0401d1c2c0f2 (diff) | |
download | subsurface-c6dbbe1aacf4dc3c6b18b318428113a3d0050625.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 32 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 4 | ||||
-rw-r--r-- | mobile-widgets/qml/GpsList.qml | 12 | ||||
-rw-r--r-- | mobile-widgets/qml/Preferences.qml | 18 | ||||
-rw-r--r-- | mobile-widgets/qml/mobile-resources.qrc | 1 |
5 files changed, 20 insertions, 47 deletions
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 @@ <file alias="org/kde/kirigami/private/EdgeShadow.qml">kirigami/private/EdgeShadow.qml</file> <file alias="org/kde/kirigami/private/MenuIcon.qml">kirigami/private/MenuIcon.qml</file> <file alias="org/kde/kirigami/private/PageStack.js">kirigami/private/PageStack.js</file> + <file alias="org/kde/kirigami/private/PageActionPropertyGroup.qml">kirigami/private/PageActionPropertyGroup.qml</file> <file alias="org/kde/kirigami/private/PassiveNotification.qml">kirigami/private/PassiveNotification.qml</file> <file alias="org/kde/kirigami/private/RefreshableScrollView.qml">kirigami/private/RefreshableScrollView.qml</file> <file alias="org/kde/kirigami/icons/go-next.svg">kirigami/icons/go-next.svg</file> |