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/settingsdialog.cpp | 52 +++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'src/settings/settingsdialog.cpp') diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index fa1e8891..08d5ca6e 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -37,13 +37,13 @@ #include "mainwindow.h" #include "webtab.h" #include "adblockwidget.h" +#include "networkwidget.h" //Ui Includes #include "ui_settings_general.h" #include "ui_settings_tabs.h" #include "ui_settings_fonts.h" #include "ui_settings_webkit.h" -#include "ui_settings_adblock.h" // KDE Includes #include @@ -67,11 +67,9 @@ private: Ui::webkit webkitUi; AdBlockWidget *adBlockWidg; + NetworkWidget *networkWidg; - KCModuleProxy *proxyModule; KCModuleProxy *ebrowsingModule; - KCModuleProxy *cookiesModule; - KCModuleProxy *cacheModule; KShortcutsEditor *shortcutsEditor; @@ -103,21 +101,6 @@ Private::Private(SettingsDialog *parent) widget->layout()->setMargin(0); pageItem = parent->addPage(widget , i18n("Fonts")); pageItem->setIcon(KIcon("preferences-desktop-font")); - - KCModuleInfo cookiesInfo("cookies.desktop"); - cookiesModule = new KCModuleProxy(cookiesInfo,parent); - pageItem = parent->addPage(cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(cookiesInfo.icon())); - - KCModuleInfo proxyInfo("proxy.desktop"); - proxyModule = new KCModuleProxy(proxyInfo,parent); - pageItem = parent->addPage(proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(proxyInfo.icon())); - - KCModuleInfo cacheInfo("cache.desktop"); - cacheModule = new KCModuleProxy(cacheInfo,parent); - pageItem = parent->addPage(cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(cacheInfo.icon())); widget = new QWidget; webkitUi.setupUi(widget); @@ -127,6 +110,11 @@ Private::Private(SettingsDialog *parent) KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); + networkWidg = new NetworkWidget(parent); + networkWidg->layout()->setMargin(0); + pageItem = parent->addPage(networkWidg , i18n("Network")); + pageItem->setIcon( KIcon("preferences-system-network") ); + adBlockWidg = new AdBlockWidget(parent); adBlockWidg->layout()->setMargin(0); pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); @@ -162,15 +150,16 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + // update buttons + connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->proxyModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->cacheModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - - connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); - + + connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); + + // save settings connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); - connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); + connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); setWebSettingsToolTips(); } @@ -212,21 +201,18 @@ void SettingsDialog::saveSettings() { ReKonfig::self()->writeConfig(); d->ebrowsingModule->save(); - d->cookiesModule->save(); - d->proxyModule->save(); - d->cacheModule->save(); d->shortcutsEditor->save(); d->adBlockWidg->save(); + d->networkWidg->save(); } bool SettingsDialog::hasChanged() { return KConfigDialog::hasChanged() - || d->ebrowsingModule->changed() - || d->cookiesModule->changed() - || d->proxyModule->changed() - || d->cacheModule->changed() + || d->adBlockWidg->changed() + || d->networkWidg->changed() + || d->ebrowsingModule->changed() || d->shortcutsEditor->isModified(); ; } -- cgit v1.2.1