feat: refactor notification system to manage hover states centrally and auto close
This commit is contained in:
@@ -15,10 +15,20 @@ Item { // container, invisible
|
||||
active: false
|
||||
NotificationHistory {
|
||||
id: nHistory
|
||||
// closeNHistory() is defined inside NotificationHistory.qml and
|
||||
// emits NotificationS.closeHistoryRequested(); the loader listens below
|
||||
// and actually deactivates. Keeping instance id for potential direct access.
|
||||
}
|
||||
}
|
||||
|
||||
function closeNHistory() {
|
||||
nHistoryLoader.closeNHistory()
|
||||
}
|
||||
// React to close requests coming from NotificationHistory (hover timer, Escape)
|
||||
// or any other component via the singleton signal. This is the single
|
||||
// source of truth for deactivating the history panel.
|
||||
Connections {
|
||||
target: NotificationS
|
||||
function onCloseHistoryRequested() {
|
||||
console.log("[NotificationHistoryLoader] closeHistoryRequested received -> closing")
|
||||
nHistoryLoader.closeNHistory()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +47,19 @@ Item { // container, invisible
|
||||
}
|
||||
|
||||
function closeNHistory() {
|
||||
// Reset hover states so timer doesn't immediately re-trigger on next open
|
||||
NotificationS.historyHovered = false
|
||||
// buttonHovered is managed by the button itself; don't force false here
|
||||
// in case button is still hovered when history closes
|
||||
notifificationHistoryLoader.active = false
|
||||
}
|
||||
|
||||
function toggleNHistory() {
|
||||
notifificationHistoryLoader.active = !notifificationHistoryLoader.active
|
||||
if (notifificationHistoryLoader.active) {
|
||||
closeNHistory()
|
||||
} else {
|
||||
openNHistory()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
Reference in New Issue
Block a user