aboutsummaryrefslogtreecommitdiffstats
path: root/src/mimeparser.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-14 17:14:33 +0200
committerDanilo M. <danix@danix.xyz>2026-08-14 17:14:33 +0200
commita79725e055699524ec57d09bd484f274ea4a961e (patch)
tree8ca944300b3f8e2650940154df73aa8b561bb3b8 /src/mimeparser.cpp
parente876e509b0770a243725b63ea55c9ccf3e41b1bf (diff)
parentbbf3c570215688c553fd70d8f372ae215725ca02 (diff)
downloadqtmaildir-a79725e055699524ec57d09bd484f274ea4a961e.tar.gz
qtmaildir-a79725e055699524ec57d09bd484f274ea4a961e.zip
Merge: searching from the message pane (item 85)
Five surfaces in the message pane offer a search built from what they show: the header's subject and date, its sender and recipients on a single-message thread, a tag chip, a body selection, and every header per message in the details dialog. Each offers Search for this, which replaces the query, and Add to search, which narrows it. The details dialog became labelled rows along the way, which the user wanted independently of this feature. Hand tested through every surface, including the case the parenthesising exists for: adding a sender to 'tag:inbox or tag:flagged' narrows it rather than widening it.
Diffstat (limited to 'src/mimeparser.cpp')
-rw-r--r--src/mimeparser.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mimeparser.cpp b/src/mimeparser.cpp
index ecf56f1..2782a4a 100644
--- a/src/mimeparser.cpp
+++ b/src/mimeparser.cpp
@@ -272,20 +272,25 @@ QString recipientSummary(const QString &rawTo, int maxNames)
return summary;
}
-QString attachmentFolderName(const QString &rfc822Date, const QString &subject)
+QDateTime MimeParser::parseDate(const QString &rfc822Date)
{
- // The date prefix sorts chronologically in a file manager. A Date: header
- // that does not parse is simply dropped rather than guessed at.
// A trailing timezone comment, "... +0200 (CEST)", is legal per RFC 5322
// and common in the wild, but Qt::RFC2822Date rejects the whole string
// when one is present (verified on Qt 6.11). Strip comments before
- // parsing, or every such message silently loses its date prefix.
+ // parsing, or every such message silently loses its date.
QString cleaned = rfc822Date;
cleaned.remove(QRegularExpression(QStringLiteral("\\s*\\([^)]*\\)")));
cleaned = cleaned.trimmed();
+ return QDateTime::fromString(cleaned, Qt::RFC2822Date);
+}
+
+QString attachmentFolderName(const QString &rfc822Date, const QString &subject)
+{
+ // The date prefix sorts chronologically in a file manager. A Date: header
+ // that does not parse is simply dropped rather than guessed at.
QString prefix;
- const QDateTime parsed = QDateTime::fromString(cleaned, Qt::RFC2822Date);
+ const QDateTime parsed = MimeParser::parseDate(rfc822Date);
if (parsed.isValid())
prefix = parsed.toString(QStringLiteral("yyyy-MM-dd"));