diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-17 19:46:08 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-17 19:46:08 +0200 |
| commit | acec616bee1c7a336a9dcee8338849b970c3eab1 (patch) | |
| tree | ce76acee427818220c1c444d737587abc5c804d9 /src | |
| parent | 69e2173b71e94e5a89c39b20d4a5962aadb715e9 (diff) | |
| download | qtmaildir-acec616bee1c7a336a9dcee8338849b970c3eab1.tar.gz qtmaildir-acec616bee1c7a336a9dcee8338849b970c3eab1.zip | |
feat(config): read a per-account trash folder
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.cpp | 11 | ||||
| -rw-r--r-- | src/config.h | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp index 600c558..d56099a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -137,6 +137,11 @@ QString Account::draftsQuery() const return folderQuery(maildir, drafts); } +QString Account::trashQuery() const +{ + return folderQuery(maildir, trash); +} + QString Config::allSentQuery() const { return joinAccountQueries(m_accounts, &Account::sentQuery); @@ -433,6 +438,12 @@ void Config::load(const QString &path) account.sent = settings.value(QStringLiteral("sent")).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. + account.trash = + settings.value(QStringLiteral("trash")).toString().trimmed(); + // Both optional, and both describe this account's chip in the thread // list. An account tag is a different taxonomy from a functional one, // saying which mailbox a thread arrived in rather than what state it diff --git a/src/config.h b/src/config.h index 70f7181..1feeeda 100644 --- a/src/config.h +++ b/src/config.h @@ -58,6 +58,15 @@ struct Account /// one for the account that has none. QString sent; + /// The account's trash folder, relative to maildir. + /// + /// MANDATORY, unlike `sent` and `drafts`. Delete moves a file into this + /// folder, so an account without one cannot delete at all, and the user + /// chose a config error over a per-account disabled state: "it is + /// mandatory for the program to function properly". Config::load() + /// reports a missing key through the warnings path. + QString trash; + /// Chip colour in the thread list. Invalid when unset, in which case one /// is generated from the account tag's name. QColor color; @@ -98,6 +107,13 @@ struct Account /// keys are independent, and one real account configures `drafts` with no /// `sent` at all. QString draftsQuery() const; + + /// Matches this account's trash, or empty when `trash` is unset. + /// + /// Empty is a config error rather than a legitimate state, unlike + /// sentQuery(). The query helper still returns empty so callers compose + /// uniformly; it is Config::load() that reports the problem. + QString trashQuery() const; }; /// A named query, stored in queries.json. |
