diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 5f29aa243..208230dfb 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -303,20 +303,20 @@ Variants { hoverEnabled: true onEntered: card.hoverCount++ onExited: card.hoverCount-- - onClicked: { - if (mouse.button === Qt.RightButton) { - animateOut(); - } else if (mouse.button === Qt.LeftButton) { - var actions = model.actionsJson ? JSON.parse(model.actionsJson) : []; - var hasDefault = actions.some(function (a) { - return a.identifier === "default"; - }); - if (hasDefault) { - NotificationService.invokeAction(notificationId, "default"); - animateOut(); - } - } - } + onClicked: mouse => { + if (mouse.button === Qt.RightButton) { + card.animateOut(); + } else if (mouse.button === Qt.LeftButton) { + var actions = model.actionsJson ? JSON.parse(model.actionsJson) : []; + var hasDefault = actions.some(function (a) { + return a.identifier === "default"; + }); + if (hasDefault) { + NotificationService.invokeAction(notificationId, "default"); + card.animateOut(); + } + } + } } // Animation setup function triggerEntryAnimation() { diff --git a/Services/System/NotificationService.qml b/Services/System/NotificationService.qml index caa609a2b..3e0df98d5 100644 --- a/Services/System/NotificationService.qml +++ b/Services/System/NotificationService.qml @@ -809,6 +809,13 @@ Singleton { } else if (!notifData.notification) { // No notification object } else { + // Disconnect closed signal before invoking so the app-triggered close + // doesn't immediately remove the delegate (the dismiss animation handles removal) + if (notifData.onClosed) { + notifData.notification.closed.disconnect(notifData.onClosed); + notifData.onClosed = null; + } + // Use cached actions if live actions are empty (which happens if app closed notification) const actionsToUse = (notifData.notification.actions && notifData.notification.actions.length > 0) ? notifData.notification.actions : (notifData.cachedActions || []);