Commit b2cdc6f8 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Battery Monitor] Only show charge threshold hint for power supply batteries

Avoids showing it on e.g. wireless mice and keyboards

BUG: 451161


(cherry picked from commit 14dac2a9)
parent 546078cd
Pipeline #146387 passed with stage
in 13 minutes and 40 seconds
......@@ -41,6 +41,8 @@ RowLayout {
// UPower seems to set the Present property false when a device is added but not probed yet
readonly property bool isPresent: root.battery["Plugged in"]
readonly property bool isPowerSupply: root.battery["Is Power Supply"]
readonly property bool isBroken: root.battery.Capacity > 0 && root.battery.Capacity < 50
property int remainingTime: 0
......@@ -191,7 +193,7 @@ RowLayout {
readonly property var chargeStopThreshold: pmSource.data["Battery"] ? pmSource.data["Battery"]["Charge Stop Threshold"] : undefined
readonly property bool pluggedIn: pmSource.data["AC Adapter"] !== undefined && pmSource.data["AC Adapter"]["Plugged in"]
visible: pluggedIn && typeof chargeStopThreshold === "number" && chargeStopThreshold > 0 && chargeStopThreshold < 100
visible: pluggedIn && root.isPowerSupply && typeof chargeStopThreshold === "number" && chargeStopThreshold > 0 && chargeStopThreshold < 100
iconSource: "kt-speed-limits" // FIXME good icon
text: i18n("Your battery is configured to only charge up to %1%.", chargeStopThreshold || 0)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment