mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
execute action when swiping left
This commit is contained in:
parent
839208addc
commit
212f60077f
1 changed files with 10 additions and 2 deletions
|
|
@ -48,11 +48,16 @@ MouseArea {
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (drag.active) {
|
if (drag.active) {
|
||||||
if (x > width / 4 || x < width / -4) {
|
if (x > width / 4 || x < width / -4) {
|
||||||
|
//if there is an action, execute the first when swiping left
|
||||||
|
if (x < 0 && actions) {
|
||||||
|
var action = actions.get(0)
|
||||||
|
root.executeAction(source, action.id)
|
||||||
|
}
|
||||||
notificationsModel.remove(index);
|
notificationsModel.remove(index);
|
||||||
} else {
|
} else {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
} else if (body) {
|
} else if (body || actions) {
|
||||||
expanded = !expanded;
|
expanded = !expanded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +139,10 @@ MouseArea {
|
||||||
model: notificationItem.actions
|
model: notificationItem.actions
|
||||||
delegate: PlasmaComponents.Button {
|
delegate: PlasmaComponents.Button {
|
||||||
text: model.text
|
text: model.text
|
||||||
onClicked: root.executeAction(notificationItem.source, model.id)
|
onClicked: {
|
||||||
|
root.executeAction(notificationItem.source, model.id)
|
||||||
|
notificationsModel.remove(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue