Changeset View
Changeset View
Standalone View
Standalone View
applets/batterymonitor/package/contents/ui/batterymonitor.qml
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 109 | readonly property var kcms: ["powerdevilprofilesconfig.desktop", | |||
---|---|---|---|---|---|
110 | "powerdevilactivitiesconfig.desktop", | 110 | "powerdevilactivitiesconfig.desktop", | ||
111 | "powerdevilglobalconfig.desktop"] | 111 | "powerdevilglobalconfig.desktop"] | ||
112 | readonly property bool kcmsAuthorized: KCMShell.authorize(batterymonitor.kcms).length > 0 | 112 | readonly property bool kcmsAuthorized: KCMShell.authorize(batterymonitor.kcms).length > 0 | ||
113 | 113 | | |||
114 | readonly property var kcm_energyinfo: ["kcm_energyinfo.desktop"] | 114 | readonly property var kcm_energyinfo: ["kcm_energyinfo.desktop"] | ||
115 | readonly property bool kcmEnergyInformationAuthorized: KCMShell.authorize(kcm_energyinfo).length > 0 | 115 | readonly property bool kcmEnergyInformationAuthorized: KCMShell.authorize(kcm_energyinfo).length > 0 | ||
116 | 116 | | |||
117 | property QtObject updateScreenBrightnessJob | 117 | property QtObject updateScreenBrightnessJob | ||
118 | onScreenBrightnessChanged: { | 118 | function onScreenBrightnessChanged() { | ||
119 | if (disableBrightnessUpdate) { | 119 | if (disableBrightnessUpdate) { | ||
120 | return; | 120 | return; | ||
121 | } | 121 | } | ||
122 | var service = pmSource.serviceForSource("PowerDevil"); | 122 | var service = pmSource.serviceForSource("PowerDevil"); | ||
123 | var operation = service.operationDescription("setBrightness"); | 123 | var operation = service.operationDescription("setBrightness"); | ||
124 | operation.brightness = screenBrightness; | 124 | operation.brightness = screenBrightness; | ||
125 | // show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough | 125 | // show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough | ||
126 | operation.silent = plasmoid.expanded | 126 | operation.silent = plasmoid.expanded | ||
127 | updateScreenBrightnessJob = service.startOperationCall(operation); | 127 | updateScreenBrightnessJob = service.startOperationCall(operation); | ||
128 | updateScreenBrightnessJob.finished.connect(function(job) { | 128 | updateScreenBrightnessJob.finished.connect(function(job) { | ||
129 | Logic.updateBrightness(batterymonitor, pmSource); | 129 | Logic.updateBrightness(batterymonitor, pmSource); | ||
130 | }); | 130 | }); | ||
131 | } | 131 | } | ||
132 | 132 | | |||
133 | property QtObject updateKeyboardBrightnessJob | 133 | property QtObject updateKeyboardBrightnessJob | ||
134 | onKeyboardBrightnessChanged: { | 134 | function onKeyboardBrightnessChanged() { | ||
135 | if (disableBrightnessUpdate) { | 135 | if (disableBrightnessUpdate) { | ||
136 | return; | 136 | return; | ||
137 | } | 137 | } | ||
138 | var service = pmSource.serviceForSource("PowerDevil"); | 138 | var service = pmSource.serviceForSource("PowerDevil"); | ||
139 | var operation = service.operationDescription("setKeyboardBrightness"); | 139 | var operation = service.operationDescription("setKeyboardBrightness"); | ||
140 | operation.brightness = keyboardBrightness; | 140 | operation.brightness = keyboardBrightness; | ||
141 | operation.silent = plasmoid.expanded | 141 | operation.silent = plasmoid.expanded | ||
142 | updateKeyboardBrightnessJob = service.startOperationCall(operation); | 142 | updateKeyboardBrightnessJob = service.startOperationCall(operation); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 186 | property QtObject pmSource: PlasmaCore.DataSource { | |||
189 | connectedSources: sources | 189 | connectedSources: sources | ||
190 | onSourceAdded: { | 190 | onSourceAdded: { | ||
191 | disconnectSource(source); | 191 | disconnectSource(source); | ||
192 | connectSource(source); | 192 | connectSource(source); | ||
193 | } | 193 | } | ||
194 | onSourceRemoved: { | 194 | onSourceRemoved: { | ||
195 | disconnectSource(source); | 195 | disconnectSource(source); | ||
196 | } | 196 | } | ||
197 | onDataChanged: { | 197 | function onDataChanged() { | ||
198 | Logic.updateBrightness(batterymonitor, pmSource) | 198 | Logic.updateBrightness(batterymonitor, pmSource) | ||
199 | Logic.updateInhibitions(batterymonitor, pmSource) | 199 | Logic.updateInhibitions(batterymonitor, pmSource) | ||
200 | } | 200 | } | ||
201 | } | 201 | } | ||
202 | 202 | | |||
203 | property QtObject batteries: PlasmaCore.SortFilterModel { | 203 | property QtObject batteries: PlasmaCore.SortFilterModel { | ||
204 | id: batteries | 204 | id: batteries | ||
205 | filterRole: "Is Power Supply" | 205 | filterRole: "Is Power Supply" | ||
Show All 21 Lines | 218 | Plasmoid.fullRepresentation: PopupDialog { | |||
227 | 227 | | |||
228 | isBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Screen Brightness Available"] ? true : false | 228 | isBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Screen Brightness Available"] ? true : false | ||
229 | isKeyboardBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Keyboard Brightness Available"] ? true : false | 229 | isKeyboardBrightnessAvailable: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Keyboard Brightness Available"] ? true : false | ||
230 | 230 | | |||
231 | pluggedIn: pmSource.data["AC Adapter"] !== undefined && pmSource.data["AC Adapter"]["Plugged in"] | 231 | pluggedIn: pmSource.data["AC Adapter"] !== undefined && pmSource.data["AC Adapter"]["Plugged in"] | ||
232 | 232 | | |||
233 | property int cookie1: -1 | 233 | property int cookie1: -1 | ||
234 | property int cookie2: -1 | 234 | property int cookie2: -1 | ||
235 | onPowermanagementChanged: { | 235 | function onPowermanagementChanged() { | ||
236 | var service = pmSource.serviceForSource("PowerDevil"); | 236 | var service = pmSource.serviceForSource("PowerDevil"); | ||
237 | if (checked) { | 237 | if (checked) { | ||
238 | var op1 = service.operationDescription("stopSuppressingSleep"); | 238 | var op1 = service.operationDescription("stopSuppressingSleep"); | ||
239 | op1.cookie = cookie1; | 239 | op1.cookie = cookie1; | ||
240 | var op2 = service.operationDescription("stopSuppressingScreenPowerManagement"); | 240 | var op2 = service.operationDescription("stopSuppressingScreenPowerManagement"); | ||
241 | op2.cookie = cookie2; | 241 | op2.cookie = cookie2; | ||
242 | 242 | | |||
243 | var job1 = service.startOperationCall(op1); | 243 | var job1 = service.startOperationCall(op1); | ||
Show All 29 Lines |