aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-24 21:11:33 +0200
committerDanilo M. <danix@danix.xyz>2026-08-24 21:11:33 +0200
commitcf88c95aa5f16b918ebf207b3e323e44c525b440 (patch)
tree144e5735bb2a62ee7a4b154cf7aa3c15004826d6 /src
parent9b8a6da4ff39428ce22dc23e16fc48cc062bc01f (diff)
downloadqtmaildir-cf88c95aa5f16b918ebf207b3e323e44c525b440.tar.gz
qtmaildir-cf88c95aa5f16b918ebf207b3e323e44c525b440.zip
feat(compose): the signature follows the account until it is chosen
A From: change re-seeds the signature from the newly selected account, and stops doing so the moment the user picks one from the switch. Re-seeding unconditionally is the one behaviour that can silently discard a deliberate choice made a moment earlier; this is the shape send_html already uses. seededSignatureName() reads the combo rather than the context, which records where the composer opened and does not follow a change to it. Part of item 152.
Diffstat (limited to 'src')
-rw-r--r--src/composewindow.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/composewindow.cpp b/src/composewindow.cpp
index 8236d79..94a3f46 100644
--- a/src/composewindow.cpp
+++ b/src/composewindow.cpp
@@ -406,8 +406,22 @@ void ComposeWindow::buildUi()
for (QLineEdit *field : { m_to, m_cc, m_bcc, m_subject })
connect(field, &QLineEdit::textChanged, this, &ComposeWindow::markDirty);
connect(m_sendHtml, &QCheckBox::toggled, this, &ComposeWindow::markDirty);
- connect(m_from, &QComboBox::currentIndexChanged, this,
- &ComposeWindow::markDirty);
+ connect(m_from, &QComboBox::currentIndexChanged, this, [this]() {
+ markDirty();
+ // The account SEEDS the signature, so a change to it re-seeds. It
+ // stops the moment the user picks one: re-seeding unconditionally is
+ // the one behaviour that can silently discard a deliberate choice
+ // made a moment earlier. Same shape as send_html, which seeds from
+ // context and is then left alone.
+ if (m_signatureChosen)
+ return;
+ const QString seeded = seededSignatureName();
+ if (!Signatures::names(m_signatureDir).contains(seeded)) {
+ applySignature(QString());
+ return;
+ }
+ applySignature(seeded);
+ });
}
void ComposeWindow::buildFormatToolbar()
@@ -708,9 +722,12 @@ QStringList ComposeWindow::knownSignatures() const
QString ComposeWindow::seededSignatureName() const
{
- // The account SEEDS, it does not bind: this is a starting value, and the
- // switch keeps every signature reachable whichever account is selected.
- const Account account = m_config.account(m_context.accountKey);
+ // The COMBO, not m_context: the context records where the composer opened
+ // and does not follow a From: change, so reading it would seed the
+ // original account's signature for ever.
+ const QString key = m_from->currentData().toString();
+ const Account account =
+ m_config.account(key.isEmpty() ? m_context.accountKey : key);
if (!account.signature.isEmpty())
return account.signature;
return m_config.compose().signature;