1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

notifications: trigger first action on left click in popup, if present

This commit is contained in:
bbedward
2025-10-21 17:45:33 -04:00
parent c7bc3d6f3b
commit aa6e09ed3e
3 changed files with 19 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
}
}
}
}
}