summaryrefslogtreecommitdiff
path: root/src/settings/settingsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/settingsdialog.cpp')
-rw-r--r--src/settings/settingsdialog.cpp120
1 files changed, 59 insertions, 61 deletions
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index e37481aa..d2d5c0d0 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -2,9 +2,8 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Lionel Chauvin <megabigbug@yahoo.fr>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
*
*
* This program is free software; you can redistribute it and/or
@@ -12,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -37,6 +36,9 @@
#include "application.h"
#include "mainwindow.h"
#include "webtab.h"
+#include "adblockwidget.h"
+#include "networkwidget.h"
+#include "searchengine.h"
//Ui Includes
#include "ui_settings_general.h"
@@ -53,26 +55,25 @@
#include <KCModuleProxy>
// Qt Includes
-#include <QtCore/QPointer>
#include <QtGui/QWidget>
class Private
{
private:
-
+
Ui::general generalUi;
Ui::tabs tabsUi;
Ui::fonts fontsUi;
Ui::webkit webkitUi;
-
- KCModuleProxy *proxyModule;
+
+ AdBlockWidget *adBlockWidg;
+ NetworkWidget *networkWidg;
+
KCModuleProxy *ebrowsingModule;
- KCModuleProxy *cookiesModule;
- KCModuleProxy *cacheModule;
- KCModuleProxy *adblockModule;
+
KShortcutsEditor *shortcutsEditor;
-
+
Private(SettingsDialog *parent);
friend class SettingsDialog;
@@ -102,21 +103,6 @@ Private::Private(SettingsDialog *parent)
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);
widget->layout()->setMargin(0);
@@ -125,23 +111,28 @@ Private::Private(SettingsDialog *parent)
KIcon webkitIcon = KIcon(QIcon(webkitIconPath));
pageItem->setIcon(webkitIcon);
- KCModuleInfo adblockInfo("khtml_filter.desktop");
- adblockModule = new KCModuleProxy(adblockInfo,parent);
- pageItem = parent->addPage(adblockModule, i18n(adblockInfo.moduleName().toLocal8Bit()));
- pageItem->setIcon(KIcon(adblockInfo.icon()));
-
+ 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"));
+ pageItem->setIcon(KIcon("preferences-web-browser-adblock"));
+
shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent);
pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts"));
pageItem->setIcon(KIcon("configure-shortcuts"));
KCModuleInfo ebrowsingInfo("ebrowsing.desktop");
- ebrowsingModule = new KCModuleProxy(ebrowsingInfo,parent);
+ ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent);
pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit()));
pageItem->setIcon(KIcon(ebrowsingInfo.icon()));
- // WARNING remember wheh changing here that the smaller netbooks
- // have a 1024x576 resolution. So DONT bother that limits!!
- parent->setMinimumSize(700,525);
+ // WARNING remember wheh changing here that the smallest netbooks
+ // have a 1024x576 resolution. So DON'T bother that limits!!
+ parent->setMinimumSize(700, 525);
}
@@ -153,24 +144,24 @@ SettingsDialog::SettingsDialog(QWidget *parent)
, d(new Private(this))
{
showButtonSeparator(false);
- setWindowTitle(i18n("Configure - rekonq"));
+ setWindowTitle(i18nc("Window title of the settings dialog", "Configure – rekonq"));
setModal(true);
readConfig();
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->adblockModule, 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();
}
@@ -184,6 +175,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::setWebSettingsToolTips()
{
d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages."));
+ d->webkitUi.kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing."));
d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs."));
d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets."));
d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages."));
@@ -194,7 +186,7 @@ void SettingsDialog::setWebSettingsToolTips()
d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed."));
d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature."));
d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature."));
- d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature."));
+ d->webkitUi.kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature."));
}
@@ -209,26 +201,32 @@ void SettingsDialog::readConfig()
// we need this function to SAVE settings in rc file..
void SettingsDialog::saveSettings()
{
+ if (!hasChanged())
+ return;
+
ReKonfig::self()->writeConfig();
d->ebrowsingModule->save();
- d->cookiesModule->save();
- d->proxyModule->save();
- d->cacheModule->save();
d->shortcutsEditor->save();
- d->adblockModule->save();
+ d->adBlockWidg->save();
+ d->networkWidg->save();
+ SearchEngine::loadDefaultWS();
+ SearchEngine::loadDelimiter();
+ SearchEngine::loadFavorites();
+
+
+ updateButtons();
+ emit settingsChanged("ReKonfig");
}
bool SettingsDialog::hasChanged()
{
- return KConfigDialog::hasChanged()
- || d->ebrowsingModule->changed()
- || d->cookiesModule->changed()
- || d->proxyModule->changed()
- || d->cacheModule->changed()
- || d->adblockModule->changed()
- || d->shortcutsEditor->isModified();
- ;
+ return KConfigDialog::hasChanged()
+ || d->adBlockWidg->changed()
+ || d->networkWidg->changed()
+ || d->ebrowsingModule->changed()
+ || d->shortcutsEditor->isModified();
+ ;
}