Commit fb450152 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor optimization

parent e10a15fc
...@@ -712,8 +712,9 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource) ...@@ -712,8 +712,9 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource)
textBeforeDoctype = s.left(indexDoctype); textBeforeDoctype = s.left(indexDoctype);
s.remove(textBeforeDoctype); s.remove(textBeforeDoctype);
} }
if (!match.captured().isEmpty()) { const QString capturedString = match.captured();
s = s.remove(match.captured()).trimmed(); if (!capturedString.isEmpty()) {
s = s.remove(capturedString).trimmed();
} }
static QRegularExpression htmlRegularExpression = QRegularExpression(QStringLiteral("<html[^>]*>"), QRegularExpression::CaseInsensitiveOption); static QRegularExpression htmlRegularExpression = QRegularExpression(QStringLiteral("<html[^>]*>"), QRegularExpression::CaseInsensitiveOption);
s = s.remove(htmlRegularExpression).trimmed(); s = s.remove(htmlRegularExpression).trimmed();
...@@ -747,8 +748,7 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource) ...@@ -747,8 +748,7 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource)
//s = s.remove(QRegularExpression(QStringLiteral("</html>$"), QRegularExpression::CaseInsensitiveOption)).trimmed(); //s = s.remove(QRegularExpression(QStringLiteral("</html>$"), QRegularExpression::CaseInsensitiveOption)).trimmed();
static QRegularExpression bodyEndRegularExpression = QRegularExpression(QStringLiteral("</body>$"), QRegularExpression::CaseInsensitiveOption); static QRegularExpression bodyEndRegularExpression = QRegularExpression(QStringLiteral("</body>$"), QRegularExpression::CaseInsensitiveOption);
s = s.remove(bodyEndRegularExpression).trimmed(); s = s.remove(bodyEndRegularExpression).trimmed();
s = textBeforeDoctype + s; messageInfo.htmlSource = textBeforeDoctype + s;
messageInfo.htmlSource = s;
return messageInfo; return messageInfo;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment