summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-19 05:43:37 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-19 05:43:37 (GMT)
commit48af0c033cc376beb3d26e15c8368d9a7fe6b8dd (patch)
tree1b5adb7660a423c96374666884c531c35a368727
parenta9b5c3127f83e8927934664266022ca0452174f1 (diff)
Remove unused method
-rw-r--r--messageviewer/src/widgets/mailsourcewebengineviewer.cpp72
-rw-r--r--messageviewer/src/widgets/mailsourcewebengineviewer.h1
2 files changed, 0 insertions, 73 deletions
diff --git a/messageviewer/src/widgets/mailsourcewebengineviewer.cpp b/messageviewer/src/widgets/mailsourcewebengineviewer.cpp
index 3e655f2..5d8df2a 100644
--- a/messageviewer/src/widgets/mailsourcewebengineviewer.cpp
+++ b/messageviewer/src/widgets/mailsourcewebengineviewer.cpp
@@ -122,75 +122,3 @@ void MailSourceWebEngineViewer::setFixedFont()
#endif
}
-QString MailSourceWebEngineViewer::reformat(const QString &src)
-{
- const QRegExp cleanLeadingWhitespace(QStringLiteral("(?:\\n)+\\w*"));
- QStringList tmpSource;
- QString source(src);
- int pos = 0;
- QString indent;
- // Best to be really verbose about this one...
- const static QRegExp htmlTagRegExp(QStringLiteral("<"
- "(/)?" //Captures the / if this is an end tag.
- "(\\w+)" //Captures TagName
- "(?:" //Groups tag contents
- "(?:\\s+" //Groups attributes
- "(?:\\w+)" //Attribute name
- "(?:" //groups =value portion.
- "\\s*=\\s*" // =
- "(?:" //Groups attribute "value" portion.
- "\\\"(?:[^\\\"]*)\\\"" // attVal='double quoted'
- "|'(?:[^']*)'" // attVal='single quoted'
- "|(?:[^'"">\\s]+)" // attVal=urlnospaces
- ")"
- ")?" //end optional att value portion.
- ")+\\s*" //One or more attribute pairs
- "|\\s*" //Some white space.
- ")"
- "(/)?>" //Captures the "/" if this is a complete tag.
- ));
-
- //First make sure that each tag is surrounded by newlines
- while ((pos = htmlTagRegExp.indexIn(source, pos)) != -1) {
- source.insert(pos, QLatin1Char('\n'));
- pos += htmlTagRegExp.matchedLength() + 1;
- source.insert(pos, QLatin1Char('\n'));
- ++pos;
- }
-
- // Then split the source on newlines skiping empty parts.
- // Now a line is either a tag or pure data.
- tmpSource = source.split(QLatin1Char('\n'), QString::SkipEmptyParts);
-
- // Then clean any leading whitespace
- for (int i = 0; i != tmpSource.length(); ++i) {
- tmpSource[i] = tmpSource[i].remove(cleanLeadingWhitespace);
- }
-
- // Then indent as appropriate
- for (int i = 0; i != tmpSource.length(); ++i) {
- if (htmlTagRegExp.indexIn(tmpSource.at(i)) != -1) { // A tag
- if (htmlTagRegExp.cap(3) == QLatin1String("/") ||
- htmlTagRegExp.cap(2) == QLatin1String("img") ||
- htmlTagRegExp.cap(2) == QLatin1String("br")) {
- //Self closing tag or no closure needed
- continue;
- }
- if (htmlTagRegExp.cap(1) == QLatin1String("/")) {
- // End tag
- indent.chop(2);
- tmpSource[i].prepend(indent);
- continue;
- }
- // start tag
- tmpSource[i].prepend(indent);
- indent.append(QStringLiteral(" "));
- continue;
- }
- // Data
- tmpSource[i].prepend(indent);
- }
-
- // Finally reassemble and return :)
- return tmpSource.join(QStringLiteral("\n"));
-}
diff --git a/messageviewer/src/widgets/mailsourcewebengineviewer.h b/messageviewer/src/widgets/mailsourcewebengineviewer.h
index f645ff0..69c2e1b 100644
--- a/messageviewer/src/widgets/mailsourcewebengineviewer.h
+++ b/messageviewer/src/widgets/mailsourcewebengineviewer.h
@@ -38,7 +38,6 @@ public:
void setDisplayedSource(QWebEnginePage *page);
void setFixedFont();
private:
- QString reformat(const QString &src);
MailSourceViewTextBrowserWidget *mRawBrowser;
FindBarSourceView *mFindBar;
#ifndef NDEBUG