Changeset View
Changeset View
Standalone View
Standalone View
applets/batterymonitor/package/contents/ui/batterymonitor.qml
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 30 | Item { | |||
---|---|---|---|---|---|
49 | } | 49 | } | ||
50 | 50 | | |||
51 | Plasmoid.toolTipMainText: { | 51 | Plasmoid.toolTipMainText: { | ||
52 | if (batteries.count === 0 || !pmSource.data["Battery"]["Has Cumulative"]) { | 52 | if (batteries.count === 0 || !pmSource.data["Battery"]["Has Cumulative"]) { | ||
53 | return plasmoid.title | 53 | return plasmoid.title | ||
54 | } else if (pmSource.data["Battery"]["State"] === "FullyCharged") { | 54 | } else if (pmSource.data["Battery"]["State"] === "FullyCharged") { | ||
55 | return i18n("Fully Charged"); | 55 | return i18n("Fully Charged"); | ||
56 | } | 56 | } | ||
57 | | ||||
58 | const percent = pmSource.data.Battery.Percent; | ||||
57 | if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { | 59 | if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { | ||
58 | if (pmSource.data.Battery.State === "NoCharge") { | 60 | const state = pmSource.data.Battery.State; | ||
59 | return i18n("Battery at %1%, not Charging", pmSource.data.Battery.Percent) | 61 | if (state === "NoCharge") { | ||
62 | return i18n("Battery at %1%, not Charging", percent); | ||||
63 | } else if (state === "Charging") { | ||||
64 | return i18n("Battery at %1%, Charging", percent); | ||||
60 | } | 65 | } | ||
61 | } else { | | |||
62 | return i18n("Battery at %1%", pmSource.data.Battery.Percent); | | |||
63 | } | 66 | } | ||
67 | return i18n("Battery at %1%", percent); | ||||
64 | } | 68 | } | ||
65 | 69 | | |||
66 | Plasmoid.toolTipSubText: { | 70 | Plasmoid.toolTipSubText: { | ||
67 | var parts = []; | 71 | var parts = []; | ||
68 | if (batteries.count === 0) { | 72 | if (batteries.count === 0) { | ||
69 | parts.push("No Batteries Available"); | 73 | parts.push("No Batteries Available"); | ||
70 | } else if (remainingTime > 0) { | 74 | } else if (remainingTime > 0) { | ||
71 | var remainingTimeString = KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds); | 75 | var remainingTimeString = KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds); | ||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |