Fix NotificationHistory

This commit is contained in:
Ly-sec 2025-08-15 23:41:10 +02:00
parent 7e7b7b0192
commit b371cb92c1

View file

@ -75,6 +75,7 @@ NLoader {
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: Style.marginTiny * scaling anchors.topMargin: Style.marginTiny * scaling
anchors.rightMargin: Style.marginTiny * scaling anchors.rightMargin: Style.marginTiny * scaling
clip: true
// Animation properties // Animation properties
property real scaleValue: 0.8 property real scaleValue: 0.8
@ -152,7 +153,7 @@ NLoader {
Layout.fillHeight: true Layout.fillHeight: true
model: NotificationService.historyModel model: NotificationService.historyModel
spacing: Style.marginMedium * scaling spacing: Style.marginMedium * scaling
clip: false clip: true
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
delegate: Rectangle { delegate: Rectangle {
@ -181,7 +182,7 @@ NLoader {
font.weight: Font.Medium font.weight: Font.Medium
color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width - 30 width: parent.width - 60
maximumLineCount: 2 maximumLineCount: 2
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -191,7 +192,7 @@ NLoader {
font.pointSize: Style.fontSizeSmall * scaling font.pointSize: Style.fontSizeSmall * scaling
color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width - 30 width: parent.width - 60
maximumLineCount: 3 maximumLineCount: 3
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -202,12 +203,13 @@ NLoader {
color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface
} }
} }
}
MouseArea { // Trash icon button
id: notificationMouseArea NIconButton {
anchors.fill: parent icon: "delete"
hoverEnabled: true sizeMultiplier: 0.7
tooltipText: "Delete notification"
color: notificationMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurfaceVariant
onClicked: { onClicked: {
console.log("[NotificationHistory] Removing notification:", summary) console.log("[NotificationHistory] Removing notification:", summary)
NotificationService.historyModel.remove(index) NotificationService.historyModel.remove(index)
@ -216,6 +218,15 @@ NLoader {
} }
} }
MouseArea {
id: notificationMouseArea
anchors.fill: parent
anchors.rightMargin: 50 * scaling
hoverEnabled: true
// Remove the onClicked handler since we now have a dedicated delete button
}
}
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
active: true active: true
anchors.right: parent.right anchors.right: parent.right