From dfdb452cb5f21a8fe53dcbc610afa9158a83d6cf Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 14 Aug 2026 11:28:33 +0200 Subject: 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 --- src/mainwindow.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mainwindow.cpp') 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) -- cgit v1.2.3