aboutsummaryrefslogtreecommitdiffstats
path: root/src/threadlistmodel.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-28 11:26:41 +0200
committerDanilo M. <danix@danix.xyz>2026-08-28 11:26:41 +0200
commit9bec59c98a9f00e6e7f2c0181659a7639bc04e72 (patch)
treeb250c7e96c26626a554e3b26b020ce2ecb1fd921 /src/threadlistmodel.cpp
parent0133fb982da2dcbbfacb9e89b0de79dd483b39fb (diff)
downloadqtmaildir-9bec59c98a9f00e6e7f2c0181659a7639bc04e72.tar.gz
qtmaildir-9bec59c98a9f00e6e7f2c0181659a7639bc04e72.zip
feat: let a row say whether it is a conversation
One predicate for the question every scope, label and membership decision in item 177 keys on. It repeats hasChildren()'s rule deliberately: an expander and a conversation are the same fact, including that a loaded thread trusts its children over a count that included duplicates.
Diffstat (limited to 'src/threadlistmodel.cpp')
-rw-r--r--src/threadlistmodel.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/threadlistmodel.cpp b/src/threadlistmodel.cpp
index f085b79..1bda728 100644
--- a/src/threadlistmodel.cpp
+++ b/src/threadlistmodel.cpp
@@ -1014,6 +1014,29 @@ bool ThreadListModel::isMessageRow(const QModelIndex &index) const
return index.isValid() && index.parent().isValid();
}
+bool ThreadListModel::isConversationRow(const QModelIndex &index) const
+{
+ if (!index.isValid() || isMessageRow(index))
+ return false;
+ if (index.row() < 0 || index.row() >= m_threads.size())
+ return false;
+
+ // A flat view has no conversations by construction: every row is one
+ // message and there is nothing to expand.
+ if (m_flatMode)
+ return false;
+
+ const ThreadNode &node = m_threads.at(index.row());
+
+ // Identical to hasChildren()'s rule, and deliberately so: an expander and a
+ // conversation are the same fact. Once loaded the children are the truth,
+ // which is how a thread whose totalCount counted DUPLICATES stops claiming
+ // to be a conversation it cannot open.
+ if (node.loaded)
+ return !node.children.isEmpty();
+ return node.summary.totalCount > 1;
+}
+
MessageNode ThreadListModel::messageAt(const QModelIndex &index) const
{
if (!isMessageRow(index))