summaryrefslogtreecommitdiffstats
path: root/src/types.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-07 18:29:58 +0200
committerDanilo M. <danix@danix.xyz>2026-08-07 18:29:58 +0200
commitfbc65d2413190faa873d6b0b5cb9ed31ebba453b (patch)
tree3a85bbd06e153bac58e6d0fbed6364a50458b0d7 /src/types.h
parent48c243d7aee3382713f7a4653be2179d313b432c (diff)
downloadqtmaildir-fbc65d2413190faa873d6b0b5cb9ed31ebba453b.tar.gz
qtmaildir-fbc65d2413190faa873d6b0b5cb9ed31ebba453b.zip
feat(ui): add a Maildir overview under Help
Nothing in the UI reported database-level facts: every query gave a thread count for that query, and nothing said how much mail there is overall. A dialog under Help now shows messages, threads and tags from notmuch, plus the account list from config, since notmuch does not model accounts at all. A separate worker call rather than a reuse of requestCounts, which counts threads to match the row count of a query. This counts messages, which is what a user means by "how much mail is in here". The test pins 4 messages in 3 threads against the fixture and fails if they are ever made equal, so routing both through one count cannot pass unnoticed. Every field starts at -1 and renders as "unknown" when notmuch could not answer it. Printing 0 would say the Maildir is empty, and telling someone their mail is gone is the worst way to report an index that failed to open. The dialog opens showing "Counting..." rather than blocking, since counting every message is not free on a large database. That makes two lifetimes matter: the reply can arrive after the dialog is closed, so the label is a QPointer, and the dialog can be closed and reopened while a count runs, so a generation counter drops the older answer. The test drains DeferredDelete before firing the late reply, because close() deletes through deleteLater and without that the dangling case is never actually reached.
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/types.h b/src/types.h
index 59d1d06..999d3f3 100644
--- a/src/types.h
+++ b/src/types.h
@@ -78,6 +78,20 @@ struct TagChange
}
};
+/// Database-level facts for the Maildir overview.
+///
+/// Every field is -1 until answered, so a dialog opened against a database that
+/// cannot be read shows "unknown" rather than a confident zero. A zero is a
+/// claim, and "no mail at all" is exactly the wrong thing to tell someone whose
+/// index failed to open.
+struct DatabaseStats
+{
+ int messages = -1; ///< Every message notmuch has indexed.
+ int threads = -1; ///< Every thread. Differs from messages by reply depth.
+ int tags = -1; ///< Distinct tag names in the database.
+};
+
Q_DECLARE_METATYPE(ThreadSummary)
Q_DECLARE_METATYPE(MessageRef)
Q_DECLARE_METATYPE(TagChange)
+Q_DECLARE_METATYPE(DatabaseStats)