Commit a24370d0 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇 Committed by Nate Graham
Browse files

[Notifications] When trashing file, close notification

There's not much you can still do with the notification
after the file it's talking about is gone.
parent c8339c02
......@@ -501,12 +501,7 @@ PlasmaComponents3.Page {
return labels;
}
onCloseClicked: {
historyModel.close(historyModel.index(index, 0));
if (list.count === 0) {
root.closePassivePlasmoid();
}
}
onCloseClicked: close()
onDismissClicked: {
model.dismissed = false;
root.closePassivePlasmoid();
......@@ -526,7 +521,13 @@ PlasmaComponents3.Page {
Qt.openUrlExternally(url);
expire();
}
onFileActionInvoked: expire()
onFileActionInvoked: {
if (action.objectName === "movetotrash" || action.objectName === "deletefile") {
close();
} else {
expire();
}
}
onSuspendJobClicked: historyModel.suspendJob(historyModel.index(index, 0))
onResumeJobClicked: historyModel.resumeJob(historyModel.index(index, 0))
......@@ -539,6 +540,13 @@ PlasmaComponents3.Page {
historyModel.expire(historyModel.index(index, 0));
}
}
function close() {
historyModel.close(historyModel.index(index, 0));
if (list.count === 0) {
root.closePassivePlasmoid();
}
}
}
}
......
......@@ -73,7 +73,7 @@ ColumnLayout {
signal killJobClicked
signal openUrl(string url)
signal fileActionInvoked
signal fileActionInvoked(QtObject action)
spacing: 0
......@@ -249,7 +249,7 @@ ColumnLayout {
Notifications.FileMenu {
id: otherFileActionsMenu
url: jobItem.url || ""
onActionTriggered: jobItem.fileActionInvoked()
onActionTriggered: jobItem.fileActionInvoked(action)
}
}
......
......@@ -104,7 +104,7 @@ ColumnLayout {
signal actionInvoked(string actionName)
signal replied(string text)
signal openUrl(string url)
signal fileActionInvoked
signal fileActionInvoked(QtObject action)
signal suspendJobClicked
signal resumeJobClicked
......@@ -296,7 +296,7 @@ ColumnLayout {
onKillJobClicked: notificationItem.killJobClicked()
onOpenUrl: notificationItem.openUrl(url)
onFileActionInvoked: notificationItem.fileActionInvoked()
onFileActionInvoked: notificationItem.fileActionInvoked(action)
hovered: notificationItem.hovered
}
......@@ -425,7 +425,7 @@ ColumnLayout {
bottomPadding: -thumbnailStripLoader.Layout.bottomMargin
urls: notificationItem.urls
onOpenUrl: notificationItem.openUrl(url)
onFileActionInvoked: notificationItem.fileActionInvoked()
onFileActionInvoked: notificationItem.fileActionInvoked(action)
}
}
......
......@@ -80,7 +80,7 @@ PlasmaCore.Dialog {
signal actionInvoked(string actionName)
signal replied(string text)
signal openUrl(string url)
signal fileActionInvoked
signal fileActionInvoked(QtObject action)
signal expired
signal hoverEntered
......@@ -208,7 +208,7 @@ PlasmaCore.Dialog {
onActionInvoked: notificationPopup.actionInvoked(actionName)
onReplied: notificationPopup.replied(text)
onOpenUrl: notificationPopup.openUrl(url)
onFileActionInvoked: notificationPopup.fileActionInvoked()
onFileActionInvoked: notificationPopup.fileActionInvoked(action)
onSuspendJobClicked: notificationPopup.suspendJobClicked()
onResumeJobClicked: notificationPopup.resumeJobClicked()
......
......@@ -49,7 +49,7 @@ DraggableFileArea {
property int bottomPadding: 0
signal openUrl(string url)
signal fileActionInvoked
signal fileActionInvoked(QtObject action)
dragParent: previewPixmap
dragUrl: thumbnailer.url
......@@ -72,7 +72,7 @@ DraggableFileArea {
id: fileMenu
url: thumbnailer.url
visualParent: menuButton
onActionTriggered: thumbnailArea.fileActionInvoked()
onActionTriggered: thumbnailArea.fileActionInvoked(action)
}
Notifications.Thumbnailer {
......
......@@ -591,10 +591,11 @@ QtObject {
}
}
onFileActionInvoked: {
if (model.resident) {
model.expired = true;
if (!model.resident
|| (action.objectName === "movetotrash" || action.objectName === "deletefile")) {
popupNotificationsModel.close(popupNotificationsModel.index(index, 0));
} else {
popupNotificationsModel.close(popupNotificationsModel.index(index, 0))
model.expired = true;
}
}
......
Supports Markdown
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