summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-16 09:42:46 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-16 13:59:18 -0700
commitccd024f0ee4c1e8ba66605eacc40db101ee72dc4 (patch)
tree1b41a2060cb7346633bad2ea7357787386099f8d
parent2abfd16a1015d7539345377c90ea357ef316bffc (diff)
downloadsubsurface-ccd024f0ee4c1e8ba66605eacc40db101ee72dc4.tar.gz
mobile/DC-download: select reasonable connection after rescanning
This seems to make more sense than to not select anything (which was the previous behavior). If the same connection is still available, select it again. Otherwise pick the top connection (which is the right thing to do if the user has just plugged in a USB device and refreshes the list -- that device will show up as top entry). Based on a suggestion by Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DownloadFromDiveComputer.qml7
1 files changed, 7 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml
index 5a732b73f..dfe254143 100644
--- a/mobile-widgets/qml/DownloadFromDiveComputer.qml
+++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml
@@ -366,7 +366,14 @@ Kirigami.Page {
text: qsTr("Rescan")
enabled: manager.btEnabled
onClicked: {
+ // refresh both USB and BT/BLE and make sure a reasonable entry is selected
+ var current = comboConnection.currentText
manager.rescanConnections()
+ // check if the same entry is still available; if not pick the first entry
+ var idx = comboConnection.find(current)
+ if (idx === -1)
+ idx = 0
+ comboConnection.currentIndex = idx
}
}