diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 21:11:30 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-04 12:54:23 +0200 |
| commit | fc3073f452e28733c3910ceda403531b3e17404d (patch) | |
| tree | 9abc7cebce905b2b6e5c7639f7c7fb0bf2659a11 /src/mainwindow.h | |
| parent | 1e587846a255592e5aab022c4e6e134d4ff64ed2 (diff) | |
| download | qtmaildir-fc3073f452e28733c3910ceda403531b3e17404d.tar.gz qtmaildir-fc3073f452e28733c3910ceda403531b3e17404d.zip | |
feat(completion): wire query completion into the main window
Adds the complete_query action, whose registration the assertion in
registerActions() has been demanding since keymap gained the name: a
known action nothing implements would have been a silently dead binding.
Also lands the QueryCompleter half of the manual trigger, which the
keymap commit left behind: triggerCompletion() and the focus-in filter
gated on completion_on_focus.
Tags refresh at startup, after a sync, and after a mutation introduces a
tag not already known, since that is the tag most likely to be typed
again. onAllTagsReady deliberately drops the generation the signal
carries: a tag list is not an ordered query result, so a later one is
always at least as good as an earlier one and discarding on staleness
could only throw away a good list.
Diffstat (limited to 'src/mainwindow.h')
| -rw-r--r-- | src/mainwindow.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h index f4186ff..3623b04 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -44,6 +44,7 @@ class ThreadListModel; class MessageView; class MailSync; class NotmuchWorker; +class QueryCompleter; class MainWindow : public QMainWindow { @@ -81,6 +82,7 @@ private slots: void onThreadLoaded(const QVector<MessageRef> &messages, quint64 generation); void onWorkerError(const QString &message); void onSyncFinished(bool success, int exitCode); + void onAllTagsReady(const QStringList &tags); private: void buildUi(); @@ -93,6 +95,10 @@ private: void registerActions(); void buildMenus(); void wireWorker(); + + /// Asks the worker to re-enumerate the database tags for the completer. + void requestAllTags(); + void showWarnings(); void showShortcutReference(); void showAbout(); @@ -131,6 +137,7 @@ private: QUndoStack m_undoStack; QLineEdit *m_queryEdit = nullptr; + QueryCompleter *m_queryCompleter = nullptr; QTableView *m_threadView = nullptr; QSplitter *m_splitter = nullptr; QComboBox *m_accountBox = nullptr; @@ -147,6 +154,11 @@ private: /// parallel with them. QHash<QString, QString> m_actionDescriptions; + /// The tag list last received from the worker. Held here and not only in + /// the completer so a mutation can ask whether it introduced a tag the + /// completer does not yet offer, without a round trip. + QStringList m_knownTags; + quint64 m_generation = 0; QString m_lastQuery; QString m_currentThreadId; |
