Skip to content
Snippets Groups Projects
Commit e6b0149d authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversationmodel: avoid too long titles

jami-client-qt#670

Change-Id: Ifbf8ba04a7a00f583ec0ec932ca07c8e1a9cf4fc
parent 93851248
No related branches found
No related tags found
No related merge requests found
......@@ -1041,18 +1041,29 @@ ConversationModel::title(const QString& conversationId) const
}
// NOTE: Do not call any daemon method there as title() is called a lot for drawing
QString title;
auto idx = 0;
auto idx = 0u;
auto others = 0;
for (const auto& member : conversation.participants) {
QString name;
if (member.uri == owner.profileInfo.uri) {
title += owner.accountModel->bestNameForAccount(owner.id);
name = owner.accountModel->bestNameForAccount(owner.id);
} else {
title += owner.contactModel->bestNameForContact(member.uri);
name = owner.contactModel->bestNameForContact(member.uri);
}
if (title.length() + name.length() > 32) {
// Avoid too long titles
others += 1;
continue;
}
title += name;
idx += 1;
if (idx != conversation.participants.size()) {
if (idx != conversation.participants.size() || others != 0) {
title += ", ";
}
}
if (others != 0) {
title += QString("+ %1").arg(others);
}
return title;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment