diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-03-15 00:38:50 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-03-15 00:38:50 +0100 |
commit | ae8aceced59f5d8721e986e7fc1c66c9026e87df (patch) | |
tree | ffe1c74221a3bb674c782ed5c1807fec699b20c1 /src/settings/adblockwidget.cpp | |
parent | Merge commit 'refs/merge-requests/105' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-ae8aceced59f5d8721e986e7fc1c66c9026e87df.tar.xz |
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.
Diffstat (limited to 'src/settings/adblockwidget.cpp')
-rw-r--r-- | src/settings/adblockwidget.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
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 <KSharedConfig> #include <KIcon> #include <KDebug> +// Qt Includes #include <QString> #include <QWhatsThis> #include <QListWidgetItem> @@ -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; } |