diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-24 12:15:09 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-24 12:15:09 +0200 |
| commit | 98ea0ee4691e60b430bd78eb615838da90bce244 (patch) | |
| tree | d64d9d02e25f5b04044ad982beefbce3600a1503 /src/composewindow.cpp | |
| parent | 02a795abe731da908928cd08a799ad79002ff421 (diff) | |
| download | qtmaildir-98ea0ee4691e60b430bd78eb615838da90bce244.tar.gz qtmaildir-98ea0ee4691e60b430bd78eb615838da90bce244.zip | |
feat: add a Drafts filter, and close the composer with Ctrl+W
Items 138 and 148.
The query row carried Unread, Inbox, Important, Sent and Trash, and no
Drafts, though the composer has been autosaving into each account's drafts
folder since compose shipped. Reaching them meant typing a query by hand.
Smaller than its size suggested: Account::draftsQuery() and
Config::allDraftsQuery() already existed for the placeholder pane's drafts
count, and builtinFilters() derives the row from kQueryGenerators, so the
work was the generator entry, two resolvedQuery branches, a label and an
icon.
It follows TRASH rather than Sent. Folder-matched like both, because `draft`
is a Maildir flag notmuch surfaces as a tag while the folder is what the
user means and what the composer actually writes into. But NOT flat: Sent is
flat so a thread cannot fold the user's own message back into the
conversation it answers, and a draft reply belongs with its conversation for
the same reason a trashed message does.
An account with no drafts folder shows no button, per item 103's rule. The
existing row test surfaced that by failing until its fixture configured one,
which is the rule working rather than a defect.
Ctrl+W closes the composer, which bound nothing at all: the only way out was
the title bar. The action is parented to the composer, so it is a
WindowShortcut dispatched to the active one only and the main window's
namespace is untouched, exactly like the formatting shortcuts. It calls
close() rather than doing anything of its own, since closeEvent() already
decides whether the draft is saved and a second route out that skipped it
would lose the message.
The Italian gains "Bozze"; lrelease reports 478 finished, 0 unfinished.
Diffstat (limited to 'src/composewindow.cpp')
| -rw-r--r-- | src/composewindow.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/composewindow.cpp b/src/composewindow.cpp index 6193e1c..5a92fa2 100644 --- a/src/composewindow.cpp +++ b/src/composewindow.cpp @@ -551,6 +551,20 @@ void ComposeWindow::buildFormatToolbar() // Remove attachment moves to its own button beside the list it acts on. m_detachButton->setDefaultAction(m_detachAction); + + // Ctrl+W closes the composer (item 148), the way it closes a window in + // every other application. Parented to this window like the formatting + // shortcuts, so it is a WindowShortcut dispatched to the active composer + // only and the main window's own namespace is untouched. + // + // close() rather than anything of its own: closeEvent() already decides + // whether the draft is saved or discarded, and a second route out that + // skipped it would lose the message. + auto *closeAction = new QAction(tr("Close"), this); + closeAction->setObjectName(QStringLiteral("compose_close")); + closeAction->setShortcut(QKeySequence(QStringLiteral("Ctrl+W"))); + connect(closeAction, &QAction::triggered, this, &ComposeWindow::close); + addAction(closeAction); } void ComposeWindow::seedFields() |
