diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 21:46:39 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 21:46:39 +0200 |
commit | 9ccf589a411591602c55c274035b0ba2b02c20bd (patch) | |
tree | 4b3fd82f3b0aa9858a0dc7b066feb822afc09fc7 /framework/src | |
parent | 0a48541c5f27c1b2913030116b1cdf3ded291219 (diff) | |
download | kube-9ccf589a411591602c55c274035b0ba2b02c20bd.tar.gz kube-9ccf589a411591602c55c274035b0ba2b02c20bd.zip |
Unused
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/otp/nodehelper.cpp | 58 | ||||
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/otp/nodehelper.h | 27 |
2 files changed, 0 insertions, 85 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/otp/nodehelper.cpp b/framework/src/domain/mime/mimetreeparser/otp/nodehelper.cpp index 8e224f1b..71e15c49 100644 --- a/framework/src/domain/mime/mimetreeparser/otp/nodehelper.cpp +++ b/framework/src/domain/mime/mimetreeparser/otp/nodehelper.cpp | |||
@@ -46,9 +46,6 @@ | |||
46 | namespace MimeTreeParser | 46 | namespace MimeTreeParser |
47 | { | 47 | { |
48 | 48 | ||
49 | QStringList replySubjPrefixes(QStringList() << QStringLiteral("Re\\s*:") << QStringLiteral("Re\\[\\d+\\]:") << QStringLiteral("Re\\d+:")); | ||
50 | QStringList forwardSubjPrefixes(QStringList() << QStringLiteral("Fwd:") << QStringLiteral("FW:")); | ||
51 | |||
52 | NodeHelper::NodeHelper() : | 49 | NodeHelper::NodeHelper() : |
53 | mAttachmentFilesDir(new AttachmentTemporaryFilesDirs()) | 50 | mAttachmentFilesDir(new AttachmentTemporaryFilesDirs()) |
54 | { | 51 | { |
@@ -472,61 +469,6 @@ void NodeHelper::magicSetType(KMime::Content *node, bool aAutoDecode) | |||
472 | node->contentType()->setMimeType(mimetype.toLatin1()); | 469 | node->contentType()->setMimeType(mimetype.toLatin1()); |
473 | } | 470 | } |
474 | 471 | ||
475 | // static | ||
476 | QString NodeHelper::replacePrefixes(const QString &str, | ||
477 | const QStringList &prefixRegExps, | ||
478 | bool replace, | ||
479 | const QString &newPrefix) | ||
480 | { | ||
481 | bool recognized = false; | ||
482 | // construct a big regexp that | ||
483 | // 1. is anchored to the beginning of str (sans whitespace) | ||
484 | // 2. matches at least one of the part regexps in prefixRegExps | ||
485 | QString bigRegExp = QStringLiteral("^(?:\\s+|(?:%1))+\\s*") | ||
486 | .arg(prefixRegExps.join(QStringLiteral(")|(?:"))); | ||
487 | QRegExp rx(bigRegExp, Qt::CaseInsensitive); | ||
488 | if (!rx.isValid()) { | ||
489 | qCWarning(MIMETREEPARSER_LOG) << "bigRegExp = \"" | ||
490 | << bigRegExp << "\"\n" | ||
491 | << "prefix regexp is invalid!"; | ||
492 | // try good ole Re/Fwd: | ||
493 | recognized = str.startsWith(newPrefix); | ||
494 | } else { // valid rx | ||
495 | QString tmp = str; | ||
496 | if (rx.indexIn(tmp) == 0) { | ||
497 | recognized = true; | ||
498 | if (replace) { | ||
499 | return tmp.replace(0, rx.matchedLength(), newPrefix + QLatin1Char(' ')); | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | if (!recognized) { | ||
504 | return newPrefix + QLatin1Char(' ') + str; | ||
505 | } else { | ||
506 | return str; | ||
507 | } | ||
508 | } | ||
509 | |||
510 | QString NodeHelper::cleanSubject(KMime::Message *message) | ||
511 | { | ||
512 | return cleanSubject(message, replySubjPrefixes + forwardSubjPrefixes, | ||
513 | true, QString()).trimmed(); | ||
514 | } | ||
515 | |||
516 | QString NodeHelper::cleanSubject(KMime::Message *message, | ||
517 | const QStringList &prefixRegExps, | ||
518 | bool replace, | ||
519 | const QString &newPrefix) | ||
520 | { | ||
521 | QString cleanStr; | ||
522 | if (message) { | ||
523 | cleanStr = | ||
524 | NodeHelper::replacePrefixes( | ||
525 | message->subject()->asUnicodeString(), prefixRegExps, replace, newPrefix); | ||
526 | } | ||
527 | return cleanStr; | ||
528 | } | ||
529 | |||
530 | void NodeHelper::setOverrideCodec(KMime::Content *node, const QTextCodec *codec) | 472 | void NodeHelper::setOverrideCodec(KMime::Content *node, const QTextCodec *codec) |
531 | { | 473 | { |
532 | if (!node) { | 474 | if (!node) { |
diff --git a/framework/src/domain/mime/mimetreeparser/otp/nodehelper.h b/framework/src/domain/mime/mimetreeparser/otp/nodehelper.h index 70253f21..40c62a75 100644 --- a/framework/src/domain/mime/mimetreeparser/otp/nodehelper.h +++ b/framework/src/domain/mime/mimetreeparser/otp/nodehelper.h | |||
@@ -80,12 +80,6 @@ public: | |||
80 | */ | 80 | */ |
81 | void magicSetType(KMime::Content *node, bool autoDecode = true); | 81 | void magicSetType(KMime::Content *node, bool autoDecode = true); |
82 | 82 | ||
83 | /** | ||
84 | * Return this mails subject, with all "forward" and "reply" | ||
85 | * prefixes removed | ||
86 | */ | ||
87 | static QString cleanSubject(KMime::Message *message); | ||
88 | |||
89 | /** Attach an extra node to an existing node */ | 83 | /** Attach an extra node to an existing node */ |
90 | void attachExtraContent(KMime::Content *topLevelNode, KMime::Content *content); | 84 | void attachExtraContent(KMime::Content *topLevelNode, KMime::Content *content); |
91 | 85 | ||
@@ -163,18 +157,6 @@ public: | |||
163 | static QByteArray charset(KMime::Content *node); | 157 | static QByteArray charset(KMime::Content *node); |
164 | 158 | ||
165 | /** | 159 | /** |
166 | * Check for prefixes @p prefixRegExps in @p str. If none | ||
167 | * is found, @p newPrefix + ' ' is prepended to @p str and the | ||
168 | * resulting string is returned. If @p replace is true, any | ||
169 | * sequence of whitespace-delimited prefixes at the beginning of | ||
170 | * @p str is replaced by @p newPrefix. | ||
171 | */ | ||
172 | static QString replacePrefixes(const QString &str, | ||
173 | const QStringList &prefixRegExps, | ||
174 | bool replace, | ||
175 | const QString &newPrefix); | ||
176 | |||
177 | /** | ||
178 | * Return a QTextCodec for the specified charset. | 160 | * Return a QTextCodec for the specified charset. |
179 | * This function is a bit more tolerant, than QTextCodec::codecForName | 161 | * This function is a bit more tolerant, than QTextCodec::codecForName |
180 | */ | 162 | */ |
@@ -243,15 +225,6 @@ private: | |||
243 | bool unencryptedMessage_helper(KMime::Content *node, QByteArray &resultingData, bool addHeaders, | 225 | bool unencryptedMessage_helper(KMime::Content *node, QByteArray &resultingData, bool addHeaders, |
244 | int recursionLevel = 1); | 226 | int recursionLevel = 1); |
245 | 227 | ||
246 | /** Check for prefixes @p prefixRegExps in #subject(). If none | ||
247 | is found, @p newPrefix + ' ' is prepended to the subject and the | ||
248 | resulting string is returned. If @p replace is true, any | ||
249 | sequence of whitespace-delimited prefixes at the beginning of | ||
250 | #subject() is replaced by @p newPrefix | ||
251 | **/ | ||
252 | static QString cleanSubject(KMime::Message *message, const QStringList &prefixRegExps, | ||
253 | bool replace, const QString &newPrefix); | ||
254 | |||
255 | void mergeExtraNodes(KMime::Content *node); | 228 | void mergeExtraNodes(KMime::Content *node); |
256 | void cleanFromExtraNodes(KMime::Content *node); | 229 | void cleanFromExtraNodes(KMime::Content *node); |
257 | 230 | ||