diff options
Diffstat (limited to 'src/settings')
| -rw-r--r-- | src/settings/adblockwidget.cpp | 193 | ||||
| -rw-r--r-- | src/settings/adblockwidget.h | 66 | ||||
| -rw-r--r-- | src/settings/networkwidget.cpp | 101 | ||||
| -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 | 102 | ||||
| -rw-r--r-- | src/settings/settings_tabs.ui | 138 | ||||
| -rw-r--r-- | src/settings/settings_webkit.ui | 13 | ||||
| -rw-r--r-- | src/settings/settingsdialog.cpp | 84 | ||||
| -rw-r--r-- | src/settings/settingsdialog.h | 10 | 
10 files changed, 802 insertions, 135 deletions
| diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp new file mode 100644 index 00000000..2f431c1e --- /dev/null +++ b/src/settings/adblockwidget.cpp @@ -0,0 +1,193 @@ +/* ============================================================ +* +* 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(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"; +    kDebug() << str; +    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..7e641f3e --- /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..54f6e068 --- /dev/null +++ b/src/settings/networkwidget.cpp @@ -0,0 +1,101 @@ +/* ============================================================ +* +* 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> +#include <KDebug> + +// 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..efdd1807 --- /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 a4503d4a..00277133 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> -         </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>lycos</string>           </property>          </item>          <item>           <property name="text"> -          <string>Closed Tabs</string> +          <string>wikipedia</string>           </property>          </item>          <item>           <property name="text"> -          <string>Bookmarks</string> -         </property> -        </item> -        <item> -         <property name="text"> -          <string>History</string> +          <string>wolfram</string>           </property>          </item>         </widget> @@ -272,21 +224,21 @@       <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"> +       <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>Use KGet for downloading files</string> +         <string>List links with KGet</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>	 +       <widget class="QCheckBox" name="kcfg_kgetDownload">          <property name="text"> -         <string>List links with KGet</string> +         <string>Use KGet for downloading files</string>          </property>         </widget>        </item> @@ -301,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..e424fd9c 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -148,13 +148,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 +213,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..35f753d3 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 @@ -37,6 +36,8 @@  #include "application.h"  #include "mainwindow.h"  #include "webtab.h" +#include "adblockwidget.h" +#include "networkwidget.h"  //Ui Includes  #include "ui_settings_general.h" @@ -53,7 +54,6 @@  #include <KCModuleProxy>  // Qt Includes -#include <QtCore/QPointer>  #include <QtGui/QWidget> @@ -65,12 +65,12 @@ private:      Ui::tabs tabsUi;      Ui::fonts fontsUi;      Ui::webkit webkitUi; + +    AdBlockWidget *adBlockWidg; +    NetworkWidget *networkWidg; -    KCModuleProxy *proxyModule;      KCModuleProxy *ebrowsingModule; -    KCModuleProxy *cookiesModule; -    KCModuleProxy *cacheModule; -    KCModuleProxy *adblockModule; +      KShortcutsEditor *shortcutsEditor;      Private(SettingsDialog *parent); @@ -101,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); @@ -125,10 +110,15 @@ 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")); @@ -139,8 +129,8 @@ Private::Private(SettingsDialog *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!! +    // WARNING remember wheh changing here that the smallest netbooks +    // have a 1024x576 resolution. So DON'T bother that limits!!      parent->setMinimumSize(700,525);      } @@ -153,23 +143,23 @@ 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();  } @@ -209,24 +199,26 @@ 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(); + +    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->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..54494a00 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 @@ -30,6 +29,9 @@  #define SETTINGS_DIALOG_H +// Local Includes +#include "rekonqprivate_export.h" +  // KDE Includes  #include <KConfigDialog> @@ -38,7 +40,7 @@ class QWidget;  class Private; -class SettingsDialog : public KConfigDialog +class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog  {      Q_OBJECT | 
