summaryrefslogtreecommitdiffstats
path: root/src/tagrulesdialog.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-14 11:26:00 +0200
committerDanilo M. <danix@danix.xyz>2026-08-14 11:26:00 +0200
commit5694cf6feadd51a047455ae28a02d25d55f83987 (patch)
treed4f58ea4823f19b6f422f3e2065460b2ceba90c1 /src/tagrulesdialog.h
parent7b100de3ccf2b62ba5f00e468e632e32925f1ed3 (diff)
downloadqtmaildir-5694cf6feadd51a047455ae28a02d25d55f83987.tar.gz
qtmaildir-5694cf6feadd51a047455ae28a02d25d55f83987.zip
feat(rules): open the rules dialog on a seeded rule
The seed is a whole TagRule rather than a query string, so item 78 can reuse the same path to seed from a sender. It is a pending edit like one made with Add rule: appended, selected, Add tags focused, and written only on Save. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/tagrulesdialog.h')
-rw-r--r--src/tagrulesdialog.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tagrulesdialog.h b/src/tagrulesdialog.h
index 8ba656b..1001745 100644
--- a/src/tagrulesdialog.h
+++ b/src/tagrulesdialog.h
@@ -52,6 +52,20 @@ class TagRulesDialog : public QDialog
public:
explicit TagRulesDialog(QWidget *parent = nullptr);
+ /// Opens with one new rule already in the working list, selected, and the
+ /// Add tags field focused. The rule is a pending edit like any other: it
+ /// reaches the file on Save and is discarded on Cancel.
+ ///
+ /// The seed is a whole TagRule rather than a query string because item 78
+ /// will seed from a sender and will want to set tags too.
+ explicit TagRulesDialog(const TagRule &seed, QWidget *parent = nullptr);
+
+ /// Appends `seed` to the working rules, selects it and focuses Add tags.
+ /// Public because the dialog is single-instance and non-modal: a second
+ /// Create tagging rule while it is open seeds the dialog already up
+ /// rather than being dropped.
+ void seedRule(const TagRule &seed);
+
/// The queries whose message counts the dialog wants, in the order its
/// rows appear. MainWindow hands these to the worker; the dialog never
/// touches the database itself, because NotmuchWorker owns the only
@@ -108,6 +122,10 @@ public:
/// Adding and filling a rule the way the buttons do, so a test can drive
/// the whole journey the user takes rather than only its last step.
int ruleCountForTest() const;
+
+ /// The selected rule's enabled flag, so the seeded default is asserted
+ /// rather than assumed from TagRule's initialiser.
+ bool currentRuleEnabledForTest() const;
void addRuleForTest() { onAddRule(); }
void setTagsForTest(const QString &tags);