diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-13 11:26:30 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-13 11:26:30 +0200 |
| commit | d10a5860b290ee35f657e95e509c8dac7608f809 (patch) | |
| tree | f89849cf272bcacc86e9e8aa3a0db4d25089deb8 /src/tagrulesdialog.h | |
| parent | 88d19a61227150dc58f7e6915a4c401001545d7e (diff) | |
| download | qtmaildir-d10a5860b290ee35f657e95e509c8dac7608f809.tar.gz qtmaildir-d10a5860b290ee35f657e95e509c8dac7608f809.zip | |
feat(rules): load a rule into the builder rows
Selecting a rule now parses its stored query and rebuilds the builder
rows from it, and a row edit compiles back onto the query line and into
the working copy.
Populating the form was already able to write the rule just loaded over
whichever rule is current: m_enabled's toggled runs
applyEditsToCurrentRule while m_query still holds the previous rule's
text, which emptied the first rule's query on open. The existing
m_reloading guard now covers the whole load rather than one signal
blocker on the note, which also covers the combo boxes rebuildRows
populates.
Diffstat (limited to 'src/tagrulesdialog.h')
| -rw-r--r-- | src/tagrulesdialog.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tagrulesdialog.h b/src/tagrulesdialog.h index b60b095..6676da9 100644 --- a/src/tagrulesdialog.h +++ b/src/tagrulesdialog.h @@ -55,6 +55,15 @@ public: /// handle and notmuch permits one per process. QStringList countQueries() const; + /// Test seams. The builder's state is otherwise reachable only through + /// synthetic clicks on widgets whose geometry the offscreen platform does + /// not guarantee. + int rowCountForTest() const { return m_rows.size(); } + QString queryLineForTest() const; + + /// Selects the rule at `index` as a click on the list would. + void selectRuleForTest(int index); + signals: /// Asks the owner to run countQueries() through the worker. void countsRequested(); @@ -95,6 +104,15 @@ private: void updateExclusionsVisibility(); void syncQueryLine(); + void rebuildRows(const RuleQuery &query); + void applyTermToRow(Row *row, const RuleTerm &term); + RuleQuery currentQueryFromRows() const; + + /// The query as parsed when the current rule was loaded. Task 10's save + /// path compares against this to decide whether the stored string may be + /// left alone. + RuleQuery m_loadedQuery; + QList<Row> m_rows; QList<Row> m_exclusionRows; |
