aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-13 21:09:33 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-13 21:10:51 -0800
commit5952b09b51b84fa1367a8013e1d5df4cb46e2c5d (patch)
treef91751c430331ab00efdc462dd738af7a61694c8 /qt-mobile/qml
parentae116c5bc80f152f4eb5061252f52e70903398c6 (diff)
downloadsubsurface-5952b09b51b84fa1367a8013e1d5df4cb46e2c5d.tar.gz
QML UI: use action button and Android back button to save / go back
This is more consistent with the rest of our UI To make this work you once again need changes to the mobile components that aren't upstream, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r--qt-mobile/qml/CloudCredentials.qml36
-rw-r--r--qt-mobile/qml/DiveList.qml24
-rw-r--r--qt-mobile/qml/StartPage.qml3
3 files changed, 34 insertions, 29 deletions
diff --git a/qt-mobile/qml/CloudCredentials.qml b/qt-mobile/qml/CloudCredentials.qml
index 649e57240..73722d3a0 100644
--- a/qt-mobile/qml/CloudCredentials.qml
+++ b/qt-mobile/qml/CloudCredentials.qml
@@ -14,6 +14,13 @@ Item {
property string password: password.text;
property bool issave: savePassword.checked;
+ function saveCredentials() {
+ manager.cloudUserName = login.text
+ manager.cloudPassword = password.text
+ manager.saveCloudPassword = savePassword.checked
+ manager.saveCloudCredentials()
+ }
+
ColumnLayout {
id: outerLayout
width: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
@@ -71,34 +78,5 @@ Item {
}
}
Item { width: MobileComponents.Units.gridUnit; height: width }
- RowLayout {
- Item {
- height: saveButton.height
- width: saveButton.width
- SubsurfaceButton {
- id: saveButton
- text: "Save"
- onClicked: {
- manager.cloudUserName = login.text
- manager.cloudPassword = password.text
- manager.saveCloudPassword = savePassword.checked
- manager.saveCloudCredentials()
- }
- }
- }
- Item {
- height: backButton.height
- width: backButton.width
- visible: diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID
- SubsurfaceButton {
- id: backButton
- text: "Back to dive list"
- onClicked: {
- manager.credentialStatus = oldStatus
- }
- }
- }
- }
-
}
}
diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml
index 403cb6846..298680682 100644
--- a/qt-mobile/qml/DiveList.qml
+++ b/qt-mobile/qml/DiveList.qml
@@ -184,13 +184,37 @@ MobileComponents.Page {
}
}
}
+
+ property QtObject saveAction: Action {
+ iconName: "document-save"
+ onTriggered: {
+ startPage.saveCredentials();
+ }
+ }
+
+ onBackRequested: {
+ if (diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID) {
+ manager.credentialStatus = oldStatus
+ }
+ event.accepted = true;
+ }
+
ScrollView {
id: startPageWrapper
anchors.fill: parent
opacity: (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1
visible: opacity > 0
Behavior on opacity { NumberAnimation { duration: MobileComponents.Units.shortDuration } }
+ onVisibleChanged: {
+ if (visible) {
+ page.mainAction = page.saveAction
+ } else {
+ page.mainAction = null
+ }
+ }
+
StartPage {
+ id: startPage
}
}
}
diff --git a/qt-mobile/qml/StartPage.qml b/qt-mobile/qml/StartPage.qml
index 28e9006d4..3793b34e3 100644
--- a/qt-mobile/qml/StartPage.qml
+++ b/qt-mobile/qml/StartPage.qml
@@ -13,6 +13,8 @@ ColumnLayout {
property int buttonWidth: width * 0.9
+ function saveCredentials() { cloudCredentials.saveCredentials() }
+
MobileComponents.Heading {
Layout.bottomMargin: MobileComponents.Units.largeSpacing
text: "Subsurface-mobile"
@@ -32,6 +34,7 @@ ColumnLayout {
wrapMode: Text.WordWrap
}
CloudCredentials {
+ id: cloudCredentials
Layout.fillWidth: true
Layout.margins: MobileComponents.Units.gridUnit
Layout.topMargin: MobileComponents.Units.gridUnit * 2