aboutsummaryrefslogtreecommitdiffstats
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-18 15:46:24 +0200
committerDanilo M. <danix@danix.xyz>2026-09-18 15:46:24 +0200
commit2401dc251a24aada7fb0d95093d7129279551ef3 (patch)
treee8f0a70cf0ab58c917dd903dd25f0b80068fdef8 /src/mainwindow.h
parent06586027b0f328ba0aa4b2c6c3c77471d72aac52 (diff)
downloadqtmaildir-2401dc251a24aada7fb0d95093d7129279551ef3.tar.gz
qtmaildir-2401dc251a24aada7fb0d95093d7129279551ef3.zip
feat: load the contact store once and feed both consumers
MainWindow reads contactsDir() once while building its UI, holds the result in m_contacts, and hands it to the query bar's completer right after that is constructed and to every ComposeWindow as it opens. An empty contactsDir() skips the call, so a machine with no address book pays nothing and warns about nothing. The directory is not watched: a restart picks up a vdirsyncer update, and a QFileSystemWatcher would be a live-index feature nobody asked for. No action is added, so none of the five places in "Adding an action is FIVE places" applies: there is no name in KeyMap::knownActions(), no default binding, no icon-table entry and no menu entry to add.
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index c3395c9..4fb19e4 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -48,6 +48,10 @@
// asserted through it without reaching into the delegate.
#include "businesssenders.h"
+// Held by value, like the business-senders list above: the parsed contact list
+// is a member, so its size must be known here.
+#include "contactstore.h"
+
class QAction;
class QLineEdit;
class QMenu;
@@ -1836,6 +1840,16 @@ private:
/// completer does not yet offer, without a round trip.
QStringList m_knownTags;
+ /// The address book, loaded ONCE when the window is built and handed to
+ /// both consumers: the query-bar completer and every composer.
+ ///
+ /// Held here so the list is read from disk a single time per session. A
+ /// vdirsyncer directory can change while the application runs, but a
+ /// QFileSystemWatcher would be speculative: a restart picks up the new
+ /// file, and the store is 117 files of two fields, not a live index.
+ /// Empty when contactsDir() is unset, which is the feature being off.
+ QList<Contact> m_contacts;
+
quint64 m_generation = 0;
/// True once the running query has reported its total, so the model holds