From b7b2e813ad21cb4c8d59a7a7940110c346e3bead Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 12 Jul 2017 04:16:37 -0700 Subject: [PATCH] QML UI: only offer BT checkbox if BT is available Right now we need to restart Subsurface-mobile in order to detect Bluetooth devices - so simply turning on BT after Subsurface-mobile was started is not sufficient. Signed-off-by: Dirk Hohndel --- .../qml/DownloadFromDiveComputer.qml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index c7f9de5f2..b7f000a46 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -18,6 +18,7 @@ Kirigami.Page { property bool selectAll : false property alias dcImportModel: importModel property bool divesDownloaded: false + property bool btEnabled: manager.btEnabled() DCDownloadThread { id: downloadThread @@ -85,11 +86,12 @@ Kirigami.Page { currentIndex = productidx } } - Kirigami.Label { text: qsTr("Bluetooth download:") } + Kirigami.Label { text: btEnabled ? qsTr("Bluetooth download:") : qsTr("No Bluetooth support detected")} CheckBox { id: isBluetooth checked: downloadThread.data().getDetectedVendorIndex(ComboBox.currentText) != -1 indicator: Rectangle { + visible: btEnabled implicitWidth: 20 implicitHeight: 20 x: isBluetooth.leftPadding @@ -99,13 +101,13 @@ Kirigami.Page { color: subsurfaceTheme.backgroundColor Rectangle { - width: 12 - height: 12 - x: 4 - y: 4 - radius: 3 - color: isBluetooth.down ? subsurfaceTheme.PrimaryColor : subsurfaceTheme.darkerPrimaryColor - visible: isBluetooth.checked + width: 12 + height: 12 + x: 4 + y: 4 + radius: 3 + color: isBluetooth.down ? subsurfaceTheme.PrimaryColor : subsurfaceTheme.darkerPrimaryColor + visible: btEnabled && isBluetooth.checked } } }