diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/adblock/adblockmanager.cpp | 6 | ||||
-rw-r--r-- | src/adblock/adblockwidget.cpp | 3 | ||||
-rw-r--r-- | src/adblock/adblockwidget.h | 4 | ||||
-rw-r--r-- | src/application.cpp | 1 |
4 files changed, 10 insertions, 4 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(); diff --git a/src/application.cpp b/src/application.cpp index a62d548e..b30867bb 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -598,7 +598,6 @@ void Application::updateConfiguration() // ====== load Settings on main classes historyManager()->loadSettings(); - adblockManager()->loadSettings(); if (!ReKonfig::useFavicon()) mainWindow()->setWindowIcon(KIcon("rekonq")); else |