aboutsummaryrefslogtreecommitdiffstats
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-08 11:13:10 +0200
committerDanilo M. <danix@danix.xyz>2026-08-08 11:13:10 +0200
commit0bbb2d2c8d75c2b4392b17214ec3ec3768305ba1 (patch)
tree9fa18a3b8ca4248c44f75ad2fed9532b135674c7 /src/mainwindow.h
parentccd19bc04d73f802b4800aadb27a1de4d6f0ee0d (diff)
downloadqtmaildir-0bbb2d2c8d75c2b4392b17214ec3ec3768305ba1.tar.gz
qtmaildir-0bbb2d2c8d75c2b4392b17214ec3ec3768305ba1.zip
feat(ui): render a single message when its row is selected
loadMessage queries by id: and returns one MessageRef, always matched, since the user asked for that message by clicking its row and a stub would answer the wrong question. An unknown id emits an empty vector rather than an error: a stale row after a reindex is an ordinary race, not a failure worth the status bar. The signal fires even when empty so the UI handler runs instead of waiting for a reply that never comes. The branch in onThreadSelected is placed BEFORE threadAt(), which is the whole trap. threadAt takes a top-level row number and a child's row number indexes its siblings, so handing a message row's number to it loads whichever thread happens to sit at that position. Mutation-checked: with the branch disabled the test reports thread 't1' for a reply belonging to 't2', a wrong answer plausible enough to survive review. m_currentMessageId and m_currentThreadId are mutually exclusive and each clears the other, so a queued reply can tell which kind of selection it belongs to. onMessageLoaded carries a third guard onThreadLoaded does not need: a reply landing after the selection moved to a thread row would render one message where the conversation belongs. No mark-read timer for a message row in this pass. Marking one message of a thread read is a per-message tag write and the pending-edit map is keyed by thread; item 28 is the record of what happens when that count goes wrong.
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index fc980a0..5b7e39e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -171,6 +171,10 @@ private slots:
/// Fills in the expanded thread's message rows.
void onThreadTreeLoaded(const QVector<MessageNode> &nodes,
quint64 generation);
+
+ /// Renders the single message a message row asked for.
+ void onMessageLoaded(const QVector<MessageRef> &messages,
+ quint64 generation);
void onWorkerError(const QString &message);
void onSyncFinished(bool success, int exitCode);
@@ -503,6 +507,11 @@ private:
QString m_lastQuery;
QString m_currentThreadId;
+ /// The message a MESSAGE row is showing, empty whenever the pane holds a
+ /// whole thread. The two are mutually exclusive and each clears the other,
+ /// so a late reply can tell which kind of selection it belongs to.
+ QString m_currentMessageId;
+
/// The selection count last written to the status bar, so it can be taken
/// back without clobbering a message some other action put there.
QString m_selectionMessage;