From 695be281c0eac76b6a11a08e620376ce5dcab54e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 17 Jul 2017 06:36:44 -0700 Subject: QML UI: automatically set the Bluetooth checkbox I wonder if we even need this anymore at all as the connection clearly determines whether this is a BT download or not. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DownloadFromDiveComputer.qml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index a4db5ef51..9086a2e0f 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -98,6 +98,14 @@ Kirigami.Page { Layout.fillWidth: true model: connectionListModel currentIndex: -1 + onCurrentTextChanged: { + // pattern that matches BT addresses + var btAddr = /[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]/ ; + if (btAddr.test(currentText)) + isBluetooth.checked = true + else + isBluetooth.checked = false + } } Kirigami.Label { text: btEnabled ? qsTr("Bluetooth download:") : qsTr("No Bluetooth support detected")} -- cgit v1.2.3-70-g09d2