aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-09 10:51:34 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-09 12:40:44 -0700
commit8138279a0459821e0640307757932192a2938847 (patch)
treee9e3bfba8cb06c507d84b8be7c6e24ba39baed51
parent174bb913260a42c8159b8d5a46461d65ff54407d (diff)
downloadsubsurface-8138279a0459821e0640307757932192a2938847.tar.gz
mobile UI: ensure download page is shown if started by plug-in event
The order of execution of the various routines is a bit counter intuitive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/main.qml17
1 files changed, 13 insertions, 4 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index de80f0a22..70c9de9fc 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -710,14 +710,18 @@ if you have network connectivity and want to sync your data to cloud storage."),
if (visible) {
pageStack.clear()
diveList.visible = false
- } else {
- pageStack.push(diveList)
}
}
Component.onCompleted: {
if (!visible) {
- showDiveList()
+ manager.appendTextToLog("StartPage completed - showing the dive list")
+ showPage(diveList) // we want to make sure that gets on the stack
+ manager.appendTextToLog("if we got started by a plugged in device, switch to download page -- pluggedInDeviceName = " + pluggedInDeviceName)
+ if (pluggedInDeviceName !== "")
+ // if we were started with a dive computer plugged in,
+ // immediately switch to download page
+ showDownloadForPluggedInDevice()
}
}
}
@@ -818,6 +822,9 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
function showDownloadForPluggedInDevice() {
+ // don't add this unless the dive list is already shown
+ if (pageIndex(diveList) === -1)
+ return
manager.appendTextToLog("plugged in device name changed to " + pluggedInDeviceName)
/* if we recognized the device, we'll pass in a triple of ComboBox indeces as "vendor;product;connection" */
var vendorProductConnection = pluggedInDeviceName.split(';')
@@ -825,7 +832,6 @@ if you have network connectivity and want to sync your data to cloud storage."),
showDownloadPage(vendorProductConnection[0], vendorProductConnection[1], vendorProductConnection[2])
else
showDownloadPage()
- manager.appendTextToLog("done showing download page")
}
onPluggedInDeviceNameChanged: {
@@ -834,6 +840,9 @@ if you have network connectivity and want to sync your data to cloud storage."),
manager.appendTextToLog("Download page requested by Android Intent, but adding/editing dive; no action taken")
} else {
// we want to show the downloads page
+ // note that if Subsurface-mobile was started because a USB device was plugged in, this is run too early;
+ // we catch this in the function below and instead switch to the download page in the completion signal
+ // handler for the startPage
showDownloadForPluggedInDevice()
}
}