From 9fff1383205279a747c09bf07af84cfa37dd3403 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 11 Nov 2009 15:32:59 +0100 Subject: cleaning home :) In Italy we say "Pulizie di Pasqua". Just some changes to reorganize things better --- src/CMakeLists.txt | 40 +++--- src/mainwindow.cpp | 2 +- src/mainwindow.h | 1 - src/newtabpage.cpp | 285 --------------------------------------- src/newtabpage.h | 72 ---------- src/rekonqpage/newtabpage.cpp | 285 +++++++++++++++++++++++++++++++++++++++ src/rekonqpage/newtabpage.h | 72 ++++++++++ src/settings.cpp | 235 -------------------------------- src/settings.h | 62 --------- src/settings/settings_fonts.ui | 97 +++++++++++++ src/settings/settings_general.ui | 244 +++++++++++++++++++++++++++++++++ src/settings/settings_tabs.ui | 81 +++++++++++ src/settings/settings_webkit.ui | 161 ++++++++++++++++++++++ src/settings/settingsdialog.cpp | 235 ++++++++++++++++++++++++++++++++ src/settings/settingsdialog.h | 62 +++++++++ src/settings_fonts.ui | 97 ------------- src/settings_general.ui | 244 --------------------------------- src/settings_tabs.ui | 81 ----------- src/settings_webkit.ui | 161 ---------------------- 19 files changed, 1259 insertions(+), 1258 deletions(-) delete mode 100644 src/newtabpage.cpp delete mode 100644 src/newtabpage.h create mode 100644 src/rekonqpage/newtabpage.cpp create mode 100644 src/rekonqpage/newtabpage.h delete mode 100644 src/settings.cpp delete mode 100644 src/settings.h create mode 100644 src/settings/settings_fonts.ui create mode 100644 src/settings/settings_general.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 delete mode 100644 src/settings_fonts.ui delete mode 100644 src/settings_general.ui delete mode 100644 src/settings_tabs.ui delete mode 100644 src/settings_webkit.ui (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e6c5d66..56bc0ebd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,36 +7,36 @@ ADD_SUBDIRECTORY( tests ) ### ------- SETTING REKONQ FILES.. SET( rekonq_KDEINIT_SRCS - newtabpage.cpp - previewimage.cpp - websnap.cpp - autosaver.cpp application.cpp - mainwindow.cpp - mainview.cpp - tabbar.cpp + autosaver.cpp + bookmarks.cpp + findbar.cpp history.cpp historymodels.cpp - bookmarks.cpp + lineedit.cpp + mainview.cpp + mainwindow.cpp modelmenu.cpp - urlbar.cpp - findbar.cpp - settings.cpp - webview.cpp - sidepanel.cpp panelhistory.cpp - lineedit.cpp - webpage.cpp + previewimage.cpp sessionmanager.cpp + sidepanel.cpp + tabbar.cpp + urlbar.cpp + webpage.cpp webpluginfactory.cpp + websnap.cpp + webview.cpp + rekonqpage/newtabpage.cpp + settings/settingsdialog.cpp ) KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS - settings_general.ui - settings_tabs.ui - settings_fonts.ui - settings_webkit.ui + settings/settings_general.ui + settings/settings_tabs.ui + settings/settings_fonts.ui + settings/settings_webkit.ui cleardata.ui ) @@ -46,6 +46,8 @@ KDE4_ADD_KCFG_FILES( rekonq_KDEINIT_SRCS rekonq.kcfgc ) ### ------------- INCLUDING DIRECTORIES... INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/rekonqpage + ${CMAKE_CURRENT_SOURCE_DIR}/settings ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES} diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 43031446..8caa6fbc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -35,7 +35,7 @@ // Local Includes #include "application.h" -#include "settings.h" +#include "settingsdialog.h" #include "history.h" #include "bookmarks.h" #include "webview.h" diff --git a/src/mainwindow.h b/src/mainwindow.h index 5071cdb2..0ee1c3c2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,7 +32,6 @@ // Local Includes #include "bookmarks.h" -// #include "mainview.h" #include "webview.h" // KDE Includes diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp deleted file mode 100644 index b34990fc..00000000 --- a/src/newtabpage.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 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 "newtabpage.h" - -// Auto Includes -#include "rekonq.h" - -// Local Includes -#include "historymodels.h" -#include "bookmarks.h" -#include "application.h" -#include "mainwindow.h" -#include "mainview.h" - -// KDE Includes -#include -#include -#include -#include -#include - -// Qt Includes -#include - - -NewTabPage::NewTabPage() -{ - m_htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html"); -} - - -NewTabPage::~NewTabPage() -{ -} - - -QString NewTabPage::newTabPageCode(const KUrl &url) -{ - QFile file(m_htmlFilePath); - bool isOpened = file.open(QIODevice::ReadOnly); - if (!isOpened) - { - kWarning() << "Couldn't open the home.html file"; - return QString(""); - } - QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics"); - QString menu = browsingMenu(url); - - QString speed; - QString title; - if(url == KUrl("about:closedTabs")) - { - speed = closedTabsPage(); - title = i18n("Closed Tabs"); - } - if(url == KUrl("about:history")) - { - speed = historyPage(); - title = i18n("History"); - } - if(url == KUrl("about:bookmarks")) - { - speed = bookmarksPage(); - title = i18n("Bookmarks"); - } - if(url == KUrl("about:home") || url == KUrl("about:favorites")) - { - speed = favoritesPage(); - title = i18n("Favorites"); - } - - QString html = QString(QLatin1String(file.readAll())) - .arg(title) - .arg(imagesPath) - .arg(menu) - .arg(speed) - ; - - return html; -} - - -QString NewTabPage::favoritesPage() -{ - QStringList names = ReKonfig::previewNames(); - QStringList urls = ReKonfig::previewUrls(); - - QString speed = "
"; - for(int i=0; i<8; ++i) - { - speed += "
"; - speed += ""; - speed += ""; - speed += ""; - speed += ""; - speed += ""; - speed += "
"; - } - - speed += "
"; - return speed; -} - - -// FIXME : port to new PreviewImage API to use... -QString NewTabPage::lastVisitedPage() -{ - QString last; - QList history = Application::historyManager()->history(); - for (int i = 0; i < 8 && i < history.size(); ++i) - { - HistoryItem it = history.at(i); - last += "
"; - last += ""; - last += ""; - last += "
"; - last += "" + it.title + "
"; - } - - return last; - -} - - -QString NewTabPage::browsingMenu(const KUrl ¤tUrl) -{ - QString menu; - - KIconLoader *loader = KIconLoader::global(); - - menu += ""; - - menu += ""; - - menu += ""; - - menu += ""; - - return menu; -} - - -QString NewTabPage::historyPage() -{ - HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); - - QString history; - int i = 0; - do - { - QModelIndex index = model->index(i, 0, QModelIndex() ); - if(model->hasChildren(index)) - { - history += "

" + index.data().toString() + "

"; - for(int j=0; j< model->rowCount(index); ++j) - { - QModelIndex son = model->index(j, 0, index ); - history += son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"); - history += ' '; - history += QString("") + - son.data().toString() + QString(""); - history += "
"; - } - } - i++; - } - while( model->hasIndex( i , 0 , QModelIndex() ) ); - - history += ""; - return history; -} - - -QString NewTabPage::bookmarksPage() -{ - KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); - if (bookGroup.isNull()) - { - return QString("Error retrieving bookmarks!"); - } - - QString str; - KBookmark bookmark = bookGroup.first(); - while (!bookmark.isNull()) - { - str += createBookItem(bookmark); - bookmark = bookGroup.next(bookmark); - } - return str; -} - - -QString NewTabPage::createBookItem(const KBookmark &bookmark) -{ - if (bookmark.isGroup()) - { - QString result; - KBookmarkGroup group = bookmark.toGroup(); - KBookmark bm = group.first(); - result += "

" + bookmark.text() + "

"; - result += "

"; - while (!bm.isNull()) - { - result += createBookItem(bm); - bm = group.next(bm); - } - result += "

"; - return result; - } - - if(bookmark.isSeparator()) - { - return QString("
"); - } - - QString books = "" + bookmark.text() + "
"; - return books; -} - - -QString NewTabPage::closedTabsPage() -{ - QList links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs(); - QString closed; - - Q_FOREACH( const HistoryItem &item, links) - { - closed += "
"; - closed += ""; - closed += ""; - closed += ""; - closed += "
"; - } - - return closed; -} diff --git a/src/newtabpage.h b/src/newtabpage.h deleted file mode 100644 index 2d8d50bd..00000000 --- a/src/newtabpage.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 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 REKONQ_NEW_TAB_PAGE -#define REKONQ_NEW_TAB_PAGE - - -// KDE Includes -#include - -// Qt Includes -#include -#include - -// Forward Includes -class KBookmark; - - -class NewTabPage -{ - -public: - NewTabPage(); - ~NewTabPage(); - - /** - * This is the unique NewTabPage public method. It takes an - * about: url and loads the corresponding part of the - * new tab page - */ - QString newTabPageCode(const KUrl &url = KUrl("about:home")); - -protected: // these are the function to build the new tab page - - QString browsingMenu(const KUrl ¤tUrl); - - QString favoritesPage(); - QString lastVisitedPage(); - QString historyPage(); - QString bookmarksPage(); - QString closedTabsPage(); - -private: - QString createBookItem(const KBookmark &bookmark); - - QString m_htmlFilePath; -}; - -#endif // REKONQ_NEW_TAB_PAGE diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp new file mode 100644 index 00000000..b34990fc --- /dev/null +++ b/src/rekonqpage/newtabpage.cpp @@ -0,0 +1,285 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 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 "newtabpage.h" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "historymodels.h" +#include "bookmarks.h" +#include "application.h" +#include "mainwindow.h" +#include "mainview.h" + +// KDE Includes +#include +#include +#include +#include +#include + +// Qt Includes +#include + + +NewTabPage::NewTabPage() +{ + m_htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html"); +} + + +NewTabPage::~NewTabPage() +{ +} + + +QString NewTabPage::newTabPageCode(const KUrl &url) +{ + QFile file(m_htmlFilePath); + bool isOpened = file.open(QIODevice::ReadOnly); + if (!isOpened) + { + kWarning() << "Couldn't open the home.html file"; + return QString(""); + } + QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics"); + QString menu = browsingMenu(url); + + QString speed; + QString title; + if(url == KUrl("about:closedTabs")) + { + speed = closedTabsPage(); + title = i18n("Closed Tabs"); + } + if(url == KUrl("about:history")) + { + speed = historyPage(); + title = i18n("History"); + } + if(url == KUrl("about:bookmarks")) + { + speed = bookmarksPage(); + title = i18n("Bookmarks"); + } + if(url == KUrl("about:home") || url == KUrl("about:favorites")) + { + speed = favoritesPage(); + title = i18n("Favorites"); + } + + QString html = QString(QLatin1String(file.readAll())) + .arg(title) + .arg(imagesPath) + .arg(menu) + .arg(speed) + ; + + return html; +} + + +QString NewTabPage::favoritesPage() +{ + QStringList names = ReKonfig::previewNames(); + QStringList urls = ReKonfig::previewUrls(); + + QString speed = "
"; + for(int i=0; i<8; ++i) + { + speed += "
"; + speed += ""; + speed += ""; + speed += ""; + speed += ""; + speed += ""; + speed += "
"; + } + + speed += "
"; + return speed; +} + + +// FIXME : port to new PreviewImage API to use... +QString NewTabPage::lastVisitedPage() +{ + QString last; + QList history = Application::historyManager()->history(); + for (int i = 0; i < 8 && i < history.size(); ++i) + { + HistoryItem it = history.at(i); + last += "
"; + last += ""; + last += ""; + last += "
"; + last += "" + it.title + "
"; + } + + return last; + +} + + +QString NewTabPage::browsingMenu(const KUrl ¤tUrl) +{ + QString menu; + + KIconLoader *loader = KIconLoader::global(); + + menu += ""; + + menu += ""; + + menu += ""; + + menu += ""; + + return menu; +} + + +QString NewTabPage::historyPage() +{ + HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); + + QString history; + int i = 0; + do + { + QModelIndex index = model->index(i, 0, QModelIndex() ); + if(model->hasChildren(index)) + { + history += "

" + index.data().toString() + "

"; + for(int j=0; j< model->rowCount(index); ++j) + { + QModelIndex son = model->index(j, 0, index ); + history += son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"); + history += ' '; + history += QString("") + + son.data().toString() + QString(""); + history += "
"; + } + } + i++; + } + while( model->hasIndex( i , 0 , QModelIndex() ) ); + + history += ""; + return history; +} + + +QString NewTabPage::bookmarksPage() +{ + KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); + if (bookGroup.isNull()) + { + return QString("Error retrieving bookmarks!"); + } + + QString str; + KBookmark bookmark = bookGroup.first(); + while (!bookmark.isNull()) + { + str += createBookItem(bookmark); + bookmark = bookGroup.next(bookmark); + } + return str; +} + + +QString NewTabPage::createBookItem(const KBookmark &bookmark) +{ + if (bookmark.isGroup()) + { + QString result; + KBookmarkGroup group = bookmark.toGroup(); + KBookmark bm = group.first(); + result += "

" + bookmark.text() + "

"; + result += "

"; + while (!bm.isNull()) + { + result += createBookItem(bm); + bm = group.next(bm); + } + result += "

"; + return result; + } + + if(bookmark.isSeparator()) + { + return QString("
"); + } + + QString books = "" + bookmark.text() + "
"; + return books; +} + + +QString NewTabPage::closedTabsPage() +{ + QList links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs(); + QString closed; + + Q_FOREACH( const HistoryItem &item, links) + { + closed += "
"; + closed += ""; + closed += ""; + closed += ""; + closed += "
"; + } + + return closed; +} diff --git a/src/rekonqpage/newtabpage.h b/src/rekonqpage/newtabpage.h new file mode 100644 index 00000000..2d8d50bd --- /dev/null +++ b/src/rekonqpage/newtabpage.h @@ -0,0 +1,72 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 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 REKONQ_NEW_TAB_PAGE +#define REKONQ_NEW_TAB_PAGE + + +// KDE Includes +#include + +// Qt Includes +#include +#include + +// Forward Includes +class KBookmark; + + +class NewTabPage +{ + +public: + NewTabPage(); + ~NewTabPage(); + + /** + * This is the unique NewTabPage public method. It takes an + * about: url and loads the corresponding part of the + * new tab page + */ + QString newTabPageCode(const KUrl &url = KUrl("about:home")); + +protected: // these are the function to build the new tab page + + QString browsingMenu(const KUrl ¤tUrl); + + QString favoritesPage(); + QString lastVisitedPage(); + QString historyPage(); + QString bookmarksPage(); + QString closedTabsPage(); + +private: + QString createBookItem(const KBookmark &bookmark); + + QString m_htmlFilePath; +}; + +#endif // REKONQ_NEW_TAB_PAGE diff --git a/src/settings.cpp b/src/settings.cpp deleted file mode 100644 index 9c95bb9c..00000000 --- a/src/settings.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* ============================================================ -* -* 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 -* Copyright (C) 2009 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 "settings.h" -#include "settings.moc" - -// Auto Includes -#include "rekonq.h" - -// Local Includes -#include "application.h" -#include "mainwindow.h" -#include "webview.h" - -//Ui Includes -#include "ui_settings_general.h" -#include "ui_settings_tabs.h" -#include "ui_settings_fonts.h" -#include "ui_settings_webkit.h" - -// KDE Includes -#include -#include -#include -#include -#include -#include - -// Qt Includes -#include -#include - - -class Private -{ -private: - - Ui::general generalUi; - Ui::tabs tabsUi; - Ui::fonts fontsUi; - Ui::webkit webkitUi; - - KCModuleProxy *proxyModule; - KCModuleProxy *ebrowsingModule; - KCModuleProxy *cookiesModule; - KCModuleProxy *cacheModule; - KShortcutsEditor *shortcutsEditor; - - Private(SettingsDialog *parent); - - friend class SettingsDialog; -}; - - -Private::Private(SettingsDialog *parent) -{ - QWidget *widget; - KPageWidgetItem *pageItem; - - widget = new QWidget; - generalUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("General")); - pageItem->setIcon(KIcon("rekonq")); - - widget = new QWidget; - tabsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Tabs")); - pageItem->setIcon(KIcon("tab-duplicate")); - - widget = new QWidget; - fontsUi.setupUi(widget); - 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); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("WebKit")); - QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png"); - KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); - pageItem->setIcon(webkitIcon); - - shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); - pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); - pageItem->setIcon(KIcon("configure-shortcuts")); - - KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); - ebrowsingModule = new KCModuleProxy(ebrowsingInfo,parent); - pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - - parent->setMinimumSize(700,500); -} - - -// ----------------------------------------------------------------------------------------------------- - - -SettingsDialog::SettingsDialog(QWidget *parent) - : KConfigDialog(parent, "rekonfig", ReKonfig::self()) - , d(new Private(this)) -{ - setFaceType(KPageDialog::Tree); - showButtonSeparator(true); - - setWindowTitle(i18n("rekonfig...")); - setModal(true); - - readConfig(); - - - connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - - 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->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); - - connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); - connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); - - setWebSettingsToolTips(); -} - - -SettingsDialog::~SettingsDialog() -{ - delete d; -} - - -void SettingsDialog::setWebSettingsToolTips() -{ - d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); - d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); - d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); - d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); - d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); - d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); - d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); - d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); - d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); - d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); - d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); - d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); -} - - -// we need this function to UPDATE the config widget data.. -void SettingsDialog::readConfig() -{ - // ======= Fonts - d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); -} - - -// we need this function to SAVE settings in rc file.. -void SettingsDialog::saveSettings() -{ - ReKonfig::self()->writeConfig(); - d->ebrowsingModule->save(); - d->cookiesModule->save(); - d->proxyModule->save(); - d->cacheModule->save(); - d->shortcutsEditor->save(); -} - - -bool SettingsDialog::hasChanged() -{ - return KConfigDialog::hasChanged() - || d->ebrowsingModule->changed() - || d->cookiesModule->changed() - || d->proxyModule->changed() - || d->cacheModule->changed() - || d->shortcutsEditor->isModified(); - ; -} - - -void SettingsDialog::setHomeToCurrentPage() -{ - MainWindow *mw = static_cast(parent()); - WebView *webView = mw->currentTab(); - if (webView) - { - d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl()); - } -} diff --git a/src/settings.h b/src/settings.h deleted file mode 100644 index 3aa943c7..00000000 --- a/src/settings.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ============================================================ -* -* 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 -* Copyright (C) 2009 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_H -#define SETTINGS_H - - -// KDE Includes -#include - -// Forward Declarations -class QWidget; -class Private; - - -class SettingsDialog : public KConfigDialog -{ - Q_OBJECT - -public: - SettingsDialog(QWidget *parent = 0); - ~SettingsDialog(); - - virtual bool hasChanged(); - -private: - Private* const d; - void setWebSettingsToolTips(); - -private slots: - void readConfig(); - void saveSettings(); - - void setHomeToCurrentPage(); -}; - -#endif // SETTINGS_H diff --git a/src/settings/settings_fonts.ui b/src/settings/settings_fonts.ui new file mode 100644 index 00000000..98efce16 --- /dev/null +++ b/src/settings/settings_fonts.ui @@ -0,0 +1,97 @@ + + + fonts + + + + 0 + 0 + 414 + 298 + + + + Appearance + + + + + + Fonts + + + + + + + + Standard font: + + + + + + + Fixed font: + + + + + + + + + + + + + + + + + + Dimension + + + + + + + + Font size: + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KFontComboBox + KComboBox +
kfontcombobox.h
+
+
+ + +
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui new file mode 100644 index 00000000..57d293e6 --- /dev/null +++ b/src/settings/settings_general.ui @@ -0,0 +1,244 @@ + + + general + + + + 0 + 0 + 751 + 523 + + + + General + + + + + + Startup + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 0 + 0 + + + + Qt::LeftToRight + + + When starting rekonq: + + + + + + + + 0 + 0 + + + + + Open the Home Page + + + + + Open the New Tab Page + + + + + Restore the Last Opened Tabs + + + + + + + + + + + Home Page + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + + + Home page URL: + + + + + + + true + + + + 0 + 0 + + + + + + + + + + Set to Current Page + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + New Tabs Behaviour + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + + + New tab opens: + + + + + + + true + + + + 0 + 0 + + + + + New Tab Page + + + + + Blank Page + + + + + Home Page + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + KLineEdit + QLineEdit +
klineedit.h
+
+ + KComboBox + QComboBox +
kcombobox.h
+
+
+ + +
diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui new file mode 100644 index 00000000..ba903ff4 --- /dev/null +++ b/src/settings/settings_tabs.ui @@ -0,0 +1,81 @@ + + + tabs + + + + 0 + 0 + 456 + 329 + + + + Tabs + + + + + + Tabbed Browsing + + + + + + Open links in new tab instead of in new window + + + + + + + Always show tab bar + + + + + + + Open new tabs in the background + + + + + + + Open new tabs after currently active one + + + + + + + Show preview when hovering tab + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 142 + + + + + + + + + diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui new file mode 100644 index 00000000..129bcf03 --- /dev/null +++ b/src/settings/settings_webkit.ui @@ -0,0 +1,161 @@ + + + webkit + + + + 0 + 0 + 622 + 360 + + + + + + + WebKit Settings + + + + + + Autoload images + + + + + + + Qt::Vertical + + + + + + + Links included in focus chain + + + + + + + JavaScript support + + + + + + + Zoom text only + + + + + + + Java support + + + + + + + Print element backgrounds + + + + + + + Plugins + + + + + + + Offline storage database + + + + + + + JavaScript can open windows + + + + + + + Offline web application cache + + + + + + + JavaScript can access clipboard + + + + + + + Local storage database + + + + + + + + + + User Style Sheet + + + + + + User CSS path: + + + + + + + *.css + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KUrlRequester + QFrame +
kurlrequester.h
+
+
+ + +
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp new file mode 100644 index 00000000..1db38b96 --- /dev/null +++ b/src/settings/settingsdialog.cpp @@ -0,0 +1,235 @@ +/* ============================================================ +* +* 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 +* Copyright (C) 2009 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 "application.h" +#include "mainwindow.h" +#include "webview.h" + +//Ui Includes +#include "ui_settings_general.h" +#include "ui_settings_tabs.h" +#include "ui_settings_fonts.h" +#include "ui_settings_webkit.h" + +// KDE Includes +#include +#include +#include +#include +#include +#include + +// Qt Includes +#include +#include + + +class Private +{ +private: + + Ui::general generalUi; + Ui::tabs tabsUi; + Ui::fonts fontsUi; + Ui::webkit webkitUi; + + KCModuleProxy *proxyModule; + KCModuleProxy *ebrowsingModule; + KCModuleProxy *cookiesModule; + KCModuleProxy *cacheModule; + KShortcutsEditor *shortcutsEditor; + + Private(SettingsDialog *parent); + + friend class SettingsDialog; +}; + + +Private::Private(SettingsDialog *parent) +{ + QWidget *widget; + KPageWidgetItem *pageItem; + + widget = new QWidget; + generalUi.setupUi(widget); + widget->layout()->setMargin(0); + pageItem = parent->addPage(widget , i18n("General")); + pageItem->setIcon(KIcon("rekonq")); + + widget = new QWidget; + tabsUi.setupUi(widget); + widget->layout()->setMargin(0); + pageItem = parent->addPage(widget , i18n("Tabs")); + pageItem->setIcon(KIcon("tab-duplicate")); + + widget = new QWidget; + fontsUi.setupUi(widget); + 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); + widget->layout()->setMargin(0); + pageItem = parent->addPage(widget , i18n("WebKit")); + QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png"); + KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); + pageItem->setIcon(webkitIcon); + + shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); + pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); + pageItem->setIcon(KIcon("configure-shortcuts")); + + KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); + ebrowsingModule = new KCModuleProxy(ebrowsingInfo,parent); + pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); + pageItem->setIcon(KIcon(ebrowsingInfo.icon())); + + parent->setMinimumSize(700,500); +} + + +// ----------------------------------------------------------------------------------------------------- + + +SettingsDialog::SettingsDialog(QWidget *parent) + : KConfigDialog(parent, "rekonfig", ReKonfig::self()) + , d(new Private(this)) +{ + setFaceType(KPageDialog::Tree); + showButtonSeparator(true); + + setWindowTitle(i18n("rekonfig...")); + setModal(true); + + readConfig(); + + + connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + + 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->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); + + connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); + connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); + + setWebSettingsToolTips(); +} + + +SettingsDialog::~SettingsDialog() +{ + delete d; +} + + +void SettingsDialog::setWebSettingsToolTips() +{ + d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); + d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); + d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); + d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); + d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); + d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); + d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); + d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); + d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); + d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); +} + + +// we need this function to UPDATE the config widget data.. +void SettingsDialog::readConfig() +{ + // ======= Fonts + d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); +} + + +// we need this function to SAVE settings in rc file.. +void SettingsDialog::saveSettings() +{ + ReKonfig::self()->writeConfig(); + d->ebrowsingModule->save(); + d->cookiesModule->save(); + d->proxyModule->save(); + d->cacheModule->save(); + d->shortcutsEditor->save(); +} + + +bool SettingsDialog::hasChanged() +{ + return KConfigDialog::hasChanged() + || d->ebrowsingModule->changed() + || d->cookiesModule->changed() + || d->proxyModule->changed() + || d->cacheModule->changed() + || d->shortcutsEditor->isModified(); + ; +} + + +void SettingsDialog::setHomeToCurrentPage() +{ + MainWindow *mw = static_cast(parent()); + WebView *webView = mw->currentTab(); + if (webView) + { + d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl()); + } +} diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h new file mode 100644 index 00000000..360fe246 --- /dev/null +++ b/src/settings/settingsdialog.h @@ -0,0 +1,62 @@ +/* ============================================================ +* +* 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 +* Copyright (C) 2009 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 + + +// KDE Includes +#include + +// Forward Declarations +class QWidget; +class Private; + + +class SettingsDialog : public KConfigDialog +{ + Q_OBJECT + +public: + SettingsDialog(QWidget *parent = 0); + ~SettingsDialog(); + + virtual bool hasChanged(); + +private: + Private* const d; + void setWebSettingsToolTips(); + +private slots: + void readConfig(); + void saveSettings(); + + void setHomeToCurrentPage(); +}; + +#endif // SETTINGS_DIALOG_H diff --git a/src/settings_fonts.ui b/src/settings_fonts.ui deleted file mode 100644 index 98efce16..00000000 --- a/src/settings_fonts.ui +++ /dev/null @@ -1,97 +0,0 @@ - - - fonts - - - - 0 - 0 - 414 - 298 - - - - Appearance - - - - - - Fonts - - - - - - - - Standard font: - - - - - - - Fixed font: - - - - - - - - - - - - - - - - - - Dimension - - - - - - - - Font size: - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - KFontComboBox - KComboBox -
kfontcombobox.h
-
-
- - -
diff --git a/src/settings_general.ui b/src/settings_general.ui deleted file mode 100644 index 57d293e6..00000000 --- a/src/settings_general.ui +++ /dev/null @@ -1,244 +0,0 @@ - - - general - - - - 0 - 0 - 751 - 523 - - - - General - - - - - - Startup - - - - - - - 0 - 0 - - - - - 120 - 0 - - - - - 0 - 0 - - - - Qt::LeftToRight - - - When starting rekonq: - - - - - - - - 0 - 0 - - - - - Open the Home Page - - - - - Open the New Tab Page - - - - - Restore the Last Opened Tabs - - - - - - - - - - - Home Page - - - - - - - 0 - 0 - - - - - 120 - 0 - - - - - 120 - 0 - - - - Home page URL: - - - - - - - true - - - - 0 - 0 - - - - - - - - - - Set to Current Page - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - New Tabs Behaviour - - - - - - - 0 - 0 - - - - - 120 - 0 - - - - - 120 - 0 - - - - New tab opens: - - - - - - - true - - - - 0 - 0 - - - - - New Tab Page - - - - - Blank Page - - - - - Home Page - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/src/settings_tabs.ui b/src/settings_tabs.ui deleted file mode 100644 index ba903ff4..00000000 --- a/src/settings_tabs.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - tabs - - - - 0 - 0 - 456 - 329 - - - - Tabs - - - - - - Tabbed Browsing - - - - - - Open links in new tab instead of in new window - - - - - - - Always show tab bar - - - - - - - Open new tabs in the background - - - - - - - Open new tabs after currently active one - - - - - - - Show preview when hovering tab - - - false - - - - - - - - - - Qt::Vertical - - - - 20 - 142 - - - - - - - - - diff --git a/src/settings_webkit.ui b/src/settings_webkit.ui deleted file mode 100644 index 129bcf03..00000000 --- a/src/settings_webkit.ui +++ /dev/null @@ -1,161 +0,0 @@ - - - webkit - - - - 0 - 0 - 622 - 360 - - - - - - - WebKit Settings - - - - - - Autoload images - - - - - - - Qt::Vertical - - - - - - - Links included in focus chain - - - - - - - JavaScript support - - - - - - - Zoom text only - - - - - - - Java support - - - - - - - Print element backgrounds - - - - - - - Plugins - - - - - - - Offline storage database - - - - - - - JavaScript can open windows - - - - - - - Offline web application cache - - - - - - - JavaScript can access clipboard - - - - - - - Local storage database - - - - - - - - - - User Style Sheet - - - - - - User CSS path: - - - - - - - *.css - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - -
-- cgit v1.2.1