aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-19 11:07:03 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-24 15:53:13 -0800
commit4687de8c8272e43f962679ba4b5d9990c3ce3789 (patch)
treefad9db46db840808cdb721fab74fdd8692367526 /mobile-widgets/qml
parentd1bee58dad50632501f6c43ef9aa6fb257b13854 (diff)
downloadsubsurface-4687de8c8272e43f962679ba4b5d9990c3ce3789.tar.gz
mobile UI/login: clean startPage/setupActions from Divelist
setupActions() in StartPage contained a mixture of StartPage actions and DiveList actions. Split setupActions to be pure. However currently StartPage is embedded inside DiveList so the action onVisibleChanged must be simulated. Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/DiveList.qml31
1 files changed, 18 insertions, 13 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index 2dac5aa2a..0b3f40ade 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -34,6 +34,18 @@ Kirigami.ScrollablePage {
}
}
}
+// this will be: onVisibleChanged: {
+ function simulateVisibleChanged() {
+ console.log("---> DiveList changed visibility to " + visible)
+ if (visible) {
+ page.actions.main = page.downloadFromDCAction
+ page.actions.right = page.addDiveAction
+ page.actions.left = page.filterToggleAction
+ page.title = qsTr("Dive list")
+ if (diveListView.count === 0)
+ showPassiveNotification(qsTr("Please tap the '+' button to add a dive (or download dives from a supported dive computer)"), 3000)
+ }
+ }
Component {
id: diveDelegate
@@ -389,25 +401,18 @@ Kirigami.ScrollablePage {
credentialStatus === CloudStatus.CS_VERIFIED) ? 0 : 1
visible: opacity > 0
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
- function setupActions() {
- if (prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
- prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
- page.actions.main = page.downloadFromDCAction
- page.actions.right = page.addDiveAction
- page.actions.left = page.filterToggleAction
- page.title = qsTr("Dive list")
- if (diveListView.count === 0)
- showPassiveNotification(qsTr("Please tap the '+' button to add a dive (or download dives from a supported dive computer)"), 3000)
- } else {
+ onVisibleChanged: {
+ console.log("---> Startpage changed visibility to " + visible)
+ if (visible) {
page.actions.main = null
page.actions.right = null
page.actions.left = null
page.title = qsTr("Cloud credentials")
+ } else {
+ // This is to be removed when StartPage becomes a proper page
+ page.simulateVisibleChanged()
}
}
- onVisibleChanged: {
- setupActions();
- }
}
Controls.Label {