From 33cbd23993ce0507215bdd69631faf5ac031554d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 31 Jul 2012 00:30:38 +0200 Subject: Settings, easier than copy/paste... --- src/CMakeLists.txt | 22 +++ src/settings/advancedwidget.cpp | 70 ++++++++ src/settings/advancedwidget.h | 62 ++++++++ src/settings/appearancewidget.cpp | 119 ++++++++++++++ src/settings/appearancewidget.h | 65 ++++++++ src/settings/generalwidget.cpp | 130 +++++++++++++++ src/settings/generalwidget.h | 62 ++++++++ src/settings/networkwidget.cpp | 100 ++++++++++++ src/settings/networkwidget.h | 63 ++++++++ src/settings/passexceptionswidget.cpp | 73 +++++++++ src/settings/passexceptionswidget.h | 53 +++++++ src/settings/password_exceptions.ui | 55 +++++++ src/settings/privacywidget.cpp | 135 ++++++++++++++++ src/settings/privacywidget.h | 67 ++++++++ src/settings/settings_advanced.ui | 153 ++++++++++++++++++ src/settings/settings_appearance.ui | 284 +++++++++++++++++++++++++++++++++ src/settings/settings_general.ui | 267 +++++++++++++++++++++++++++++++ src/settings/settings_privacy.ui | 260 ++++++++++++++++++++++++++++++ src/settings/settings_tabs.ui | 290 ++++++++++++++++++++++++++++++++++ src/settings/settings_webkit.ui | 200 +++++++++++++++++++++++ src/settings/settingsdialog.cpp | 227 ++++++++++++++++++++++++++ src/settings/settingsdialog.h | 63 ++++++++ src/settings/tabswidget.cpp | 52 ++++++ src/settings/tabswidget.h | 58 +++++++ src/settings/webkitwidget.cpp | 71 +++++++++ src/settings/webkitwidget.h | 60 +++++++ 26 files changed, 3061 insertions(+) create mode 100644 src/settings/advancedwidget.cpp create mode 100644 src/settings/advancedwidget.h create mode 100644 src/settings/appearancewidget.cpp create mode 100644 src/settings/appearancewidget.h create mode 100644 src/settings/generalwidget.cpp create mode 100644 src/settings/generalwidget.h create mode 100644 src/settings/networkwidget.cpp create mode 100644 src/settings/networkwidget.h create mode 100644 src/settings/passexceptionswidget.cpp create mode 100644 src/settings/passexceptionswidget.h create mode 100644 src/settings/password_exceptions.ui create mode 100644 src/settings/privacywidget.cpp create mode 100644 src/settings/privacywidget.h create mode 100644 src/settings/settings_advanced.ui create mode 100644 src/settings/settings_appearance.ui create mode 100644 src/settings/settings_general.ui create mode 100644 src/settings/settings_privacy.ui create mode 100644 src/settings/settings_tabs.ui create mode 100644 src/settings/settings_webkit.ui create mode 100644 src/settings/settingsdialog.cpp create mode 100644 src/settings/settingsdialog.h create mode 100644 src/settings/tabswidget.cpp create mode 100644 src/settings/tabswidget.h create mode 100644 src/settings/webkitwidget.cpp create mode 100644 src/settings/webkitwidget.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e66691de..5ab4f8fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,6 +28,15 @@ set(rekonq_KDEINIT_SRCS #---------------------------------------- session/sessionmanager.cpp #---------------------------------------- + settings/settingsdialog.cpp + settings/appearancewidget.cpp + settings/advancedwidget.cpp + settings/generalwidget.cpp + settings/privacywidget.cpp + settings/tabswidget.cpp + settings/webkitwidget.cpp + settings/passexceptionswidget.cpp + #---------------------------------------- tabwindow/tabbar.cpp tabwindow/tabhighlighteffect.cpp tabwindow/tabpreviewpopup.cpp @@ -40,12 +49,25 @@ set(rekonq_KDEINIT_SRCS ) +KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS + #---------------------------------------- + settings/settings_general.ui + settings/settings_tabs.ui + settings/settings_appearance.ui + settings/settings_webkit.ui + settings/settings_advanced.ui + settings/settings_privacy.ui + settings/password_exceptions.ui + ) + + ### ------------- INCLUDING DIRECTORIES... INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/adblock ${CMAKE_CURRENT_SOURCE_DIR}/history ${CMAKE_CURRENT_SOURCE_DIR}/session + ${CMAKE_CURRENT_SOURCE_DIR}/settings ${CMAKE_CURRENT_SOURCE_DIR}/tabwindow ${CMAKE_CURRENT_SOURCE_DIR}/webwindow ${CMAKE_CURRENT_BINARY_DIR} diff --git a/src/settings/advancedwidget.cpp b/src/settings/advancedwidget.cpp new file mode 100644 index 00000000..73c889dc --- /dev/null +++ b/src/settings/advancedwidget.cpp @@ -0,0 +1,70 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Local Includes +#include "advancedwidget.h" +#include "advancedwidget.moc" + +// Qt Includes +#include + + +AdvancedWidget::AdvancedWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + connect(proxyButton, SIGNAL(clicked()), this, SLOT(launchProxySettings())); +} + + +void AdvancedWidget::save() +{ +} + + +bool AdvancedWidget::changed() +{ + return _changed; +} + + +void AdvancedWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +void AdvancedWidget::launchProxySettings() +{ + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("proxy"); + QProcess *proc = new QProcess(this); + proc->start(program, arguments); +} diff --git a/src/settings/advancedwidget.h b/src/settings/advancedwidget.h new file mode 100644 index 00000000..c9509c9d --- /dev/null +++ b/src/settings/advancedwidget.h @@ -0,0 +1,62 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef ADVANCED_WIDGET_H +#define ADVANCED_WIDGET_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Ui Includes +#include "ui_settings_advanced.h" + +// Qt Includes +#include + + +class AdvancedWidget : public QWidget, private Ui::advanced +{ + Q_OBJECT + +public: + AdvancedWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + void launchProxySettings(); + +private: + bool _changed; +}; + +#endif // ADVANCED_WIDGET_H diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp new file mode 100644 index 00000000..42c9db14 --- /dev/null +++ b/src/settings/appearancewidget.cpp @@ -0,0 +1,119 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "appearancewidget.h" +#include "appearancewidget.moc" + +// Auto Includes +#include "rekonq.h" + +// KDE Includes +#include +#include + +AppearanceWidget::AppearanceWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + fixedFontChooser->setOnlyFixed(true); + + standardFontChooser->setCurrentFont(QFont(ReKonfig::standardFontFamily())); + fixedFontChooser->setCurrentFont(QFont(ReKonfig::fixedFontFamily())); + serifFontChooser->setCurrentFont(QFont(ReKonfig::serifFontFamily())); + sansSerifFontChooser->setCurrentFont(QFont(ReKonfig::sansSerifFontFamily())); + cursiveFontChooser->setCurrentFont(QFont(ReKonfig::cursiveFontFamily())); + fantasyFontChooser->setCurrentFont(QFont(ReKonfig::fantasyFontFamily())); + + connect(standardFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + connect(fixedFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + connect(serifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + connect(sansSerifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + connect(cursiveFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + connect(fantasyFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); + + populateEncodingMenu(); +} + + +void AppearanceWidget::save() +{ + ReKonfig::setStandardFontFamily(standardFontChooser->currentFont().family()); + ReKonfig::setFixedFontFamily(fixedFontChooser->currentFont().family()); + ReKonfig::setSerifFontFamily(serifFontChooser->currentFont().family()); + ReKonfig::setSansSerifFontFamily(sansSerifFontChooser->currentFont().family()); + ReKonfig::setCursiveFontFamily(cursiveFontChooser->currentFont().family()); + ReKonfig::setFantasyFontFamily(fantasyFontChooser->currentFont().family()); +} + + +bool AppearanceWidget::changed() +{ + return _changed; +} + + +void AppearanceWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool AppearanceWidget::isDefault() +{ + bool def = true; + + // TODO: implement me!! + + return def; +} + + +void AppearanceWidget::populateEncodingMenu() +{ + encodingCombo->setEditable(false); + QStringList encodings = KGlobal::charsets()->availableEncodingNames(); + encodingCombo->addItems(encodings); + + encodingCombo->setWhatsThis(i18n("Select the default encoding to be used; normally, you will be fine with 'Use language encoding' " + "and should not have to change this.")); + + connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(setEncoding(QString))); + connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(hasChanged())); + + QString enc = ReKonfig::defaultEncoding(); + int indexOfEnc = encodings.indexOf(enc); + encodingCombo->setCurrentIndex(indexOfEnc); +} + + +void AppearanceWidget::setEncoding(const QString &enc) +{ + ReKonfig::setDefaultEncoding(enc); +} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h new file mode 100644 index 00000000..86f6d66a --- /dev/null +++ b/src/settings/appearancewidget.h @@ -0,0 +1,65 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef APPEARANCE_WIDGET_H +#define APPEARANCE_WIDGET_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Ui Includes +#include "ui_settings_appearance.h" + +// Qt Includes +#include + + +class AppearanceWidget : public QWidget, private Ui::appearance +{ + Q_OBJECT + +public: + AppearanceWidget(QWidget *parent = 0); + + void save(); + bool changed(); + bool isDefault(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + void setEncoding(const QString &); + +private: + void populateEncodingMenu(); + + bool _changed; +}; + +#endif // APPEARANCE_WIDGET_H diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp new file mode 100644 index 00000000..34bea602 --- /dev/null +++ b/src/settings/generalwidget.cpp @@ -0,0 +1,130 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "generalwidget.h" +#include "generalwidget.moc" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "application.h" +#include "tabwindow.h" +#include "webwindow.h" + +//KDE Includes +#include +#include + + +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))); + + checkKGetPresence(); + + connect(kcfg_homePage, SIGNAL(editingFinished()), this, SLOT(fixHomePageURL())); + + kcfg_downloadPath->setMode(KFile::Directory); + + askDownloadYes->setChecked(ReKonfig::askDownloadPath()); + askDownloadNo->setChecked(!ReKonfig::askDownloadPath()); + + kcfg_downloadPath->setEnabled(!ReKonfig::askDownloadPath()); + connect(askDownloadNo, SIGNAL(toggled(bool)), kcfg_downloadPath, SLOT(setEnabled(bool))); + connect(askDownloadNo, SIGNAL(toggled(bool)), this, SLOT(hasChanged())); +} + + +void GeneralWidget::save() +{ + ReKonfig::setAskDownloadPath(askDownloadYes->isChecked()); + + _changed = false; +} + + +bool GeneralWidget::changed() +{ + return _changed; +} + + +void GeneralWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +void GeneralWidget::setHomeToCurrentPage() +{ + TabWindow *tw = rApp->tabWindow(); + WebWindow *tab = tw->currentWebWindow(); + if (tab) + { + kcfg_homePage->setText(tab->url().toString()); + } +} + + +void GeneralWidget::disableHomeSettings(bool b) +{ + kcfg_homePage->setEnabled(!b); + setHomeToCurrentPageButton->setEnabled(!b); +} + + +void GeneralWidget::checkKGetPresence() +{ + if (KStandardDirs::findExe("kget").isNull()) + { + kcfg_kgetDownload->setDisabled(true); + kcfg_kgetList->setDisabled(true); + kcfg_kgetDownload->setToolTip(i18n("Install KGet to enable rekonq to use it as download manager")); + } + else + { + kcfg_kgetDownload->setDisabled(false); + kcfg_kgetList->setDisabled(false); + } +} + + +void GeneralWidget::fixHomePageURL() +{ + QString fixedURL = QUrl::fromUserInput(kcfg_homePage->text()).toString(); + kcfg_homePage->setText(fixedURL); +} diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h new file mode 100644 index 00000000..33dfe610 --- /dev/null +++ b/src/settings/generalwidget.h @@ -0,0 +1,62 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef GENERAL_WIDGET_H +#define GENERAL_WIDGET_H + + +// Ui Includes +#include "ui_settings_general.h" + +// Qt Includes +#include + + +class GeneralWidget : public QWidget, private Ui::general +{ + Q_OBJECT + +public: + GeneralWidget(QWidget *parent = 0); + + void save(); + bool changed(); + void checkKGetPresence(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + void setHomeToCurrentPage(); + void disableHomeSettings(bool); + void fixHomePageURL(); + +private: + bool _changed; +}; + +#endif // GENERAL_WIDGET_H diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp new file mode 100644 index 00000000..c2988eb1 --- /dev/null +++ b/src/settings/networkwidget.cpp @@ -0,0 +1,100 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "networkwidget.h" +#include "networkwidget.moc" + +// KDE Includes +#include +#include + +// Qt Includes +#include + + +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().toUtf8())); + + KCModuleInfo cookiesInfo("cookies.desktop"); + _cookiesModule = new KCModuleProxy(cookiesInfo, parent); + tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toUtf8())); + + KCModuleInfo proxyInfo("proxy.desktop"); + _proxyModule = new KCModuleProxy(proxyInfo, parent); + tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toUtf8())); + + 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..74a0e312 --- /dev/null +++ b/src/settings/networkwidget.h @@ -0,0 +1,63 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef NETWORK_WIDGET_H +#define NETWORK_WIDGET_H + + +// KDE Includes +#include + +// Qt Includes +#include + + +class NetworkWidget : public QWidget +{ + Q_OBJECT + +public: + NetworkWidget(QWidget *parent = 0); + ~NetworkWidget(); + + void save(); + bool changed(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + +private: + KCModuleProxy *_cacheModule; + KCModuleProxy *_cookiesModule; + KCModuleProxy *_proxyModule; + + bool _changed; +}; + +#endif // NETWORK_WIDGET_H diff --git a/src/settings/passexceptionswidget.cpp b/src/settings/passexceptionswidget.cpp new file mode 100644 index 00000000..fe20e711 --- /dev/null +++ b/src/settings/passexceptionswidget.cpp @@ -0,0 +1,73 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "passexceptionswidget.h" +#include "passexceptionswidget.moc" + +// Auto Includes +#include "rekonq.h" + + +PassExWidget::PassExWidget(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose, true); + + connect(removeOneButton, SIGNAL(clicked()), this, SLOT(removeOne())); + connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll())); + + QStringList exList = ReKonfig::walletBlackList(); + Q_FOREACH(const QString & str, exList) + { + QListWidgetItem *item = new QListWidgetItem(str, listWidget); + listWidget->addItem(item); + } +} + + +void PassExWidget::removeOne() +{ + const int currentRow(listWidget->currentRow()); + if (currentRow == -1) + return; + QString item = listWidget->takeItem(currentRow)->text(); + + QStringList exList = ReKonfig::walletBlackList(); + exList.removeOne(item); + ReKonfig::setWalletBlackList(exList); +} + + +void PassExWidget::removeAll() +{ + listWidget->clear(); + + QStringList clearList; + ReKonfig::setWalletBlackList(clearList); +} diff --git a/src/settings/passexceptionswidget.h b/src/settings/passexceptionswidget.h new file mode 100644 index 00000000..6b02c4e6 --- /dev/null +++ b/src/settings/passexceptionswidget.h @@ -0,0 +1,53 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef PASS_EX_WIDGET_H +#define PASS_EX_WIDGET_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Ui Includes +#include "ui_password_exceptions.h" + +// Qt Includes +#include + + +class PassExWidget : public QWidget, private Ui::PassExceptions +{ + Q_OBJECT + +public: + PassExWidget(QWidget *parent = 0); + +private Q_SLOTS: + void removeOne(); + void removeAll(); +}; + +#endif // PASS_EX_WIDGET_H diff --git a/src/settings/password_exceptions.ui b/src/settings/password_exceptions.ui new file mode 100644 index 00000000..97cf621b --- /dev/null +++ b/src/settings/password_exceptions.ui @@ -0,0 +1,55 @@ + + + PassExceptions + + + + 0 + 0 + 400 + 300 + + + + Password Exceptions + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Remove one + + + + + + + Remove all + + + + + + + + + + diff --git a/src/settings/privacywidget.cpp b/src/settings/privacywidget.cpp new file mode 100644 index 00000000..46774a63 --- /dev/null +++ b/src/settings/privacywidget.cpp @@ -0,0 +1,135 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "privacywidget.h" +#include "privacywidget.moc" + +// Local Includes +#include "passexceptionswidget.h" + +// Auto Includes +#include "rekonq.h" + +// KDE Includes +#include +#include + +// Qt Includes +#include + + +PrivacyWidget::PrivacyWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + reload(); + + // DO NOT TRACK + KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString()); + doNotTrackCheckBox->setChecked(cg.readEntry("DoNotTrack", false)); + connect(doNotTrackCheckBox, SIGNAL(clicked()), this, SLOT(hasChanged())); + + // CACHE & COOKIES + connect(cacheButton, SIGNAL(clicked()), this, SLOT(launchCacheSettings())); + connect(cookiesButton, SIGNAL(clicked()), this, SLOT(launchCookieSettings())); + + // PASSWORDS + connect(managePassExceptionsButton, SIGNAL(clicked()), this, SLOT(showPassExceptions())); +} + + +void PrivacyWidget::save() +{ + KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString()); + cg.writeEntry("DoNotTrack", doNotTrackCheckBox->isChecked()); + cg.sync(); + + reload(); +} + + +void PrivacyWidget::reload() +{ + bool b = ReKonfig::javascriptEnabled(); + + kcfg_javascriptCanAccessClipboard->setEnabled(b); + kcfg_javascriptCanOpenWindows->setEnabled(b); + + if (b) + { + 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.")); + } + else + { + QString str = i18n("Javascript is NOT enabled, cannot change these settings"); + kcfg_javascriptCanOpenWindows->setToolTip(str); + kcfg_javascriptCanAccessClipboard->setToolTip(str); + } +} + + +bool PrivacyWidget::changed() +{ + return _changed; +} + + +void PrivacyWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +void PrivacyWidget::launchCacheSettings() +{ + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("cache"); + QProcess *proc = new QProcess(this); + proc->start(program, arguments); +} + + +void PrivacyWidget::launchCookieSettings() +{ + QString program = QL1S("kcmshell4"); + QStringList arguments; + arguments << QL1S("cookies"); + QProcess *proc = new QProcess(this); + proc->start(program, arguments); +} + + +void PrivacyWidget::showPassExceptions() +{ + PassExWidget *widg = new PassExWidget; + widg->show(); +} diff --git a/src/settings/privacywidget.h b/src/settings/privacywidget.h new file mode 100644 index 00000000..229cb7df --- /dev/null +++ b/src/settings/privacywidget.h @@ -0,0 +1,67 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2012 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef PRIVACY_WIDGET_H +#define PRIVACY_WIDGET_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// Ui Includes +#include "ui_settings_privacy.h" + +// Qt Includes +#include + + +class PrivacyWidget : public QWidget, private Ui::privacy +{ + Q_OBJECT + +public: + PrivacyWidget(QWidget *parent = 0); + + void save(); + void reload(); + + bool changed(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + + void launchCacheSettings(); + void launchCookieSettings(); + void showPassExceptions(); + +private: + bool _changed; +}; + +#endif // PRIVACY_WIDGET_H diff --git a/src/settings/settings_advanced.ui b/src/settings/settings_advanced.ui new file mode 100644 index 00000000..9457ca22 --- /dev/null +++ b/src/settings/settings_advanced.ui @@ -0,0 +1,153 @@ + + + advanced + + + + 0 + 0 + 480 + 440 + + + + + + + Proxy + + + + + + Rekonq is using your system's proxy settings + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Change them! + + + + + + + + + + + + + Misc + + + + + + Use horizontal scroll wheel to go through web history + + + + + + + Use favicon of the current website as window icon + + + + + + + Scroll pages with an eye candy effect + + + Enable smooth scrolling + + + true + + + + + + + Enable Vi-like navigation shortcuts + + + + + + + Enable keyboard navigation using the Ctrl key + + + + + + + + + Middle click should: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + Auto-scroll + + + + + Load Clipboard URL + + + + + Do Nothing + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 155 + + + + + + + + + diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui new file mode 100644 index 00000000..b0232089 --- /dev/null +++ b/src/settings/settings_appearance.ui @@ -0,0 +1,284 @@ + + + appearance + + + + 0 + 0 + 570 + 562 + + + + Appearance + + + + + + Fonts + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Standard font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Fixed font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Serif font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Sans Serif font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + Cursive font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Fantasy font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + Font size + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Default font size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Minimal font size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + Character Encoding + + + + + + Default character encoding: + + + + + + + + + + + + + Custom Style Sheet + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 150 + 0 + + + + Path to custom CSS file: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + *.css + + + + + + + + + + Qt::Vertical + + + + 20 + 149 + + + + + + + + + KFontComboBox + KComboBox +
kfontcombobox.h
+
+ + KComboBox + QComboBox +
kcombobox.h
+
+ + KUrlRequester + QFrame +
kurlrequester.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+
+ + +
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui new file mode 100644 index 00000000..7d4419b8 --- /dev/null +++ b/src/settings/settings_general.ui @@ -0,0 +1,267 @@ + + + general + + + + 0 + 0 + 573 + 410 + + + + General + + + + + + Startup + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Qt::LeftToRight + + + When starting rekonq: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + Open the Home Page + + + + + Open the New Tab Page + + + + + Restore the Last Opened Tabs + + + + + + + + + + + Home Page + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Home page URL: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + + + + + + Set to Current Page + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Use the New Tab Page as home page + + + + + + + + + + Download Manager + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Save files to: + + + + + + + + 0 + 0 + + + + + + + + + + Always ask me where to save files + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Use KGet for downloading files + + + + + + + If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet. + + + List links with KGet + + + + + + + + + + Qt::Vertical + + + + 20 + 179 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KUrlRequester + QFrame +
kurlrequester.h
+
+
+ + +
diff --git a/src/settings/settings_privacy.ui b/src/settings/settings_privacy.ui new file mode 100644 index 00000000..04f36bad --- /dev/null +++ b/src/settings/settings_privacy.ui @@ -0,0 +1,260 @@ + + + privacy + + + + 0 + 0 + 535 + 520 + + + + + + + Javascript + + + + + + Let Javascript open new windows + + + + + + + Let Javascript access clipboard + + + + + + + + + + Tracking + + + + + + Tell websites you do not want to be tracked + + + + + + + + + + History + + + + + + + + Remove history items: + + + + + + + + never + + + + + every 3 months + + + + + every month + + + + + every day + + + + + at application exit + + + + + don't even store them + + + + + + + + + + + + + Passwords + + + + + + + + Remember passwords for sites + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Manage Exceptions + + + + + + + + + + + + Cookies + + + + + + Rekonq is sharing cookies settings with all other KDE applications + + + false + + + + + + + + + Manage Cookies + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Cache + + + + + + Rekonq is sharing cache settings with all other KDE applications + + + false + + + + + + + + + Manage Cache + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 135 + + + + + + + + + diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui new file mode 100644 index 00000000..4e19545f --- /dev/null +++ b/src/settings/settings_tabs.ui @@ -0,0 +1,290 @@ + + + tabs + + + + 0 + 0 + 483 + 427 + + + + Tabs + + + + + + New Tab Behavior + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 150 + 0 + + + + New tab opens: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + New Tab Page + + + + + Blank Page + + + + + Home Page + + + + + + + + + 150 + 0 + + + + New Tab Page starts with: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + Favorites + + + + + Closed Tabs + + + + + Bookmarks + + + + + History + + + + + Downloads + + + + + Tabs + + + + + + + + + + + Tabbed Browsing + + + + + + + + + 150 + 0 + + + + When hovering a tab show: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + + Tab Preview + + + + + Tab's Title in a Tooltip + + + + + Tab's URL in a Tooltip + + + + + Nothing + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Always show tab bar + + + + + + + Don't use tabs: open links in new windows + + + + + + + Open as new window when URL is called externally + + + + + + + Closing last tab closes window + + + + + + + Open new tabs in the background + + + + + + + Open new tabs after currently active one + + + + + + + Activate previously used tab when closing the current one + + + false + + + + + + + Animated tab highlighting + + + + + + + + + + Qt::Vertical + + + + 20 + 120 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+
+ + +
diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui new file mode 100644 index 00000000..62f3bafd --- /dev/null +++ b/src/settings/settings_webkit.ui @@ -0,0 +1,200 @@ + + + webkit + + + + 0 + 0 + 503 + 514 + + + + + + + General + + + + + + + 0 + 0 + + + + Enable JavaScript + + + + + + + Load java applets + + + + + + + WebGL + + + + + + + Spatial Navigation + + + + + + + Frame Flattening + + + + + + + Prefetch DNS entries + + + + + + + Print element backgrounds + + + + + + + + + + true + + + + 0 + 0 + + + + Plugins + + + + + + true + + + + 0 + 0 + + + + + 150 + 0 + + + + When loading web pages: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + Autoload Plugins + + + + + Manually Load Plugins + + + + + Never Load Plugins + + + + + + + + + + + HTML 5 + + + + + + Offline storage database + + + + + + + Offline web application cache + + + + + + + Local Storage + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+
+ + +
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp new file mode 100644 index 00000000..9f6b372a --- /dev/null +++ b/src/settings/settingsdialog.cpp @@ -0,0 +1,227 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2008-2012 by Andrea Diamantini +* Copyright (C) 2009-2011 by Lionel Chauvin +* +* +* 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 . +* +* ============================================================ */ + + +// Self Includes +#include "settingsdialog.h" +#include "settingsdialog.moc" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "searchengine.h" + +// Widget Includes +#include "advancedwidget.h" +#include "appearancewidget.h" +#include "generalwidget.h" +#include "privacywidget.h" +#include "tabswidget.h" +#include "webkitwidget.h" + +// KDE Includes +#include +#include +#include +#include +#include +#include + +// Qt Includes +#include + + +class Private +{ +private: + Private(SettingsDialog *parent); + +private: + GeneralWidget *generalWidg; + TabsWidget *tabsWidg; + AppearanceWidget *appearanceWidg; + WebKitWidget *webkitWidg; + PrivacyWidget *privacyWidg; + AdvancedWidget *advancedWidg; + + KCModuleProxy *ebrowsingModule; + + KShortcutsEditor *shortcutsEditor; + + friend class SettingsDialog; +}; + + +Private::Private(SettingsDialog *parent) +{ + KPageWidgetItem *pageItem; + + // -- 1 + generalWidg = new GeneralWidget(parent); + generalWidg->layout()->setMargin(0); + pageItem = parent->addPage(generalWidg, i18n("General")); + pageItem->setIcon(KIcon("rekonq")); + + // -- 2 + tabsWidg = new TabsWidget(parent); + tabsWidg->layout()->setMargin(0); + pageItem = parent->addPage(tabsWidg, i18n("Tabs")); + pageItem->setIcon(KIcon("tab-duplicate")); + + // -- 3 + appearanceWidg = new AppearanceWidget(parent); + appearanceWidg->layout()->setMargin(0); + pageItem = parent->addPage(appearanceWidg, i18n("Appearance")); + pageItem->setIcon(KIcon("preferences-desktop-font")); + + // -- 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 + privacyWidg = new PrivacyWidget(parent); + privacyWidg->layout()->setMargin(0); + pageItem = parent->addPage(privacyWidg, i18n("Privacy")); + pageItem->setIcon(KIcon("view-media-artist")); + + // -- 6 + advancedWidg = new AdvancedWidget(parent); + advancedWidg->layout()->setMargin(0); + pageItem = parent->addPage(advancedWidg, i18n("Advanced")); + pageItem->setIcon(KIcon("applications-system")); + +// // -- 7 +// shortcutsEditor = new KShortcutsEditor(rApp->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("Search Engines")); + KIcon wsIcon("edit-web-search"); + if (wsIcon.isNull()) + { + wsIcon = KIcon("preferences-web-browser-shortcuts"); + } + pageItem->setIcon(wsIcon); + + // WARNING + // remember wheh changing here that the smallest netbooks + // have a 1024x576 resolution. So DON'T bother that limits!! + parent->setMinimumSize(700, 525); +} + + +// ----------------------------------------------------------------------------------------------------- + + +SettingsDialog::SettingsDialog(QWidget *parent) + : KConfigDialog(parent, "rekonfig", ReKonfig::self()) + , d(new Private(this)) +{ + showButtonSeparator(false); + setWindowTitle(i18nc("Window title of the settings dialog", "Configure – rekonq")); + + // update buttons + 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->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->advancedWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->privacyWidg, 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())); + setHelp("Config-rekonq", "rekonq"); +} + + +SettingsDialog::~SettingsDialog() +{ + kDebug() << "bye bye settings..."; + delete d; +} + + +// we need this function to SAVE settings in rc file.. +void SettingsDialog::saveSettings() +{ + ReKonfig::self()->writeConfig(); + + d->generalWidg->save(); + d->tabsWidg->save(); + d->appearanceWidg->save(); + d->webkitWidg->save(); + d->advancedWidg->save(); + d->privacyWidg->save(); + d->shortcutsEditor->save(); + d->ebrowsingModule->save(); + + d->privacyWidg->reload(); + + SearchEngine::reload(); + + updateButtons(); + emit settingsChanged("ReKonfig"); +} + + +bool SettingsDialog::hasChanged() +{ + return KConfigDialog::hasChanged() + || d->generalWidg->changed() + || d->tabsWidg->changed() + || d->appearanceWidg->changed() + || d->webkitWidg->changed() + || d->advancedWidg->changed() + || d->privacyWidg->changed() + || d->ebrowsingModule->changed() + || d->shortcutsEditor->isModified(); + ; +} + + +bool SettingsDialog::isDefault() +{ + bool isDef = KConfigDialog::isDefault(); + + if (isDef) + { + // check our private widget values + isDef = d->appearanceWidg->isDefault(); + } + return isDef; +} diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h new file mode 100644 index 00000000..ad03602b --- /dev/null +++ b/src/settings/settingsdialog.h @@ -0,0 +1,63 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2008-2012 by Andrea Diamantini +* Copyright (C) 2009-2011 by Lionel Chauvin +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef SETTINGS_DIALOG_H +#define SETTINGS_DIALOG_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// KDE Includes +#include + +// Forward Declarations +class QWidget; +class Private; + + +class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog +{ + Q_OBJECT + +public: + SettingsDialog(QWidget *parent = 0); + ~SettingsDialog(); + + virtual bool hasChanged(); + +protected: + virtual bool isDefault(); + +private: + Private* const d; + +private Q_SLOTS: + void saveSettings(); +}; + +#endif // SETTINGS_DIALOG_H diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp new file mode 100644 index 00000000..67829f82 --- /dev/null +++ b/src/settings/tabswidget.cpp @@ -0,0 +1,52 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// 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..056f030c --- /dev/null +++ b/src/settings/tabswidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef TABS_WIDGET_H +#define TABS_WIDGET_H + + +// Ui Includes +#include "ui_settings_tabs.h" + +// Qt Includes +#include + + +class TabsWidget : public QWidget, private Ui::tabs +{ + Q_OBJECT + +public: + TabsWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +Q_SIGNALS: + void changed(bool); + +private Q_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..31224f05 --- /dev/null +++ b/src/settings/webkitwidget.cpp @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +// Local Includes +#include "webkitwidget.h" +#include "webkitwidget.moc" + + +WebKitWidget::WebKitWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + setWebSettingsToolTips(); +} + + +void WebKitWidget::save() +{ +} + + +bool WebKitWidget::changed() +{ + return _changed; +} + + +void WebKitWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +void WebKitWidget::setWebSettingsToolTips() +{ + kcfg_webGL->setToolTip(i18n("Enables WebGL technology")); + kcfg_spatialNavigation->setToolTip(i18n("Lets you navigating between focusable elements using arrow keys.")); + kcfg_frameFlattening->setToolTip(i18n("Flatten all the frames to become one scrollable page.")); + kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); + kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); + kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + 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..1a41a6a1 --- /dev/null +++ b/src/settings/webkitwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Andrea Diamantini +* +* +* 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 . +* +* ============================================================ */ + + +#ifndef WEBKIT_WIDGET_H +#define WEBKIT_WIDGET_H + + +// Ui Includes +#include "ui_settings_webkit.h" + +// Qt Includes +#include + + +class WebKitWidget : public QWidget, private Ui::webkit +{ + Q_OBJECT + +public: + WebKitWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +Q_SIGNALS: + void changed(bool); + +private Q_SLOTS: + void hasChanged(); + +private: + void setWebSettingsToolTips(); + + bool _changed; +}; + +#endif // WEBKIT_WIDGET_H -- cgit v1.2.1