fix: Update NotificationBody.qml for expanded groups and clear-group functionality
This commit is contained in:
@@ -31,7 +31,7 @@ Rectangle {
|
||||
color: textBGColor
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
radius: isHistory ? Config.small_radius : 0
|
||||
radius: isHistory ? Config.radius : 0
|
||||
clip: isHistory
|
||||
|
||||
property color textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
@@ -73,6 +73,7 @@ Rectangle {
|
||||
height: Math.max(iconRectangle.height, contentRectangle.height)+contentRow.anchors.margins*2
|
||||
width: parent.width
|
||||
color: "transparent"
|
||||
radius: isHistory ? Config.radius : 0
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
|
||||
@@ -394,7 +395,7 @@ Rectangle {
|
||||
from: 1.0
|
||||
to: 0.0
|
||||
duration: root.duration
|
||||
paused: mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse || root._hoveredActionCount > 0 || inlineReplyTextField.hovered || inlineReplyTextField.activeFocus
|
||||
paused: (mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse || root._hoveredActionCount > 0 || inlineReplyTextField.hovered || inlineReplyTextField.activeFocus) && !isHistory
|
||||
|
||||
onFinished: root.closeNotification(false)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Wayland
|
||||
@@ -253,10 +253,10 @@ PanelWindow {
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Flickable {
|
||||
Flickable {
|
||||
id: flick
|
||||
width: parent.width
|
||||
// height: Math.min(root.maxContentHeight, contentColumn.implicitHeight)
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.screen_spacing_fun(screen.height)
|
||||
contentWidth: width
|
||||
contentHeight: contentColumn.implicitHeight
|
||||
clip: true
|
||||
@@ -268,7 +268,166 @@ PanelWindow {
|
||||
width: flick.width
|
||||
spacing: Config.spacing
|
||||
|
||||
}
|
||||
// ── Grouped view ──────────────────────────────
|
||||
// Uses root.grouped (sorted by appName). Each group
|
||||
// shows a header with appName + count + expand/collapse
|
||||
// + clear-group button. The notifications themselves
|
||||
// are rendered via NotificationBody.qml with
|
||||
// isHistory:true (no auto-timeout, no click-to-close).
|
||||
Repeater {
|
||||
id: groupedRepeater
|
||||
model: root.grouped
|
||||
delegate: Rectangle {
|
||||
id: groupDelegate
|
||||
required property var modelData
|
||||
required property int index
|
||||
property var group: modelData
|
||||
// collapsed by default (expandedGroups[appName] === true means expanded)
|
||||
// to default to expanded use: root.expandedGroups[group.appName] !== false
|
||||
property bool isExpanded: root.expandedGroups[group.appName] === true
|
||||
|
||||
width: contentColumn.width
|
||||
implicitHeight: groupColumn.implicitHeight + Config.spacing * 2
|
||||
color: Qt.alpha(Colors.surfaceContainerHigh, 0.45)
|
||||
radius: Config.screen_big_radius_fun(root.screen.height)
|
||||
border.width: Config.border_width
|
||||
border.color: root.textColor
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
id: groupColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.spacing
|
||||
spacing: Config.spacing
|
||||
|
||||
// Header row
|
||||
Rectangle {
|
||||
id: groupHeader
|
||||
width: parent.width
|
||||
height: Math.max(appNameText.implicitHeight, countText.implicitHeight, expandIcon.implicitHeight, clearGroupIcon.implicitHeight) + Config.spacing * 1.5
|
||||
color: root.bGColor
|
||||
radius: Config.radius
|
||||
border.width: Config.border_width
|
||||
border.color: root.textColor
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.toggleGroup(group.appName)
|
||||
}
|
||||
|
||||
Row {
|
||||
id: headerLeft
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Config.spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Config.spacing
|
||||
|
||||
Text {
|
||||
id: expandIcon
|
||||
text: groupDelegate.isExpanded ? "" : ""
|
||||
font.family: Config.font
|
||||
font.pixelSize: root.fontSize
|
||||
color: root.textColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: appNameText
|
||||
text: group.appName
|
||||
font.family: Config.font
|
||||
font.pixelSize: root.fontSize
|
||||
font.bold: true
|
||||
color: root.textColor
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
}
|
||||
Text {
|
||||
id: countText
|
||||
text: "(" + group.notes.length + ")"
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_tiny(root.screen.height)
|
||||
color: Qt.alpha(root.textColor, 0.8)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: headerRight
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Config.spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Config.spacing
|
||||
|
||||
MouseArea {
|
||||
id: clearGroupArea
|
||||
width: clearGroupIcon.implicitWidth + Config.spacing
|
||||
height: clearGroupIcon.implicitHeight + Config.spacing * 0.6
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function(mouse) {
|
||||
mouse.accepted = true
|
||||
root.clearGroup(group.appName)
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Config.radius
|
||||
color: clearGroupArea.containsMouse ? Colors.errorContainer : "transparent"
|
||||
border.width: Config.border_width
|
||||
border.color: clearGroupArea.containsMouse ? Colors.error : root.textColor
|
||||
Text {
|
||||
id: clearGroupIcon
|
||||
anchors.centerIn: parent
|
||||
text: ""
|
||||
font.family: Config.font
|
||||
font.pixelSize: root.fontSize
|
||||
color: clearGroupArea.containsMouse ? Colors.error_fg : root.textColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expanded list of NotificationBody items
|
||||
Column {
|
||||
id: notificationsColumn
|
||||
width: parent.width
|
||||
spacing: Config.spacing
|
||||
visible: groupDelegate.isExpanded
|
||||
Repeater {
|
||||
model: group.notes
|
||||
delegate: NotificationBody {
|
||||
required property var modelData
|
||||
required property int index
|
||||
width: notificationsColumn.width
|
||||
screen: root.screen
|
||||
notification: modelData
|
||||
isHistory: true
|
||||
onDismissed: function(notification, dismiss) {
|
||||
if (notification && notification.tracked) {
|
||||
notification.dismiss()
|
||||
} else if (notification && notification.close) {
|
||||
notification.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hint when collapsed
|
||||
Text {
|
||||
visible: !groupDelegate.isExpanded && group.notes.length > 0
|
||||
width: parent.width
|
||||
text: group.notes.length + " notification" + (group.notes.length > 1 ? "s hidden" : " hidden") + " — click header to expand"
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_tiny(root.screen.height)
|
||||
color: Qt.alpha(root.textColor, 0.6)
|
||||
elide: Text.ElideRight
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user