mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
remove activities with swipe away
This commit is contained in:
parent
43f05e4cae
commit
b413f8b664
1 changed files with 33 additions and 1 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.1
|
import QtQuick 2.5
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
@ -33,6 +33,29 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
highlight: PlasmaComponents.Highlight {}
|
highlight: PlasmaComponents.Highlight {}
|
||||||
delegate: MouseArea {
|
delegate: MouseArea {
|
||||||
|
id: delegate
|
||||||
|
drag {
|
||||||
|
target: delegate
|
||||||
|
axis: Drag.XAxis
|
||||||
|
}
|
||||||
|
SequentialAnimation {
|
||||||
|
id: positionAnim
|
||||||
|
property alias to: xAnim.to
|
||||||
|
XAnimator {
|
||||||
|
id: xAnim
|
||||||
|
target: delegate
|
||||||
|
from: delegate.x
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
if (delegate.x < -delegate.width/2 || delegate.x > delegate.width/2) {
|
||||||
|
activityModel.removeActivity(model.id, function() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
width: listView.width
|
width: listView.width
|
||||||
height: label.height
|
height: label.height
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
@ -48,6 +71,15 @@ ColumnLayout {
|
||||||
edit.focus = true
|
edit.focus = true
|
||||||
edit.forceActiveFocus()
|
edit.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
if (delegate.x < -delegate.width/2) {
|
||||||
|
positionAnim.to = -delegate.width;
|
||||||
|
} else if (delegate.x > delegate.width/2) {
|
||||||
|
positionAnim.to = delegate.width;
|
||||||
|
} else {
|
||||||
|
positionAnim.to = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
positionAnim.running = true;
|
||||||
}
|
}
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: label
|
id: label
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue