Notifications: minor renaming + house keeping. Bring back the close history when clearing all notifications

This commit is contained in:
LemmyCook
2025-09-21 10:24:47 -04:00
parent fac9b8f54c
commit 0279b5654a
5 changed files with 114 additions and 110 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ Variants {
readonly property real scaling: ScalingService.getScreenScale(modelData)
// Access the notification model from the service - UPDATED NAME
property ListModel notificationModel: NotificationService.activeNotifications
property ListModel notificationModel: NotificationService.activeList
// If no notification display activated in settings, then show them all
active: Settings.isLoaded && modelData && (notificationModel.count > 0) ? (Settings.data.notifications.monitors.includes(modelData.name) || (Settings.data.notifications.monitors.length === 0)) : false
@@ -256,7 +256,7 @@ Variants {
}
NText {
text: `${model.appName || "Unknown App"} · ${NotificationService.formatTimestamp(model.timestamp)}`
text: `${model.appName || "Unknown App"} · ${Time.formatRelativeTime(model.timestamp)}`
color: Color.mSecondary
font.pointSize: Style.fontSizeXS * scaling
}
@@ -55,7 +55,11 @@ NPanel {
icon: "trash"
tooltipText: "Clear history"
baseSize: Style.baseWidgetSize * 0.8
onClicked: NotificationService.clearHistory()
onClicked: {
NotificationService.clearHistory()
// Close panel as there is nothing more to see.
root.close()
}
}
NIconButton {
@@ -75,7 +79,7 @@ NPanel {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
visible: NotificationService.notificationHistory.count === 0
visible: NotificationService.historyList.count === 0
spacing: Style.marginL * scaling
Item {
@@ -119,11 +123,11 @@ NPanel {
horizontalPolicy: ScrollBar.AlwaysOff
verticalPolicy: ScrollBar.AsNeeded
model: NotificationService.notificationHistory
model: NotificationService.historyList
spacing: Style.marginM * scaling
clip: true
boundsBehavior: Flickable.StopAtBounds
visible: NotificationService.notificationHistory.count > 0
visible: NotificationService.historyList.count > 0
delegate: Rectangle {
property string notificationId: model.id
@@ -200,7 +204,7 @@ NPanel {
}
NText {
text: NotificationService.formatTimestamp(model.timestamp)
text: Time.formatRelativeTime(model.timestamp)
font.pointSize: Style.fontSizeXS * scaling
color: Color.mSecondary
}