aboutsummaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-14 11:27:56 +0200
committerDanilo M. <danix@danix.xyz>2026-08-14 11:27:56 +0200
commit46bdfeb27a072a44ce05affb0ccc3ca9c330197d (patch)
tree5247380549647904e6ce245830566f51516daa72 /src/mainwindow.cpp
parent80d78727bf9a73f609e6456fd114951b6daf347b (diff)
downloadqtmaildir-46bdfeb27a072a44ce05affb0ccc3ca9c330197d.tar.gz
qtmaildir-46bdfeb27a072a44ce05affb0ccc3ca9c330197d.zip
feat(rules): seed the rules dialog even when it is open
The dialog is non-modal and single-instance, so a second Create tagging rule reaches one that is already up. Seeding it beats dropping the request, which would read as a broken menu item. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 14e4202..f9c9c65 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1322,18 +1322,23 @@ void MainWindow::onDatabaseStatsReady(const DatabaseStats &stats,
number(stats.tags)));
}
-void MainWindow::showTagRulesDialog()
+void MainWindow::showTagRulesDialog(const TagRule &seed)
{
// One dialog. A second would edit a stale copy and the last Save would
// silently win, which is the lost-edit case the atomic write cannot help
// with because both writers are this process.
if (m_tagRulesDialog) {
+ // Seeded into the dialog already up rather than dropped: the menu item
+ // must do something visible, and a second dialog would edit a stale
+ // copy whose Save would silently win.
+ if (!seed.query.isEmpty())
+ m_tagRulesDialog->seedRule(seed);
m_tagRulesDialog->raise();
m_tagRulesDialog->activateWindow();
return;
}
- auto *dialog = new TagRulesDialog(this);
+ auto *dialog = new TagRulesDialog(seed, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
m_tagRulesDialog = dialog;