mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
destroy container when an applet gets removed
This commit is contained in:
parent
73a2d560f0
commit
79af925af8
2 changed files with 21 additions and 2 deletions
|
|
@ -62,6 +62,7 @@ MouseEventListener {
|
|||
}
|
||||
|
||||
draggingApplet.y = mouse.y - draggingApplet.height/2;
|
||||
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
||||
|
||||
var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
|
||||
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
|
||||
|
|
@ -91,7 +92,12 @@ MouseEventListener {
|
|||
if (!draggingApplet) {
|
||||
return;
|
||||
}
|
||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
||||
draggingApplet.x = 0;
|
||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||
} else {
|
||||
draggingApplet.applet.action("remove").trigger();
|
||||
}
|
||||
applicationsView.interactive = true;
|
||||
dndSpacer.parent = colorScope;
|
||||
draggingApplet = null;
|
||||
|
|
|
|||
|
|
@ -156,10 +156,12 @@ Item {
|
|||
Component {
|
||||
id: appletContainerComponent
|
||||
MouseArea {
|
||||
id: appletContainer
|
||||
//not used yet
|
||||
property bool animationsEnabled: false
|
||||
property Item applet
|
||||
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
||||
opacity: 1/Math.abs(x/(width/2))
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: applet && applet.Layout.fillHeight
|
||||
Layout.onFillHeightChanged: {
|
||||
|
|
@ -168,10 +170,21 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: plasmoid
|
||||
|
||||
onAppletRemoved: {
|
||||
print("Applet removed Applet-" + applet.id)
|
||||
if (applet.id == appletContainer.applet.id) {
|
||||
appletContainer.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onAppletChanged: {
|
||||
if (applet.backgroundHints == PlasmaCore.Types.StandardBackground) {
|
||||
applet.anchors.margins = background.margins.top;
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: background
|
||||
|
|
|
|||
Loading…
Reference in a new issue