Commit 073c0f29 authored by Laurent Montel's avatar Laurent Montel 😁

Reactivate save/load settings

parent 403aaea3
......@@ -53,6 +53,7 @@ bool AdblockInterceptorInterface::interceptRequest(QWebEngineUrlRequestInfo &inf
QList<QAction *> AdblockInterceptorInterface::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const
{
QList<QAction *> lstAction;
qDebug()<<" mAdblockManager->isEnabled()"<<mAdblockManager->isEnabled();
if (mAdblockManager->isEnabled()) {
lstAction.append(mShowBlockableItems);
if (!result.imageUrl().isEmpty()) {
......
......@@ -27,6 +27,11 @@ set(adblocklibprivate_SRCS
${messageviewer_adblock_lib_common_SRCS}
)
kconfig_add_kcfg_files(adblocklibprivate_SRCS
settings/globalsettings_webengineurlinterceptoradblock.kcfgc
)
ki18n_wrap_ui(adblocklibprivate_SRCS widgets/ui/adblockcreatefilterwidget.ui widgets/ui/settings_adblock.ui)
add_library(adblocklibprivate ${adblocklibprivate_SRCS})
......
File=webengineurlinterceptoradblock.kcfg
ClassName=AdBlockSettings
NameSpace=AdBlock
Mutators=true
Singleton=true
ItemAccessors=true
SetUserTexts=true
<?xml version="1.0" encoding="utf-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name="webengineurlinterceptoradblockrc" />
<group name="General">
<entry name="AdBlockEnabled" type="Bool">
<label>Enabled ad block</label>
<default>false</default>
</entry>
<entry name="HideAdsEnabled" type="Bool">
<label>Hide advertisement enabled</label>
<default>false</default>
</entry>
<entry name="AdBlockUpdateInterval" type="int">
<label>Update interval list of adblock</label>
<default>7</default>
</entry>
</group>
</kcfg>
......@@ -28,8 +28,7 @@
// Self Includes
#include "adblocksettingwidget.h"
#include "ui_settings_adblock.h"
//#include "adblockl"
//#include "settings/AdBlocksettings.h"
#include "globalsettings_webengineurlinterceptoradblock.h"
#include "adblockaddsubscriptiondialog.h"
//#include "adblock/adblockmanager.h"
......@@ -201,28 +200,24 @@ void AdBlockSettingWidget::removeRule()
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
......@@ -283,11 +278,9 @@ void AdBlockSettingWidget::save()
}
// 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+")));
......
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