summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-15 11:13:28 +0200
committerDanilo M. <danix@danix.xyz>2026-08-15 11:13:28 +0200
commit4757cc5780de1f7a7478cf07948f5659913d31b5 (patch)
tree80a0366d74cb98b5499abeb9209a689d8b834292 /src/mainwindow.h
parente6e18849bd5aa49dbdd299982d39a92e7360d0aa (diff)
parent8ea004e67427693139ddd55384c7963d856650f0 (diff)
downloadqtmaildir-4757cc5780de1f7a7478cf07948f5659913d31b5.tar.gz
qtmaildir-4757cc5780de1f7a7478cf07948f5659913d31b5.zip
Merge branch 'builtin-filters': four built-in query filters
Items 93, 95 and 90. The query row starts with Unread, Inbox, Flagged and Sent, shipped by the application rather than pinned by the user, and they compose with the account dropdown instead of resetting it. Item 90 is absorbed: the button that cleared the account selection is no longer a saved query at all. Item 95 was found by hand testing this and is not caused by it: no entry in the saved query overflow menu had ever been runnable, because Qt emits no triggered for an action that owns a submenu.
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 80c7d2b..bb1ba75 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -274,12 +274,23 @@ public:
enum class FlatResult { No, Yes };
Q_ENUM(FlatResult)
+ /// Whether runQuery() applies the selected account's scope to the bar text.
+ ///
+ /// Apply is right for anything the user typed or a saved query put there.
+ /// AlreadyScoped is for a built-in filter, whose text was resolved through
+ /// Config::resolvedQuery(query, accountKey) and already carries the scope:
+ /// scoping it a second time would wrap path:"work/Sent/**" in
+ /// path:"work/**", which is the double scope item 93 exists to avoid.
+ enum class AccountScope { Apply, AlreadyScoped };
+ Q_ENUM(AccountScope)
+
private:
/// The real query runner. Kept off the slot list deliberately: a slot with
/// a defaulted argument does not satisfy QObject::connect, which matches
/// signal and slot arity at compile time, so the zero-argument slot below
/// is what widgets connect to.
- void runQuery(FlatResult flat);
+ void runQuery(FlatResult flat,
+ AccountScope scope = AccountScope::Apply);
/// Builds the row of saved-query buttons, the overflow menu and Sent.
///
@@ -295,6 +306,19 @@ private:
/// twice. Setting the dropdown also shows the user what scope they are in.
void runSavedQuery(const SavedQuery &saved);
+ /// Runs a built-in filter in whatever account scope is currently selected.
+ ///
+ /// The opposite of runSavedQuery() in the one way that matters: it does NOT
+ /// touch the account box. A filter narrows what the user is already looking
+ /// at, so the dropdown is its input rather than something it overwrites,
+ /// which is item 90's defect and item 93's design.
+ ///
+ /// The query text is resolved here rather than left to runQuery()'s own
+ /// scoping, because a generator must be asked for the account's own query:
+ /// Sent wrapped in a scope double-scopes and works only by accident of
+ /// path: being hierarchical. See Config::resolvedQuery(query, accountKey).
+ void runFilter(const SavedQuery &filter);
+
/// Names the current query and stores it in queries.json.
void saveCurrentQuery();