diff options
Diffstat (limited to 'src/settings')
-rw-r--r-- | src/settings/adblockwidget.cpp | 192 | ||||
-rw-r--r-- | src/settings/adblockwidget.h | 66 | ||||
-rw-r--r-- | src/settings/networkwidget.cpp | 100 | ||||
-rw-r--r-- | src/settings/networkwidget.h | 63 | ||||
-rw-r--r-- | src/settings/settings_adblock.ui | 167 | ||||
-rw-r--r-- | src/settings/settings_general.ui | 93 | ||||
-rw-r--r-- | src/settings/settings_tabs.ui | 138 | ||||
-rw-r--r-- | src/settings/settings_webkit.ui | 98 | ||||
-rw-r--r-- | src/settings/settingsdialog.cpp | 120 | ||||
-rw-r--r-- | src/settings/settingsdialog.h | 16 |
10 files changed, 867 insertions, 186 deletions
diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp new file mode 100644 index 00000000..59cb8a81 --- /dev/null +++ b/src/settings/adblockwidget.cpp @@ -0,0 +1,192 @@ +/* ============================================================ +* +* 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 "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> + + +AdBlockWidget::AdBlockWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):")); + connect(hintLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotInfoLinkActivated(const QString &))); + + listWidget->setSortingEnabled(true); + listWidget->setSelectionMode(QAbstractItemView::SingleSelection); + + searchLine->setListWidget(listWidget); + + 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())); +} + + +void AdBlockWidget::slotInfoLinkActivated(const QString &url) +{ + Q_UNUSED(url) + + QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:" + "<ul><li>a shell-style wildcard, e.g. <tt>http://www.example.com/ads*</tt>, the wildcards <tt>*?[]</tt> may be used</li>" + "<li>a full regular expression by surrounding the string with '<tt>/</tt>', e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>" + "<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, " + "which takes priority over any blacklist (blocking) filter."); + + QWhatsThis::showText(QCursor::pos(), hintHelpString); +} + + +void AdBlockWidget::insertRule() +{ + QString rule = addFilterLineEdit->text(); + if (rule.isEmpty()) + return; + + listWidget->addItem(rule); + addFilterLineEdit->clear(); +} + + +void AdBlockWidget::removeRule() +{ + listWidget->takeItem(listWidget->currentRow()); +} + + +void AdBlockWidget::load() +{ + bool isAdBlockEnabled = ReKonfig::adBlockEnabled(); + checkEnableAdblock->setChecked(isAdBlockEnabled); + + bool areImageFiltered = ReKonfig::hideAdsEnabled(); + checkHideAds->setChecked(areImageFiltered); + + int days = ReKonfig::updateInterval(); + spinBox->setValue(days); + + QStringList subscriptions = ReKonfig::subscriptionTitles(); + + // load automatic rules + foreach(const QString &sub, subscriptions) + { + QTreeWidgetItem *subItem = new QTreeWidgetItem(treeWidget); + subItem->setText(0, sub); + loadRules(subItem); + } + + // load local rules + KSharedConfig::Ptr config = KGlobal::config(); + KConfigGroup localGroup(config, "rules"); + QStringList rules = localGroup.readEntry("local-rules" , QStringList()); + foreach(const QString &rule, rules) + { + listWidget->addItem(rule); + } +} + + +void AdBlockWidget::loadRules(QTreeWidgetItem *item) +{ + KSharedConfig::Ptr config = KGlobal::config(); + KConfigGroup localGroup(config, "rules"); + + QString str = item->text(0) + "-rules"; + QStringList rules = localGroup.readEntry(str , QStringList()); + + foreach(const QString &rule, rules) + { + QTreeWidgetItem *subItem = new QTreeWidgetItem(item); + subItem->setText(0, rule); + } +} + + +void AdBlockWidget::save() +{ + int n; + + // local rules + KSharedConfig::Ptr config = KGlobal::config(); + KConfigGroup localGroup(config , "rules"); + + QStringList localRules; + + n = listWidget->count(); + for (int i = 0; i < n; ++i) + { + QListWidgetItem *item = listWidget->item(i); + localRules << item->text(); + } + localGroup.writeEntry("local-rules" , localRules); + + ReKonfig::setAdBlockEnabled(checkEnableAdblock->isChecked()); + ReKonfig::setHideAdsEnabled(checkHideAds->isChecked()); + ReKonfig::setUpdateInterval(spinBox->value()); + + _changed = false; + emit changed(false); +} + + +void AdBlockWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool AdBlockWidget::changed() +{ + return _changed; +} diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h new file mode 100644 index 00000000..1ed9aaa6 --- /dev/null +++ b/src/settings/adblockwidget.h @@ -0,0 +1,66 @@ +/* ============================================================ +* +* 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 ADBLOCK_WIDGET_H +#define ADBLOCK_WIDGET_H + + +// Ui Includes +#include "ui_settings_adblock.h" + +// Qt Includes +#include <QWidget> +#include <QTreeWidgetItem> + + +class AdBlockWidget : public QWidget, private Ui::adblock +{ + Q_OBJECT + +public: + AdBlockWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + + void slotInfoLinkActivated(const QString &); + void insertRule(); + void removeRule(); + +private: + void load(); + void loadRules(QTreeWidgetItem *item); + + bool _changed; +}; + +#endif // ADBLOCK_WIDGET_H diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp new file mode 100644 index 00000000..5495f0ce --- /dev/null +++ b/src/settings/networkwidget.cpp @@ -0,0 +1,100 @@ +/* ============================================================ +* +* 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 "networkwidget.h" +#include "networkwidget.moc" + +// KDE Includes +#include <KTabWidget> +#include <KCModuleInfo> + +// Qt Includes +#include <QVBoxLayout> + + +NetworkWidget::NetworkWidget(QWidget *parent) + : QWidget(parent) + , _cacheModule(0) + , _cookiesModule(0) + , _proxyModule(0) + , _changed(false) +{ + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + + KTabWidget *tabWidget = new KTabWidget(this); + l->addWidget(tabWidget); + + KCModuleInfo cacheInfo("cache.desktop"); + _cacheModule = new KCModuleProxy(cacheInfo, parent); + tabWidget->addTab(_cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit())); + + KCModuleInfo cookiesInfo("cookies.desktop"); + _cookiesModule = new KCModuleProxy(cookiesInfo, parent); + tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit())); + + KCModuleInfo proxyInfo("proxy.desktop"); + _proxyModule = new KCModuleProxy(proxyInfo, parent); + tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit())); + + connect(_cacheModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); + connect(_cookiesModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); + connect(_proxyModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); +} + + +NetworkWidget::~NetworkWidget() +{ + delete _cacheModule; + delete _cookiesModule; + delete _proxyModule; +} + + +void NetworkWidget::save() +{ + _cookiesModule->save(); + _proxyModule->save(); + _cacheModule->save(); + + _changed = false; + emit changed(false); +} + + +void NetworkWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool NetworkWidget::changed() +{ + return _changed; +} diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h new file mode 100644 index 00000000..6b7abffd --- /dev/null +++ b/src/settings/networkwidget.h @@ -0,0 +1,63 @@ +/* ============================================================ +* +* 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 NETWORK_WIDGET_H +#define NETWORK_WIDGET_H + + +// KDE Includes +#include <KCModuleProxy> + +// Qt Includes +#include <QWidget> + + +class NetworkWidget : public QWidget +{ + Q_OBJECT + +public: + NetworkWidget(QWidget *parent = 0); + ~NetworkWidget(); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + KCModuleProxy *_cacheModule; + KCModuleProxy *_cookiesModule; + KCModuleProxy *_proxyModule; + + bool _changed; +}; + +#endif // NETWORK_WIDGET_H diff --git a/src/settings/settings_adblock.ui b/src/settings/settings_adblock.ui new file mode 100644 index 00000000..445431c5 --- /dev/null +++ b/src/settings/settings_adblock.ui @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>adblock</class> + <widget class="QWidget" name="adblock"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>601</width> + <height>507</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="checkEnableAdblock"> + <property name="text"> + <string>&Enable AdBlock</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkHideAds"> + <property name="text"> + <string>&Hide filtered Elements</string> + </property> + </widget> + </item> + <item> + <widget class="KTabWidget" name="tabWidget"> + <property name="toolTip"> + <string/> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Automatic Filters</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QTreeWidget" name="treeWidget"> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Automatic update interval:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox"> + <property name="value"> + <number>7</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Manual Filters</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Search:</string> + </property> + </widget> + </item> + <item> + <widget class="KListWidgetSearchLine" name="searchLine"/> + </item> + </layout> + </item> + <item> + <widget class="KListWidget" name="listWidget"/> + </item> + <item> + <widget class="QLabel" name="hintLabel"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="KLineEdit" name="addFilterLineEdit"/> + </item> + <item> + <widget class="QToolButton" name="insertButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="removeButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KListWidget</class> + <extends>QListWidget</extends> + <header>klistwidget.h</header> + </customwidget> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + <customwidget> + <class>KTabWidget</class> + <extends>QTabWidget</extends> + <header>ktabwidget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>KListWidgetSearchLine</class> + <extends>KLineEdit</extends> + <header>klistwidgetsearchline.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index 17ac0d0f..eaa91859 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>751</width> - <height>523</height> + <width>552</width> + <height>512</height> </rect> </property> <property name="windowTitle"> @@ -150,11 +150,11 @@ <item> <widget class="QGroupBox" name="groupBox_3"> <property name="title"> - <string>New Tabs Behaviour</string> + <string>Search Engine</string> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_4"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -169,20 +169,20 @@ </property> <property name="baseSize"> <size> - <width>120</width> + <width>0</width> <height>0</height> </size> </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> <property name="text"> - <string>New tab opens:</string> + <string>Default search engine:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="KComboBox" name="kcfg_newTabsBehaviour"> - <property name="enabled"> - <bool>true</bool> - </property> + <item> + <widget class="KComboBox" name="kcfg_searchEngine"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -191,75 +191,27 @@ </property> <item> <property name="text"> - <string>New Tab Page</string> + <string>google</string> </property> </item> <item> <property name="text"> - <string>Blank Page</string> + <string>altavista</string> </property> </item> <item> <property name="text"> - <string comment="@item:inlistbox">Home Page</string> + <string>lycos</string> </property> </item> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>New tab page starts with:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KComboBox" name="kcfg_newTabStartPage"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <item> <property name="text"> - <string>favorites</string> + <string>wikipedia</string> </property> </item> <item> <property name="text"> - <string>closed tabs</string> - </property> - </item> - <item> - <property name="text"> - <string>history</string> - </property> - </item> - <item> - <property name="text"> - <string>bookmarks</string> + <string>wolfram</string> </property> </item> </widget> @@ -272,16 +224,19 @@ <property name="title"> <string>Download Manager</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QCheckBox" name="kcfg_kgetDownload"> <property name="text"> - <string>Download with KGet</string> + <string>Use KGet for downloading files</string> </property> </widget> </item> <item> <widget class="QCheckBox" name="kcfg_kgetList"> + <property name="whatsThis"> + <string>If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet.</string> + </property> <property name="text"> <string>List links with KGet</string> </property> @@ -298,7 +253,7 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>40</height> + <height>179</height> </size> </property> </spacer> diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 9104843a..45579e90 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>456</width> - <height>329</height> + <width>483</width> + <height>427</height> </rect> </property> <property name="windowTitle"> @@ -15,6 +15,131 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>New Tabs Behaviour</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>New tab opens:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KComboBox" name="kcfg_newTabsBehaviour"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <item> + <property name="text"> + <string>New Tab Page</string> + </property> + </item> + <item> + <property name="text"> + <string>Blank Page</string> + </property> + </item> + <item> + <property name="text"> + <string comment="@item:inlistbox">Home Page</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>New tab page starts with:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KComboBox" name="kcfg_newTabStartPage"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <item> + <property name="text"> + <string>Favorites</string> + </property> + </item> + <item> + <property name="text"> + <string>Closed Tabs</string> + </property> + </item> + <item> + <property name="text"> + <string>Bookmarks</string> + </property> + </item> + <item> + <property name="text"> + <string>History</string> + </property> + </item> + <item> + <property name="text"> + <string>Downloads</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="groupBox_4"> <property name="title"> <string>Tabbed Browsing</string> @@ -79,13 +204,20 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>142</height> + <height>120</height> </size> </property> </spacer> </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> + </customwidgets> <resources/> <connections/> </ui> diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index 5074522b..55f34ab3 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>437</width> - <height>346</height> + <width>643</width> + <height>560</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -17,99 +17,106 @@ <string>WebKit Settings</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" colspan="2"> + <item row="0" column="0"> <widget class="QCheckBox" name="kcfg_autoLoadImages"> <property name="text"> <string>Autoload images</string> </property> </widget> </item> - <item row="0" column="3"> + <item row="0" column="1" rowspan="7"> + <widget class="Line" name="line"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="0" column="2"> <widget class="QCheckBox" name="kcfg_linksIncludedInFocusChain"> <property name="text"> <string>Links included in focus chain</string> </property> </widget> </item> - <item row="1" column="0" colspan="2"> - <widget class="QCheckBox" name="kcfg_javascriptEnabled"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item row="1" column="0"> + <widget class="QCheckBox" name="kcfg_dnsPrefetch"> <property name="text"> - <string>JavaScript support</string> + <string>Prefetch DNS entries</string> </property> </widget> </item> - <item row="1" column="3"> + <item row="1" column="2"> <widget class="QCheckBox" name="kcfg_zoomTextOnly"> <property name="text"> <string>Zoom text only</string> </property> </widget> </item> - <item row="2" column="0" colspan="2"> - <widget class="QCheckBox" name="kcfg_javaEnabled"> + <item row="2" column="0"> + <widget class="QCheckBox" name="kcfg_javascriptEnabled"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string>Java support</string> + <string>JavaScript support</string> </property> </widget> </item> - <item row="2" column="3"> + <item row="2" column="2"> <widget class="QCheckBox" name="kcfg_printElementBackgrounds"> <property name="text"> <string>Print element backgrounds</string> </property> </widget> </item> - <item row="3" column="3"> + <item row="4" column="2"> <widget class="QCheckBox" name="kcfg_offlineStorageDatabaseEnabled"> <property name="text"> <string>Offline storage database</string> </property> </widget> </item> - <item row="4" column="3"> - <widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled"> + <item row="3" column="0" rowspan="2"> + <widget class="QCheckBox" name="kcfg_javaEnabled"> <property name="text"> - <string>Offline web application cache</string> + <string>Java support</string> </property> </widget> </item> - <item row="5" column="3"> - <widget class="QCheckBox" name="kcfg_localStorageDatabaseEnabled"> + <item row="5" column="0"> + <widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows"> <property name="text"> - <string>Local storage database</string> + <string>JavaScript can open windows</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows"> + <item row="5" column="2"> + <widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled"> <property name="text"> - <string>JavaScript can open windows</string> + <string>Offline web application cache</string> </property> </widget> </item> - <item row="4" column="0"> + <item row="6" column="0"> <widget class="QCheckBox" name="kcfg_javascriptCanAccessClipboard"> <property name="text"> <string>JavaScript can access clipboard</string> </property> </widget> </item> - <item row="0" column="2" rowspan="6"> - <widget class="Line" name="line"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> + <item row="6" column="2"> + <widget class="QCheckBox" name="kcfg_localStorageEnabled"> + <property name="text"> + <string>Local Storage</string> </property> </widget> </item> @@ -148,13 +155,7 @@ </widget> </item> <item> - <widget class="QComboBox" name="kcfg_pluginsEnabled"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="KComboBox" name="kcfg_pluginsEnabled"> <item> <property name="text"> <string>Autoload Plugins</string> @@ -219,6 +220,11 @@ <extends>QFrame</extends> <header>kurlrequester.h</header> </customwidget> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> </customwidgets> <resources/> <connections/> 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(); + ; } diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index 360fe246..25b2fe9b 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -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 @@ -30,6 +29,9 @@ #define SETTINGS_DIALOG_H +// Rekonq Includes +#include "rekonq_defines.h" + // KDE Includes #include <KConfigDialog> @@ -38,14 +40,14 @@ class QWidget; class Private; -class SettingsDialog : public KConfigDialog +class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog { Q_OBJECT public: SettingsDialog(QWidget *parent = 0); ~SettingsDialog(); - + virtual bool hasChanged(); private: |