feat(notifs): handle transient notifications properly
Transient notifications are not persistently shown in the dashboard, and thus permanently expire after their timer runs out.
This commit is contained in:
parent
3bb5e10d4d
commit
a9dab6189d
3 changed files with 22 additions and 17 deletions
|
|
@ -45,7 +45,7 @@ Singleton {
|
|||
description: "Clear all notifications"
|
||||
onPressed: {
|
||||
for (const notif of root.list)
|
||||
notif.popup = null;
|
||||
notif.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,13 +93,20 @@ Singleton {
|
|||
// One-line version (for non-expanded notifications)
|
||||
readonly property string bodyOneLine: notification.body.replace("\n", " ")
|
||||
|
||||
readonly property int expireTimeout: notification.expireTimeout > 0 ?
|
||||
notification.expireTimeout : Config.notifs.defaultExpireTimeout
|
||||
|
||||
readonly property Timer timer: Timer {
|
||||
running: true
|
||||
interval: notif.notification.expireTimeout > 0 ? notif.notification.expireTimeout : Config.notifs.defaultExpireTimeout
|
||||
onTriggered: {
|
||||
if (Config.notifs.expire)
|
||||
notif.popup = null;
|
||||
}
|
||||
interval: notif.expireTimeout
|
||||
onTriggered: notif.clear()
|
||||
}
|
||||
|
||||
function clear(): void {
|
||||
if (notification.transient)
|
||||
notification.expire();
|
||||
else
|
||||
popup = null;
|
||||
}
|
||||
|
||||
readonly property Connections conn: Connections {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue