aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cpp21
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)