aboutsummaryrefslogtreecommitdiffstats
path: root/src/threadlistmodel.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-28 20:46:44 +0200
committerDanilo M. <danix@danix.xyz>2026-08-28 20:46:44 +0200
commitd7c4d03f7d583767bc23406579e11bcc884dec18 (patch)
treeabe49fa75cb88d768a892cc11a8c2258869ead85 /src/threadlistmodel.cpp
parentae2ae2df75ed780a88423b77af3b31fbe2b26389 (diff)
downloadqtmaildir-thread-row-identity.tar.gz
qtmaildir-thread-row-identity.zip
feat: count a card's messages, not its repliesthread-row-identity
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.
Diffstat (limited to 'src/threadlistmodel.cpp')
-rw-r--r--src/threadlistmodel.cpp18
1 files changed, 11 insertions, 7 deletions
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: