Changeset View
Changeset View
Standalone View
Standalone View
applets/digital-clock/package/contents/ui/configTimeZones.qml
Show All 19 Lines | |||||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.0 | ||
22 | import QtQuick.Controls 1.2 as QtControls | 22 | import QtQuick.Controls 1.2 as QtControls | ||
23 | import QtQuick.Layouts 1.0 | 23 | import QtQuick.Layouts 1.0 | ||
24 | import QtQuick.Dialogs 1.1 | 24 | import QtQuick.Dialogs 1.1 | ||
25 | 25 | | |||
26 | import org.kde.plasma.private.digitalclock 1.0 | 26 | import org.kde.plasma.private.digitalclock 1.0 | ||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | 27 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
28 | import org.kde.plasma.components 2.0 as PlasmaComponents | 28 | import org.kde.kirigami 2.5 as Kirigami | ||
29 | 29 | | |||
30 | Item { | 30 | ColumnLayout { | ||
31 | id: timeZonesPage | 31 | id: timeZonesPage | ||
32 | width: parent.width | | |||
33 | height: parent.height | | |||
34 | 32 | | |||
davidedmundson: Do you need these?
Generally it's a sign of a problem or bad layering if the root item has… | |||||
Ops, copy&pPaste from HolidayConfig.qml. I'll remove it, width/height are not needed, I just checked, AppletConfiguration.qml handles that. kmaterka: Ops, copy&pPaste from HolidayConfig.qml. I'll remove it, width/height are not needed, I just… | |||||
35 | property alias cfg_selectedTimeZones: timeZones.selectedTimeZones | 33 | property alias cfg_selectedTimeZones: timeZones.selectedTimeZones | ||
36 | property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked | 34 | property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked | ||
37 | 35 | | |||
38 | TimeZoneModel { | 36 | TimeZoneModel { | ||
39 | id: timeZones | 37 | id: timeZones | ||
40 | 38 | | |||
41 | onSelectedTimeZonesChanged: { | 39 | onSelectedTimeZonesChanged: { | ||
42 | if (selectedTimeZones.length === 0) { | 40 | if (selectedTimeZones.length === 0) { | ||
43 | messageWidget.visible = true; | 41 | messageWidget.visible = true; | ||
44 | 42 | | |||
45 | timeZones.selectLocalTimeZone(); | 43 | timeZones.selectLocalTimeZone(); | ||
46 | } | 44 | } | ||
47 | } | 45 | } | ||
48 | } | 46 | } | ||
49 | 47 | | |||
50 | // This is just for getting the column width | 48 | // This is just for getting the column width | ||
51 | QtControls.CheckBox { | 49 | QtControls.CheckBox { | ||
52 | id: checkbox | 50 | id: checkbox | ||
53 | visible: false | 51 | visible: false | ||
54 | } | 52 | } | ||
55 | 53 | | |||
56 | 54 | Kirigami.InlineMessage { | |||
If we're going to port stuff, we may as well port to: https://api.kde.org/frameworks/kirigami/html/classorg_1_1kde_1_1kirigami_1_1InlineMessage.html the library version of this davidedmundson: If we're going to port stuff, we may as well port to:
https://api.kde. | |||||
kmaterka: Cool! I need there must be something! | |||||
57 | ColumnLayout { | | |||
58 | anchors.fill: parent | | |||
59 | | ||||
60 | Rectangle { | | |||
61 | id: messageWidget | 55 | id: messageWidget | ||
62 | 56 | | |||
63 | anchors { | | |||
64 | left: parent.left | | |||
65 | right: parent.right | | |||
66 | margins: 1 | | |||
67 | } | | |||
68 | | ||||
69 | height: 0 | | |||
70 | | ||||
71 | //TODO: This is the actual color KMessageWidget uses as its base color but here it gives | | |||
72 | // a different color, figure out why | | |||
73 | //property color gradBaseColor: Qt.rgba(0.69, 0.5, 0, 1) | | |||
74 | gradient: Gradient { | | |||
75 | GradientStop { position: 0.0; color: "#FFD86D" } //Qt.lighter(messageWidget.gradBaseColor, 1.1) | | |||
76 | GradientStop { position: 0.1; color: "#EAC360" } // messageWidget.gradBaseColor | | |||
77 | GradientStop { position: 1.0; color: "#CAB064" } //Qt.darker(messageWidget.gradBaseColor, 1.1) | | |||
78 | } | | |||
79 | | ||||
80 | radius: 5 | | |||
81 | border.width: 1 | | |||
82 | border.color: "#79735B" | | |||
83 | | ||||
84 | visible: false | | |||
85 | | ||||
86 | Behavior on visible { | | |||
87 | ParallelAnimation { | | |||
88 | PropertyAnimation { | | |||
89 | target: messageWidget | | |||
90 | property: "opacity" | | |||
91 | to: messageWidget.visible ? 0 : 1.0 | | |||
92 | easing.type: Easing.Linear | | |||
93 | } | | |||
94 | PropertyAnimation { | | |||
95 | target: messageWidget | | |||
96 | property: "Layout.minimumHeight" | | |||
97 | to: messageWidget.visible ? 0 : messageWidgetLabel.height + (2 *units.largeSpacing) | | |||
98 | easing.type: Easing.Linear | | |||
99 | } | | |||
100 | } | | |||
101 | } | | |||
102 | | ||||
103 | RowLayout { | | |||
104 | anchors.fill: parent | | |||
105 | anchors.margins: units.largeSpacing | | |||
106 | anchors.leftMargin: units.smallSpacing | | |||
107 | anchors.rightMargin: units.smallSpacing | | |||
108 | spacing: units.smallSpacing | | |||
109 | | ||||
110 | PlasmaCore.IconItem { | | |||
111 | anchors.verticalCenter: parent.verticalCenter | | |||
112 | height: units.iconSizes.smallMedium | | |||
113 | width: height | | |||
114 | source: "dialog-warning" | | |||
115 | } | | |||
116 | | ||||
117 | QtControls.Label { | | |||
118 | id: messageWidgetLabel | | |||
119 | anchors.verticalCenter: parent.verticalCenter | | |||
120 | Layout.fillWidth: true | 57 | Layout.fillWidth: true | ||
121 | text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") | | |||
122 | verticalAlignment: Text.AlignVCenter | | |||
123 | wrapMode: Text.WordWrap | | |||
124 | } | | |||
125 | 58 | | |||
ngraham: Don't use hardcoded margins. This should be `Kirigami.Units.smallSpacing` | |||||
I just copied values form the original Rectangle. I will remove it entirely, probably it's not needed anymore. kmaterka: I just copied values form the original Rectangle. I will remove it entirely, probably it's not… | |||||
126 | PlasmaComponents.ToolButton { | 59 | type: Kirigami.MessageType.Warning | ||
127 | anchors.verticalCenter: parent.verticalCenter | 60 | text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") | ||
128 | iconName: "dialog-close" | | |||
129 | flat: true | | |||
130 | 61 | | |||
131 | onClicked: { | 62 | showCloseButton: true | ||
132 | messageWidget.visible = false; | | |||
133 | } | | |||
134 | } | | |||
135 | } | | |||
136 | } | 63 | } | ||
137 | 64 | | |||
138 | QtControls.TextField { | 65 | QtControls.TextField { | ||
139 | id: filter | 66 | id: filter | ||
140 | Layout.fillWidth: true | 67 | Layout.fillWidth: true | ||
141 | placeholderText: i18n("Search Time Zones") | 68 | placeholderText: i18n("Search Time Zones") | ||
142 | } | 69 | } | ||
143 | 70 | | |||
Show All 9 Lines | 71 | QtControls.TableView { | |||
153 | 80 | | |||
154 | model: TimeZoneFilterProxy { | 81 | model: TimeZoneFilterProxy { | ||
155 | sourceModel: timeZones | 82 | sourceModel: timeZones | ||
156 | filterString: filter.text | 83 | filterString: filter.text | ||
157 | } | 84 | } | ||
158 | 85 | | |||
159 | QtControls.TableViewColumn { | 86 | QtControls.TableViewColumn { | ||
160 | role: "checked" | 87 | role: "checked" | ||
161 | width: checkbox.width | 88 | width: checkbox.width | ||
davidedmundson: What's this for? Opacity should be inherited by children
| |||||
kmaterka: I will use Kirigami component. | |||||
162 | delegate: | 89 | delegate: | ||
163 | QtControls.CheckBox { | 90 | QtControls.CheckBox { | ||
164 | id: checkBox | 91 | id: checkBox | ||
165 | anchors.centerIn: parent | 92 | anchors.centerIn: parent | ||
166 | checked: styleData.value | 93 | checked: styleData.value | ||
167 | activeFocusOnTab: false // only let the TableView as a whole get focus | 94 | activeFocusOnTab: false // only let the TableView as a whole get focus | ||
168 | onClicked: { | 95 | onClicked: { | ||
169 | //needed for model's setData to be called | 96 | //needed for model's setData to be called | ||
Show All 29 Lines | |||||
199 | 126 | | |||
200 | RowLayout { | 127 | RowLayout { | ||
201 | Layout.fillWidth: true | 128 | Layout.fillWidth: true | ||
202 | QtControls.CheckBox { | 129 | QtControls.CheckBox { | ||
203 | id: enableWheelCheckBox | 130 | id: enableWheelCheckBox | ||
204 | text: i18n("Switch time zone with mouse wheel") | 131 | text: i18n("Switch time zone with mouse wheel") | ||
205 | } | 132 | } | ||
206 | } | 133 | } | ||
207 | | ||||
208 | } | | |||
209 | } | 134 | } |
Do you need these?
Generally it's a sign of a problem or bad layering if the root item has anchors in it.