feat: Introduce NotificationHistoryLoader to manage opening and closing the NotificationHistory panel.
This commit is contained in:
@@ -7,16 +7,16 @@ import QtQuick.Controls
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
//TODO: urgency, expireTimeoutText, ...
|
||||
|
||||
required property var notification
|
||||
required property var screen
|
||||
property var urgency: (notification.urgency ?? notification.hints["urgency"]) != null ? (notification.urgency ?? notification.hints["urgency"]) + 1 : 0
|
||||
|
||||
property bool closing: false
|
||||
property int _hoveredActionCount: 0
|
||||
// When used in history overview we don't want auto-timeout or click-to-close
|
||||
property bool isHistory: false
|
||||
|
||||
property real duration: (
|
||||
property real duration: isHistory ? 0 : (
|
||||
notification.expireTimeout > 0 ? notification.expireTimeout*1000 :
|
||||
urgency ? urgency * 2000 :
|
||||
5000
|
||||
@@ -31,9 +31,11 @@ Rectangle {
|
||||
color: textBGColor
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
radius: isHistory ? Config.small_radius : 0
|
||||
clip: isHistory
|
||||
|
||||
property string textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
property string textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
|
||||
property color textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
property color textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
|
||||
|
||||
function closeNotification(dismiss){
|
||||
if (closing) {
|
||||
@@ -55,6 +57,8 @@ Rectangle {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !root.isHistory
|
||||
visible: !root.isHistory
|
||||
onClicked: {
|
||||
root.closeNotification(false)
|
||||
}
|
||||
@@ -389,7 +393,7 @@ Rectangle {
|
||||
running: root.duration > 0
|
||||
from: 1.0
|
||||
to: 0.0
|
||||
duration: root.duration
|
||||
duration: root.duration
|
||||
paused: mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse || root._hoveredActionCount > 0 || inlineReplyTextField.hovered || inlineReplyTextField.activeFocus
|
||||
|
||||
onFinished: root.closeNotification(false)
|
||||
@@ -427,7 +431,7 @@ Rectangle {
|
||||
console.log("\x1b[31m\t"+"notification.transient: " + notification.transient+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.hasInlineReply: " + notification.hasInlineReply+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.hasActionIcons: " + notification.hasActionIcons+"\x1b[0m")
|
||||
|
||||
|
||||
console.log("\x1b[31m\t"+"image.source: " + iconImage.source+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"urgency: " + urgency+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"duration: " + duration+"\x1b[0m")
|
||||
|
||||
Reference in New Issue
Block a user