mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +00:00
close panel when an applet wants to close
This commit is contained in:
parent
efc09b0011
commit
e64fda4a63
3 changed files with 27 additions and 5 deletions
|
|
@ -45,7 +45,9 @@ ColumnLayout {
|
||||||
if (text != "") {
|
if (text != "") {
|
||||||
activityModel.addActivity(text, function(id) {
|
activityModel.addActivity(text, function(id) {
|
||||||
visible = false;
|
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)
|
height: Math.max(label.height, label.height)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
listView.currentIndex = index;
|
listView.currentIndex = index;
|
||||||
activityModel.setCurrentActivity(model.id, function() {});
|
activityModel.setCurrentActivity(model.id, function() {
|
||||||
|
plasmoid.expanded = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
edit.visible = true
|
edit.visible = true
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ FullScreenPanel {
|
||||||
width: Screen.width
|
width: Screen.width
|
||||||
height: Screen.height
|
height: Screen.height
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
mouseArea.state = "open";
|
||||||
|
}
|
||||||
|
function close() {
|
||||||
|
mouseArea.state = "closed";
|
||||||
|
}
|
||||||
function updateState() {
|
function updateState() {
|
||||||
var delta = offset - mouseArea.startOffset;
|
var delta = offset - mouseArea.startOffset;
|
||||||
if (delta > units.gridUnit * 8) {
|
if (delta > units.gridUnit * 8) {
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,15 @@ PlasmaCore.ColorScope {
|
||||||
LayoutManager.save();
|
LayoutManager.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: expandedApplet
|
||||||
|
onExpandedChanged: {
|
||||||
|
if (!expanded) {
|
||||||
|
slidingPanel.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addApplet(applet, x, y) {
|
function addApplet(applet, x, y) {
|
||||||
|
|
||||||
var container = appletContainerComponent.createObject(appletIconsRow)
|
var container = appletContainerComponent.createObject(appletIconsRow)
|
||||||
|
|
@ -98,12 +107,14 @@ PlasmaCore.ColorScope {
|
||||||
z: 999
|
z: 999
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.expandedApplet != applet) {
|
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;
|
applet.expanded = true;
|
||||||
appletsStack.replace(applet.fullRepresentationItem);
|
appletsStack.replace(applet.fullRepresentationItem);
|
||||||
if (root.expandedApplet) {
|
if (oldExpandedApplet) {
|
||||||
root.expandedApplet.expanded = false;
|
oldExpandedApplet.expanded = false;
|
||||||
}
|
}
|
||||||
root.expandedApplet = applet;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -209,6 +220,7 @@ PlasmaCore.ColorScope {
|
||||||
var factor = 1;
|
var factor = 1;
|
||||||
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor;
|
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor;
|
||||||
oldMouseY = mouse.y;
|
oldMouseY = mouse.y;
|
||||||
|
root.expandedApplet.expanded = true;
|
||||||
}
|
}
|
||||||
onReleased: slidingPanel.updateState();
|
onReleased: slidingPanel.updateState();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue