[Battery Monitor] Add a "plugged in but not charging" state for the tooltip

The tooltip would only take into account the AC adapter state and say the
battery is being charged although it isn't. This adds a "Plugged in"
state when the AC is plugged in but the battery is not charging.

BUG: 355922
FIXED-IN: 5.7.0
wilder-5.14
Kai Uwe Broulik 10 years ago
parent 8b677a9812
commit 93daaf4c50
  1. 7
      applets/batterymonitor/package/contents/ui/batterymonitor.qml

@ -57,7 +57,12 @@ Item {
} else if (pmSource.data["Battery"]["State"] === "FullyCharged") {
return i18n("Fully Charged");
} else if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) {
return i18n("%1%. Charging", pmSource.data["Battery"]["Percent"])
var percent = pmSource.data.Battery.Percent
if (pmSource.data.Battery.State === "Charging") {
return i18n("%1%. Charging", percent)
} else {
return i18nc("AC is plugged in but battery full/not charging", "%1%. Plugged in", percent)
}
} else {
if (remainingTime > 0) {
return i18nc("%1 is remaining time, %2 is percentage", "%1 Remaining (%2%)",

Loading…
Cancel
Save