Commit e64fda4a authored by Marco Martin's avatar Marco Martin

close panel when an applet wants to close

parent efc09b00
......@@ -45,7 +45,9 @@ ColumnLayout {
if (text != "") {
activityModel.addActivity(text, function(id) {
visible = false;
activityModel.setCurrentActivity(id, function() {});
activityModel.setCurrentActivity(id, function() {
plasmoid.expanded = false;
});
});
}
}
......@@ -107,7 +109,9 @@ ColumnLayout {
height: Math.max(label.height, label.height)
onClicked: {
listView.currentIndex = index;
activityModel.setCurrentActivity(model.id, function() {});
activityModel.setCurrentActivity(model.id, function() {
plasmoid.expanded = false;
});
}
onPressAndHold: {
edit.visible = true
......
......@@ -36,6 +36,12 @@ FullScreenPanel {
width: Screen.width
height: Screen.height
function open() {
mouseArea.state = "open";
}
function close() {
mouseArea.state = "closed";
}
function updateState() {
var delta = offset - mouseArea.startOffset;
if (delta > units.gridUnit * 8) {
......
......@@ -44,6 +44,15 @@ PlasmaCore.ColorScope {
LayoutManager.save();
}
Connections {
target: expandedApplet
onExpandedChanged: {
if (!expanded) {
slidingPanel.close();
}
}
}
function addApplet(applet, x, y) {
var container = appletContainerComponent.createObject(appletIconsRow)
......@@ -98,12 +107,14 @@ PlasmaCore.ColorScope {
z: 999
onClicked: {
if (root.expandedApplet != applet) {
//temp var needed for oldExpandedApplet not to catch one expandedChanged too much by our Connections
var oldExpandedApplet = root.expandedApplet;
root.expandedApplet = applet;
applet.expanded = true;
appletsStack.replace(applet.fullRepresentationItem);
if (root.expandedApplet) {
root.expandedApplet.expanded = false;
if (oldExpandedApplet) {
oldExpandedApplet.expanded = false;
}
root.expandedApplet = applet;
}
}
}
......@@ -209,6 +220,7 @@ PlasmaCore.ColorScope {
var factor = 1;
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor;
oldMouseY = mouse.y;
root.expandedApplet.expanded = true;
}
onReleased: slidingPanel.updateState();
}
......
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