summaryrefslogtreecommitdiff
path: root/src/adblock
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-08-19 01:18:17 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-08-19 01:18:17 +0200
commitb56648b2d624ad5933bbfae0dcac6f65bb96bd3b (patch)
treee86423eb28a17d5c2e3c9d977ebd05026767d962 /src/adblock
parentfixes wrong comment in rekonqui.rc that could lead to a parsing error that le... (diff)
downloadrekonq-b56648b2d624ad5933bbfae0dcac6f65bb96bd3b.tar.xz
Fix saving in adblock management
This original patch from fritz_van_tom has been modified by me to fix a couple of "obsoleted" things not removed in the previous changes. My fault for them (and for the need of this patch), sorry. REVIEW: 102362
Diffstat (limited to 'src/adblock')
-rw-r--r--src/adblock/adblockmanager.cpp6
-rw-r--r--src/adblock/adblockwidget.cpp3
-rw-r--r--src/adblock/adblockwidget.h4
3 files changed, 10 insertions, 3 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index ff09fdc7..40e23d5f 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -52,6 +52,7 @@ AdBlockManager::AdBlockManager(QObject *parent)
, _isHideAdsEnabled(false)
, _index(0)
{
+ loadSettings();
}
@@ -180,7 +181,6 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa
const QString host = request.url().host();
// check white rules before :)
-
if (_hostWhiteList.match(host))
{
kDebug() << "****ADBLOCK: WHITE RULE (@@) Matched by host matcher: ***********";
@@ -369,10 +369,12 @@ void AdBlockManager::showSettings()
{
QPointer<KDialog> dialog = new KDialog();
dialog->setCaption(i18nc("@title:window", "Ad Block Settings"));
- dialog->setButtons(KDialog::Ok);
+ dialog->setButtons(KDialog::Ok | KDialog::Cancel);
AdBlockWidget widget;
dialog->setMainWidget(&widget);
+ connect(dialog, SIGNAL(okClicked()), &widget, SLOT(save()));
+ connect(dialog, SIGNAL(okClicked()), this, SLOT(loadSettings()));
dialog->exec();
dialog->deleteLater();
diff --git a/src/adblock/adblockwidget.cpp b/src/adblock/adblockwidget.cpp
index 29281786..a5153f98 100644
--- a/src/adblock/adblockwidget.cpp
+++ b/src/adblock/adblockwidget.cpp
@@ -159,6 +159,9 @@ void AdBlockWidget::loadRules(QTreeWidgetItem *item)
void AdBlockWidget::save()
{
+ if (!_changed)
+ return;
+
// local rules
KSharedConfig::Ptr config = KSharedConfig::openConfig("adblock", KConfig::SimpleConfig, "appdata");
KConfigGroup localGroup(config , "rules");
diff --git a/src/adblock/adblockwidget.h b/src/adblock/adblockwidget.h
index 08194ada..daaf499e 100644
--- a/src/adblock/adblockwidget.h
+++ b/src/adblock/adblockwidget.h
@@ -43,12 +43,14 @@ class AdBlockWidget : public QWidget, private Ui::adblock
public:
AdBlockWidget(QWidget *parent = 0);
- void save();
bool changed();
signals:
void changed(bool);
+public slots:
+ void save();
+
private slots:
void hasChanged();