mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
notifications: trigger first action on left click in popup, if present
This commit is contained in:
@@ -537,7 +537,7 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: clearText
|
id: clearText
|
||||||
text: I18n.tr("Clear")
|
text: I18n.tr("Dismiss")
|
||||||
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
|
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -630,7 +630,7 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: clearText
|
id: clearText
|
||||||
text: I18n.tr("Clear")
|
text: I18n.tr("Dismiss")
|
||||||
color: clearButton.isHovered ? Theme.primary : Theme.surfaceVariantText
|
color: clearButton.isHovered ? Theme.primary : Theme.surfaceVariantText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: I18n.tr("Clear All")
|
text: I18n.tr("Clear")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: clearArea.containsMouse ? Theme.primary : Theme.surfaceText
|
color: clearArea.containsMouse ? Theme.primary : Theme.surfaceText
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ PanelWindow {
|
|||||||
property bool exiting: false
|
property bool exiting: false
|
||||||
property bool _isDestroying: false
|
property bool _isDestroying: false
|
||||||
property bool _finalized: false
|
property bool _finalized: false
|
||||||
readonly property string clearText: I18n.tr("Clear")
|
readonly property string clearText: I18n.tr("Dismiss")
|
||||||
|
|
||||||
signal entered
|
signal entered
|
||||||
signal exitFinished
|
signal exitFinished
|
||||||
@@ -512,7 +512,7 @@ PanelWindow {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
z: -1
|
z: -1
|
||||||
onEntered: {
|
onEntered: {
|
||||||
@@ -523,9 +523,20 @@ PanelWindow {
|
|||||||
if (notificationData && notificationData.popup && notificationData.timer)
|
if (notificationData && notificationData.popup && notificationData.timer)
|
||||||
notificationData.timer.restart()
|
notificationData.timer.restart()
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: (mouse) => {
|
||||||
if (notificationData && !win.exiting)
|
if (!notificationData || win.exiting)
|
||||||
notificationData.popup = false
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user