Changeset View
Changeset View
Standalone View
Standalone View
desktoppackage/contents/configuration/panelconfiguration/ToolBar.qml
Show All 20 Lines | |||||
21 | import QtQuick.Layouts 1.0 | 21 | import QtQuick.Layouts 1.0 | ||
22 | import org.kde.plasma.components 2.0 as PlasmaComponents | 22 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
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.configuration 2.0 | 24 | import org.kde.plasma.configuration 2.0 | ||
25 | 25 | | |||
26 | Item { | 26 | Item { | ||
27 | id: root | 27 | id: root | ||
28 | state: parent.state | 28 | state: parent.state | ||
29 | implicitWidth: Math.max(buttonsLayout.width, row.width) + units.smallSpacing * 2 | 29 | implicitWidth: Math.max(buttonsLayout_1.width, buttonsLayout_2.width, row.width) + units.smallSpacing * 2 | ||
30 | implicitHeight: row.height + 20 | 30 | implicitHeight: row.height + 20 | ||
31 | 31 | | |||
32 | readonly property string lockWidgetsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Lock Widgets") | ||||
33 | readonly property string removePanelButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Remove Panel") | ||||
32 | readonly property string addWidgetsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Widgets...") | 34 | readonly property string addWidgetsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Widgets...") | ||
33 | readonly property string addSpacerButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Spacer") | 35 | readonly property string addSpacerButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "Add Spacer") | ||
34 | readonly property string settingsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "More Settings...") | 36 | readonly property string settingsButtonText: i18nd("plasma_shell_org.kde.plasma.desktop", "More Settings...") | ||
35 | 37 | | |||
36 | QQC.Action { | 38 | QQC.Action { | ||
37 | shortcut: "Escape" | 39 | shortcut: "Escape" | ||
38 | onTriggered: { | 40 | onTriggered: { | ||
39 | // avoid leaving the panel in an inconsistent state when escaping while dragging it | 41 | // avoid leaving the panel in an inconsistent state when escaping while dragging it | ||
40 | // "checked" means "pressed" in this case, we abuse that property to make the button look pressed | 42 | // "checked" means "pressed" in this case, we abuse that property to make the button look pressed | ||
41 | if (edgeHandle.checked || sizeHandle.checked) { | 43 | if (edgeHandle.checked || sizeHandle.checked) { | ||
42 | return | 44 | return | ||
43 | } | 45 | } | ||
44 | 46 | | |||
45 | if (contextMenuLoader.opened) { | 47 | if (contextMenuLoader.opened) { | ||
46 | contextMenuLoader.close() | 48 | contextMenuLoader.close() | ||
47 | } else { | 49 | } else { | ||
48 | configDialog.close() | 50 | configDialog.close() | ||
49 | } | 51 | } | ||
50 | } | 52 | } | ||
51 | } | 53 | } | ||
52 | 54 | | |||
53 | GridLayout { | 55 | GridLayout { | ||
56 | id: buttonsLayout_1 | ||||
57 | rows: 1 | ||||
58 | columns: 1 | ||||
59 | flow: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? GridLayout.TopToBottom : GridLayout.LeftToRight | ||||
60 | | ||||
61 | anchors.margins: rowSpacing | ||||
62 | anchors.topMargin: plasmoid.formFactor === PlasmaCore.Types.Vertical ? rowSpacing + closeButton.height : rowSpacing | ||||
63 | | ||||
64 | property bool showText: plasmoid.formFactor === PlasmaCore.Types.Vertical || (row.x + row.width < root.width - placeHolder.width - units.iconSizes.small*4 - units.largeSpacing*5) | ||||
65 | | ||||
66 | rowSpacing: units.smallSpacing | ||||
67 | columnSpacing: units.smallSpacing | ||||
68 | | ||||
69 | PlasmaComponents.Button { | ||||
70 | iconSource: "document-encrypt" | ||||
71 | text: buttonsLayout_1.showText ? root.lockWidgetsButtonText : "" | ||||
72 | tooltip: buttonsLayout_1.showText ? "" : root.lockWidgetsButtonText | ||||
73 | Layout.fillWidth: true | ||||
74 | onClicked: { | ||||
75 | plasmoid.action("lock widgets").trigger(); | ||||
76 | configDialog.close(); | ||||
77 | } | ||||
78 | } | ||||
79 | | ||||
80 | PlasmaComponents.Button { | ||||
81 | iconSource: "delete" | ||||
82 | text: buttonsLayout_1.showText ? root.removePanelButtonText : "" | ||||
83 | tooltip: buttonsLayout_1.showText ? "" : root.removePanelButtonText | ||||
84 | Layout.fillWidth: true | ||||
85 | onClicked: { | ||||
86 | plasmoid.action("remove").trigger(); | ||||
87 | } | ||||
88 | } | ||||
89 | } | ||||
90 | | ||||
91 | GridLayout { | ||||
54 | id: row | 92 | id: row | ||
55 | columns: dialogRoot.vertical ? 1 : 2 | 93 | columns: dialogRoot.vertical ? 1 : 2 | ||
56 | rows: dialogRoot.vertical ? 2 : 1 | 94 | rows: dialogRoot.vertical ? 2 : 1 | ||
57 | anchors.centerIn: parent | 95 | anchors.centerIn: parent | ||
58 | 96 | | |||
59 | rowSpacing: units.smallSpacing | 97 | rowSpacing: units.smallSpacing | ||
60 | columnSpacing: units.smallSpacing | 98 | columnSpacing: units.smallSpacing | ||
61 | 99 | | |||
Show All 18 Lines | 116 | Connections { | |||
80 | onVisibleChanged: { | 118 | onVisibleChanged: { | ||
81 | if (!configDialog.visible) { | 119 | if (!configDialog.visible) { | ||
82 | settingsButton.checked = false | 120 | settingsButton.checked = false | ||
83 | } | 121 | } | ||
84 | } | 122 | } | ||
85 | } | 123 | } | ||
86 | 124 | | |||
87 | GridLayout { | 125 | GridLayout { | ||
88 | id: buttonsLayout | 126 | id: buttonsLayout_2 | ||
89 | rows: 1 | 127 | rows: 1 | ||
90 | columns: 1 | 128 | columns: 1 | ||
91 | flow: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? GridLayout.TopToBottom : GridLayout.LeftToRight | 129 | flow: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? GridLayout.TopToBottom : GridLayout.LeftToRight | ||
92 | 130 | | |||
93 | anchors.margins: rowSpacing | 131 | anchors.margins: rowSpacing | ||
94 | 132 | | |||
95 | property bool showText: plasmoid.formFactor === PlasmaCore.Types.Vertical || (row.x + row.width < root.width - placeHolder.width - units.iconSizes.small*4 - units.largeSpacing*5) | 133 | property bool showText: plasmoid.formFactor === PlasmaCore.Types.Vertical || (row.x + row.width < root.width - placeHolder.width - units.iconSizes.small*4 - units.largeSpacing*5) | ||
96 | 134 | | |||
97 | rowSpacing: units.smallSpacing | 135 | rowSpacing: units.smallSpacing | ||
98 | columnSpacing: units.smallSpacing | 136 | columnSpacing: units.smallSpacing | ||
99 | 137 | | |||
100 | PlasmaComponents.Button { | 138 | PlasmaComponents.Button { | ||
101 | text: buttonsLayout.showText ? root.addWidgetsButtonText : "" | 139 | text: buttonsLayout_2.showText ? root.addWidgetsButtonText : "" | ||
102 | tooltip: buttonsLayout.showText ? "" : root.addWidgetsButtonText | 140 | tooltip: buttonsLayout_2.showText ? "" : root.addWidgetsButtonText | ||
103 | iconSource: "list-add" | 141 | iconSource: "list-add" | ||
104 | Layout.fillWidth: true | 142 | Layout.fillWidth: true | ||
105 | onClicked: { | 143 | onClicked: { | ||
106 | configDialog.close(); | 144 | configDialog.close(); | ||
107 | configDialog.showAddWidgetDialog(); | 145 | configDialog.showAddWidgetDialog(); | ||
108 | } | 146 | } | ||
109 | } | 147 | } | ||
110 | 148 | | |||
111 | PlasmaComponents.Button { | 149 | PlasmaComponents.Button { | ||
112 | iconSource: "distribute-horizontal-x" | 150 | iconSource: "distribute-horizontal-x" | ||
113 | text: buttonsLayout.showText ? root.addSpacerButtonText : "" | 151 | text: buttonsLayout_2.showText ? root.addSpacerButtonText : "" | ||
114 | tooltip: buttonsLayout.showText ? "" : root.addSpacerButtonText | 152 | tooltip: buttonsLayout_2.showText ? "" : root.addSpacerButtonText | ||
115 | Layout.fillWidth: true | 153 | Layout.fillWidth: true | ||
116 | onClicked: { | 154 | onClicked: { | ||
117 | configDialog.addPanelSpacer(); | 155 | configDialog.addPanelSpacer(); | ||
118 | } | 156 | } | ||
119 | } | 157 | } | ||
120 | 158 | | |||
121 | PlasmaComponents.Button { | 159 | PlasmaComponents.Button { | ||
122 | id: settingsButton | 160 | id: settingsButton | ||
123 | iconSource: "configure" | 161 | iconSource: "configure" | ||
124 | text: buttonsLayout.showText ? root.settingsButtonText : "" | 162 | text: buttonsLayout_2.showText ? root.settingsButtonText : "" | ||
125 | tooltip: buttonsLayout.showText ? "" : root.settingsButtonText | 163 | tooltip: buttonsLayout_2.showText ? "" : root.settingsButtonText | ||
126 | Layout.fillWidth: true | 164 | Layout.fillWidth: true | ||
127 | checkable: true | 165 | checkable: true | ||
128 | onCheckedChanged: { | 166 | onCheckedChanged: { | ||
129 | if (checked) { | 167 | if (checked) { | ||
130 | contextMenuLoader.open() | 168 | contextMenuLoader.open() | ||
131 | } else { | 169 | } else { | ||
132 | contextMenuLoader.close() | 170 | contextMenuLoader.close() | ||
133 | } | 171 | } | ||
134 | } | 172 | } | ||
135 | } | 173 | } | ||
136 | 174 | | |||
137 | PlasmaComponents.ToolButton { | 175 | PlasmaComponents.ToolButton { | ||
138 | parent: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? buttonsLayout : root | 176 | id: closeButton | ||
177 | parent: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? buttonsLayout_2 : root | ||||
139 | anchors.right: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? undefined : parent.right | 178 | anchors.right: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? undefined : parent.right | ||
140 | iconSource: "window-close" | 179 | iconSource: "window-close" | ||
141 | tooltip: i18nd("plasma_shell_org.kde.plasma.desktop", "Close") | 180 | tooltip: i18nd("plasma_shell_org.kde.plasma.desktop", "Close") | ||
142 | onClicked: { | 181 | onClicked: { | ||
143 | configDialog.close() | 182 | configDialog.close() | ||
144 | } | 183 | } | ||
145 | } | 184 | } | ||
146 | 185 | | |||
Show All 29 Lines | 213 | AnchorChanges { | |||
176 | anchors { | 215 | anchors { | ||
177 | top: undefined | 216 | top: undefined | ||
178 | bottom: root.parent.bottom | 217 | bottom: root.parent.bottom | ||
179 | left: root.parent.left | 218 | left: root.parent.left | ||
180 | right: root.parent.right | 219 | right: root.parent.right | ||
181 | } | 220 | } | ||
182 | } | 221 | } | ||
183 | AnchorChanges { | 222 | AnchorChanges { | ||
184 | target: buttonsLayout | 223 | target: buttonsLayout_1 | ||
224 | anchors { | ||||
225 | verticalCenter: root.verticalCenter | ||||
226 | top: undefined | ||||
227 | bottom: undefined | ||||
228 | left: root.left | ||||
229 | right: undefined | ||||
230 | } | ||||
231 | } | ||||
232 | AnchorChanges { | ||||
233 | target: buttonsLayout_2 | ||||
185 | anchors { | 234 | anchors { | ||
186 | verticalCenter: root.verticalCenter | 235 | verticalCenter: root.verticalCenter | ||
187 | top: undefined | 236 | top: undefined | ||
188 | bottom: undefined | 237 | bottom: undefined | ||
189 | left: undefined | 238 | left: undefined | ||
190 | right: root.right | 239 | right: root.right | ||
191 | } | 240 | } | ||
192 | } | 241 | } | ||
193 | PropertyChanges { | 242 | PropertyChanges { | ||
194 | target: buttonsLayout | 243 | target: buttonsLayout_1 | ||
195 | width: buttonsLayout.implicitWidth | 244 | width: buttonsLayout_1.implicitWidth | ||
245 | } | ||||
246 | PropertyChanges { | ||||
247 | target: buttonsLayout_2 | ||||
248 | width: buttonsLayout_2.implicitWidth | ||||
196 | } | 249 | } | ||
197 | }, | 250 | }, | ||
198 | State { | 251 | State { | ||
199 | name: "BottomEdge" | 252 | name: "BottomEdge" | ||
200 | PropertyChanges { | 253 | PropertyChanges { | ||
201 | target: root | 254 | target: root | ||
202 | height: root.implicitHeight | 255 | height: root.implicitHeight | ||
203 | } | 256 | } | ||
204 | AnchorChanges { | 257 | AnchorChanges { | ||
205 | target: root | 258 | target: root | ||
206 | anchors { | 259 | anchors { | ||
207 | top: root.parent.top | 260 | top: root.parent.top | ||
208 | bottom: undefined | 261 | bottom: undefined | ||
209 | left: root.parent.left | 262 | left: root.parent.left | ||
210 | right: root.parent.right | 263 | right: root.parent.right | ||
211 | } | 264 | } | ||
212 | } | 265 | } | ||
213 | AnchorChanges { | 266 | AnchorChanges { | ||
214 | target: buttonsLayout | 267 | target: buttonsLayout_1 | ||
268 | anchors { | ||||
269 | verticalCenter: root.verticalCenter | ||||
270 | top: undefined | ||||
271 | bottom: undefined | ||||
272 | left: root.left | ||||
273 | right: undefined | ||||
274 | } | ||||
275 | } | ||||
276 | AnchorChanges { | ||||
277 | target: buttonsLayout_2 | ||||
215 | anchors { | 278 | anchors { | ||
216 | verticalCenter: root.verticalCenter | 279 | verticalCenter: root.verticalCenter | ||
217 | top: undefined | 280 | top: undefined | ||
218 | bottom: undefined | 281 | bottom: undefined | ||
219 | left: undefined | 282 | left: undefined | ||
220 | right: root.right | 283 | right: root.right | ||
221 | } | 284 | } | ||
222 | } | 285 | } | ||
223 | PropertyChanges { | 286 | PropertyChanges { | ||
224 | target: buttonsLayout | 287 | target: buttonsLayout_1 | ||
225 | width: buttonsLayout.implicitWidth | 288 | width: buttonsLayout_1.implicitWidth | ||
289 | } | ||||
290 | PropertyChanges { | ||||
291 | target: buttonsLayout_2 | ||||
292 | width: buttonsLayout_2.implicitWidth | ||||
226 | } | 293 | } | ||
227 | }, | 294 | }, | ||
228 | State { | 295 | State { | ||
229 | name: "LeftEdge" | 296 | name: "LeftEdge" | ||
230 | PropertyChanges { | 297 | PropertyChanges { | ||
231 | target: root | 298 | target: root | ||
232 | width: root.implicitWidth | 299 | width: root.implicitWidth | ||
233 | } | 300 | } | ||
234 | AnchorChanges { | 301 | AnchorChanges { | ||
235 | target: root | 302 | target: root | ||
236 | anchors { | 303 | anchors { | ||
237 | top: root.parent.top | 304 | top: root.parent.top | ||
238 | bottom: root.parent.bottom | 305 | bottom: root.parent.bottom | ||
239 | left: undefined | 306 | left: undefined | ||
240 | right: root.parent.right | 307 | right: root.parent.right | ||
241 | } | 308 | } | ||
242 | } | 309 | } | ||
243 | AnchorChanges { | 310 | AnchorChanges { | ||
244 | target: buttonsLayout | 311 | target: buttonsLayout_1 | ||
312 | anchors { | ||||
313 | verticalCenter: undefined | ||||
314 | top: root.top | ||||
315 | bottom: undefined | ||||
316 | left: root.left | ||||
317 | right: root.right | ||||
318 | } | ||||
319 | } | ||||
320 | AnchorChanges { | ||||
321 | target: buttonsLayout_2 | ||||
245 | anchors { | 322 | anchors { | ||
246 | verticalCenter: undefined | 323 | verticalCenter: undefined | ||
247 | top: undefined | 324 | top: undefined | ||
248 | bottom: root.bottom | 325 | bottom: root.bottom | ||
249 | left: root.left | 326 | left: root.left | ||
250 | right: root.right | 327 | right: root.right | ||
251 | } | 328 | } | ||
252 | } | 329 | } | ||
Show All 9 Lines | 337 | AnchorChanges { | |||
262 | anchors { | 339 | anchors { | ||
263 | top: root.parent.top | 340 | top: root.parent.top | ||
264 | bottom: root.parent.bottom | 341 | bottom: root.parent.bottom | ||
265 | left: root.parent.left | 342 | left: root.parent.left | ||
266 | right: undefined | 343 | right: undefined | ||
267 | } | 344 | } | ||
268 | } | 345 | } | ||
269 | AnchorChanges { | 346 | AnchorChanges { | ||
270 | target: buttonsLayout | 347 | target: buttonsLayout_1 | ||
348 | anchors { | ||||
349 | verticalCenter: undefined | ||||
350 | top: root.top | ||||
351 | bottom: undefined | ||||
352 | left: root.left | ||||
353 | right: root.right | ||||
354 | } | ||||
355 | } | ||||
356 | AnchorChanges { | ||||
357 | target: buttonsLayout_2 | ||||
271 | anchors { | 358 | anchors { | ||
272 | verticalCenter: undefined | 359 | verticalCenter: undefined | ||
273 | top: undefined | 360 | top: undefined | ||
274 | bottom: root.bottom | 361 | bottom: root.bottom | ||
275 | left: root.left | 362 | left: root.left | ||
276 | right: root.right | 363 | right: root.right | ||
277 | } | 364 | } | ||
278 | } | 365 | } | ||
279 | } | 366 | } | ||
280 | ] | 367 | ] | ||
281 | //END States | 368 | //END States | ||
282 | } | 369 | } |