1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fix build with latest Qt 5.6 snapshot

Closes #1797
This commit is contained in:
David Rosca 2015-12-09 19:33:54 +01:00
parent f130bc9763
commit 4a8d8fde59
9 changed files with 19 additions and 29 deletions

View File

@ -25,7 +25,8 @@ AdBlockUrlInterceptor::AdBlockUrlInterceptor(AdBlockManager *manager)
{
}
bool AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
void AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
return m_manager->block(info);
if (m_manager->block(info))
info.block(true);
}

View File

@ -29,7 +29,7 @@ class QUPZILLA_EXPORT AdBlockUrlInterceptor : public UrlInterceptor
public:
explicit AdBlockUrlInterceptor(AdBlockManager* manager);
bool interceptRequest(QWebEngineUrlRequestInfo &info);
void interceptRequest(QWebEngineUrlRequestInfo &info);
private:
AdBlockManager *m_manager;

View File

@ -31,16 +31,15 @@
CookieJar::CookieJar(QObject* parent)
: QObject(parent)
, m_client(mApp->webProfile()->cookieStoreClient())
, m_client(mApp->webProfile()->cookieStore())
{
loadSettings();
connect(m_client, &QWebEngineCookieStoreClient::cookieAdded, this, &CookieJar::cookieAdded);
connect(m_client, &QWebEngineCookieStoreClient::cookieRemoved, this, &CookieJar::cookieRemoved);
connect(m_client, &QWebEngineCookieStore::cookieAdded, this, &CookieJar::cookieAdded);
connect(m_client, &QWebEngineCookieStore::cookieRemoved, this, &CookieJar::cookieRemoved);
m_client->setCookieFilter([this](const QWebEngineCookieStoreClient::FilterRequest &req) {
QWebEngineCookieStoreClient::FilterRequest &r = const_cast<QWebEngineCookieStoreClient::FilterRequest&>(req);
r.accepted = acceptCookie(r.firstPartyUrl, r.cookieLine, r.cookieSource);
m_client->setCookieFilter([this](QWebEngineCookieStore::FilterRequest &req) {
req.accepted = acceptCookie(req.firstPartyUrl, req.cookieLine, req.cookieSource);
});
}

View File

@ -20,7 +20,7 @@
#include <QFile>
#include <QStringList>
#include <QWebEngineCookieStoreClient>
#include <QWebEngineCookieStore>
#include "qzcommon.h"
@ -58,7 +58,7 @@ private:
QStringList m_whitelist;
QStringList m_blacklist;
QWebEngineCookieStoreClient *m_client;
QWebEngineCookieStore *m_client;
};
#endif // COOKIEJAR_H

View File

@ -26,21 +26,14 @@ NetworkUrlInterceptor::NetworkUrlInterceptor(QObject *parent)
{
}
bool NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
bool result = false;
if (m_sendDNT) {
result = true;
info.setExtraHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
}
if (m_sendDNT)
info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
foreach (UrlInterceptor *interceptor, m_interceptors) {
if (interceptor->interceptRequest(info))
result = true;
interceptor->interceptRequest(info);
}
return result;
}
void NetworkUrlInterceptor::installUrlInterceptor(UrlInterceptor *interceptor)

View File

@ -30,7 +30,7 @@ class QUPZILLA_EXPORT NetworkUrlInterceptor : public QWebEngineUrlRequestInterce
public:
explicit NetworkUrlInterceptor(QObject* parent = Q_NULLPTR);
bool interceptRequest(QWebEngineUrlRequestInfo &info);
void interceptRequest(QWebEngineUrlRequestInfo &info) Q_DECL_OVERRIDE;
void installUrlInterceptor(UrlInterceptor *interceptor);
void removeUrlInterceptor(UrlInterceptor *interceptor);

View File

@ -26,7 +26,7 @@ class UrlInterceptor : public QObject
{
public:
explicit UrlInterceptor(QObject *parent = Q_NULLPTR) : QObject(parent) { }
virtual bool interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
};
#endif // URLINTERCEPTOR_H

View File

@ -24,14 +24,11 @@ GM_UrlInterceptor::GM_UrlInterceptor(GM_Manager *manager)
{
}
bool GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
if (info.requestUrl().toString().endsWith(QLatin1String(".user.js"))) {
m_manager->downloadScript(info.requestUrl());
info.block(true);
return true;
}
return false;
}

View File

@ -28,7 +28,7 @@ class GM_UrlInterceptor : public UrlInterceptor
public:
explicit GM_UrlInterceptor(GM_Manager* manager);
bool interceptRequest(QWebEngineUrlRequestInfo &info);
void interceptRequest(QWebEngineUrlRequestInfo &info);
private:
GM_Manager *m_manager;