aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/config.cpp b/src/config.cpp
index b148102..cb6168f 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -63,11 +63,12 @@ const QStringList kQueryGenerators = { QStringLiteral("unread"),
QStringLiteral("inbox"),
QStringLiteral("flagged"),
QStringLiteral("sent"),
+ QStringLiteral("drafts"),
QStringLiteral("trash") };
/// The tag a generator matches, for the three filters that are a plain tag
-/// query. Empty for "sent", which composes from each account's folder instead
-/// and is handled separately.
+/// query. Empty for "sent", "drafts" and "trash", which compose from each
+/// account's folder instead and are handled separately.
QString generatorTag(const QString &generator)
{
if (generator == QStringLiteral("unread"))
@@ -986,6 +987,12 @@ SavedQuery Config::builtinFilter(const QString &generator)
// thread would fold the user's sent message back into the conversation
// it belongs to, which is item 63's finding.
filter.flat = true;
+ } else if (generator == QStringLiteral("drafts")) {
+ // The LABEL is translated; the generator stays `drafts`, which is what
+ // queries.json stores and what a closed set is matched against.
+ filter.name = tr("Drafts");
+ // NOT flat, like Trash and unlike Sent: a draft reply belongs with the
+ // conversation it answers.
} else if (generator == QStringLiteral("trash")) {
filter.name = tr("Trash");
// NOT flat, unlike Sent. A deleted message still belongs to its
@@ -1015,6 +1022,10 @@ QString Config::resolvedQuery(const SavedQuery &query,
const QString all = allSentQuery();
return all.isEmpty() ? matchNothingQuery() : all;
}
+ if (query.generated == QStringLiteral("drafts")) {
+ const QString all = allDraftsQuery();
+ return all.isEmpty() ? matchNothingQuery() : all;
+ }
if (query.generated == QStringLiteral("trash")) {
const QString all = allTrashQuery();
return all.isEmpty() ? matchNothingQuery() : all;
@@ -1039,6 +1050,13 @@ QString Config::resolvedQuery(const SavedQuery &query,
return sent.isEmpty() ? matchNothingQuery() : sent;
}
+ if (query.generated == QStringLiteral("drafts")) {
+ // The account's OWN drafts query, for the reason spelled out above the
+ // sent case.
+ const QString drafts = scope.draftsQuery();
+ return drafts.isEmpty() ? matchNothingQuery() : drafts;
+ }
+
if (query.generated == QStringLiteral("trash")) {
// The account's OWN trash query, for the reason spelled out above the
// sent case: wrapping the all-accounts query in this account's path