From aa6e09ed3e4c4caeeef592bb7dab4b0ce125c894 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 21 Oct 2025 17:45:33 -0400 Subject: [PATCH] notifications: trigger first action on left click in popup, if present --- .../Notifications/Center/NotificationCard.qml | 4 ++-- .../Center/NotificationHeader.qml | 2 +- .../Notifications/Popup/NotificationPopup.qml | 21 ++++++++++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Modules/Notifications/Center/NotificationCard.qml b/Modules/Notifications/Center/NotificationCard.qml index dac71d05..70edf3e7 100644 --- a/Modules/Notifications/Center/NotificationCard.qml +++ b/Modules/Notifications/Center/NotificationCard.qml @@ -537,7 +537,7 @@ Rectangle { StyledText { id: clearText - text: I18n.tr("Clear") + text: I18n.tr("Dismiss") color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText font.pixelSize: Theme.fontSizeSmall font.weight: Font.Medium @@ -630,7 +630,7 @@ Rectangle { StyledText { id: clearText - text: I18n.tr("Clear") + text: I18n.tr("Dismiss") color: clearButton.isHovered ? Theme.primary : Theme.surfaceVariantText font.pixelSize: Theme.fontSizeSmall font.weight: Font.Medium diff --git a/Modules/Notifications/Center/NotificationHeader.qml b/Modules/Notifications/Center/NotificationHeader.qml index d3187676..7a6ae535 100644 --- a/Modules/Notifications/Center/NotificationHeader.qml +++ b/Modules/Notifications/Center/NotificationHeader.qml @@ -99,7 +99,7 @@ Item { } StyledText { - text: I18n.tr("Clear All") + text: I18n.tr("Clear") font.pixelSize: Theme.fontSizeSmall color: clearArea.containsMouse ? Theme.primary : Theme.surfaceText font.weight: Font.Medium diff --git a/Modules/Notifications/Popup/NotificationPopup.qml b/Modules/Notifications/Popup/NotificationPopup.qml index 3146f4a2..f5ff70b2 100644 --- a/Modules/Notifications/Popup/NotificationPopup.qml +++ b/Modules/Notifications/Popup/NotificationPopup.qml @@ -21,7 +21,7 @@ PanelWindow { property bool exiting: false property bool _isDestroying: false property bool _finalized: false - readonly property string clearText: I18n.tr("Clear") + readonly property string clearText: I18n.tr("Dismiss") signal entered signal exitFinished @@ -512,7 +512,7 @@ PanelWindow { anchors.fill: parent hoverEnabled: true - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.LeftButton | Qt.RightButton propagateComposedEvents: true z: -1 onEntered: { @@ -523,9 +523,20 @@ PanelWindow { if (notificationData && notificationData.popup && notificationData.timer) notificationData.timer.restart() } - onClicked: { - if (notificationData && !win.exiting) - notificationData.popup = false + onClicked: (mouse) => { + if (!notificationData || win.exiting) + return + + if (mouse.button === Qt.RightButton) { + NotificationService.dismissNotification(notificationData) + } else if (mouse.button === Qt.LeftButton) { + if (notificationData.actions && notificationData.actions.length > 0) { + notificationData.actions[0].invoke() + NotificationService.dismissNotification(notificationData) + } else { + notificationData.popup = false + } + } } } }