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

We need to get style

parent 77431636
......@@ -741,7 +741,14 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource)
}
// body
static QRegularExpression body = QRegularExpression(QStringLiteral("<body[^>]*>"), QRegularExpression::CaseInsensitiveOption);
s = s.remove(body).trimmed();
QRegularExpressionMatch matchBody;
const int bodyStartIndex = s.indexOf(body, 0, &matchBody);
if (bodyStartIndex >= 0) {
//qDebug() << "matchBody " << matchBody.captured();
s = s.remove(bodyStartIndex, matchBody.capturedLength()).trimmed();
//Parse style
messageInfo.bodyStyle = matchBody.captured();
}
//Some mail has </div>$ at end
static QRegularExpression htmlDivRegularExpression = QRegularExpression(QStringLiteral("(</html></div>|</html>)$"), QRegularExpression::CaseInsensitiveOption);
s = s.remove(htmlDivRegularExpression).trimmed();
......
......@@ -75,10 +75,12 @@ MESSAGEVIEWER_EXPORT const QTextCodec *codecForName(const QByteArray &_str);
struct HtmlMessageInfo {
QString htmlSource;
QString extraHead;
QString bodyStyle;
Q_REQUIRED_RESULT bool operator==(const HtmlMessageInfo &other) const
{
return other.htmlSource == htmlSource
&& other.extraHead == extraHead;
&& other.extraHead == extraHead
&& other.bodyStyle == bodyStyle;
}
};
......
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