mobile UI: remove duplicate StartPage

This was a merge error in the dive list rewrite and brought in a code block that
had moved, which caused issues with correctly switching to the dive list.

Calling setupActions() moves to the diveListView (where it really belongs).

Instead of messing with the visibility of components of the same page, we now
simply switch out the shown page.

Fixes #2667

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-11 16:54:46 -07:00
parent 0d1510929f
commit 84d45485fd
2 changed files with 18 additions and 33 deletions

View file

@ -312,16 +312,9 @@ Kirigami.ScrollablePage {
onTriggered: manager.redo()
}
property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, deleteAction, mapAction, tripDetailsEdit, undoAction, redoAction ]
StartPage {
id: startPage
anchors.fill: parent
opacity: (Backend.cloud_verification_status === Enums.CS_NOCLOUD ||
Backend.cloud_verification_status === Enums.CS_VERIFIED) ? 0 : 1
visible: opacity > 0
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
function setupActions() {
if (Backend.cloud_verification_status === Enums.CS_VERIFIED ||
Backend.cloud_verification_status === Enums.CS_NOCLOUD) {
if (Backend.cloud_verification_status === Enums.CS_VERIFIED || Backend.cloud_verification_status === Enums.CS_NOCLOUD) {
page.actions.main = page.downloadFromDCAction
page.actions.right = page.addDiveAction
page.actions.left = page.filterToggleAction
@ -337,15 +330,6 @@ Kirigami.ScrollablePage {
page.title = qsTr("Cloud credentials")
}
}
onVisibleChanged: {
setupActions();
}
Component.onCompleted: {
manager.finishSetup();
setupActions();
}
}
Controls.Label {
anchors.fill: parent
@ -450,6 +434,7 @@ Kirigami.ScrollablePage {
Component.onCompleted: {
manager.appendTextToLog("finished setting up the diveListView")
}
onVisibleChanged: setupActions()
}
property QtObject downloadFromDCAction: Kirigami.Action {

View file

@ -715,10 +715,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
onVisibleChanged: {
if (visible) {
pageStack.clear()
diveList.visible = false
} else {
showDiveList()
}
}
Component.onCompleted: {
if (!visible) {
manager.appendTextToLog("StartPage completed - showing the dive list")