mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +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.y = mouse.y - draggingApplet.height/2;
|
||||||
|
draggingApplet.x = mouse.x - draggingApplet.width/2;
|
||||||
|
|
||||||
var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
|
var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
|
||||||
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
|
var itemUnderMouse = appletsSpace.layout.childAt(pos.x, pos.y);
|
||||||
|
|
@ -91,7 +92,12 @@ MouseEventListener {
|
||||||
if (!draggingApplet) {
|
if (!draggingApplet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (draggingApplet.x > -draggingApplet.width/4 && draggingApplet.x < draggingApplet.width/4) {
|
||||||
|
draggingApplet.x = 0;
|
||||||
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
LayoutManager.insertBefore( dndSpacer, draggingApplet);
|
||||||
|
} else {
|
||||||
|
draggingApplet.applet.action("remove").trigger();
|
||||||
|
}
|
||||||
applicationsView.interactive = true;
|
applicationsView.interactive = true;
|
||||||
dndSpacer.parent = colorScope;
|
dndSpacer.parent = colorScope;
|
||||||
draggingApplet = null;
|
draggingApplet = null;
|
||||||
|
|
|
||||||
|
|
@ -156,10 +156,12 @@ Item {
|
||||||
Component {
|
Component {
|
||||||
id: appletContainerComponent
|
id: appletContainerComponent
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: appletContainer
|
||||||
//not used yet
|
//not used yet
|
||||||
property bool animationsEnabled: false
|
property bool animationsEnabled: false
|
||||||
property Item applet
|
property Item applet
|
||||||
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
z: applet && applet.compactRepresentationItem && applet.expanded ? 99 : 0
|
||||||
|
opacity: 1/Math.abs(x/(width/2))
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: applet && applet.Layout.fillHeight
|
Layout.fillHeight: applet && applet.Layout.fillHeight
|
||||||
Layout.onFillHeightChanged: {
|
Layout.onFillHeightChanged: {
|
||||||
|
|
@ -168,6 +170,17 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: plasmoid
|
||||||
|
|
||||||
|
onAppletRemoved: {
|
||||||
|
print("Applet removed Applet-" + applet.id)
|
||||||
|
if (applet.id == appletContainer.applet.id) {
|
||||||
|
appletContainer.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onAppletChanged: {
|
onAppletChanged: {
|
||||||
if (applet.backgroundHints == PlasmaCore.Types.StandardBackground) {
|
if (applet.backgroundHints == PlasmaCore.Types.StandardBackground) {
|
||||||
applet.anchors.margins = background.margins.top;
|
applet.anchors.margins = background.margins.top;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue