aboutsummaryrefslogtreecommitdiffstats
path: root/testing/asteroid-launcher/0001-use-mce-battery-api-and-fix-deprecation-issues.patch
blob: d9607490fd5b780fa164a488eef8fe8087508d65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 59e072c0e2f2e3d848f08affed6d046cec801114 Mon Sep 17 00:00:00 2001
From: MagneFire <IDaNLContact@gmail.com>
Date: Sun, 4 Apr 2021 20:51:52 +0200
Subject: [PATCH] QuickSettings: Use Mce for battery information.

---
 qml/quicksettings/QuickSettings.qml | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/qml/quicksettings/QuickSettings.qml b/qml/quicksettings/QuickSettings.qml
index ee13e7c..344b72b 100644
--- a/qml/quicksettings/QuickSettings.qml
+++ b/qml/quicksettings/QuickSettings.qml
@@ -29,7 +29,7 @@
  */
 
 import QtQuick 2.9
-import org.freedesktop.contextkit 1.0
+import Nemo.Mce 1.0
 import Nemo.DBus 2.0
 import org.nemomobile.systemsettings 1.0
 import Nemo.Ngf 1.0
@@ -44,17 +44,12 @@ Item {
     property bool forbidLeft:  true
     property bool forbidRight: true
 
-    ContextProperty {
+    MceBatteryLevel {
         id: batteryChargePercentage
-        key: "Battery.ChargePercentage"
-        value: "100"
-        Component.onCompleted: batteryChargePercentage.subscribe()
     }
 
-    ContextProperty {
-        id: batteryIsCharging
-        key: "Battery.IsCharging"
-        value: false
+    MceBatteryState {
+        id: batteryChargeState
     }
 
     DBusInterface {
@@ -149,9 +144,9 @@ Item {
         Icon {
             id: batteryIcon
             name: {
-                if(batteryIsCharging.value)                 return "ios-battery-charging"
-                else if(batteryChargePercentage.value > 15) return "ios-battery-full"
-                else                                        return "ios-battery-dead"
+                if(batteryChargeState.value == MceBatteryState.Charging) return "ios-battery-charging"
+                else if(batteryChargePercentage.percent > 15)            return "ios-battery-full"
+                else                                                     return "ios-battery-dead"
             }
             width:  parent.height/2
             height: width
@@ -161,7 +156,7 @@ Item {
         Label {
             id: batteryIndicator
             font.pixelSize: parent.height/4
-            text: batteryChargePercentage.value + "%"
+            text: batteryChargePercentage.percent + "%"
             anchors.right: parent.right
             anchors.verticalCenter: parent.verticalCenter
         }