diff --git a/webengineviewer/src/networkmanager/interceptormanager.cpp b/webengineviewer/src/networkmanager/interceptormanager.cpp index 08632ac3..d16e05c3 100644 --- a/webengineviewer/src/networkmanager/interceptormanager.cpp +++ b/webengineviewer/src/networkmanager/interceptormanager.cpp @@ -1,79 +1,80 @@ /* Copyright (C) 2016-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "interceptormanager.h" #include "urlinterceptor/networkurlinterceptormanager.h" #include "urlinterceptor/networkurlinterceptor.h" #include #include #include +#include using namespace WebEngineViewer; class WebEngineViewer::NetworkAccessManagerWebEnginePrivate { public: NetworkAccessManagerWebEnginePrivate() { } WebEngineViewer::NetworkUrlInterceptorManager *mManager = nullptr; WebEngineViewer::NetworkUrlInterceptor *mNetworkUrlInterceptor = nullptr; }; InterceptorManager::InterceptorManager(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent) : QObject(parent) , d(new NetworkAccessManagerWebEnginePrivate) { d->mManager = new WebEngineViewer::NetworkUrlInterceptorManager(webEngine, ac, this); // Add interceptor. d->mNetworkUrlInterceptor = new WebEngineViewer::NetworkUrlInterceptor(this); for (WebEngineViewer::NetworkPluginUrlInterceptorInterface *interface : d->mManager->interfaceList()) { d->mNetworkUrlInterceptor->addInterceptor(interface); } -#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 13, 0) +#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() { delete d; } void InterceptorManager::addInterceptor(WebEngineViewer::NetworkPluginUrlInterceptorInterface *interceptor) { d->mNetworkUrlInterceptor->addInterceptor(interceptor); } void InterceptorManager::removeInterceptor(WebEngineViewer::NetworkPluginUrlInterceptorInterface *interceptor) { d->mNetworkUrlInterceptor->removeInterceptor(interceptor); } QList InterceptorManager::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const { QList actions; for (WebEngineViewer::NetworkPluginUrlInterceptorInterface *interface : d->mManager->interfaceList()) { actions.append(interface->interceptorUrlActions(result)); } return actions; }