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 { ...@@ -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 { ...@@ -91,7 +92,12 @@ MouseEventListener {
if (!draggingApplet) { if (!draggingApplet) {
return; 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; applicationsView.interactive = true;
dndSpacer.parent = colorScope; dndSpacer.parent = colorScope;
draggingApplet = null; draggingApplet = null;
......
...@@ -156,10 +156,12 @@ Item { ...@@ -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,10 +170,21 @@ Item { ...@@ -168,10 +170,21 @@ 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;
} }
} }
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: background id: background
......
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