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

now we depend against qt5.13

parent 332418cd
Pipeline #21293 passed with stage
in 29 minutes and 29 seconds
......@@ -25,26 +25,6 @@ MessageViewerUtilsTest::MessageViewerUtilsTest(QObject *parent)
{
}
void MessageViewerUtilsTest::shouldExcludeHeader_data()
{
QTest::addColumn<QString>("header");
QTest::addColumn<bool>("exclude");
QTest::newRow("emptylist") << QString() << false;
QTest::newRow("REFRESH1") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv=\'REFRESH\'></head>") << true;
QTest::newRow("REFRESH2") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv=\"REFRESH\"></head>") << true;
QTest::newRow("REFRESH3") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv=\"refresh\"></head>") << true;
QTest::newRow("REFRESH4") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv=\"&#82;EFRESH\"></head>") << true;
QTest::newRow("REFRESH5") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv=\'&#82;EFRESH\'></head>") << true;
QTest::newRow("REFRESH6") << QStringLiteral("<meta content=\"0;URL=http://www.kde.org\" http-equiv= \"REFRESH\"></head>") << true;
}
void MessageViewerUtilsTest::shouldExcludeHeader()
{
QFETCH(QString, header);
QFETCH(bool, exclude);
QCOMPARE(MessageViewer::Util::excludeExtraHeader(header), exclude);
}
void MessageViewerUtilsTest::shouldContainsExternalReferences_data()
{
QTest::addColumn<QString>("filename");
......
......@@ -27,9 +27,6 @@ public:
explicit MessageViewerUtilsTest(QObject *parent = nullptr);
~MessageViewerUtilsTest() = default;
private Q_SLOTS:
void shouldExcludeHeader_data();
void shouldExcludeHeader();
void shouldContainsExternalReferences_data();
void shouldContainsExternalReferences();
......
......@@ -652,15 +652,6 @@ QAction *Util::createAppAction(const KService::Ptr &service, bool singleOffer, Q
return act;
}
bool Util::excludeExtraHeader(const QString &s)
{
QRegularExpression ref(QStringLiteral("http-equiv=\\s*(\'|\")(&#82;|R)EFRESH(\'|\")"), QRegularExpression::CaseInsensitiveOption);
if (s.contains(ref)) {
return true;
}
return false;
}
void Util::addHelpTextAction(QAction *act, const QString &text)
{
act->setStatusTip(text);
......@@ -750,13 +741,6 @@ Util::HtmlMessageInfo Util::processHtml(const QString &htmlSource)
}
const int index = startIndex + 6;
messageInfo.extraHead = s.mid(index, endIndex - index);
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 13, 0)
//Remove this hack with https://codereview.qt-project.org/#/c/256100/2 is merged
//Don't authorize to refresh content.
if (MessageViewer::Util::excludeExtraHeader(s)) {
messageInfo.extraHead.clear();
}
#endif
s = s.remove(startIndex, endIndex - startIndex + 7).trimmed();
}
// body
......
......@@ -67,7 +67,6 @@ Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QString generateMboxFileName(const Akonad
Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool saveAttachments(const KMime::Content::List &contents, QWidget *parent, QList<QUrl> &saveUrl);
Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QAction *createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent);
Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool excludeExtraHeader(const QString &s);
/** Return a QTextCodec for the specified charset.
* This function is a bit more tolerant, than QTextCodec::codecForName */
MESSAGEVIEWER_EXPORT const QTextCodec *codecForName(const QByteArray &_str);
......
......@@ -52,9 +52,7 @@ void MailWebEnginePage::initialize()
settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, enableElement);
settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, enableElement);
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0)
settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, enableElement);
#endif
profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
profile()->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
......
......@@ -47,9 +47,7 @@ TemplateWebEnginePage::TemplateWebEnginePage(QObject *parent)
settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, false);
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0)
settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, false);
#endif
profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
profile()->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
}
......
......@@ -48,11 +48,7 @@ InterceptorManager::InterceptorManager(QWebEngineView *webEngine, KActionCollect
for (WebEngineViewer::NetworkPluginUrlInterceptorInterface *interface : d->mManager->interfaceList()) {
d->mNetworkUrlInterceptor->addInterceptor(interface);
}
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 13, 0)
webEngine->page()->profile()->setRequestInterceptor(d->mNetworkUrlInterceptor);
#else
webEngine->page()->profile()->setUrlRequestInterceptor(d->mNetworkUrlInterceptor);
#endif
}
InterceptorManager::~InterceptorManager()
......
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