From 49646c63f83d17c09b82cee590d9ae81ecc8a441 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 12 Feb 2026 20:21:46 -0500 Subject: [PATCH] Improve read marker delegate, add button to mark as read I added an icon to the read marker (to help distinguish it from text-heavy chat rooms), and fixed up the padding. I also find myself reaching to right-click rooms often to mark them as read, so why not do this from the read marker itself? --- src/timeline/EventDelegate.qml | 4 ++- src/timeline/ReadMarkerDelegate.qml | 47 ++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/timeline/EventDelegate.qml b/src/timeline/EventDelegate.qml index 27b9aebeb..0a314e9b9 100644 --- a/src/timeline/EventDelegate.qml +++ b/src/timeline/EventDelegate.qml @@ -39,7 +39,9 @@ DelegateChooser { DelegateChoice { roleValue: DelegateType.ReadMarker - delegate: ReadMarkerDelegate {} + delegate: ReadMarkerDelegate { + room: root.room + } } DelegateChoice { diff --git a/src/timeline/ReadMarkerDelegate.qml b/src/timeline/ReadMarkerDelegate.qml index 0a6f51bed..708cbf0d3 100644 --- a/src/timeline/ReadMarkerDelegate.qml +++ b/src/timeline/ReadMarkerDelegate.qml @@ -13,6 +13,11 @@ import org.kde.neochat TimelineDelegate { id: root + /** + * @brief The NeoChatRoom the delegate is being displayed in. + */ + required property NeoChatRoom room + /** * @brief The timestamp of the event as a neoChatDateTime. */ @@ -29,12 +34,16 @@ TimelineDelegate { alwaysFillWidth: NeoChatConfig.compactLayout contentItem: QQC2.ItemDelegate { - padding: Kirigami.Units.largeSpacing - topInset: Kirigami.Units.largeSpacing - topPadding: Kirigami.Units.largeSpacing * 2 - bottomPadding: Kirigami.Units.largeSpacing * 2 - leftPadding: Kirigami.Units.largeSpacing * 2 - bottomInset: Kirigami.Units.largeSpacing + padding: Kirigami.Units.largeSpacing * 2 + topPadding: padding + bottomPadding: Kirigami.Units.largeSpacing + leftPadding: padding + rightPadding: padding + + topInset: Kirigami.Units.largeSpacing + Kirigami.Units.mediumSpacing + bottomInset: Kirigami.Units.mediumSpacing + rightInset: Kirigami.Units.largeSpacing + leftInset: 0 Timer { id: temporaryHighlightTimer @@ -43,8 +52,30 @@ TimelineDelegate { onTriggered: root.isTemporaryHighlighted = false } - contentItem: QQC2.Label { - text: i18nc("Relative time since the room was last read", "Last read: %1", root.dateTime.relativeDateTime) + contentItem: RowLayout { + spacing: Kirigami.Units.largeSpacing + + Kirigami.Icon { + source: "view-readermode" + + Layout.preferredWidth: Kirigami.Units.iconSizes.sizeForLabels + Layout.preferredHeight: Kirigami.Units.iconSizes.sizeForLabels + } + + QQC2.Label { + text: i18nc("Relative time since the room was last read", "Last read: %1", root.dateTime.relativeDateTime) + + Layout.fillWidth: true + } + + QQC2.ToolButton { + text: i18nc("@action:button Mark all messages up to now as read", "Mark as Read") + icon.name: "checkmark" + + onClicked: root.room.markAllMessagesAsRead() + + Layout.alignment: Qt.AlignRight + } } background: Kirigami.ShadowedRectangle {