diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.cpp | 36 | ||||
| -rw-r--r-- | src/config.h | 23 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp index 23c7364..534ba72 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -459,6 +459,17 @@ void Config::load(const QString &path) account.sent = settings.value(QStringLiteral("sent")).toString().trimmed(); + // Optional, and a STARTING value rather than a binding: the composer's + // switch keeps every signature reachable whichever account is + // selected. Left empty when absent, so the composer can tell "this + // account says nothing" from "this account says none" and fall through + // to [compose] signature itself; resolving that here would collapse + // the two. Trimmed for the same reason as sent, above: a trailing + // space would be carried into a filename lookup and match nothing, + // which is invisible in a config file. + account.signature = + settings.value(QStringLiteral("signature")).toString().trimmed(); + // Mandatory, unlike sent: Delete moves a file into this folder, so an // account without one cannot delete at all. Trimmed for the same // reason as sent, above. @@ -547,6 +558,31 @@ void Config::load(const QString &path) m_compose.sendHtml = settings.value(QStringLiteral("send_html"), true).toBool(); + // Trimmed for the same reason the account key is: it reaches a filename + // lookup, where a trailing space matches nothing invisibly. + m_compose.signature = + settings.value(QStringLiteral("signature")).toString().trimmed(); + + // The same shape as quote_position directly above: an absent key is + // silent and the struct default holds, but a PRESENT and malformed value + // is reported rather than silently accepted. value(key, default) alone + // would read "signature_position = abov" as above_quote. + const QString signaturePosition = + settings.value(QStringLiteral("signature_position"), + QStringLiteral("end")) + .toString().trimmed(); + if (signaturePosition.compare(QStringLiteral("above_quote"), + Qt::CaseInsensitive) == 0) { + m_compose.signaturePosition = Signatures::Position::AboveQuote; + } else if (signaturePosition.compare(QStringLiteral("end"), + Qt::CaseInsensitive) == 0) { + m_compose.signaturePosition = Signatures::Position::End; + } else { + addProblem(tr("[compose] signature_position '%1' is not recognised; " + "expected end or above_quote. Using end.") + .arg(signaturePosition)); + } + // Three numerics, all following the shape already established at // message_zoom, toolbar_icon_size, mark_read_delay_ms and // auto_sync_delay_ms elsewhere in this function: a QVariant, a checked diff --git a/src/config.h b/src/config.h index 4dcfbf1..02b4038 100644 --- a/src/config.h +++ b/src/config.h @@ -26,6 +26,7 @@ #include <QStringList> #include "completionentry.h" +#include "signatures.h" class QSettings; @@ -58,6 +59,18 @@ struct Account /// one for the account that has none. QString sent; + /// The signature seeded when composing from this account, by name. + /// + /// Optional, and it does not tie a signature to the account: the switch on + /// the composer's editor bar keeps every signature reachable whichever + /// account is selected. This is a STARTING value only, which is why the + /// user's "not tied to an account" constraint survives it (item 152). + /// + /// The fallback to [compose] signature is NOT resolved here. An account + /// with no key of its own carries an empty string and the composer falls + /// through, so the two values stay distinguishable. + QString signature; + /// The account's trash folder, relative to maildir. /// /// MANDATORY, unlike `sent` and `drafts`. Delete moves a file into this @@ -228,6 +241,16 @@ struct ComposeSettings /// accounts. Falls through when it names an account that cannot send. QString defaultAccount; + /// The signature seeded when the account carries none, by name. Empty + /// means no signature is seeded at all. + QString signature; + + /// Where a newly inserted signature goes. End by default, which is the + /// user's own habit; above_quote exists because other clients offer the + /// choice, and the splice's quote-aware scan is needed for the guard + /// either way. + Signatures::Position signaturePosition = Signatures::Position::End; + qint64 attachmentWarnBytes = 26214400; }; |
