fix
This commit is contained in:
@@ -21,6 +21,7 @@ Item {
|
||||
property bool closing: false
|
||||
property bool contextOpen: false
|
||||
property real collapseFactor: 1
|
||||
property bool hovered: hoverHandler.hovered
|
||||
|
||||
readonly property string notifTitle: notifObject ? String(notifObject.summary || "") : ""
|
||||
readonly property string notifBody: notifObject ? String(notifObject.body || "") : ""
|
||||
@@ -78,9 +79,11 @@ Item {
|
||||
if (!notifObject)
|
||||
return theme.fallbackNormalTimeoutMs;
|
||||
|
||||
const rawSeconds = Number(notifObject.expireTimeout);
|
||||
if (Number.isFinite(rawSeconds) && rawSeconds > 0)
|
||||
return Math.max(1000, Math.round(rawSeconds * 1000));
|
||||
const rawTimeout = Number(notifObject.expireTimeout);
|
||||
if (Number.isFinite(rawTimeout) && rawTimeout > 0) {
|
||||
const normalizedTimeout = rawTimeout > 100 ? Math.round(rawTimeout) : Math.round(rawTimeout * 1000);
|
||||
return Math.max(theme ? theme.minimumTimeoutMs : 4500, normalizedTimeout);
|
||||
}
|
||||
|
||||
const urgency = notifObject.urgency;
|
||||
if (urgency === NotificationUrgency.Critical)
|
||||
@@ -124,7 +127,7 @@ Item {
|
||||
}
|
||||
|
||||
function restartTimeout() {
|
||||
if (closing || isExpanded || peekMode)
|
||||
if (closing || isExpanded || peekMode || hovered)
|
||||
return;
|
||||
timeoutTimer.interval = urgencyTimeoutMs();
|
||||
timeoutTimer.restart();
|
||||
@@ -160,7 +163,7 @@ Item {
|
||||
id: timeoutTimer
|
||||
interval: root.urgencyTimeoutMs()
|
||||
repeat: false
|
||||
running: !root.peekMode
|
||||
running: false
|
||||
onTriggered: root.beginClose("timeout")
|
||||
}
|
||||
|
||||
@@ -384,6 +387,10 @@ Item {
|
||||
onTapped: root.beginClose("dismiss")
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
}
|
||||
|
||||
onNotifObjectChanged: restartTimeout()
|
||||
onNotifVersionChanged: restartTimeout()
|
||||
onContextOpenChanged: {
|
||||
@@ -392,5 +399,17 @@ Item {
|
||||
else
|
||||
timeoutTimer.stop();
|
||||
}
|
||||
onHoveredChanged: {
|
||||
if (hovered)
|
||||
timeoutTimer.stop();
|
||||
else
|
||||
restartTimeout();
|
||||
}
|
||||
onForceExpandedChanged: {
|
||||
if (forceExpanded)
|
||||
timeoutTimer.stop();
|
||||
else
|
||||
restartTimeout();
|
||||
}
|
||||
Component.onCompleted: restartTimeout()
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ QtObject {
|
||||
readonly property int fallbackLowTimeoutMs: 4500
|
||||
readonly property int fallbackNormalTimeoutMs: 5000
|
||||
readonly property int fallbackCriticalTimeoutMs: 8000
|
||||
readonly property int minimumTimeoutMs: 4500
|
||||
|
||||
readonly property int enterMs: 170
|
||||
readonly property int exitMs: 140
|
||||
|
||||
Reference in New Issue
Block a user