diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-23 15:35:41 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-23 15:35:41 +0200 |
commit | 6debba6ebd47792310168af8a0d2ace4796eff10 (patch) | |
tree | 1386a6638c2847d6487c8f3cff02b239bbdc1bf7 /src | |
parent | Cleaning some kDebug calls (diff) | |
download | rekonq-6debba6ebd47792310168af8a0d2ace4796eff10.tar.xz |
New Settings classes, one for each widget.
It seems clear to me that this way code is more maintainable than merging everything
in the settingsdialog class
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/settings/adblockwidget.h | 4 | ||||
-rw-r--r-- | src/settings/appearancewidget.cpp | 55 | ||||
-rw-r--r-- | src/settings/appearancewidget.h | 58 | ||||
-rw-r--r-- | src/settings/generalwidget.cpp | 85 | ||||
-rw-r--r-- | src/settings/generalwidget.h | 60 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui (renamed from src/settings/settings_fonts.ui) | 66 | ||||
-rw-r--r-- | src/settings/settings_general.ui | 23 | ||||
-rw-r--r-- | src/settings/settings_webkit.ui | 41 | ||||
-rw-r--r-- | src/settings/settingsdialog.cpp | 149 | ||||
-rw-r--r-- | src/settings/settingsdialog.h | 4 | ||||
-rw-r--r-- | src/settings/tabswidget.cpp | 53 | ||||
-rw-r--r-- | src/settings/tabswidget.h | 58 | ||||
-rw-r--r-- | src/settings/webkitwidget.cpp | 71 | ||||
-rw-r--r-- | src/settings/webkitwidget.h | 60 |
15 files changed, 631 insertions, 162 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b79e64fa..d0e5721c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,6 +37,10 @@ SET( rekonq_KDEINIT_SRCS #---------------------------------------- settings/settingsdialog.cpp settings/adblockwidget.cpp + settings/appearancewidget.cpp + settings/generalwidget.cpp + settings/tabswidget.cpp + settings/webkitwidget.cpp settings/networkwidget.cpp #---------------------------------------- bookmarks/bookmarksmanager.cpp @@ -64,7 +68,7 @@ SET( rekonq_KDEINIT_SRCS KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS settings/settings_general.ui settings/settings_tabs.ui - settings/settings_fonts.ui + settings/settings_appearance.ui settings/settings_webkit.ui settings/settings_adblock.ui cleardata.ui diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h index 1ed9aaa6..38a02636 100644 --- a/src/settings/adblockwidget.h +++ b/src/settings/adblockwidget.h @@ -32,8 +32,8 @@ #include "ui_settings_adblock.h" // Qt Includes -#include <QWidget> -#include <QTreeWidgetItem> +#include <QtGui/QWidget> +#include <QtGui/QTreeWidgetItem> class AdBlockWidget : public QWidget, private Ui::adblock diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp new file mode 100644 index 00000000..be3c2980 --- /dev/null +++ b/src/settings/appearancewidget.cpp @@ -0,0 +1,55 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +// Self Includes +#include "appearancewidget.h" +#include "appearancewidget.moc" + + +AppearanceWidget::AppearanceWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + kcfg_fixedFont->setOnlyFixed(true); +} + + +void AppearanceWidget::save() +{ +} + + +bool AppearanceWidget::changed() +{ + return _changed; +} + + +void AppearanceWidget::hasChanged() +{ +} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h new file mode 100644 index 00000000..0e400031 --- /dev/null +++ b/src/settings/appearancewidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +#ifndef APPEARANCE_WIDGET_H +#define APPEARANCE_WIDGET_H + + +// Ui Includes +#include "ui_settings_appearance.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class AppearanceWidget : public QWidget, private Ui::appearance +{ + Q_OBJECT + +public: + AppearanceWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + bool _changed; +}; + +#endif // APPEARANCE_WIDGET_H diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp new file mode 100644 index 00000000..fc2d4d5d --- /dev/null +++ b/src/settings/generalwidget.cpp @@ -0,0 +1,85 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +// Self Includes +#include "generalwidget.h" +#include "generalwidget.moc" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "application.h" +#include "mainwindow.h" +#include "webtab.h" + + +GeneralWidget::GeneralWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + + disableHomeSettings(ReKonfig::useNewTabPage()); + + connect(kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); +} + + +void GeneralWidget::save() +{ +} + + +bool GeneralWidget::changed() +{ + return _changed; +} + + +void GeneralWidget::hasChanged() +{ +} + + +void GeneralWidget::setHomeToCurrentPage() +{ + MainWindow *mw = qobject_cast<MainWindow*>(parent()); + WebTab *webTab = mw->currentTab(); + if (webTab) + { + kcfg_homePage->setText(webTab->url().prettyUrl()); + } +} + + +void GeneralWidget::disableHomeSettings(bool b) +{ + kcfg_homePage->setEnabled(!b); + setHomeToCurrentPageButton->setEnabled(!b); +} diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h new file mode 100644 index 00000000..d669fd04 --- /dev/null +++ b/src/settings/generalwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +#ifndef GENERAL_WIDGET_H +#define GENERAL_WIDGET_H + + +// Ui Includes +#include "ui_settings_general.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class GeneralWidget : public QWidget, private Ui::general +{ + Q_OBJECT + +public: + GeneralWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + void setHomeToCurrentPage(); + void disableHomeSettings(bool); + +private: + bool _changed; +}; + +#endif // GENERAL_WIDGET_H diff --git a/src/settings/settings_fonts.ui b/src/settings/settings_appearance.ui index 52c7872e..aff6bfbe 100644 --- a/src/settings/settings_fonts.ui +++ b/src/settings/settings_appearance.ui @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>fonts</class> - <widget class="QWidget" name="fonts"> + <class>appearance</class> + <widget class="QWidget" name="appearance"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>414</width> - <height>298</height> + <width>569</width> + <height>484</height> </rect> </property> <property name="windowTitle"> <string>Appearance</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> @@ -161,6 +161,57 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>User Style Sheet</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>User CSS path:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KUrlRequester" name="kcfg_userCSS"> + <property name="filter"> + <string>*.css</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Misc</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="kcfg_disableAutoScroll"> + <property name="toolTip"> + <string>Disable automatic scrolling on middle click in a web page</string> + </property> + <property name="text"> + <string>Disable auto scrolling</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -177,6 +228,11 @@ </widget> <customwidgets> <customwidget> + <class>KUrlRequester</class> + <extends>QFrame</extends> + <header>kurlrequester.h</header> + </customwidget> + <customwidget> <class>KFontComboBox</class> <extends>KComboBox</extends> <header>kfontcombobox.h</header> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index c0060d76..63ab933c 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>552</width> - <height>512</height> + <width>464</width> + <height>462</height> </rect> </property> <property name="windowTitle"> @@ -244,25 +244,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Navigation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QCheckBox" name="kcfg_disableAutoScroll"> - <property name="toolTip"> - <string>Disable automatic scrolling on middle click in a web page</string> - </property> - <property name="text"> - <string>Disable auto scrolling</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index e87e3fec..58fbe459 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>643</width> - <height>560</height> + <width>480</width> + <height>377</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -192,38 +192,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>User Style Sheet</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>User CSS path:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KUrlRequester" name="kcfg_userCSS"> - <property name="filter"> - <string>*.css</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -240,11 +208,6 @@ </widget> <customwidgets> <customwidget> - <class>KUrlRequester</class> - <extends>QFrame</extends> - <header>kurlrequester.h</header> - </customwidget> - <customwidget> <class>KComboBox</class> <extends>QComboBox</extends> <header>kcombobox.h</header> diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 3f701c5b..27d40467 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -36,15 +36,15 @@ #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" -#include "ui_settings_tabs.h" -#include "ui_settings_fonts.h" -#include "ui_settings_webkit.h" +// Widget Includes +#include "adblockwidget.h" +#include "networkwidget.h" +#include "generalwidget.h" +#include "appearancewidget.h" +#include "webkitwidget.h" +#include "tabswidget.h" // KDE Includes #include <KConfig> @@ -61,76 +61,79 @@ class Private { private: + Private(SettingsDialog *parent); - Ui::general generalUi; - Ui::tabs tabsUi; - Ui::fonts fontsUi; - Ui::webkit webkitUi; - - AdBlockWidget *adBlockWidg; +private: + GeneralWidget *generalWidg; + TabsWidget *tabsWidg; + AppearanceWidget *appearanceWidg; + WebKitWidget *webkitWidg; NetworkWidget *networkWidg; - + AdBlockWidget *adBlockWidg; + KCModuleProxy *ebrowsingModule; KShortcutsEditor *shortcutsEditor; - Private(SettingsDialog *parent); - friend class SettingsDialog; }; Private::Private(SettingsDialog *parent) { - QWidget *widget; KPageWidgetItem *pageItem; - widget = new QWidget; - generalUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("General")); + // -- 1 + generalWidg = new GeneralWidget(parent); + generalWidg->layout()->setMargin(0); + pageItem = parent->addPage(generalWidg, i18n("General")); pageItem->setIcon(KIcon("rekonq")); - widget = new QWidget; - tabsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Tabs")); + // -- 2 + tabsWidg = new TabsWidget(parent); + tabsWidg->layout()->setMargin(0); + pageItem = parent->addPage(tabsWidg, i18n("Tabs")); pageItem->setIcon(KIcon("tab-duplicate")); - - widget = new QWidget; - fontsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Fonts")); + + // -- 3 + appearanceWidg = new AppearanceWidget(parent); + appearanceWidg->layout()->setMargin(0); + pageItem = parent->addPage(appearanceWidg, i18n("Appearance")); pageItem->setIcon(KIcon("preferences-desktop-font")); - - widget = new QWidget; - webkitUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("WebKit")); + + // -- 4 + webkitWidg = new WebKitWidget(parent); + webkitWidg->layout()->setMargin(0); + pageItem = parent->addPage(webkitWidg, i18n("WebKit")); QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png"); KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); - + + // -- 5 networkWidg = new NetworkWidget(parent); networkWidg->layout()->setMargin(0); pageItem = parent->addPage(networkWidg , i18n("Network")); pageItem->setIcon(KIcon("preferences-system-network")); + // -- 6 adBlockWidg = new AdBlockWidget(parent); adBlockWidg->layout()->setMargin(0); pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); pageItem->setIcon(KIcon("preferences-web-browser-adblock")); + // -- 7 shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); pageItem->setIcon(KIcon("configure-shortcuts")); + // -- 8 KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); 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 smallest netbooks + // WARNING + // remember wheh changing here that the smallest netbooks // have a 1024x576 resolution. So DON'T bother that limits!! parent->setMinimumSize(700, 525); } @@ -148,25 +151,20 @@ SettingsDialog::SettingsDialog(QWidget *parent) setModal(true); readConfig(); - - connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - - // new tab page - disableHomeSettings(ReKonfig::useNewTabPage()); - connect(d->generalUi.kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); // update buttons - connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->generalWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->tabsWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->appearanceWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->webkitWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->ebrowsingModule, SIGNAL(changed(bool)), 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())); - - setWebSettingsToolTips(); } @@ -176,29 +174,9 @@ 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.")); - d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); - d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); - d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); - d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); - 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_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); -} - - // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { - // ======= Fonts - d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); } @@ -209,15 +187,20 @@ void SettingsDialog::saveSettings() return; ReKonfig::self()->writeConfig(); - d->ebrowsingModule->save(); - d->shortcutsEditor->save(); - d->adBlockWidg->save(); + + d->generalWidg->save(); + d->tabsWidg->save(); + d->appearanceWidg->save(); + d->webkitWidg->save(); d->networkWidg->save(); + d->adBlockWidg->save(); + d->shortcutsEditor->save(); + d->ebrowsingModule->save(); + SearchEngine::loadDefaultWS(); SearchEngine::loadDelimiter(); SearchEngine::loadFavorites(); - updateButtons(); emit settingsChanged("ReKonfig"); } @@ -226,27 +209,13 @@ void SettingsDialog::saveSettings() bool SettingsDialog::hasChanged() { return KConfigDialog::hasChanged() - || d->adBlockWidg->changed() + || d->generalWidg->changed() + || d->tabsWidg->changed() + || d->appearanceWidg->changed() + || d->webkitWidg->changed() || d->networkWidg->changed() + || d->adBlockWidg->changed() || d->ebrowsingModule->changed() || d->shortcutsEditor->isModified(); ; } - - -void SettingsDialog::setHomeToCurrentPage() -{ - MainWindow *mw = static_cast<MainWindow*>(parent()); - WebTab *webTab = mw->currentTab(); - if (webTab) - { - d->generalUi.kcfg_homePage->setText(webTab->url().prettyUrl()); - } -} - - -void SettingsDialog::disableHomeSettings(bool b) -{ - d->generalUi.kcfg_homePage->setEnabled(!b); - d->generalUi.setHomeToCurrentPageButton->setEnabled(!b); -} diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index cade78e3..c25db74b 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -52,14 +52,10 @@ public: private: Private* const d; - void setWebSettingsToolTips(); private slots: void readConfig(); void saveSettings(); - - void setHomeToCurrentPage(); - void disableHomeSettings(bool); }; #endif // SETTINGS_DIALOG_H diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp new file mode 100644 index 00000000..aa555339 --- /dev/null +++ b/src/settings/tabswidget.cpp @@ -0,0 +1,53 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +// Local Includes +#include "tabswidget.h" +#include "tabswidget.moc" + + +TabsWidget::TabsWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); +} + + +void TabsWidget::save() +{ +} + + +bool TabsWidget::changed() +{ + return _changed; +} + + +void TabsWidget::hasChanged() +{ +} diff --git a/src/settings/tabswidget.h b/src/settings/tabswidget.h new file mode 100644 index 00000000..f1ff8a52 --- /dev/null +++ b/src/settings/tabswidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +#ifndef TABS_WIDGET_H +#define TABS_WIDGET_H + + +// Ui Includes +#include "ui_settings_tabs.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class TabsWidget : public QWidget, private Ui::tabs +{ + Q_OBJECT + +public: + TabsWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + bool _changed; +}; + +#endif // TABS_WIDGET_H diff --git a/src/settings/webkitwidget.cpp b/src/settings/webkitwidget.cpp new file mode 100644 index 00000000..f9d94d76 --- /dev/null +++ b/src/settings/webkitwidget.cpp @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +// Local Includes +#include "webkitwidget.h" +#include "webkitwidget.moc" + + +WebKitWidget::WebKitWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); +} + + +void WebKitWidget::save() +{ +} + + +bool WebKitWidget::changed() +{ + return _changed; +} + + +void WebKitWidget::hasChanged() +{ +} + + +void WebKitWidget::setWebSettingsToolTips() +{ + kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); + kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); + kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); + kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); + kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); + kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); + kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); + kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); + kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); + kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); + kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); +} diff --git a/src/settings/webkitwidget.h b/src/settings/webkitwidget.h new file mode 100644 index 00000000..b1eb8d76 --- /dev/null +++ b/src/settings/webkitwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +#ifndef WEBKIT_WIDGET_H +#define WEBKIT_WIDGET_H + + +// Ui Includes +#include "ui_settings_webkit.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class WebKitWidget : public QWidget, private Ui::webkit +{ + Q_OBJECT + +public: + WebKitWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + void setWebSettingsToolTips(); + + bool _changed; +}; + +#endif // WEBKIT_WIDGET_H |