homescreen: bluetooth: switch bluetooth power status
authorMatt Ranostay <matt.ranostay@konsulko.com>
Fri, 2 Nov 2018 01:36:56 +0000 (18:36 -0700)
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>
Fri, 5 Apr 2019 06:29:08 +0000 (15:29 +0900)
Don't turn on/off bluetooth icon on homescreen when a device is
connected, but when the adapter is powered on/off. This is the common
functionality for most UIs

Change-Id: If26d84da31433c461d06c157832f7b6bd744ef39
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
homescreen/qml/StatusArea.qml

index 8d01ea3..c7ad598 100644 (file)
@@ -138,25 +138,9 @@ Item {
                 property bool connStatus: false
                 Connections {
                     target: bluetooth
-                    onConnectionEvent: {
-                        console.log("onConnectionEvent", data.Status)
-                        if (data.Status === "connected") {
-                            bt_icon.connStatus = true
-                        } else if (data.Status === "disconnected") {
-                            bt_icon.connStatus = false
-                        }
-                    }
-                    onDeviceUpdateEvent: {
-                        console.log("onConnectionEvent", data.Paired)
-                        if (data.Paired === "True" && data.Connected === "True") {
-                            bt_icon.deviceName = data.name
-                            bt_icon.connStatus = true
-                        } else {
-                            if(bt_icon.deviceName === data.Name)
-                            {
-                                bt_icon.connStatus = false
-                            }
-                        }
+
+                    onPowerChanged: {
+                            bt_icon.connStatus = state
                     }
                 }
             }