File indexing completed on 2025-01-19 04:47:00

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "adblockpluginurlinterceptor.h"
0008 #include "adblockinterceptorinterface.h"
0009 #include "adblockpluginurlinterceptorconfiguredialog.h"
0010 
0011 #include <KPluginFactory>
0012 #include <QPointer>
0013 #include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
0014 
0015 K_PLUGIN_CLASS_WITH_JSON(AdblockPluginUrlInterceptor, "messageviewer_adblockurlinterceptor.json")
0016 AdblockPluginUrlInterceptor::AdblockPluginUrlInterceptor(QObject *parent, const QList<QVariant> &)
0017     : WebEngineViewer::NetworkPluginUrlInterceptor(parent)
0018 {
0019 }
0020 
0021 AdblockPluginUrlInterceptor::~AdblockPluginUrlInterceptor() = default;
0022 
0023 WebEngineViewer::NetworkPluginUrlInterceptorInterface *AdblockPluginUrlInterceptor::createInterface(QWebEngineView *webEngine, QObject *parent)
0024 {
0025     auto adblockInterface = new AdblockInterceptorInterface(parent);
0026     adblockInterface->setWebEngineView(webEngine);
0027     return adblockInterface;
0028 }
0029 
0030 bool AdblockPluginUrlInterceptor::hasConfigureDialog() const
0031 {
0032     return true;
0033 }
0034 
0035 void AdblockPluginUrlInterceptor::showConfigureDialog(QWidget *parent)
0036 {
0037     AdblockPluginUrlInterceptorConfigureDialog dlg(parent);
0038     dlg.exec();
0039 }
0040 
0041 #include "adblockpluginurlinterceptor.moc"
0042 
0043 #include "moc_adblockpluginurlinterceptor.cpp"