Changeset View
Changeset View
Standalone View
Standalone View
containments/panel/contents/ui/ConfigOverlay.qml
Show First 20 Lines • Show All 218 Lines • ▼ Show 20 Line(s) | 209 | onReleased: { | |||
---|---|---|---|---|---|
219 | 219 | | |||
220 | configurationArea.isResizingLeft = false; | 220 | configurationArea.isResizingLeft = false; | ||
221 | configurationArea.isResizingRight = false; | 221 | configurationArea.isResizingRight = false; | ||
222 | 222 | | |||
223 | root.layoutManager.insertBefore(placeHolder, currentApplet); | 223 | root.layoutManager.insertBefore(placeHolder, currentApplet); | ||
224 | placeHolder.parent = configurationArea; | 224 | placeHolder.parent = configurationArea; | ||
225 | currentApplet.z = 1; | 225 | currentApplet.z = 1; | ||
226 | 226 | | |||
227 | handle.x = currentApplet.x; | 227 | handle.x = currentApplet.x; | ||
broulik: This is never triggered when you just move the mouse over, you probably want to do that in the… | |||||
228 | handle.y = currentApplet.y; | 228 | handle.y = currentApplet.y; | ||
229 | handle.width = currentApplet.width; | 229 | handle.width = currentApplet.width; | ||
230 | handle.height = currentApplet.height; | 230 | handle.height = currentApplet.height; | ||
231 | root.layoutManager.save(); | 231 | root.layoutManager.save(); | ||
232 | } | 232 | } | ||
233 | 233 | | |||
234 | Item { | 234 | Item { | ||
235 | id: placeHolder | 235 | id: placeHolder | ||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 342 | PlasmaCore.Dialog { | |||
344 | visualParent: currentApplet | 344 | visualParent: currentApplet | ||
345 | 345 | | |||
346 | type: PlasmaCore.Dialog.Dock | 346 | type: PlasmaCore.Dialog.Dock | ||
347 | flags: Qt.WindowStaysOnTopHint|Qt.WindowDoesNotAcceptFocus|Qt.BypassWindowManagerHint | 347 | flags: Qt.WindowStaysOnTopHint|Qt.WindowDoesNotAcceptFocus|Qt.BypassWindowManagerHint | ||
348 | location: plasmoid.location | 348 | location: plasmoid.location | ||
349 | 349 | | |||
350 | onVisualParentChanged: { | 350 | onVisualParentChanged: { | ||
351 | if (visualParent) { | 351 | if (visualParent) { | ||
352 | currentApplet.applet.prepareContextualActions(); | ||||
353 | alternativesButton.visible = currentApplet.applet.action("alternatives") && currentApplet.applet.action("alternatives").enabled; | ||||
352 | configureButton.visible = currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled; | 354 | configureButton.visible = currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled; | ||
353 | closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled; | 355 | closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled; | ||
354 | label.text = currentApplet.applet.title; | 356 | label.text = currentApplet.applet.title; | ||
355 | } | 357 | } | ||
356 | } | 358 | } | ||
357 | 359 | | |||
358 | mainItem: MouseArea { | 360 | mainItem: MouseArea { | ||
359 | enabled: currentApplet | 361 | enabled: currentApplet | ||
Show All 20 Lines | 379 | PlasmaComponents.ToolButton { | |||
380 | iconSource: "configure" | 382 | iconSource: "configure" | ||
381 | text: i18n("Configure...") | 383 | text: i18n("Configure...") | ||
382 | onClicked: { | 384 | onClicked: { | ||
383 | tooltip.visible = false; | 385 | tooltip.visible = false; | ||
384 | currentApplet.applet.action("configure").trigger() | 386 | currentApplet.applet.action("configure").trigger() | ||
385 | } | 387 | } | ||
386 | } | 388 | } | ||
387 | PlasmaComponents.ToolButton { | 389 | PlasmaComponents.ToolButton { | ||
390 | id: alternativesButton | ||||
391 | Layout.fillWidth: true | ||||
392 | iconSource: "widget-alternatives" | ||||
ngraham: This should now be `widget-alternatives` | |||||
393 | text: i18n("Show Alternatives...") | ||||
GB_2: And this "Show Alternatives..." | |||||
394 | onClicked: { | ||||
395 | tooltip.visible = false; | ||||
396 | currentApplet.applet.action("alternatives").trigger() | ||||
As for your TODO: See in plasma-frameworks applet_p.cpp around line 189 Good news: The "visible" property of this action indicates if we have alternatives or not. Probably also worth taking the text and icon source from there too Bad news: This property is only updated when it receives the signal: so that needs to be called somewhere. davidedmundson: As for your TODO:
See in plasma-frameworks applet_p.cpp around line 189
Good news: The… | |||||
397 | } | ||||
398 | } | ||||
399 | PlasmaComponents.ToolButton { | ||||
388 | id: closeButton | 400 | id: closeButton | ||
389 | Layout.fillWidth: true | 401 | Layout.fillWidth: true | ||
390 | iconSource: "delete" | 402 | iconSource: "delete" | ||
391 | text: i18n("Remove") | 403 | text: i18n("Remove") | ||
392 | onClicked: { | 404 | onClicked: { | ||
393 | tooltip.visible = false; | 405 | tooltip.visible = false; | ||
394 | currentApplet.applet.action("remove").trigger(); | 406 | currentApplet.applet.action("remove").trigger(); | ||
395 | } | 407 | } | ||
396 | } | 408 | } | ||
397 | } | 409 | } | ||
398 | } | 410 | } | ||
399 | } | 411 | } | ||
400 | } | 412 | } |
This is never triggered when you just move the mouse over, you probably want to do that in the onVisualParentChanged handler below
Ideally this was all done using proper bindings instead of imperative code, though.