mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d1bee58dad
commit
4687de8c82
1 changed files with 18 additions and 13 deletions
|
@ -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 {
|
Component {
|
||||||
id: diveDelegate
|
id: diveDelegate
|
||||||
|
@ -389,25 +401,18 @@ Kirigami.ScrollablePage {
|
||||||
credentialStatus === CloudStatus.CS_VERIFIED) ? 0 : 1
|
credentialStatus === CloudStatus.CS_VERIFIED) ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
||||||
function setupActions() {
|
onVisibleChanged: {
|
||||||
if (prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
console.log("---> Startpage changed visibility to " + visible)
|
||||||
prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
|
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)
|
|
||||||
} else {
|
|
||||||
page.actions.main = null
|
page.actions.main = null
|
||||||
page.actions.right = null
|
page.actions.right = null
|
||||||
page.actions.left = null
|
page.actions.left = null
|
||||||
page.title = qsTr("Cloud credentials")
|
page.title = qsTr("Cloud credentials")
|
||||||
|
} else {
|
||||||
|
// This is to be removed when StartPage becomes a proper page
|
||||||
|
page.simulateVisibleChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onVisibleChanged: {
|
|
||||||
setupActions();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
|
Loading…
Add table
Reference in a new issue