summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-04-06 21:22:46 +0200
committerMontel Laurent <[email protected]>2016-04-06 21:22:46 +0200
commiteb8de1d3e2219bfea213e750d93760d080a983ca (patch)
treed552aa53bb99edc0a3b8d09c0986b86747e07b4b
parent742016cd9456edb01c6f2c8aeed33592d3846044 (diff)
Don't use messageviewer code (prepare to remove qtwebkit support in messageviewer)
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt27
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/autotests/adblockpluginurlinterceptorconfigurewidgettest.cpp4
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/CMakeLists.txt25
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.cpp81
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.h31
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettings_gui.cpp43
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettingsdialog_gui.cpp62
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.cpp105
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.h46
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.cpp109
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.h47
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.cpp71
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.h46
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.cpp6
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.h7
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.cpp502
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.h94
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.cpp160
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.h68
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.cpp54
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.h37
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.cpp71
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.h35
-rw-r--r--plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/settings_adblock.ui256
24 files changed, 1970 insertions, 17 deletions
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
index a7f64c9..d2caec0 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/CMakeLists.txt
@@ -6,7 +6,15 @@ set(adblocklibprivate_widget_SRCS
widgets/adblockblockableitemswidget.cpp
widgets/adblockcreatefilterdialog.cpp
widgets/adblockpluginurlinterceptorconfigurewidget.cpp
+ widgets/adblockaddsubscriptiondialog.cpp
+ widgets/adblockautomaticruleslistwidget.cpp
+ widgets/adblocklistwidget.cpp
+ widgets/adblocksettingwidget.cpp
+ widgets/adblockshowlistdialog.cpp
+ widgets/adblocksyntaxhighlighter.cpp
+ widgets/adblockutil.cpp
)
+
set(adblocklibprivate_SRCS
adblockmanager.cpp
adblocksearchtree.cpp
@@ -17,14 +25,14 @@ set(adblocklibprivate_SRCS
adblocksubscription.cpp
${adblocklibprivate_widget_SRCS}
${messageviewer_adblock_lib_common_SRCS}
-)
-ki18n_wrap_ui(adblocklibprivate_SRCS widgets/adblockcreatefilterwidget.ui)
+ )
+ki18n_wrap_ui(adblocklibprivate_SRCS widgets/adblockcreatefilterwidget.ui widgets/settings_adblock.ui)
add_library(adblocklibprivate ${adblocklibprivate_SRCS})
generate_export_header(adblocklibprivate BASE_NAME adblocklib)
target_link_libraries(adblocklibprivate
-PRIVATE
+ PRIVATE
Qt5::Core
Qt5::WebEngine
Qt5::WebEngineWidgets
@@ -32,15 +40,20 @@ PRIVATE
KF5::ItemViews
KF5::ConfigCore
KF5::PimCommon
- KF5::MessageViewer
KF5::KIOWidgets
KF5::WebEngineViewer
-)
+ KF5::TextWidgets
+ KF5::PimTextEdit
+ KF5::Libkdepim
+ )
set_target_properties(adblocklibprivate
PROPERTIES VERSION ${KDEPIMADDONS_LIB_VERSION} SOVERSION ${KDEPIMADDONS_LIB_SOVERSION}
-)
+ )
install(TARGETS adblocklibprivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
-add_subdirectory(autotests)
+if(BUILD_TESTING)
+ add_subdirectory(autotests)
+ add_subdirectory(tests)
+endif()
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/autotests/adblockpluginurlinterceptorconfigurewidgettest.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/autotests/adblockpluginurlinterceptorconfigurewidgettest.cpp
index 649ea8b..da1772a 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/autotests/adblockpluginurlinterceptorconfigurewidgettest.cpp
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/autotests/adblockpluginurlinterceptorconfigurewidgettest.cpp
@@ -17,7 +17,7 @@
#include "adblockpluginurlinterceptorconfigurewidgettest.h"
#include "../widgets/adblockpluginurlinterceptorconfigurewidget.h"
-#include <AdBlockSettingWidget>
+#include "../widgets/adblocksettingwidget.h"
#include <QTest>
AdblockPluginUrlInterceptorConfigureWidgetTest::AdblockPluginUrlInterceptorConfigureWidgetTest(QObject *parent)
@@ -35,7 +35,7 @@ void AdblockPluginUrlInterceptorConfigureWidgetTest::shouldHaveDefaultValue()
{
AdBlock::AdblockPluginUrlInterceptorConfigureWidget w;
- MessageViewer::AdBlockSettingWidget *configurewidget = w.findChild<MessageViewer::AdBlockSettingWidget *>(QStringLiteral("configurewidget"));
+ AdBlock::AdBlockSettingWidget *configurewidget = w.findChild<AdBlock::AdBlockSettingWidget *>(QStringLiteral("configurewidget"));
QVERIFY(configurewidget);
}
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/CMakeLists.txt b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/CMakeLists.txt
new file mode 100644
index 0000000..9aa75b7
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/CMakeLists.txt
@@ -0,0 +1,25 @@
+set(adblocksettings_gui_SRCS adblocksettings_gui.cpp)
+add_executable(adblocksettings_gui ${adblocksettings_gui_SRCS})
+target_link_libraries(adblocksettings_gui
+ adblocklibprivate
+ KF5::ItemViews
+ KF5::I18n
+ KF5::CoreAddons
+ )
+
+set(adblocksettingsdialog_gui_SRCS adblocksettingsdialog_gui.cpp)
+add_executable(adblocksettingsdialog_gui ${adblocksettingsdialog_gui_SRCS})
+target_link_libraries(adblocksettingsdialog_gui
+ adblocklibprivate
+ KF5::ItemViews
+ KF5::I18n
+ KF5::CoreAddons
+ )
+set(adblockautomaticruleslistwidget_gui_SRCS adblockautomaticruleslistwidget_gui.cpp)
+add_executable(adblockautomaticruleslistwidget_gui ${adblockautomaticruleslistwidget_gui_SRCS})
+target_link_libraries(adblockautomaticruleslistwidget_gui
+ adblocklibprivate
+ KF5::ItemViews
+ KF5::I18n
+ KF5::CoreAddons
+ )
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.cpp
new file mode 100644
index 0000000..bb68874
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.cpp
@@ -0,0 +1,81 @@
+/*
+ Copyright (c) 2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblockautomaticruleslistwidget_gui.h"
+#include "../widgets/adblockautomaticruleslistwidget.h"
+
+#include <KAboutData>
+#include <KLocalizedString>
+#include <QCommandLineParser>
+#include <QHBoxLayout>
+#include <QApplication>
+#include <QStandardPaths>
+#include <QFileDialog>
+
+AdBlockAutomaticRulesListWidgetTest::AdBlockAutomaticRulesListWidgetTest(const QString &fileName, QWidget *parent)
+ : QWidget(parent)
+{
+ QVBoxLayout *lay = new QVBoxLayout(this);
+ QFile localFile(fileName);
+ QString adblockList;
+ if (localFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ adblockList = QString::fromLatin1(localFile.readAll());
+ }
+ AdBlock::AdBlockAutomaticRulesListWidget *list = new AdBlock::AdBlockAutomaticRulesListWidget(this);
+ list->setRules(adblockList);
+ lay->addWidget(list);
+}
+
+AdBlockAutomaticRulesListWidgetTest::~AdBlockAutomaticRulesListWidgetTest()
+{
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QStandardPaths::setTestModeEnabled(true);
+ KAboutData aboutData(QStringLiteral("AdBlockAutomaticRulesListWidget_gui"), i18n("AdBlockAutomaticRulesListWidget_Gui"), QStringLiteral("1.0"));
+ aboutData.setShortDescription(i18n("Test for AdBlockAutomaticRulesListWidget"));
+ QCommandLineParser parser;
+ KAboutData::setApplicationData(aboutData);
+ parser.addVersionOption();
+ parser.addHelpOption();
+ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"), i18n("URL of adblock file list")));
+
+ aboutData.setupCommandLine(&parser);
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
+
+ QString fileName;
+ if (parser.positionalArguments().count()) {
+ fileName = parser.positionalArguments().at(0);
+ } else {
+ fileName = QFileDialog::getOpenFileName(0, QString(), QString(), i18n("Adblock File (*)"));
+ }
+ if (fileName.isEmpty()) {
+ return 0;
+ }
+
+ AdBlockAutomaticRulesListWidgetTest *w = new AdBlockAutomaticRulesListWidgetTest(fileName);
+
+ w->resize(800, 600);
+ w->show();
+ app.exec();
+ delete w;
+ return 0;
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.h
new file mode 100644
index 0000000..c9ebe1e
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblockautomaticruleslistwidget_gui.h
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef TEST_ADBLOCKAUTOMATICRULESLISTWIDGET_GUI_H
+#define TEST_ADBLOCKAUTOMATICRULESLISTWIDGET_GUI_H
+
+#include <QWidget>
+
+class AdBlockAutomaticRulesListWidgetTest : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit AdBlockAutomaticRulesListWidgetTest(const QString &fileName, QWidget *parent = Q_NULLPTR);
+ ~AdBlockAutomaticRulesListWidgetTest();
+};
+
+#endif
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettings_gui.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettings_gui.cpp
new file mode 100644
index 0000000..5572f62
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettings_gui.cpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <QApplication>
+#include <KAboutData>
+#include <KLocalizedString>
+#include <QCommandLineParser>
+#include <QStandardPaths>
+
+#include "../widgets/adblocksettingwidget.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QStandardPaths::setTestModeEnabled(true);
+ KAboutData aboutData(QStringLiteral("adblocksettings_gui"), i18n("adblocksettingstest_Gui"), QStringLiteral("1.0"));
+ aboutData.setShortDescription(i18n("Test for adblocksettings"));
+ QCommandLineParser parser;
+ KAboutData::setApplicationData(aboutData);
+ parser.addVersionOption();
+ parser.addHelpOption();
+ aboutData.setupCommandLine(&parser);
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
+ AdBlock::AdBlockSettingWidget *w = new AdBlock::AdBlockSettingWidget;
+ w->show();
+ return app.exec();
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettingsdialog_gui.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettingsdialog_gui.cpp
new file mode 100644
index 0000000..7bee138
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/tests/adblocksettingsdialog_gui.cpp
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <QDialog>
+#include <QApplication>
+#include <KAboutData>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <KLocalizedString>
+#include <QCommandLineParser>
+#include <QDialogButtonBox>
+#include <QStandardPaths>
+#include "../widgets/adblocksettingwidget.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QStandardPaths::setTestModeEnabled(true);
+ KAboutData aboutData(QStringLiteral("adblocksettings_gui"), i18n("adblocksettingstest_Gui"), QStringLiteral("1.0"));
+ aboutData.setShortDescription(i18n("Test for adblocksettings"));
+ QCommandLineParser parser;
+ KAboutData::setApplicationData(aboutData);
+ parser.addVersionOption();
+ parser.addHelpOption();
+ aboutData.setupCommandLine(&parser);
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
+
+ AdBlock::AdBlockSettingWidget *w = new AdBlock::AdBlockSettingWidget;
+ QDialog dlg;
+ QVBoxLayout *layout = new QVBoxLayout;
+ dlg.setLayout(layout);
+ layout->addWidget(w);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept);
+ QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
+ layout->addWidget(buttonBox);
+
+ w->doLoadFromGlobalSettings();
+ if (dlg.exec()) {
+ w->save();
+ }
+ return 0;
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.cpp
new file mode 100644
index 0000000..a9f1884
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.cpp
@@ -0,0 +1,105 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblockaddsubscriptiondialog.h"
+#include "adblockshowlistdialog.h"
+#include "adblockutil.h"
+
+#include <KLocalizedString>
+
+#include <QComboBox>
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QToolButton>
+#include <QPointer>
+
+using namespace AdBlock;
+AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(const QStringList &excludeList, QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowTitle(i18n("Add subscription"));
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+
+ QWidget *w = new QWidget;
+ QHBoxLayout *lay = new QHBoxLayout;
+ lay->setMargin(0);
+ QLabel *lab = new QLabel(i18n("Select List:"));
+ lab->setObjectName(QStringLiteral("listsubscriptionlabel"));
+ lay->addWidget(lab);
+
+ mListSubscription = new QComboBox;
+ mListSubscription->setObjectName(QStringLiteral("listsubscriptioncombobox"));
+ lay->addWidget(mListSubscription);
+
+ mShowList = new QToolButton;
+ mShowList->setToolTip(i18n("Show List"));
+ mShowList->setObjectName(QStringLiteral("showlisttoolbutton"));
+ mShowList->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
+ lay->addWidget(mShowList);
+ connect(mShowList, &QToolButton::clicked, this, &AdBlockAddSubscriptionDialog::slotShowList);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ buttonBox->setObjectName(QStringLiteral("listsubscriptionbuttonBox"));
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &AdBlockAddSubscriptionDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &AdBlockAddSubscriptionDialog::reject);
+
+ w->setLayout(lay);
+ mainLayout->addWidget(w);
+ mainLayout->addWidget(buttonBox);
+ initializeList(excludeList);
+}
+
+AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog()
+{
+
+}
+
+void AdBlockAddSubscriptionDialog::initializeList(const QStringList &excludeList)
+{
+ QMapIterator<QString, QString> i(AdBlock::AdBlockUtil::listSubscriptions());
+ while (i.hasNext()) {
+ i.next();
+ if (!excludeList.contains(i.key())) {
+ mListSubscription->addItem(i.key(), i.value());
+ }
+ }
+}
+
+void AdBlockAddSubscriptionDialog::selectedList(QString &name, QString &url)
+{
+ name = mListSubscription->currentText();
+ url = mListSubscription->itemData(mListSubscription->currentIndex()).toString();
+}
+
+void AdBlockAddSubscriptionDialog::slotShowList()
+{
+ const QString url = mListSubscription->itemData(mListSubscription->currentIndex()).toString();
+ if (!url.isEmpty()) {
+ QPointer<AdBlockShowListDialog> dlg = new AdBlockShowListDialog(false, this);
+ dlg->setListName(mListSubscription->currentText());
+ dlg->setAdBlockListPath(QString(), url);
+ dlg->exec();
+ delete dlg;
+ }
+}
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.h
new file mode 100644
index 0000000..05e6ee7
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockaddsubscriptiondialog.h
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKADDSUBSCRIPTIONDIALOG_H
+#define ADBLOCKADDSUBSCRIPTIONDIALOG_H
+
+#include <QDialog>
+
+class QComboBox;
+class QToolButton;
+namespace AdBlock
+{
+class AdBlockAddSubscriptionDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit AdBlockAddSubscriptionDialog(const QStringList &excludeList, QWidget *parent = Q_NULLPTR);
+ ~AdBlockAddSubscriptionDialog();
+
+ void selectedList(QString &name, QString &url);
+
+private Q_SLOTS:
+ void slotShowList();
+
+private:
+ void initializeList(const QStringList &excludeList);
+ QComboBox *mListSubscription;
+ QToolButton *mShowList;
+};
+}
+
+#endif // ADBLOCKADDSUBSCRIPTIONDIALOG_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.cpp
new file mode 100644
index 0000000..94673c1
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.cpp
@@ -0,0 +1,109 @@
+/*
+ Copyright (c) 2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblockautomaticruleslistwidget.h"
+
+using namespace AdBlock;
+
+AdBlockAutomaticRulesListWidget::AdBlockAutomaticRulesListWidget(QWidget *parent)
+ : QListWidget(parent)
+{
+ connect(this, &AdBlockAutomaticRulesListWidget::itemChanged, this, &AdBlockAutomaticRulesListWidget::slotItemChanged);
+}
+
+AdBlockAutomaticRulesListWidget::~AdBlockAutomaticRulesListWidget()
+{
+
+}
+
+void AdBlockAutomaticRulesListWidget::slotItemChanged(QListWidgetItem *item)
+{
+ updateItem(item);
+}
+
+void AdBlockAutomaticRulesListWidget::updateItem(QListWidgetItem *item)
+{
+ const bool itemIsChecked = (item->checkState() & Qt::Checked);
+ QFont font = item->font();
+ const QString rule = item->text();
+ if (itemIsChecked) {
+ font.setItalic(false);
+ item->setFont(font);
+ if (rule.contains(QRegularExpression(QStringLiteral("^@@.*")))) {
+ item->setTextColor(Qt::magenta);
+ } else if (rule.contains(QRegularExpression(QStringLiteral("^\\[.*")))) {
+ item->setTextColor(Qt::red);
+ } else if (rule.contains(QRegularExpression(QStringLiteral(".*##.*")))) {
+ item->setTextColor(Qt::blue);
+ } else {
+ if (!defaultTextColor.isValid()) {
+ const QPalette palette = viewport()->palette();
+ defaultTextColor = palette.text().color();
+ }
+ item->setTextColor(defaultTextColor);
+ }
+ } else {
+ font.setItalic(true);
+ item->setFont(font);
+ item->setTextColor(Qt::gray);
+ }
+}
+
+void AdBlockAutomaticRulesListWidget::setDisabledRules(const QStringList &disabledRules)
+{
+ mDisabledRules = disabledRules;
+}
+
+void AdBlockAutomaticRulesListWidget::setRules(const QString &rules)
+{
+ clear();
+ const QStringList lst = rules.split(QLatin1Char('\n'), QString::SkipEmptyParts);
+ Q_FOREACH (const QString &rule, lst) {
+ createItem(rule);
+ }
+}
+
+void AdBlockAutomaticRulesListWidget::createItem(const QString &rule)
+{
+ QListWidgetItem *subItem = new QListWidgetItem(this);
+ subItem->setText(rule);
+ if (rule.startsWith(QLatin1Char('!')) || rule.startsWith(QLatin1Char('['))) {
+ //Comment
+ subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
+ subItem->setTextColor(Qt::gray);
+ } else {
+ subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
+ const bool checkState = mDisabledRules.contains(rule);
+ subItem->setCheckState(checkState ? Qt::Unchecked : Qt::Checked);
+ updateItem(subItem);
+ }
+}
+
+QStringList AdBlockAutomaticRulesListWidget::disabledRules() const
+{
+ QStringList currentDisabledRules;
+ for (int i = 0; i < count(); ++i) {
+ QListWidgetItem *row = item(i);
+ if (row->flags() & Qt::ItemIsUserCheckable) {
+ if (row->checkState() == Qt::Unchecked) {
+ currentDisabledRules << row->text();
+ }
+ }
+ }
+ return currentDisabledRules;
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.h
new file mode 100644
index 0000000..80334a8
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockautomaticruleslistwidget.h
@@ -0,0 +1,47 @@
+/*
+ Copyright (c) 2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKAUTOMATICRULESLISTWIDGET_H
+#define ADBLOCKAUTOMATICRULESLISTWIDGET_H
+
+#include <QListWidget>
+#include "adblocklib_export.h"
+namespace AdBlock
+{
+class ADBLOCKLIB_EXPORT AdBlockAutomaticRulesListWidget : public QListWidget
+{
+ Q_OBJECT
+public:
+ explicit AdBlockAutomaticRulesListWidget(QWidget *parent = Q_NULLPTR);
+ ~AdBlockAutomaticRulesListWidget();
+ void setRules(const QString &rules);
+
+ void setDisabledRules(const QStringList &disabledRules);
+ QStringList disabledRules() const;
+
+private Q_SLOTS:
+ void slotItemChanged(QListWidgetItem *item);
+
+private:
+ void updateItem(QListWidgetItem *item);
+ void createItem(const QString &rule);
+ QStringList mDisabledRules;
+ QColor defaultTextColor;
+};
+}
+
+#endif // ADBLOCKAUTOMATICRULESLISTWIDGET_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.cpp
new file mode 100644
index 0000000..7ca9a36
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.cpp
@@ -0,0 +1,71 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblocklistwidget.h"
+
+#include <KLocalizedString>
+
+#include <QPainter>
+#include <QPaintEvent>
+
+using namespace AdBlock;
+AdBlockListWidget::AdBlockListWidget(QWidget *parent)
+ : QListWidget(parent)
+{
+}
+
+AdBlockListWidget::~AdBlockListWidget()
+{
+
+}
+
+void AdBlockListWidget::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::PaletteChange) {
+ generalPaletteChanged();
+ }
+ QListWidget::changeEvent(event);
+}
+
+void AdBlockListWidget::generalPaletteChanged()
+{
+ const QPalette palette = viewport()->palette();
+ QColor color = palette.text().color();
+ color.setAlpha(128);
+ mTextColor = color;
+}
+
+void AdBlockListWidget::paintEvent(QPaintEvent *event)
+{
+ if (!model() || model()->rowCount() == 0) {
+ QPainter p(viewport());
+
+ QFont font = p.font();
+ font.setItalic(true);
+ p.setFont(font);
+
+ if (!mTextColor.isValid()) {
+ generalPaletteChanged();
+ }
+ p.setPen(mTextColor);
+
+ p.drawText(QRect(0, 0, width(), height()), Qt::AlignCenter, i18n("Not subscription added..."));
+ } else {
+ QListWidget::paintEvent(event);
+ }
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.h
new file mode 100644
index 0000000..c0d3881
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocklistwidget.h
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKLISTWIDGET_H
+#define ADBLOCKLISTWIDGET_H
+
+#include <QListWidget>
+
+class QPaintEvent;
+class QEvent;
+namespace AdBlock
+{
+class AdBlockListWidget : public QListWidget
+{
+ Q_OBJECT
+public:
+ explicit AdBlockListWidget(QWidget *parent = Q_NULLPTR);
+ ~AdBlockListWidget();
+
+private:
+ void generalPaletteChanged();
+
+protected:
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+
+ void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+private:
+ QColor mTextColor;
+};
+}
+
+#endif // ADBLOCKLISTWIDGET_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.cpp
index 3bbc74b..8c408cb 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.cpp
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.cpp
@@ -16,7 +16,7 @@
*/
#include "adblockpluginurlinterceptorconfigurewidget.h"
-#include <MessageViewer/AdBlockSettingWidget>
+#include "adblocksettingwidget.h"
#include <KLocalizedString>
#include <QHBoxLayout>
@@ -27,10 +27,10 @@ AdblockPluginUrlInterceptorConfigureWidget::AdblockPluginUrlInterceptorConfigure
{
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->setMargin(0);
- mConfigureWidget = new MessageViewer::AdBlockSettingWidget(this);
+ mConfigureWidget = new AdBlock::AdBlockSettingWidget(this);
mConfigureWidget->setObjectName(QStringLiteral("configurewidget"));
hbox->addWidget(mConfigureWidget);
- connect(mConfigureWidget, &MessageViewer::AdBlockSettingWidget::settingsChanged, this, &AdblockPluginUrlInterceptorConfigureWidget::configureChanged);
+ connect(mConfigureWidget, &AdBlockSettingWidget::settingsChanged, this, &AdblockPluginUrlInterceptorConfigureWidget::configureChanged);
}
AdblockPluginUrlInterceptorConfigureWidget::~AdblockPluginUrlInterceptorConfigureWidget()
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.h
index 0bffd8a..f649625 100644
--- a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.h
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockpluginurlinterceptorconfigurewidget.h
@@ -21,12 +21,9 @@
#include <WebEngineViewer/NetworkPluginUrlInterceptorConfigureWidget>
#include "adblocklib_export.h"
-namespace MessageViewer
-{
-class AdBlockSettingWidget;
-}
namespace AdBlock
{
+class AdBlockSettingWidget;
class ADBLOCKLIB_EXPORT AdblockPluginUrlInterceptorConfigureWidget : public WebEngineViewer::NetworkPluginUrlInterceptorConfigureWidget
{
Q_OBJECT
@@ -39,7 +36,7 @@ public:
void resetSettings() Q_DECL_OVERRIDE;
private:
- MessageViewer::AdBlockSettingWidget *mConfigureWidget;
+ AdBlock::AdBlockSettingWidget *mConfigureWidget;
};
}
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.cpp
new file mode 100644
index 0000000..20f6d49
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.cpp
@@ -0,0 +1,502 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+* based on code from rekonq
+* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+// Self Includes
+#include "adblocksettingwidget.h"
+#include "ui_settings_adblock.h"
+//#include "adblockl"
+//#include "settings/AdBlocksettings.h"
+#include "adblockaddsubscriptiondialog.h"
+
+//#include "adblock/adblockmanager.h"
+#include "adblockshowlistdialog.h"
+#include "adblockutil.h"
+#include "PimCommon/ConfigureImmutableWidgetUtils"
+using namespace PimCommon::ConfigureImmutableWidgetUtils;
+
+#include "PimCommon/PimUtil"
+
+// KDE Includes
+#include <KSharedConfig>
+
+#include <QIcon>
+
+#include <KMessageBox>
+#include <KLocalizedString>
+#include <QWhatsThisClickedEvent>
+
+// Qt Includes
+#include <QWhatsThis>
+#include <QListWidgetItem>
+#include <QFile>
+#include <QPointer>
+#include <QTextStream>
+#include <QStandardPaths>
+#include <QRegularExpression>
+#include <KRun>
+
+using namespace AdBlock;
+AdBlockSettingWidget::AdBlockSettingWidget(QWidget *parent)
+ : QWidget(parent)
+ , mChanged(false)
+{
+ mUi = new Ui::adblock;
+ mUi->setupUi(this);
+
+ mUi->hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"));
+ connect(mUi->hintLabel, &QLabel::linkActivated, this, &AdBlockSettingWidget::slotInfoLinkActivated);
+ mUi->hintLabel->setContextMenuPolicy(Qt::NoContextMenu);
+
+ mUi->manualFiltersListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
+
+ mUi->searchLine->setListWidget(mUi->manualFiltersListWidget);
+
+ mUi->insertButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
+ connect(mUi->insertButton, &QToolButton::clicked, this, &AdBlockSettingWidget::insertRule);
+
+ mUi->removeButton->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
+ connect(mUi->removeButton, &QPushButton::clicked, this, &AdBlockSettingWidget::removeRule);
+ connect(mUi->removeSubscription, &QPushButton::clicked, this, &AdBlockSettingWidget::slotRemoveSubscription);
+ connect(mUi->manualFiltersListWidget, &QListWidget::currentItemChanged, this, &AdBlockSettingWidget::slotUpdateManualButtons);
+ connect(mUi->manualFiltersListWidget, &QListWidget::itemChanged, this, &AdBlockSettingWidget::hasChanged);
+
+ mUi->spinBox->setSuffix(ki18np(" day", " days"));
+
+ mUi->removeSubscription->setEnabled(false);
+ mUi->showList->setEnabled(false);
+ // Q_EMIT changed signal
+ connect(mUi->checkEnableAdblock, &QCheckBox::stateChanged, this, &AdBlockSettingWidget::hasChanged);
+ connect(mUi->checkHideAds, &QCheckBox::stateChanged, this, &AdBlockSettingWidget::hasChanged);
+ connect(mUi->spinBox, static_cast<void (KPluralHandlingSpinBox::*)(int)>(&KPluralHandlingSpinBox::valueChanged), this, &AdBlockSettingWidget::hasChanged);
+ connect(mUi->addFilters, &QPushButton::clicked, this, &AdBlockSettingWidget::slotAddFilter);
+ connect(mUi->showList, &QPushButton::clicked, this, &AdBlockSettingWidget::slotShowList);
+ connect(mUi->editFilter, &QPushButton::clicked, this, &AdBlockSettingWidget::slotEditFilter);
+
+ connect(mUi->automaticFiltersListWidget, &AdBlock::AdBlockListWidget::itemChanged, this, &AdBlockSettingWidget::hasChanged);
+ connect(mUi->automaticFiltersListWidget, &AdBlock::AdBlockListWidget::currentItemChanged, this, &AdBlockSettingWidget::slotUpdateButtons);
+ connect(mUi->automaticFiltersListWidget, &AdBlock::AdBlockListWidget::itemDoubleClicked, this, &AdBlockSettingWidget::slotAutomaticFilterDouble);
+
+ connect(mUi->importFilters, &QPushButton::clicked, this, &AdBlockSettingWidget::slotImportFilters);
+ connect(mUi->exportFilters, &QPushButton::clicked, this, &AdBlockSettingWidget::slotExportFilters);
+ connect(mUi->addFilterLineEdit, &QLineEdit::textChanged, this, &AdBlockSettingWidget::slotManualFilterLineEditTextChanged);
+ slotUpdateManualButtons();
+ mUi->insertButton->setEnabled(false);
+}
+
+AdBlockSettingWidget::~AdBlockSettingWidget()
+{
+ delete mUi;
+}
+
+void AdBlockSettingWidget::slotManualFilterLineEditTextChanged(const QString &text)
+{
+ mUi->insertButton->setEnabled(!text.isEmpty());
+}
+
+void AdBlockSettingWidget::slotEditFilter()
+{
+ QListWidgetItem *item = mUi->manualFiltersListWidget->currentItem();
+ if (item) {
+ mUi->manualFiltersListWidget->editItem(item);
+ }
+}
+
+void AdBlockSettingWidget::slotUpdateButtons()
+{
+ const bool enabled = mUi->automaticFiltersListWidget->currentItem();
+ mUi->removeSubscription->setEnabled(enabled);
+ mUi->showList->setEnabled(enabled);
+}
+
+void AdBlockSettingWidget::slotUpdateManualButtons()
+{
+ const bool enabled = mUi->manualFiltersListWidget->currentItem();
+ mUi->removeButton->setEnabled(enabled);
+ mUi->editFilter->setEnabled(enabled);
+ mUi->exportFilters->setEnabled(mUi->manualFiltersListWidget->count() > 0);
+}
+
+void AdBlockSettingWidget::slotInfoLinkActivated(const QString &url)
+{
+ Q_UNUSED(url)
+
+ const QString href = QStringLiteral("https://adblockplus.org/en/filters");
+ const QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:"
+ "<ul><li>a shell-style wildcard, e.g. <tt>http://www.example.com/ads*</tt>, "
+ "the wildcards <tt>*?[]</tt> may be used</li>"
+ "<li>a full regular expression by surrounding the string with '<tt>/</tt>', "
+ "e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>"
+ "<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, "
+ "which takes priority over any blacklist (blocking) filter.<br><a href=\'%1\'>%2</a></qt>", href, i18n("More information"));
+
+ QWhatsThis::showText(QCursor::pos(), hintHelpString, this);
+}
+
+bool AdBlockSettingWidget::event(QEvent *event)
+{
+ if (event->type() == QEvent::WhatsThisClicked) {
+ QWhatsThisClickedEvent *clicked = static_cast<QWhatsThisClickedEvent *>(event);
+ new KRun(QUrl(clicked->href()), this);
+ return true;
+ }
+ return QWidget::event(event);
+}
+
+void AdBlockSettingWidget::insertRule()
+{
+ const QString rule = mUi->addFilterLineEdit->text();
+ if (rule.isEmpty()) {
+ return;
+ }
+ const int numberItem(mUi->manualFiltersListWidget->count());
+ for (int i = 0; i < numberItem; ++i) {
+ if (mUi->manualFiltersListWidget->item(i)->text() == rule) {
+ mUi->addFilterLineEdit->clear();
+ return;
+ }
+ }
+
+ addManualFilter(rule);
+ mUi->exportFilters->setEnabled(mUi->manualFiltersListWidget->count() > 0);
+ mUi->addFilterLineEdit->clear();
+ hasChanged();
+}
+
+void AdBlockSettingWidget::removeRule()
+{
+ QList<QListWidgetItem *> select = mUi->manualFiltersListWidget->selectedItems();
+ if (select.isEmpty()) {
+ return;
+ }
+ Q_FOREACH (QListWidgetItem *item, select) {
+ delete item;
+ }
+ mUi->exportFilters->setEnabled(mUi->manualFiltersListWidget->count() > 0);
+ hasChanged();
+}
+
+void AdBlockSettingWidget::doResetToDefaultsOther()
+{
+#if 0 //FIXME
+ const bool bUseDefaults = AdBlock::AdBlockSettings::self()->useDefaults(true);
+ loadWidget(mUi->checkEnableAdblock, AdBlock::AdBlockSettings::self()->adBlockEnabledItem());
+ mUi->tabWidget->setEnabled(AdBlock::AdBlockSettings::self()->adBlockEnabled());
+ saveCheckBox(mUi->checkHideAds, AdBlock::AdBlockSettings::self()->hideAdsEnabledItem());
+ loadWidget(mUi->spinBox, AdBlock::AdBlockSettings::self()->adBlockUpdateIntervalItem());
+ AdBlock::AdBlockSettings::self()->useDefaults(bUseDefaults);
+#endif
+}
+
+void AdBlockSettingWidget::doLoadFromGlobalSettings()
+{
+ mUi->manualFiltersListWidget->clear();
+ mUi->automaticFiltersListWidget->clear();
+#if 0 //FIXME
+ loadWidget(mUi->checkEnableAdblock, AdBlock::AdBlockSettings::self()->adBlockEnabledItem());
+
+ // update enabled status
+ mUi->tabWidget->setEnabled(AdBlock::AdBlockSettings::self()->adBlockEnabled());
+ loadWidget(mUi->checkHideAds, AdBlock::AdBlockSettings::self()->hideAdsEnabledItem());
+ loadWidget(mUi->spinBox, AdBlock::AdBlockSettings::self()->adBlockUpdateIntervalItem());
+#endif
+ // ------------------------------------------------------------------------------
+
+ // automatic filters
+ KConfig config(QStringLiteral("AdBlockadblockrc"));
+
+ const QStringList itemList = config.groupList().filter(QRegularExpression(QStringLiteral("FilterList \\d+")));
+ Q_FOREACH (const QString &item, itemList) {
+ KConfigGroup filtersGroup(&config, item);
+ const bool isFilterEnabled = filtersGroup.readEntry(QStringLiteral("FilterEnabled"), false);
+ const QString url = filtersGroup.readEntry(QStringLiteral("url"));
+ const QString path = filtersGroup.readEntry(QStringLiteral("path"));
+ const QString name = filtersGroup.readEntry(QStringLiteral("name"));
+ const QDateTime lastUpdate = filtersGroup.readEntry(QStringLiteral("lastUpdate"), QDateTime());
+ if (url.isEmpty() || path.isEmpty() || name.isEmpty()) {
+ continue;
+ }
+
+ QListWidgetItem *subItem = new QListWidgetItem(mUi->automaticFiltersListWidget);
+ subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
+ if (isFilterEnabled) {
+ subItem->setCheckState(Qt::Checked);
+ } else {
+ subItem->setCheckState(Qt::Unchecked);
+ }
+
+ subItem->setData(UrlList, url);
+ subItem->setData(PathList, path);
+ subItem->setData(LastUpdateList, lastUpdate);
+ subItem->setText(name);
+ }
+
+ // ------------------------------------------------------------------------------
+
+ // local filters
+ const QString localRulesFilePath = AdBlock::AdBlockUtil::localFilterPath();
+
+ QFile ruleFile(localRulesFilePath);
+ if (!ruleFile.open(QFile::ReadOnly | QFile::Text)) {
+ //FIXME qCDebug(AdBlock_LOG) << "Unable to open rule file" << localRulesFilePath;
+ return;
+ }
+
+ KConfigGroup grp = config.group(QStringLiteral("DisableRules"));
+ const QStringList disableRules = grp.readEntry("DisableRules", QStringList());
+
+ QTextStream in(&ruleFile);
+ while (!in.atEnd()) {
+ QString stringRule = in.readLine();
+ addManualFilter(stringRule, disableRules);
+ }
+ updateCheckBox();
+}
+
+void AdBlockSettingWidget::save()
+{
+ if (!mChanged) {
+ return;
+ }
+
+ // General settings
+#if 0 //FIXME
+ saveCheckBox(mUi->checkEnableAdblock, AdBlock::AdBlockSettings::self()->adBlockEnabledItem());
+ saveCheckBox(mUi->checkHideAds, AdBlock::AdBlockSettings::self()->hideAdsEnabledItem());
+ saveSpinBox(mUi->spinBox, AdBlock::AdBlockSettings::self()->adBlockUpdateIntervalItem());
+#endif
+ // automatic filters
+ KConfig config(QStringLiteral("AdBlockadblockrc"));
+ const QStringList list = config.groupList().filter(QRegularExpression(QStringLiteral("FilterList \\d+")));
+ foreach (const QString &group, list) {
+ config.deleteGroup(group);
+ }
+
+ const int numberItem(mUi->automaticFiltersListWidget->count());
+ for (int i = 0; i < numberItem; ++i) {
+ QListWidgetItem *subItem = mUi->automaticFiltersListWidget->item(i);
+ KConfigGroup grp = config.group(QStringLiteral("FilterList %1").arg(i));
+ grp.writeEntry(QStringLiteral("FilterEnabled"), subItem->checkState() == Qt::Checked);
+ grp.writeEntry(QStringLiteral("url"), subItem->data(UrlList).toString());
+ grp.writeEntry(QStringLiteral("name"), subItem->text());
+ if (subItem->data(LastUpdateList).toDateTime().isValid()) {
+ grp.writeEntry(QStringLiteral("lastUpdate"), subItem->data(LastUpdateList).toDateTime());
+ }
+ QString path = subItem->data(PathList).toString();
+ if (path.isEmpty()) {
+ path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QStringLiteral("kmail2/adblockrules-%1").arg(i);
+ }
+ grp.writeEntry(QStringLiteral("path"), path);
+ }
+
+ config.sync();
+ // local filters
+ const QString localRulesFilePath = AdBlock::AdBlockUtil::localFilterPath();
+
+ QFile ruleFile(localRulesFilePath);
+ if (!ruleFile.open(QFile::WriteOnly | QFile::Text)) {
+ //FIXME qCDebug(AdBlock_LOG) << "Unable to open rule file" << localRulesFilePath;
+ return;
+ }
+
+ QStringList disableCustomFilter;
+ QTextStream out(&ruleFile);
+ for (int i = 0; i < mUi->manualFiltersListWidget->count(); ++i) {
+ QListWidgetItem *subItem = mUi->manualFiltersListWidget->item(i);
+ const QString stringRule = subItem->text();
+ if (!stringRule.trimmed().isEmpty()) {
+ out << stringRule << '\n';
+ }
+ if (subItem->checkState() == Qt::Unchecked) {
+ disableCustomFilter << stringRule;
+ }
+ }
+
+ if (!disableCustomFilter.isEmpty()) {
+ KConfigGroup grp = config.group(QStringLiteral("DisableRules"));
+ grp.writeEntry("DisableRules", disableCustomFilter);
+ } else {
+ config.deleteGroup(QStringLiteral("DisableRules"));
+ }
+ // -------------------------------------------------------------------------------
+ mChanged = false;
+ Q_EMIT changed(false);
+#ifdef AdBlock_USE_QTWEBENGINE
+ //FIXME
+#else
+ //FIXME AdBlockManager::self()->reloadConfig();
+#endif
+}
+
+void AdBlockSettingWidget::updateCheckBox()
+{
+ // update enabled status
+ mUi->checkHideAds->setEnabled(mUi->checkEnableAdblock->isChecked());
+ mUi->tabWidget->setEnabled(mUi->checkEnableAdblock->isChecked());
+}
+
+void AdBlockSettingWidget::hasChanged()
+{
+ updateCheckBox();
+ mChanged = true;
+ Q_EMIT changed(true);
+ Q_EMIT settingsChanged();
+}
+
+bool AdBlockSettingWidget::changed() const
+{
+ return mChanged;
+}
+
+void AdBlockSettingWidget::slotAddFilter()
+{
+ QStringList excludeList;
+ const int numberItem(mUi->automaticFiltersListWidget->count());
+ excludeList.reserve(numberItem);
+ for (int i = 0; i < numberItem; ++i) {
+ excludeList << mUi->automaticFiltersListWidget->item(i)->text();
+ }
+ QPointer<AdBlock::AdBlockAddSubscriptionDialog> dlg = new AdBlock::AdBlockAddSubscriptionDialog(excludeList, this);
+ if (dlg->exec()) {
+ QString name;
+ QString url;
+ dlg->selectedList(name, url);
+ QListWidgetItem *subItem = new QListWidgetItem(mUi->automaticFiltersListWidget);
+ subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
+ subItem->setCheckState(Qt::Checked);
+ subItem->setText(name);
+ subItem->setData(UrlList, url);
+ subItem->setData(LastUpdateList, QDateTime());
+ subItem->setData(PathList, QString());
+ hasChanged();
+ }
+ delete dlg;
+}
+
+void AdBlockSettingWidget::slotRemoveSubscription()
+{
+ QListWidgetItem *item = mUi->automaticFiltersListWidget->currentItem();
+ if (item) {
+ if (KMessageBox::questionYesNo(this, i18n("Do you want to delete list \"%1\"?", item->text()), i18n("Delete current list")) == KMessageBox::Yes) {
+ const QString path = item->data(PathList).toString();
+ if (!path.isEmpty()) {
+ if (!QFile(path).remove()) {
+ //FIXME qCDebug(AdBlock_LOG) << " we can not remove file:" << path;
+ }
+ }
+ delete item;
+ }
+ hasChanged();
+ }
+}
+
+void AdBlockSettingWidget::slotShowList()
+{
+ showAutomaticFilterList(mUi->automaticFiltersListWidget->currentItem());
+}
+
+void AdBlockSettingWidget::showAutomaticFilterList(QListWidgetItem *item)
+{
+ if (item) {
+ QPointer<AdBlockShowListDialog> dlg = new AdBlockShowListDialog(true, this);
+ dlg->setListName(item->text());
+ dlg->setAdBlockListPath(item->data(PathList).toString(), item->data(UrlList).toString());
+ connect(dlg.data(), &AdBlockShowListDialog::deleteList, this, &AdBlockSettingWidget::slotDeleteList);
+ dlg->exec();
+ delete dlg;
+ }
+}
+
+void AdBlockSettingWidget::slotDeleteList(const QString &listName)
+{
+ QListWidgetItem *item = mUi->automaticFiltersListWidget->currentItem();
+ if (item && item->text() == listName) {
+ const QString path = item->data(PathList).toString();
+ if (!path.isEmpty()) {
+ if (!QFile(path).remove()) {
+ //FIXME qCDebug(AdBlock_LOG) << " we can not remove file:" << path;
+ }
+ }
+ delete item;
+ hasChanged();
+ }
+}
+
+void AdBlockSettingWidget::slotImportFilters()
+{
+ const QString filter = i18n("All Files (*)");
+ const QString result = PimCommon::Util::loadToFile(filter, this, i18n("Import Filters"));
+ if (result.isEmpty()) {
+ return;
+ }
+ const QStringList listFilter = result.split(QLatin1Char('\n'));
+ QStringList excludeFilter;
+ const int numberOfElements(mUi->manualFiltersListWidget->count());
+ excludeFilter.reserve(numberOfElements);
+ for (int i = 0; i < numberOfElements; ++i) {
+ QListWidgetItem *subItem = mUi->manualFiltersListWidget->item(i);
+ excludeFilter.append(subItem->text());
+ }
+
+ Q_FOREACH (const QString &element, listFilter) {
+ if (element == QLatin1String("\n")) {
+ continue;
+ }
+ if (excludeFilter.contains(element)) {
+ continue;
+ }
+ addManualFilter(element);
+ }
+}
+
+void AdBlockSettingWidget::addManualFilter(const QString &text, const QStringList &excludeRules)
+{
+ QListWidgetItem *subItem = new QListWidgetItem(mUi->manualFiltersListWidget);
+ subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
+ subItem->setCheckState(excludeRules.contains(text) ? Qt::Unchecked : Qt::Checked);
+ subItem->setText(text);
+}
+
+void AdBlockSettingWidget::slotExportFilters()
+{
+ const QString filter = i18n("All Files (*)");
+ QString exportFilters;
+ const int numberOfElement(mUi->manualFiltersListWidget->count());
+ for (int i = 0; i < numberOfElement; ++i) {
+ QListWidgetItem *subItem = mUi->manualFiltersListWidget->item(i);
+ const QString stringRule = subItem->text();
+ if (!stringRule.isEmpty()) {
+ exportFilters += stringRule + QLatin1Char('\n');
+ }
+ }
+ PimCommon::Util::saveTextAs(exportFilters, filter, this, QUrl(), i18n("Export Filters"));
+}
+
+void AdBlockSettingWidget::slotAutomaticFilterDouble(QListWidgetItem *item)
+{
+ showAutomaticFilterList(item);
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.h
new file mode 100644
index 0000000..5a46a3b
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksettingwidget.h
@@ -0,0 +1,94 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+* Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+* based on code from rekonq
+* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+#ifndef AD_BLOCK_SETTINGS_WIDGET_H
+#define AD_BLOCK_SETTINGS_WIDGET_H
+
+#include "adblocklib_export.h"
+
+// Qt Includes
+#include <QWidget>
+
+class QListWidgetItem;
+
+namespace Ui
+{
+class adblock;
+}
+
+namespace AdBlock
+{
+class ADBLOCKLIB_EXPORT AdBlockSettingWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit AdBlockSettingWidget(QWidget *parent = Q_NULLPTR);
+ virtual ~AdBlockSettingWidget();
+
+ bool changed() const;
+
+ void save();
+ void doLoadFromGlobalSettings();
+ void doResetToDefaultsOther();
+
+Q_SIGNALS:
+ void changed(bool);
+ void settingsChanged();
+
+protected:
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+private Q_SLOTS:
+ void hasChanged();
+ void slotInfoLinkActivated(const QString &);
+ void insertRule();
+ void removeRule();
+ void slotAddFilter();
+ void slotRemoveSubscription();
+ void slotUpdateButtons();
+ void slotShowList();
+ void slotImportFilters();
+ void slotExportFilters();
+ void slotUpdateManualButtons();
+ void slotEditFilter();
+ void slotManualFilterLineEditTextChanged(const QString &);
+ void slotAutomaticFilterDouble(QListWidgetItem *item);
+ void slotDeleteList(const QString &listName);
+private:
+ void updateCheckBox();
+ void addManualFilter(const QString &text, const QStringList &excludeRules = QStringList());
+ void showAutomaticFilterList(QListWidgetItem *item);
+ enum List {
+ UrlList = Qt::UserRole + 1,
+ PathList = Qt::UserRole + 2,
+ LastUpdateList = Qt::UserRole + 3
+ };
+ Ui::adblock *mUi;
+ bool mChanged;
+};
+}
+
+#endif // AD_BLOCK_SETTINGS_WIDGET_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.cpp
new file mode 100644
index 0000000..d485618
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.cpp
@@ -0,0 +1,160 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblockshowlistdialog.h"
+#include "adblocksyntaxhighlighter.h"
+#include "kpimtextedit/plaintexteditorwidget.h"
+#include "kpimtextedit/plaintexteditor.h"
+#include "Libkdepim/ProgressIndicatorLabel"
+
+#include <KLocalizedString>
+#include <KIO/Job>
+#include <QTemporaryFile>
+#include <KSharedConfig>
+#include <QUrl>
+
+#include <QDialogButtonBox>
+#include <KConfigGroup>
+#include <QPushButton>
+#include <QVBoxLayout>
+
+using namespace AdBlock;
+AdBlockShowListDialog::AdBlockShowListDialog(bool showDeleteBrokenList, QWidget *parent)
+ : QDialog(parent),
+ mTemporaryFile(Q_NULLPTR),
+ mUser1Button(Q_NULLPTR)
+{
+ setWindowTitle(i18n("Show adblock list"));
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &AdBlockShowListDialog::reject);
+ if (showDeleteBrokenList) {
+ mUser1Button = new QPushButton;
+ buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
+ mUser1Button->setText(i18n("Delete List"));
+ mUser1Button->setEnabled(false);
+ mUser1Button->hide();
+ connect(mUser1Button, &QPushButton::clicked, this, &AdBlockShowListDialog::slotDeleteBrokenList);
+ }
+ QWidget *w = new QWidget;
+ QVBoxLayout *lay = new QVBoxLayout;
+ mTextEdit = new KPIMTextEdit::PlainTextEditorWidget;
+ (void)new AdBlock::AdBlockSyntaxHighlighter(mTextEdit->editor()->document());
+ mTextEdit->setReadOnly(true);
+ lay->addWidget(mTextEdit);
+
+ mProgress = new KPIM::ProgressIndicatorLabel(i18n("Download..."));
+ lay->addWidget(mProgress);
+ w->setLayout(lay);
+ mainLayout->addWidget(w);
+ mainLayout->addWidget(buttonBox);
+ readConfig();
+}
+
+AdBlockShowListDialog::~AdBlockShowListDialog()
+{
+ delete mTemporaryFile;
+ writeConfig();
+}
+
+void AdBlockShowListDialog::writeConfig()
+{
+ KConfigGroup group(KSharedConfig::openConfig(), "AdBlockShowListDialog");
+ group.writeEntry("Size", size());
+}
+
+void AdBlockShowListDialog::readConfig()
+{
+ KConfigGroup group(KSharedConfig::openConfig(), "AdBlockShowListDialog");
+ const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
+ if (sizeDialog.isValid()) {
+ resize(sizeDialog);
+ }
+}
+
+void AdBlockShowListDialog::setAdBlockListPath(const QString &localPath, const QString &url)
+{
+ if (localPath.isEmpty()) {
+ downLoadList(url);
+ } else {
+ QFile file(localPath);
+ if (file.open(QFile::ReadOnly | QFile::Text)) {
+ mTextEdit->editor()->setPlainText(QString::fromUtf8(file.readAll()));
+ } else {
+ downLoadList(url);
+ }
+ }
+}
+
+void AdBlockShowListDialog::downLoadList(const QString &url)
+{
+ delete mTemporaryFile;
+ mTemporaryFile = new QTemporaryFile;
+ if (!mTemporaryFile->open()) {
+ //FIXME qCDebug(MESSAGEVIEWER_LOG) << "can not open temporary file";
+ delete mTemporaryFile;
+ mTemporaryFile = 0;
+ return;
+ }
+ QUrl subUrl(url);
+
+ QUrl destUrl = QUrl::fromLocalFile(mTemporaryFile->fileName());
+
+ mProgress->start();
+ KIO::FileCopyJob *job = KIO::file_copy(subUrl, destUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ KIO::MetaData metadata = job->metaData();
+ metadata.insert(QStringLiteral("ssl_no_client_cert"), QStringLiteral("TRUE"));
+ metadata.insert(QStringLiteral("ssl_no_ui"), QStringLiteral("TRUE"));
+ metadata.insert(QStringLiteral("UseCache"), QStringLiteral("false"));
+ metadata.insert(QStringLiteral("cookies"), QStringLiteral("none"));
+ metadata.insert(QStringLiteral("no-auth"), QStringLiteral("true"));
+ job->setMetaData(metadata);
+
+ connect(job, &KIO::FileCopyJob::finished, this, &AdBlockShowListDialog::slotFinished);
+}
+
+void AdBlockShowListDialog::slotFinished(KJob *job)
+{
+ mProgress->stop();
+ if (job->error()) {
+ mTextEdit->editor()->setPlainText(i18n("An error occurs during download list: \"%1\"", job->errorString()));
+ if (mUser1Button) {
+ mUser1Button->show();
+ mUser1Button->setEnabled(true);
+ }
+ } else {
+ QFile f(mTemporaryFile->fileName());
+ if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ mTextEdit->editor()->setPlainText(QString::fromUtf8(f.readAll()));
+ }
+ }
+ mTemporaryFile->close();
+ delete mTemporaryFile;
+ mTemporaryFile = 0;
+}
+
+void AdBlockShowListDialog::slotDeleteBrokenList()
+{
+ Q_EMIT deleteList(mListName);
+ accept();
+}
+
+void AdBlockShowListDialog::setListName(const QString &listName)
+{
+ mListName = listName;
+}
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.h
new file mode 100644
index 0000000..e1386c9
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockshowlistdialog.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKSHOWLISTDIALOG_H
+#define ADBLOCKSHOWLISTDIALOG_H
+
+#include <QDialog>
+
+class KJob;
+class QTemporaryFile;
+
+namespace KPIM
+{
+class ProgressIndicatorLabel;
+}
+
+namespace KPIMTextEdit
+{
+class PlainTextEditorWidget;
+}
+class QPushButton;
+namespace AdBlock
+{
+class AdBlockShowListDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit AdBlockShowListDialog(bool showDeleteBrokenList, QWidget *parent = Q_NULLPTR);
+ ~AdBlockShowListDialog();
+
+ void setAdBlockListPath(const QString &localPath, const QString &url);
+
+ void setListName(const QString &listName);
+private Q_SLOTS:
+ void slotFinished(KJob *job);
+ void slotDeleteBrokenList();
+
+Q_SIGNALS:
+ void deleteList(const QString &name);
+
+private:
+ void readConfig();
+ void writeConfig();
+ void downLoadList(const QString &url);
+
+ QString mListName;
+ KPIMTextEdit::PlainTextEditorWidget *mTextEdit;
+ QTemporaryFile *mTemporaryFile;
+ KPIM::ProgressIndicatorLabel *mProgress;
+ QPushButton *mUser1Button;
+};
+}
+
+#endif // ADBLOCKSHOWLISTDIALOG_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.cpp
new file mode 100644
index 0000000..0ff4309
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.cpp
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblocksyntaxhighlighter.h"
+
+using namespace AdBlock;
+
+AdBlockSyntaxHighlighter::AdBlockSyntaxHighlighter(QTextDocument *doc)
+ : KPIMTextEdit::SyntaxHighlighterBase(doc)
+{
+ init();
+}
+
+AdBlockSyntaxHighlighter::~AdBlockSyntaxHighlighter()
+{
+}
+
+void AdBlockSyntaxHighlighter::init()
+{
+ QTextCharFormat commentFormat;
+ commentFormat.setForeground(Qt::darkYellow);
+ QRegularExpression commentRegex(QStringLiteral("^!.*"));
+ m_rules.append(KPIMTextEdit::Rule(commentRegex, commentFormat));
+
+ QTextCharFormat exceptionFormat;
+ exceptionFormat.setForeground(Qt::magenta);
+ QRegularExpression exceptionRegex(QStringLiteral("^@@.*"));
+ m_rules.append(KPIMTextEdit::Rule(exceptionRegex, exceptionFormat));
+
+ QTextCharFormat headerFormat;
+ headerFormat.setForeground(Qt::red);
+ QRegularExpression headerRegex(QStringLiteral("^\\[.*"));
+ m_rules.append(KPIMTextEdit::Rule(headerRegex, headerFormat));
+
+ QTextCharFormat elementFormat;
+ elementFormat.setForeground(Qt::blue);
+ QRegularExpression elementRegex(QStringLiteral(".*##.*"));
+ m_rules.append(KPIMTextEdit::Rule(elementRegex, elementFormat));
+}
+
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.h
new file mode 100644
index 0000000..fe6cc0a
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblocksyntaxhighlighter.h
@@ -0,0 +1,37 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKSYNTAXHIGHLIGHTER_H
+#define ADBLOCKSYNTAXHIGHLIGHTER_H
+
+#include <KPIMTextEdit/SyntaxHighlighterBase>
+
+namespace AdBlock
+{
+class AdBlockSyntaxHighlighter : public KPIMTextEdit::SyntaxHighlighterBase
+{
+ Q_OBJECT
+public:
+ explicit AdBlockSyntaxHighlighter(QTextDocument *doc);
+ ~AdBlockSyntaxHighlighter();
+
+private:
+ void init() Q_DECL_OVERRIDE;
+};
+}
+
+#endif // ADBLOCKSYNTAXHIGHLIGHTER_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.cpp b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.cpp
new file mode 100644
index 0000000..ea5b3fe
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.cpp
@@ -0,0 +1,71 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "adblockutil.h"
+
+#include <QStandardPaths>
+
+QMap<QString, QString> AdBlock::AdBlockUtil::listSubscriptions()
+{
+ QMap<QString, QString> lst;
+ lst.insert(QStringLiteral("EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist.txt"));
+ lst.insert(QStringLiteral("EasyList without element hiding"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist_noelemhide.txt"));
+ lst.insert(QStringLiteral("Corset"), QStringLiteral("http://brianyi.com/corset.txt"));
+ lst.insert(QStringLiteral("EasyList Germany+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/ares+easylist.txt"));
+ lst.insert(QStringLiteral("EasyList Germany"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylistgermany.txt"));
+ lst.insert(QStringLiteral("Liste FR+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/liste_fr+easylist.txt"));
+ lst.insert(QStringLiteral("Liste FR"), QStringLiteral("http://lian.info.tm/liste_fr.txt"));
+ lst.insert(QStringLiteral("ROList+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/rolist+easylist.txt"));
+ lst.insert(QStringLiteral("ROList"), QStringLiteral("http://www.picpoc.ro/menetzrolist.txt"));
+ lst.insert(QStringLiteral("Việt Nam List"), QStringLiteral("http://adblockplus-vietnam.googlecode.com/svn/trunk/abpvn.txt"));
+ lst.insert(QStringLiteral("AdblockList.org"), QStringLiteral("http://adblocklist.org/adblock-pxf-polish.txt"));
+ lst.insert(QStringLiteral("Bulgarian list"), QStringLiteral("http://stanev.org/abp/adblock_bg.txt"));
+ lst.insert(QStringLiteral("EasyPrivacy+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt"));
+ lst.insert(QStringLiteral("EasyPrivacy+Cédrics Liste"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+cedrics.txt"));
+ lst.insert(QStringLiteral("EasyPrivacy"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy.txt"));
+ lst.insert(QStringLiteral("void.gr"), QStringLiteral("http://www.void.gr/kargig/void-gr-filters.txt"));
+ //lst.insert(QStringLiteral("Wiltteri"), QStringLiteral("http://www.wiltteri.net/wiltteri.txt"));
+ lst.insert(QStringLiteral("ChinaList"), QStringLiteral("http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt"));
+ lst.insert(QStringLiteral("Filter von Dr.Evil"), QStringLiteral("http://adblock.maltekraus.de/adblock.txt"));
+ lst.insert(QStringLiteral("RuAdList"), QStringLiteral("http://ruadlist.googlecode.com/svn/trunk/adblock.txt"));
+ //lst.insert(QStringLiteral("AdblockRules.org"), QStringLiteral("http://adblockrules.org/download.php?typeall"));
+ lst.insert(QStringLiteral("BSI Lista Polska"), QStringLiteral("http://www.bsi.info.pl/filtrABP.txt"));
+ lst.insert(QStringLiteral("Czech List"), QStringLiteral("http://dajbych.net/adblock.txt"));
+ lst.insert(QStringLiteral("Cédrics Liste"), QStringLiteral("http://chewey.de/mozilla/data/adblock.txt"));
+ lst.insert(QStringLiteral("Fanboy's List"), QStringLiteral("http://www.fanboy.co.nz/adblock/fanboy-adblocklist-current-expanded.txt"));
+ lst.insert(QStringLiteral("Filter von MonztA"), QStringLiteral("http://monzta.maltekraus.de/adblock.txt"));
+ lst.insert(QStringLiteral("hufilter"), QStringLiteral("http://pete.teamlupus.hu/hufilter.txt"));
+ lst.insert(QStringLiteral("Iceland List"), QStringLiteral("http://adblock-iceland.googlecode.com/files/icelandic%20filter.txt"));
+ lst.insert(QStringLiteral("Japanese General Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_general.txt"));
+ lst.insert(QStringLiteral("Japanese Site-Specific Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_site_specific.txt"));
+ lst.insert(QStringLiteral("NLBlock"), QStringLiteral("http://www.verzijlbergh.com/adblock/nlblock.txt"));
+ lst.insert(QStringLiteral("PLgeneral"), QStringLiteral("http://www.niecko.pl/adblock/adblock.txt"));
+ lst.insert(QStringLiteral("Schacks Adblock Plus liste"), QStringLiteral("http://adblock.schack.dk/block.txt"));
+ lst.insert(QStringLiteral("Xfiles"), QStringLiteral("http://mozilla.gfsolone.com/filtri.txt"));
+ lst.insert(QStringLiteral("adblock.free.fr"), QStringLiteral("http://adblock.free.fr/adblock.txt"));
+ lst.insert(QStringLiteral("adblock.free.fr basic (bloque les pubs uniquement)"), QStringLiteral("http://adblock.free.fr/adblock_basic.txt"));
+ lst.insert(QStringLiteral("Ajnasz's list"), QStringLiteral("http://ajnasz.hu/adblock/recent"));
+ lst.insert(QStringLiteral("Schuzak's Universal Filter"), QStringLiteral("http://www.schuzak.jp/other/abp.txt"));
+ lst.insert(QStringLiteral("Rickroll Blacklist"), QStringLiteral("http://rickrolldb.com/ricklist.txt"));
+ lst.insert(QStringLiteral("Corset+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/corset+easylist.txt"));
+ return lst;
+}
+
+QString AdBlock::AdBlockUtil::localFilterPath()
+{
+ return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kmail2/adblockrules_local");
+}
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.h b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.h
new file mode 100644
index 0000000..93e1059
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/adblockutil.h
@@ -0,0 +1,35 @@
+/*
+ Copyright (c) 2013-2016 Montel Laurent <[email protected]>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ADBLOCKUTIL_H
+#define ADBLOCKUTIL_H
+
+#include <QString>
+#include <QMap>
+
+namespace AdBlock
+{
+namespace AdBlockUtil
+{
+QMap<QString, QString> listSubscriptions();
+
+QString localFilterPath();
+
+}
+}
+
+#endif // ADBLOCKUTIL_H
diff --git a/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/settings_adblock.ui b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/settings_adblock.ui
new file mode 100644
index 0000000..b877da9
--- /dev/null
+++ b/plugins/messageviewerwebengineurlinterceptor/adblock/lib/widgets/settings_adblock.ui
@@ -0,0 +1,256 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>adblock</class>
+ <widget class="QWidget" name="adblock">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>601</width>
+ <height>507</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="checkEnableAdblock">
+ <property name="text">
+ <string>&amp;Enable Ad Block</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkHideAds">
+ <property name="text">
+ <string>&amp;Hide filtered elements</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_3">
+ <attribute name="title">
+ <string>Automatic Filters</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="1">
+ <widget class="QPushButton" name="addFilters">
+ <property name="text">
+ <string>Add Filters subscriptions...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" rowspan="4">
+ <widget class="AdBlock::AdBlockListWidget" name="automaticFiltersListWidget">
+ <property name="dragEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="dragDropOverwriteMode">
+ <bool>false</bool>
+ </property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::InternalMove</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="removeSubscription">
+ <property name="text">
+ <string>Remove subscription</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>301</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Update enabled automatic filters every:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KPluralHandlingSpinBox" name="spinBox">
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>7</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="showList">
+ <property name="text">
+ <string>Show List...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Manual Filters</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="7" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="addFilterLineEdit"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="insertButton">
+ <property name="toolTip">
+ <string>Add filter expression</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="1">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>252</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="hintLabel">
+ <property name="text">
+ <string comment="KDE::DoNotExtract">TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" rowspan="5">
+ <widget class="QListWidget" name="manualFiltersListWidget">
+ <property name="dragEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::InternalMove</enum>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::MultiSelection</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="importFilters">
+ <property name="text">
+ <string>Import Filters...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="exportFilters">
+ <property name="text">
+ <string>Export filters...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KListWidgetSearchLine" name="searchLine"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="editFilter">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QPushButton" name="removeButton">
+ <property name="toolTip">
+ <string>Remove filter expression</string>
+ </property>
+ <property name="text">
+ <string>Remove Filter</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KPluralHandlingSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>KPluralHandlingSpinBox</header>
+ </customwidget>
+ <customwidget>
+ <class>AdBlock::AdBlockListWidget</class>
+ <extends>QListWidget</extends>
+ <header>widgets/adblocklistwidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>KListWidgetSearchLine</class>
+ <extends>KLineEdit</extends>
+ <header>klistwidgetsearchline.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>