From 9ccf589a411591602c55c274035b0ba2b02c20bd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 23 May 2017 21:46:39 +0200 Subject: Unused --- .../domain/mime/mimetreeparser/otp/nodehelper.cpp | 58 ---------------------- .../domain/mime/mimetreeparser/otp/nodehelper.h | 27 ---------- 2 files changed, 85 deletions(-) (limited to 'framework/src/domain') 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 @@ namespace MimeTreeParser { -QStringList replySubjPrefixes(QStringList() << QStringLiteral("Re\\s*:") << QStringLiteral("Re\\[\\d+\\]:") << QStringLiteral("Re\\d+:")); -QStringList forwardSubjPrefixes(QStringList() << QStringLiteral("Fwd:") << QStringLiteral("FW:")); - NodeHelper::NodeHelper() : mAttachmentFilesDir(new AttachmentTemporaryFilesDirs()) { @@ -472,61 +469,6 @@ void NodeHelper::magicSetType(KMime::Content *node, bool aAutoDecode) node->contentType()->setMimeType(mimetype.toLatin1()); } -// static -QString NodeHelper::replacePrefixes(const QString &str, - const QStringList &prefixRegExps, - bool replace, - const QString &newPrefix) -{ - bool recognized = false; - // construct a big regexp that - // 1. is anchored to the beginning of str (sans whitespace) - // 2. matches at least one of the part regexps in prefixRegExps - QString bigRegExp = QStringLiteral("^(?:\\s+|(?:%1))+\\s*") - .arg(prefixRegExps.join(QStringLiteral(")|(?:"))); - QRegExp rx(bigRegExp, Qt::CaseInsensitive); - if (!rx.isValid()) { - qCWarning(MIMETREEPARSER_LOG) << "bigRegExp = \"" - << bigRegExp << "\"\n" - << "prefix regexp is invalid!"; - // try good ole Re/Fwd: - recognized = str.startsWith(newPrefix); - } else { // valid rx - QString tmp = str; - if (rx.indexIn(tmp) == 0) { - recognized = true; - if (replace) { - return tmp.replace(0, rx.matchedLength(), newPrefix + QLatin1Char(' ')); - } - } - } - if (!recognized) { - return newPrefix + QLatin1Char(' ') + str; - } else { - return str; - } -} - -QString NodeHelper::cleanSubject(KMime::Message *message) -{ - return cleanSubject(message, replySubjPrefixes + forwardSubjPrefixes, - true, QString()).trimmed(); -} - -QString NodeHelper::cleanSubject(KMime::Message *message, - const QStringList &prefixRegExps, - bool replace, - const QString &newPrefix) -{ - QString cleanStr; - if (message) { - cleanStr = - NodeHelper::replacePrefixes( - message->subject()->asUnicodeString(), prefixRegExps, replace, newPrefix); - } - return cleanStr; -} - void NodeHelper::setOverrideCodec(KMime::Content *node, const QTextCodec *codec) { 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: */ void magicSetType(KMime::Content *node, bool autoDecode = true); - /** - * Return this mails subject, with all "forward" and "reply" - * prefixes removed - */ - static QString cleanSubject(KMime::Message *message); - /** Attach an extra node to an existing node */ void attachExtraContent(KMime::Content *topLevelNode, KMime::Content *content); @@ -162,18 +156,6 @@ public: */ static QByteArray charset(KMime::Content *node); - /** - * Check for prefixes @p prefixRegExps in @p str. If none - * is found, @p newPrefix + ' ' is prepended to @p str and the - * resulting string is returned. If @p replace is true, any - * sequence of whitespace-delimited prefixes at the beginning of - * @p str is replaced by @p newPrefix. - */ - static QString replacePrefixes(const QString &str, - const QStringList &prefixRegExps, - bool replace, - const QString &newPrefix); - /** * Return a QTextCodec for the specified charset. * This function is a bit more tolerant, than QTextCodec::codecForName @@ -243,15 +225,6 @@ private: bool unencryptedMessage_helper(KMime::Content *node, QByteArray &resultingData, bool addHeaders, int recursionLevel = 1); - /** Check for prefixes @p prefixRegExps in #subject(). If none - is found, @p newPrefix + ' ' is prepended to the subject and the - resulting string is returned. If @p replace is true, any - sequence of whitespace-delimited prefixes at the beginning of - #subject() is replaced by @p newPrefix - **/ - static QString cleanSubject(KMime::Message *message, const QStringList &prefixRegExps, - bool replace, const QString &newPrefix); - void mergeExtraNodes(KMime::Content *node); void cleanFromExtraNodes(KMime::Content *node); -- cgit v1.2.3