diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-15 02:56:04 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-15 02:56:04 +0300 |
commit | 3b0ff1a4cdd0c7eb3ed06eec2e70ee2722b7c4e5 (patch) | |
tree | 2e243545972ee7ef4f07152359bbdd782e6ca011 /src/RoomList.cc | |
parent | Update screen (diff) | |
download | nheko-3b0ff1a4cdd0c7eb3ed06eec2e70ee2722b7c4e5.tar.xz |
Add initial support for unread message count
- Add border width on Badge
Diffstat (limited to 'src/RoomList.cc')
-rw-r--r-- | src/RoomList.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/RoomList.cc b/src/RoomList.cc index f483a798..b1186d39 100644 --- a/src/RoomList.cc +++ b/src/RoomList.cc @@ -81,6 +81,16 @@ RoomInfo RoomList::extractRoomInfo(const State &room_state) return info; } +void RoomList::updateUnreadMessageCount(const QString &roomid, int count) +{ + if (!rooms_.contains(roomid)) { + qWarning() << "UpdateUnreadMessageCount: Unknown roomid"; + return; + } + + rooms_[roomid]->updateUnreadMessageCount(count); +} + void RoomList::setInitialRooms(const Rooms &rooms) { rooms_.clear(); @@ -117,6 +127,16 @@ void RoomList::highlightSelectedRoom(const RoomInfo &info) { emit roomChanged(info); + if (!rooms_.contains(info.id())) { + qDebug() << "RoomList: clicked unknown roomid"; + return; + } + + + // TODO: Send a read receipt for the last event. + auto room = rooms_[info.id()]; + room->clearUnreadMessageCount(); + for (auto it = rooms_.constBegin(); it != rooms_.constEnd(); it++) { if (it.key() != info.id()) it.value()->setPressedState(false); |