NotificationHistory: properly hook up the unread counter
This commit is contained in:
parent
57448f100c
commit
4578aad0bc
1 changed files with 2 additions and 16 deletions
|
|
@ -33,7 +33,7 @@ NIconButton {
|
||||||
readonly property bool userDoNotDisturb: (widgetSettings.doNotDisturb !== undefined) ? widgetSettings.doNotDisturb : BarWidgetRegistry.widgetMetadata["NotificationHistory"].doNotDisturb
|
readonly property bool userDoNotDisturb: (widgetSettings.doNotDisturb !== undefined) ? widgetSettings.doNotDisturb : BarWidgetRegistry.widgetMetadata["NotificationHistory"].doNotDisturb
|
||||||
|
|
||||||
function lastSeenTs() {
|
function lastSeenTs() {
|
||||||
return widgetSettings.lastSeenTs || 0
|
return Settings.data.notifications?.lastSeenTs || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function computeUnreadCount() {
|
function computeUnreadCount() {
|
||||||
|
|
@ -59,23 +59,9 @@ NIconButton {
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// Open first using current geometry as anchor
|
|
||||||
var panel = PanelService.getPanel("notificationHistoryPanel")
|
var panel = PanelService.getPanel("notificationHistoryPanel")
|
||||||
panel?.toggle(screen, this)
|
panel?.toggle(screen, this)
|
||||||
// Update last seen right after to avoid affecting anchor calculation
|
Settings.data.notifications.lastSeenTs = Time.timestamp * 1000
|
||||||
Qt.callLater(function () {
|
|
||||||
try {
|
|
||||||
var section = barSection.replace("Section", "").toLowerCase()
|
|
||||||
if (section && sectionWidgetIndex >= 0) {
|
|
||||||
var widgets = Settings.data.bar.widgets[section]
|
|
||||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
|
||||||
widgets[sectionWidgetIndex].lastSeenTs = Time.timestamp * 1000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
|
onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue