From d7c4d03f7d583767bc23406579e11bcc884dec18 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 28 Aug 2026 20:46:44 +0200 Subject: feat: count a card's messages, not its replies The expander pill read "N replies" while the row stood for the conversation: a thread of one message and four replies said "4 replies" over rows that listed all five messages. The user's model is messages, so it now reads "5 messages". A thread of one still shows nothing: its row is the message, the pill is the expander, and there is nothing to open. ReplyCountRole becomes MessageCountRole and CardLayout::Input::replyCount becomes messageCount, so the names stop lying about what they carry. The label is now translated under a CardLayout context, with Italian "messaggio"/"messaggi" shipped; %n's untranslated fallback on this Qt does not pluralise, so the two forms are separate entries. The card's densest geometry test needs 460px rather than 400 now that the pill is one character wider. --- src/threadlistmodel.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/threadlistmodel.cpp') diff --git a/src/threadlistmodel.cpp b/src/threadlistmodel.cpp index 8bb9849..5c44dd4 100644 --- a/src/threadlistmodel.cpp +++ b/src/threadlistmodel.cpp @@ -439,7 +439,7 @@ QVariant ThreadListModel::data(const QModelIndex &index, int role) const m_forwardPrefixes); case IsRepliedRole: return node.isReplied(); - case ReplyCountRole: + case MessageCountRole: // A reply never offers an expander: nesting past the first level is // drawn from depth, not from further parent-child structure. return 0; @@ -714,15 +714,19 @@ QVariant ThreadListModel::data(const QModelIndex &index, int role) const m_forwardPrefixes); case IsRepliedRole: return thread.isReplied(); - case ReplyCountRole: + case MessageCountRole: // Zero in a flat list, so the card draws no expander pill. The count - // and hasChildren() must agree: a card advertising "3 replies" that - // cannot be opened is the inert-glyph defect this project has already - // shipped once. + // and hasChildren() must agree: a card advertising a count for a thread + // that cannot be opened is the inert-glyph defect this project has + // already shipped once. if (m_flatMode) return 0; - // totalCount includes the root message, which is the card itself. - return qMax(0, thread.totalCount - 1); + // The number of MESSAGES in the conversation, not the replies alone: + // the row stands for the conversation now (item 177), so a thread of + // one message and four replies reads "5 messages". A thread of one + // shows nothing: its row is the message, there is nothing to expand, + // and the pill is the expander. + return thread.totalCount > 1 ? thread.totalCount : 0; case DateFormatRole: return m_dateFormat; default: -- cgit v1.2.3