Changeset View
Changeset View
Standalone View
Standalone View
applets/batterymonitor/package/contents/ui/batterymonitor.qml
| Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 30 | Item { | |||
|---|---|---|---|---|---|
| 97 | 97 | | |||
| 98 | property var inhibitions: [] | 98 | property var inhibitions: [] | ||
| 99 | 99 | | |||
| 100 | readonly property var kcms: ["powerdevilprofilesconfig.desktop", | 100 | readonly property var kcms: ["powerdevilprofilesconfig.desktop", | ||
| 101 | "powerdevilactivitiesconfig.desktop", | 101 | "powerdevilactivitiesconfig.desktop", | ||
| 102 | "powerdevilglobalconfig.desktop"] | 102 | "powerdevilglobalconfig.desktop"] | ||
| 103 | readonly property bool kcmsAuthorized: KCMShell.authorize(batterymonitor.kcms).length > 0 | 103 | readonly property bool kcmsAuthorized: KCMShell.authorize(batterymonitor.kcms).length > 0 | ||
| 104 | 104 | | |||
| 105 | readonly property var kcm_energyinfo: ["kcm_energyinfo.desktop"] | ||||
| 106 | readonly property bool kcmEnergyInformationAuthorized: KCMShell.authorize(kcm_energyinfo).length > 0 | ||||
apol: Typo? kcm_energyinfo vs kcms_energyinfo | |||||
meven: Thanks | |||||
| 105 | onScreenBrightnessChanged: { | 107 | onScreenBrightnessChanged: { | ||
| 106 | if (disableBrightnessUpdate) { | 108 | if (disableBrightnessUpdate) { | ||
| 107 | return; | 109 | return; | ||
| 108 | } | 110 | } | ||
| 109 | var service = pmSource.serviceForSource("PowerDevil"); | 111 | var service = pmSource.serviceForSource("PowerDevil"); | ||
| 110 | var operation = service.operationDescription("setBrightness"); | 112 | var operation = service.operationDescription("setBrightness"); | ||
| 111 | operation.brightness = screenBrightness; | 113 | operation.brightness = screenBrightness; | ||
| 112 | // show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough | 114 | // show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough | ||
| Show All 10 Lines | 118 | onKeyboardBrightnessChanged: { | |||
| 123 | operation.silent = plasmoid.expanded | 125 | operation.silent = plasmoid.expanded | ||
| 124 | service.startOperationCall(operation); | 126 | service.startOperationCall(operation); | ||
| 125 | } | 127 | } | ||
| 126 | 128 | | |||
| 127 | function action_powerdevilkcm() { | 129 | function action_powerdevilkcm() { | ||
| 128 | KCMShell.open(batterymonitor.kcms); | 130 | KCMShell.open(batterymonitor.kcms); | ||
| 129 | } | 131 | } | ||
| 130 | 132 | | |||
| 133 | function action_energyinformationkcm() { | ||||
| 134 | KCMShell.open(batterymonitor.kcm_energyinfo); | ||||
| 135 | } | ||||
| 136 | | ||||
| 131 | Component.onCompleted: { | 137 | Component.onCompleted: { | ||
| 132 | Logic.updateBrightness(batterymonitor, pmSource); | 138 | Logic.updateBrightness(batterymonitor, pmSource); | ||
| 133 | Logic.updateInhibitions(batterymonitor, pmSource) | 139 | Logic.updateInhibitions(batterymonitor, pmSource) | ||
| 134 | 140 | | |||
| 141 | if (batterymonitor.kcmEnergyInformationAuthorized) { | ||||
| 142 | plasmoid.setAction("energyinformationkcm", i18n("&Energy Information..."), "battery"); | ||||
Generally we start menu items with action verbs. And in this case we don't need ellipsis because no further input from the user is required as a part of the action. See https://hig.kde.org/style/writing/labels.html#using-ellipses-in-labels So for this string, I would recommend "Show Energy Information" ngraham: Generally we start menu items with action verbs. And in this case we don't need ellipsis… | |||||
meven: Thanks for pointing it out. | |||||
ngraham: Not fixed yet. The text needs to be "Show Energy Information..." | |||||
| 143 | } | ||||
| 135 | if (batterymonitor.kcmsAuthorized) { | 144 | if (batterymonitor.kcmsAuthorized) { | ||
| 136 | plasmoid.setAction("powerdevilkcm", i18n("&Configure Power Saving..."), "preferences-system-power-management"); | 145 | plasmoid.setAction("powerdevilkcm", i18n("&Configure Power Saving..."), "preferences-system-power-management"); | ||
broulik: This should be in a check for `kcmEnergyInformationAuthorized` | |||||
| 137 | } | 146 | } | ||
| 138 | } | 147 | } | ||
| 139 | 148 | | |||
| 140 | Plasmoid.compactRepresentation: CompactRepresentation { | 149 | Plasmoid.compactRepresentation: CompactRepresentation { | ||
| 141 | property int wheelDelta: 0 | 150 | property int wheelDelta: 0 | ||
| 142 | 151 | | |||
| 143 | onEntered: wheelDelta = 0 | 152 | onEntered: wheelDelta = 0 | ||
| 144 | onExited: wheelDelta = 0 | 153 | onExited: wheelDelta = 0 | ||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||
Typo? kcm_energyinfo vs kcms_energyinfo