Changeset View
Changeset View
Standalone View
Standalone View
applets/batterymonitor/package/contents/ui/PowerManagementItem.qml
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.0 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.components 2.0 as Components | 24 | import org.kde.plasma.components 2.0 as Components | ||
25 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
26 | 26 | | |||
27 | Column { | 27 | ColumnLayout { | ||
28 | property alias enabled: pmCheckBox.checked | 28 | property alias enabled: pmCheckBox.checked | ||
29 | 29 | | |||
30 | spacing: 0 | 30 | spacing: 0 | ||
31 | 31 | | |||
32 | RowLayout { | 32 | RowLayout { | ||
33 | width: parent.width | 33 | Layout.fillWidth: true | ||
34 | 34 | | |||
35 | Components.CheckBox { | 35 | Components.CheckBox { | ||
36 | id: pmCheckBox | 36 | id: pmCheckBox | ||
37 | Layout.fillWidth: true | 37 | Layout.fillWidth: true | ||
38 | text: i18n("Enable Power Management") | 38 | text: i18n("Enable Power Management") | ||
39 | checked: true | 39 | checked: true | ||
40 | // we don't want to mess with the checked state but still reflect that changing it might not yield the desired result | 40 | // we don't want to mess with the checked state but still reflect that changing it might not yield the desired result | ||
41 | opacity: inhibitions.length > 0 ? 0.5 : 1 | 41 | opacity: inhibitions.length > 0 ? 0.5 : 1 | ||
Show All 10 Lines | |||||
52 | Components.ToolButton { | 52 | Components.ToolButton { | ||
53 | iconSource: "configure" | 53 | iconSource: "configure" | ||
54 | onClicked: batterymonitor.action_powerdevilkcm() | 54 | onClicked: batterymonitor.action_powerdevilkcm() | ||
55 | tooltip: i18n("Configure Power Saving...") | 55 | tooltip: i18n("Configure Power Saving...") | ||
56 | visible: batterymonitor.kcmsAuthorized | 56 | visible: batterymonitor.kcmsAuthorized | ||
57 | } | 57 | } | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | Column { | 60 | ColumnLayout { | ||
61 | anchors { | 61 | Layout.fillWidth: true | ||
62 | left: parent.left | 62 | Layout.leftMargin: units.gridUnit + units.smallSpacing // width of checkbox and spacer | ||
broulik: Try if this works with right-to-left layout, or should we ignore this and hope david's patch… | |||||
63 | leftMargin: units.iconSizes.medium + units.gridUnit | | |||
64 | right: parent.right | | |||
65 | } | | |||
66 | spacing: units.smallSpacing | 63 | spacing: units.smallSpacing | ||
67 | 64 | | |||
68 | InhibitionHint { | 65 | InhibitionHint { | ||
69 | width: parent.width | 66 | Layout.fillWidth: true | ||
70 | visible: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Is Lid Present"] && !pmSource.data["PowerDevil"]["Triggers Lid Action"] ? true : false | 67 | visible: pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Is Lid Present"] && !pmSource.data["PowerDevil"]["Triggers Lid Action"] ? true : false | ||
71 | iconSource: "computer-laptop" | 68 | iconSource: "computer-laptop" | ||
72 | text: i18n("Your notebook is configured not to suspend when closing the lid while an external monitor is connected.") | 69 | text: i18n("Your notebook is configured not to suspend when closing the lid while an external monitor is connected.") | ||
73 | } | 70 | } | ||
74 | 71 | | |||
75 | InhibitionHint { | 72 | InhibitionHint { | ||
76 | width: parent.width | 73 | Layout.fillWidth: true | ||
77 | visible: inhibitions.length > 0 | 74 | visible: inhibitions.length > 0 | ||
78 | iconSource: inhibitions.length > 0 ? inhibitions[0].Icon || "" : "" | 75 | iconSource: inhibitions.length > 0 ? inhibitions[0].Icon || "" : "" | ||
79 | text: { | 76 | text: { | ||
80 | if (inhibitions.length > 1) { | 77 | if (inhibitions.length > 1) { | ||
81 | return i18ncp("Some Application and n others are currently suppressing PM", | 78 | return i18ncp("Some Application and n others are currently suppressing PM", | ||
82 | "%2 and %1 other application are currently suppressing power management.", | 79 | "%2 and %1 other application are currently suppressing power management.", | ||
83 | "%2 and %1 other applications are currently suppressing power management.", | 80 | "%2 and %1 other applications are currently suppressing power management.", | ||
84 | inhibitions.length - 1, inhibitions[0].Name) // plural only works on %1 | 81 | inhibitions.length - 1, inhibitions[0].Name) // plural only works on %1 | ||
Show All 16 Lines |
Try if this works with right-to-left layout, or should we ignore this and hope david's patch goes in?