diff --git a/applets/batterymonitor/package/contents/ui/batterymonitor.qml b/applets/batterymonitor/package/contents/ui/batterymonitor.qml --- a/applets/batterymonitor/package/contents/ui/batterymonitor.qml +++ b/applets/batterymonitor/package/contents/ui/batterymonitor.qml @@ -39,48 +39,71 @@ if (powermanagementDisabled) { return PlasmaCore.Types.ActiveStatus } - if (pmSource.data.Battery["Has Cumulative"]) { if (pmSource.data.Battery.State !== "Charging" && pmSource.data.Battery.Percent <= 5) { return PlasmaCore.Types.NeedsAttentionStatus } else if (pmSource.data["Battery"]["State"] !== "FullyCharged") { return PlasmaCore.Types.ActiveStatus } } - return PlasmaCore.Types.PassiveStatus } Plasmoid.toolTipMainText: { + if (batteries.count === 0 || !pmSource.data["Battery"]["Has Cumulative"]) { + return plasmoid.title + } + if (pmSource.data["Battery"]["State"] === "FullyCharged") { + return i18n("Plugged in"); + } + if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { + if (state === "NoCharge") { + return i18n("Plugged in"); + } + } + return i18n("Battery at %1%", pmSource.data.Battery.Percent); + } + + Plasmoid.toolTipSubText: { if (batteries.count === 0) { - return i18n("No Batteries Available"); - } else if (!pmSource.data["Battery"]["Has Cumulative"]) { - // Bug 362924: Distinguish between no batteries and no power supply batteries - // just show the generic applet title in the latter case - return i18n("Battery and Brightness") - } else if (pmSource.data["Battery"]["State"] === "FullyCharged") { - return i18n("Fully Charged"); - } else if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { - var percent = pmSource.data.Battery.Percent - var state = pmSource.data.Battery.State - if (state === "Charging") { - return i18n("%1% Charging", percent) - } else if (state === "NoCharge") { - return i18n("%1% Plugged in, not Charging", percent) - } else { - return i18n("%1% Plugged in", percent) + if (powermanagementDisabled) { + return i18n("Power management is disabled\nNo Batteries Available"); } - } else { - if (remainingTime > 0) { - return i18nc("%1 is remaining time, %2 is percentage", "%1 Remaining (%2%)", - KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds), - pmSource.data["Battery"]["Percent"]) + else { + return i18n("No Batteries Available"); + } + } + if (pmSource.data["Battery"]["State"] === "FullyCharged") { + if (powermanagementDisabled) { + return i18n("Power management is disabled\nFully Charged"); + } + else { + return i18n("Fully Charged"); + } + } + if (remainingTime > 0) { + if (powermanagementDisabled) { + if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { + return i18nc("time until fully charged - HH:MM","Power management is disabled\n%1 until fully charged", KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds)); + } else { + return i18nc("remaining time left of battery usage - HH:MM","Power management is disabled\n%1 remaining", KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds)); + } } else { - return i18n("%1% Battery Remaining", pmSource.data["Battery"]["Percent"]); + if (pmSource.data["AC Adapter"] && pmSource.data["AC Adapter"]["Plugged in"]) { + return i18nc("time until fully charged - HH:MM","%1 until fully charged", KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds)); + } else { + return i18nc("remaining time left of battery usage - HH:MM","%1 remaining", KCoreAddons.Format.formatDuration(remainingTime, KCoreAddons.FormatTypes.HideSeconds)); + } } } + if (powermanagementDisabled) { + return i18n("Power management is disabled\nCalculating remaining time..."); + } + else { + return i18n("Calculating remaining time..."); + } } - Plasmoid.toolTipSubText: powermanagementDisabled ? i18n("Power management is disabled") : "" + Plasmoid.icon: "battery" property bool disableBrightnessUpdate: true