From ae8aceced59f5d8721e986e7fc1c66c9026e87df Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 15 Mar 2010 00:38:50 +0100 Subject: Created a new Network Widget containing Cache, Cookies & Proxy Settings. This for multiple purposes: - clean a bit our settings dialog. Network settings are usually the less used - Provide a unique place where managing the settings network related. This to implement (one day) some better Ui to manage them. This commit also fixes all the handling with the network & the adblock widgets related to updating buttons and settings Ui at the beginning. --- src/settings/adblockwidget.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src/settings/adblockwidget.cpp') diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp index 45e5fd5c..8aac3e8c 100644 --- a/src/settings/adblockwidget.cpp +++ b/src/settings/adblockwidget.cpp @@ -24,15 +24,19 @@ * ============================================================ */ +// Self Includes #include "adblockwidget.h" #include "adblockwidget.moc" +// Auto Includes #include "rekonq.h" +// KDE Includes #include #include #include +// Qt Includes #include #include #include @@ -40,6 +44,7 @@ AdBlockWidget::AdBlockWidget(QWidget *parent) : QWidget(parent) + , _changed(false) { setupUi(this); @@ -53,11 +58,18 @@ AdBlockWidget::AdBlockWidget(QWidget *parent) insertButton->setIcon( KIcon("list-add") ); connect( insertButton, SIGNAL( clicked() ), this, SLOT( insertRule() ) ); - + removeButton->setIcon( KIcon("list-remove") ); connect( removeButton, SIGNAL( clicked() ), this, SLOT( removeRule() ) ); load(); + + // emit changed signal + connect( insertButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) ); + connect( removeButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) ); + connect( checkEnableAdblock, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) ); + connect( checkHideAds, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) ); + connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( hasChanged() ) ); } @@ -98,7 +110,10 @@ void AdBlockWidget::load() checkEnableAdblock->setChecked(isAdBlockEnabled); bool areImageFiltered = ReKonfig::hideAdsEnabled(); - checkHideImages->setChecked(areImageFiltered); + checkHideAds->setChecked(areImageFiltered); + + int days = ReKonfig::updateInterval(); + spinBox->setValue( days ); QStringList subscriptions = ReKonfig::subscriptionNames(); @@ -155,4 +170,21 @@ void AdBlockWidget::save() localRules << item->text(); } localGroup.writeEntry( "local-rules" , localRules ); + + ReKonfig::setAdBlockEnabled( checkEnableAdblock->isChecked() ); + ReKonfig::setHideAdsEnabled( checkHideAds->isChecked() ); + ReKonfig::setUpdateInterval( spinBox->value() ); +} + + +void AdBlockWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool AdBlockWidget::changed() +{ + return _changed; } -- cgit v1.2.1