diff --git a/src/models/roomlistmodel.cpp b/src/models/roomlistmodel.cpp index 68f7e353c..aa1b5a056 100644 --- a/src/models/roomlistmodel.cpp +++ b/src/models/roomlistmodel.cpp @@ -161,7 +161,7 @@ void RoomListModel::connectRoomSignals(NeoChatRoom *room) refresh(room, {DisplayNameRole, NameRole}); }); connect(room, &Room::unreadMessagesChanged, this, [this, room] { - refresh(room, {UnreadCountRole, NotificationCountRole, HighlightCountRole}); + refresh(room, {NotificationCountRole, HighlightCountRole}); }); connect(room, &Room::notificationCountChanged, this, [this, room] { refresh(room); @@ -374,9 +374,6 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const } return NeoChatRoomType::Normal; } - if (role == UnreadCountRole) { - return room->unreadCount(); - } if (role == NotificationCountRole) { return room->notificationCount(); } @@ -443,7 +440,6 @@ QHash RoomListModel::roleNames() const roles[CanonicalAliasRole] = "canonicalAlias"; roles[TopicRole] = "topic"; roles[CategoryRole] = "category"; - roles[UnreadCountRole] = "unreadCount"; roles[NotificationCountRole] = "notificationCount"; roles[HighlightCountRole] = "highlightCount"; roles[LastEventRole] = "lastEvent"; diff --git a/src/models/roomlistmodel.h b/src/models/roomlistmodel.h index 7b22856eb..9a1617d76 100644 --- a/src/models/roomlistmodel.h +++ b/src/models/roomlistmodel.h @@ -64,7 +64,6 @@ public: CanonicalAliasRole, /**< The room canonical alias. */ TopicRole, /**< The room topic. */ CategoryRole, /**< The room category, e.g favourite. */ - UnreadCountRole, /**< The number of unread messages in the room. */ NotificationCountRole, /**< The number of notifications in the room. */ HighlightCountRole, /**< The number of highlighted messages in the room. */ LastEventRole, /**< Text for the last event in the room. */ diff --git a/src/qml/Page/RoomList/RoomDelegate.qml b/src/qml/Page/RoomList/RoomDelegate.qml index 5acaae08f..0aa20e525 100644 --- a/src/qml/Page/RoomList/RoomDelegate.qml +++ b/src/qml/Page/RoomList/RoomDelegate.qml @@ -17,7 +17,6 @@ Kirigami.BasicListItem { id: root required property int index - required property int unreadCount required property int notificationCount required property int highlightCount required property var currentRoom @@ -28,7 +27,7 @@ Kirigami.BasicListItem { required property string name - readonly property bool hasUnread: unreadCount > 0 + readonly property bool hasNotifications: notificationCount > 0 topPadding: Kirigami.Units.largeSpacing bottomPadding: Kirigami.Units.largeSpacing @@ -37,7 +36,7 @@ Kirigami.BasicListItem { highlighted: ListView.view.currentIndex === index focus: true icon: undefined - bold: root.unreadCount > 0 + bold: root.hasNotifications label: root.name ?? "" labelItem.textFormat: Text.PlainText @@ -77,14 +76,14 @@ Kirigami.BasicListItem { enabled: false implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium - visible: currentRoom.pushNotificationState === PushNotificationState.Mute && !configButton.visible && unreadCount <= 0 + visible: currentRoom.pushNotificationState === PushNotificationState.Mute && !configButton.visible && !hasNotifications Accessible.name: i18n("Muted room") Layout.rightMargin: Kirigami.Units.smallSpacing } QQC2.Label { id: notificationCountLabel - text: notificationCount > 0 ? notificationCount : "●" - visible: unreadCount > 0 + text: notificationCount + visible: hasNotifications color: Kirigami.Theme.textColor horizontalAlignment: Text.AlignHCenter background: Rectangle {