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>
This commit is contained in:
Dirk Hohndel 2016-04-19 04:51:19 -07:00
parent fe62da3a6b
commit c6dbbe1aac
5 changed files with 20 additions and 47 deletions

View file

@ -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") {

View file

@ -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"
}
}

View file

@ -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 {

View file

@ -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()
}
}
}

View file

@ -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>