diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-14 11:28:33 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-14 11:28:33 +0200 |
| commit | dfdb452cb5f21a8fe53dcbc610afa9158a83d6cf (patch) | |
| tree | aa29de5d6ef6a2ae929af8330d4a136528427dde | |
| parent | 46bdfeb27a072a44ce05affb0ccc3ca9c330197d (diff) | |
| download | qtmaildir-dfdb452cb5f21a8fe53dcbc610afa9158a83d6cf.tar.gz qtmaildir-dfdb452cb5f21a8fe53dcbc610afa9158a83d6cf.zip | |
feat(queries): create a tagging rule from a saved query
Right-click a stored saved query and the rules dialog opens on a new
rule carrying its query, with the tags left empty and focused. Generated
entries are excluded: their query is composed from the accounts, so a
rule made from one would freeze a snapshot that goes stale.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| -rw-r--r-- | src/mainwindow.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f9c9c65..bb6aa43 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1775,6 +1775,27 @@ void MainWindow::addSavedQueryActions(QWidget *target, const SavedQuery &saved) connect(remove, &QAction::triggered, this, [this, saved]() { deleteSavedQuery(saved); }); target->addAction(remove); + + // Stored queries only. A generated entry composes its query from the + // accounts at run time, so a rule made from one would freeze a snapshot + // that goes stale the day an account is added, in a file the post-new hook + // reads unattended. + if (saved.isGenerated()) + return; + + auto *ruleSeparator = new QAction(target); + ruleSeparator->setSeparator(true); + target->addAction(ruleSeparator); + + auto *toRule = new QAction(tr("Create tagging rule..."), target); + toRule->setObjectName(QStringLiteral("queryToRule")); + connect(toRule, &QAction::triggered, this, [this, saved]() { + TagRule seed; + seed.id = TagRules::sanitiseId(saved.name); + seed.query = saved.query; + showTagRulesDialog(seed); + }); + target->addAction(toRule); } void MainWindow::editSavedQuery(const SavedQuery &saved) |
