aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-09 14:41:55 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-16 07:58:20 -0700
commit822b05bec4c81a35720f3c1e504a2a36f861d13a (patch)
tree4f7c4735c796460b69ac303c38e7b91541cfb58c
parent5e89d81d9d6b8b1101b1482620b3f85968eb3b47 (diff)
downloadsubsurface-822b05bec4c81a35720f3c1e504a2a36f861d13a.tar.gz
mobile/download: only use device guess if no USB device plugged in
If we explicitly open the download page after the use plugged in a USB device, don't try to use guesses from the BT/BLE pairings to populate the device/connection dropdowns. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml19
-rw-r--r--mobile-widgets/qml/main.qml4
2 files changed, 17 insertions, 6 deletions
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index ca55bfef8..84467858e 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -23,6 +23,7 @@ Kirigami.Page {
property alias vendor: comboVendor.currentIndex
property alias product: comboProduct.currentIndex
property alias connection: comboConnection.currentIndex
+ property bool setupUSB: false
DCImportModel {
id: importModel
@@ -224,6 +225,7 @@ Kirigami.Page {
spacing: Kirigami.Units.smallSpacing;
Layout.fillWidth: true
function setDC(vendor, product, device) {
+ manager.appendTextToLog("setDC called with " + vendor + "/" + product + "/" + device)
comboVendor.currentIndex = comboVendor.find(vendor);
comboProduct.currentIndex = comboProduct.find(product);
comboConnection.currentIndex = manager.getConnectionIndex(device);
@@ -477,12 +479,17 @@ Kirigami.Page {
}
onVisibleChanged: {
- comboVendor.currentIndex = comboProduct.currentIndex = comboConnection.currentIndex = -1
- dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
- if (visible) {
- comboVendor.currentIndex = manager.getDetectedVendorIndex()
- comboProduct.currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
- comboConnection.currentIndex = manager.getMatchingAddress(comboVendor.currentText, comboProduct.currentText)
+ if (!setupUSB) {
+ // if we aren't called with a known USB connection, check if we can find
+ // a known BT/BLE device
+ manager.appendTextToLog("download page -- looking for known BT/BLE device")
+ comboVendor.currentIndex = comboProduct.currentIndex = comboConnection.currentIndex = -1
+ dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
+ if (visible) {
+ comboVendor.currentIndex = manager.getDetectedVendorIndex()
+ comboProduct.currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
+ comboConnection.currentIndex = manager.getMatchingAddress(comboVendor.currentText, comboProduct.currentText)
+ }
}
}
}
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 06c6826ab..ea9321ab5 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -819,6 +819,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
manager.appendTextToLog("show download page for " + vendor + " / " + product + " / " + connection)
downloadFromDc.dcImportModel.clearTable()
if (vendor !== undefined && product !== undefined && connection !== undefined) {
+ downloadFromDc.setupUSB = true
/* set up the correct values on the download page */
if (vendor !== -1)
downloadFromDc.vendor = vendor
@@ -826,7 +827,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
downloadFromDc.product = product
if (connection !== -1)
downloadFromDc.connection = connection
+ } else {
+ downloadFromDc.setupUSB = false
}
+
showPage(downloadFromDc)
}