summaryrefslogtreecommitdiff
path: root/Applications/IRCClient/IRCWindowListModel.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-16 02:14:53 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-16 02:14:53 +0100
commitb4f787090c6edcdd6799dfe97e18bb79f0cb5dd2 (patch)
tree11c1e9af14a4b65efaf3f3695b76f79ad4496d62 /Applications/IRCClient/IRCWindowListModel.cpp
parent1394677528c62bd05f487d16921f2d0b693d28e6 (diff)
downloadserenity-b4f787090c6edcdd6799dfe97e18bb79f0cb5dd2.zip
IRCClient: Add a little "(n)" indicator to window list for unread messages.
Diffstat (limited to 'Applications/IRCClient/IRCWindowListModel.cpp')
-rw-r--r--Applications/IRCClient/IRCWindowListModel.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Applications/IRCClient/IRCWindowListModel.cpp b/Applications/IRCClient/IRCWindowListModel.cpp
index b6cf241ba5..b6aa3239a8 100644
--- a/Applications/IRCClient/IRCWindowListModel.cpp
+++ b/Applications/IRCClient/IRCWindowListModel.cpp
@@ -43,7 +43,12 @@ GTableModel::ColumnMetadata IRCWindowListModel::column_metadata(int column) cons
GVariant IRCWindowListModel::data(const GModelIndex& index, Role) const
{
switch (index.column()) {
- case Column::Name: return m_client.window_at(index.row()).name();
+ case Column::Name: {
+ auto& window = m_client.window_at(index.row());
+ if (!window.unread_count())
+ return window.name();
+ return String::format("%s (%d)\n", window.name().characters(), window.unread_count());
+ }
}
ASSERT_NOT_REACHED();
}