Commit 79af925a authored by Marco Martin's avatar Marco Martin
Browse files

destroy container when an applet gets removed

parent 73a2d560
......@@ -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;
}
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,6 +170,17 @@ 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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment