summaryrefslogtreecommitdiffstats
path: root/x11/kde4-workspace/files/patch-plasma__generic__applets__batterymonitor__contents__ui__batterymonitor.qml
blob: a2ffa0442140c358c82baa380e8e0a6ff0b3dbdd (plain)
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
--- ./plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml.orig	2012-08-13 10:54:40.000000000 +0200
+++ ./plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml	2012-09-27 16:19:28.837589000 +0200
@@ -48,7 +48,7 @@
             onClicked: plasmoid.togglePopup()
 
             property QtObject pmSource: plasmoid.rootItem.pmSource
-            property bool hasBattery: pmSource.data["Battery"]["Has Battery"]
+            property bool hasBattery: pmSource.data["Battery"]["Has Battery"] && pmSource.data["Battery0"]["Plugged in"]
             property int percent: pmSource.data["Battery0"]["Percent"]
             property string batteryState: pmSource.data["Battery0"]["State"]
             property bool pluggedIn: pmSource.data["AC Adapter"]["Plugged in"]
@@ -135,10 +135,10 @@
     property QtObject pmSource: PlasmaCore.DataSource {
         id: pmSource
         engine: "powermanagement"
-        connectedSources: ["AC Adapter", "Battery", "Battery0", "PowerDevil", "Sleep States"]
+        connectedSources: sources
         onDataChanged: {
             var status = "PassiveStatus";
-            if (data["Battery"]["Has Battery"]) {
+            if (data["Battery"]["Has Battery"] && data["Battery0"]["Plugged in"]) {
                 if (data["Battery0"]["Percent"] <= 10) {
                     status = "NeedsAttentionStatus";
                 } else if (data["Battery0"]["State"] != "NoCharge") {
@@ -147,16 +147,6 @@
             }
             plasmoid.status = status;
         }
-        onSourceAdded: {
-            if (source == "Battery0") {
-                connectSource(source)
-            }
-        }
-        onSourceRemoved: {
-            if (source == "Battery0") {
-                disconnectSource(source)
-            }
-        }
     }
 
     function stringForState(state, percent) {
@@ -173,7 +163,7 @@
         id: dialogItem
         percent: pmSource.data["Battery0"]["Percent"]
         batteryState: pmSource.data["Battery0"]["State"]
-        hasBattery: pmSource.data["Battery"]["Has Battery"]
+        hasBattery: pmSource.data["Battery"]["Has Battery"] && pmSource.data["Battery0"]["Plugged in"]
         pluggedIn: pmSource.data["AC Adapter"]["Plugged in"]
         screenBrightness: pmSource.data["PowerDevil"]["Screen Brightness"]
         remainingMsec: parent.show_remaining_time ? Number(pmSource.data["Battery"]["Remaining msec"]) : 0
OpenPOWER on IntegriCloud