Remove Unread Count
Unread count is deprecated and notification count should be used in all cases. As such remove unreadCount and use notification count in all places it was being used. Fixes network/neochat#76 \ BUG: 466515
This commit is contained in:
@@ -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<int, QByteArray> RoomListModel::roleNames() const
|
||||
roles[CanonicalAliasRole] = "canonicalAlias";
|
||||
roles[TopicRole] = "topic";
|
||||
roles[CategoryRole] = "category";
|
||||
roles[UnreadCountRole] = "unreadCount";
|
||||
roles[NotificationCountRole] = "notificationCount";
|
||||
roles[HighlightCountRole] = "highlightCount";
|
||||
roles[LastEventRole] = "lastEvent";
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user