mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
use battery dataengine
This commit is contained in:
parent
2384ff36d9
commit
3fc011cf68
1 changed files with 14 additions and 12 deletions
|
|
@ -27,7 +27,6 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
||||||
import org.nemomobile.voicecall 1.0
|
import org.nemomobile.voicecall 1.0
|
||||||
import org.kde.kquickcontrolsaddons 2.0
|
import org.kde.kquickcontrolsaddons 2.0
|
||||||
import org.freedesktop.contextkit 1.0
|
|
||||||
import MeeGo.QOfono 0.2
|
import MeeGo.QOfono 0.2
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
|
|
@ -358,6 +357,7 @@ MouseEventListener {
|
||||||
onReleased: slidingPanel.updateState();
|
onReleased: slidingPanel.updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlasmaWorkspace.BatteryIcon {
|
PlasmaWorkspace.BatteryIcon {
|
||||||
id: batteryIcon
|
id: batteryIcon
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -366,19 +366,21 @@ MouseEventListener {
|
||||||
}
|
}
|
||||||
width: units.iconSizes.small
|
width: units.iconSizes.small
|
||||||
height: width
|
height: width
|
||||||
hasBattery: batteryOn.value
|
hasBattery: pmSource.data["Battery"]["Has Battery"]
|
||||||
batteryType: "Phone"
|
batteryType: "Phone"
|
||||||
percent: batteryChargePercentage.value
|
percent: pmSource.data["Battery0"] ? pmSource.data["Battery0"]["Percent"] : 0
|
||||||
|
|
||||||
ContextProperty {
|
PlasmaCore.DataSource {
|
||||||
id: batteryOn
|
id: pmSource
|
||||||
key: "Battery.OnBattery"
|
engine: "powermanagement"
|
||||||
|
connectedSources: sources
|
||||||
|
onSourceAdded: {
|
||||||
|
disconnectSource(source);
|
||||||
|
connectSource(source);
|
||||||
|
}
|
||||||
|
onSourceRemoved: {
|
||||||
|
disconnectSource(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextProperty {
|
|
||||||
id: batteryChargePercentage
|
|
||||||
key: "Battery.ChargePercentage"
|
|
||||||
value: "100"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue