Commit 25190c4f authored by Laurent Montel's avatar Laurent Montel 😁

Fix api

parent 5efb99ef
......@@ -35,7 +35,7 @@ void AdblockInterceptorInterface::interceptRequest(QWebEngineUrlRequestInfo &inf
if (!mAdblockManager->isEnabled()) {
return;
}
if (mAdblockManager->interceptRequest(info.requestUrl())) {
if (mAdblockManager->interceptRequest(info)) {
info.block(true);
}
}
......@@ -21,7 +21,6 @@
#include "lib/adblockmanager.h"
#include <MessageViewer/NetworkPluginUrlInterceptorInterface>
#include <kpluginfactory.h>
#include <QDebug>
K_PLUGIN_FACTORY_WITH_JSON(AdblockPluginUrlInterceptorFactory, "messageviewer_adblockurlinterceptor.json", registerPlugin<AdblockPluginUrlInterceptor>();)
AdblockPluginUrlInterceptor::AdblockPluginUrlInterceptor(QObject *parent, const QList<QVariant> &)
......
......@@ -2,7 +2,7 @@
ecm_add_test(adblockmanagertest.cpp
TEST_NAME adblockmanagertest
NAME_PREFIX "messageviewer-urlinterceptor-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets adblocklibprivate KF5::ItemViews
LINK_LIBRARIES Qt5::Test Qt5::Widgets adblocklibprivate KF5::ItemViews Qt5::WebEngine Qt5::WebEngineWidgets
)
......@@ -16,4 +16,4 @@ set( adblockpluginurlinterceptorconfigurewidgettest_SRCS adblockpluginurlinterce
add_executable( adblockpluginurlinterceptorconfigurewidgettest ${adblockpluginurlinterceptorconfigurewidgettest_SRCS})
add_test(adblockpluginurlinterceptorconfigurewidgettest adblockpluginurlinterceptorconfigurewidgettest)
ecm_mark_as_test(adblockpluginurlinterceptorconfigurewidgettest)
target_link_libraries( adblockpluginurlinterceptorconfigurewidgettest Qt5::Test Qt5::Widgets KF5::MessageViewer KF5::ItemViews)
target_link_libraries( adblockpluginurlinterceptorconfigurewidgettest Qt5::Test Qt5::Widgets KF5::MessageViewer KF5::ItemViews Qt5::WebEngine Qt5::WebEngineWidgets)
......@@ -65,8 +65,9 @@ bool AdblockManager::isEnabled() const
return mEnabled;
}
bool AdblockManager::interceptRequest(const QUrl &url)
bool AdblockManager::interceptRequest(const QWebEngineUrlRequestInfo &info)
{
QUrl url = info.requestUrl();
const QString urlString = url.toString().toLower();
const QString host = url.host().toLower();
const QString scheme = url.scheme().toLower();
......
......@@ -19,6 +19,7 @@
#define ADBLOCKMANAGER_H
#include <QObject>
#include <QWebEngineUrlRequestInfo>
#include "adblocklib_export.h"
namespace AdBlock
{
......@@ -31,7 +32,7 @@ public:
~AdblockManager();
bool isEnabled() const;
bool interceptRequest(const QUrl &url);
bool interceptRequest(const QWebEngineUrlRequestInfo &info);
public Q_SLOTS:
void reloadConfig();
......
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