summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-04-02 20:05:26 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-04-02 20:44:19 -0700
commite1e25b0d97ab9eafaa63f76af22dc0d565724138 (patch)
treebb3cda505ec1b089321c7f4fa0d7b8d63ecf3bd2
parent38a1f8f16281233bedfed3c2a7ad5a6b1598c227 (diff)
settings: bluetooth: qml: cleanup onPoweredChanged slot
Move enabling of discovery + discoverablity to the respective slot to avoid race conditions from the adapter powering on Bug-AGL: SPEC-2295 Change-Id: I16c04d7bcd880ef5dcc5352d0da52ce2fe8b2447 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--app/bluetooth/Bluetooth.qml16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/bluetooth/Bluetooth.qml b/app/bluetooth/Bluetooth.qml
index efc2374..b2b3308 100644
--- a/app/bluetooth/Bluetooth.qml
+++ b/app/bluetooth/Bluetooth.qml
@@ -33,7 +33,14 @@ SettingPage {
bluetooth.send_confirmation(data.pincode)
}
- onPowerChanged: if (!root.checked) root.checked = state
+ onPowerChanged: {
+ if (state) {
+ bluetooth.start_discovery()
+ bluetooth.discoverable = true;
+ }
+ root.checked = state
+ }
+
}
Text {
@@ -46,12 +53,7 @@ SettingPage {
onCheckedChanged: {
console.log("Bluetooth set to", checked)
-
- bluetooth.power = checked;
- bluetooth.discoverable = checked;
-
- if (checked == true)
- bluetooth.start_discovery()
+ bluetooth.power = checked
}
Rectangle {