aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 0f0caf1..0fa3c85 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -158,6 +158,11 @@ QString Account::trashQuery() const
return folderQuery(maildir, trash);
}
+QString Account::spamQuery() const
+{
+ return folderQuery(maildir, spam);
+}
+
QString Account::inboxFolder() const
{
// Never empty: Restore needs a folder to name, and "Inbox" is both the
@@ -192,6 +197,11 @@ QString Config::allTrashQuery() const
return joinAccountQueries(m_accounts, &Account::trashQuery);
}
+QString Config::allSpamQuery() const
+{
+ return joinAccountQueries(m_accounts, &Account::spamQuery);
+}
+
QString Config::defaultPath()
{
const QString base =
@@ -528,6 +538,12 @@ void Config::load(const QString &path)
account.trash =
settings.value(QStringLiteral("trash")).toString().trimmed();
+ // Mandatory, unlike sent: Mark spam moves a file into this folder, so
+ // an account without one cannot mark spam at all. Trimmed for the same
+ // reason as sent, above.
+ account.spam =
+ settings.value(QStringLiteral("spam")).toString().trimmed();
+
// Optional, unlike trash: inboxFolder() defaults it to "Inbox", which
// is right for any ordinary Maildir. Read so an account whose inbox is
// named otherwise can say so, rather than having Restore create a
@@ -585,6 +601,19 @@ void Config::load(const QString &path)
.arg(account.key));
}
+ // Mandatory, unlike sent: Mark spam moves a file into this folder, so
+ // an account without one cannot mark spam at all. Reported rather than
+ // silently disabled, so the user finds out from a warning rather than
+ // from a Mark spam that quietly does nothing. The account still loads;
+ // only Mark spam is unusable.
+ if (account.spam.isEmpty()) {
+ addProblem(
+ tr("Account '%1' has no spam folder configured; add a "
+ "'spam' key to its section. Mark spam will not work for "
+ "this account until it does.")
+ .arg(account.key));
+ }
+
m_accounts.append(account);
}