From d93d198db6eef9186177aa5a918b300a6b749627 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 24 Jul 2010 20:39:19 +0000 Subject: Sourcecode hierarchy cleanup: Use subfolders inside the "settings" folder svn path=/trunk/KDE/kdebase/apps/; revision=1154129 --- src/CMakeLists.txt | 54 ++--- src/kcm/kcmdolphingeneral.cpp | 8 +- src/kcm/kcmdolphinnavigation.cpp | 4 +- src/kcm/kcmdolphinservices.cpp | 4 +- src/kcm/kcmdolphinviewmodes.cpp | 8 +- src/settings/behaviorsettingspage.cpp | 224 ------------------- src/settings/behaviorsettingspage.h | 80 ------- src/settings/columnviewsettingspage.cpp | 158 ------------- src/settings/columnviewsettingspage.h | 66 ------ src/settings/contextmenusettingspage.cpp | 93 -------- src/settings/contextmenusettingspage.h | 51 ----- src/settings/detailsviewsettingspage.cpp | 151 ------------- src/settings/detailsviewsettingspage.h | 60 ----- src/settings/dolphinfontrequester.cpp | 111 --------- src/settings/dolphinfontrequester.h | 79 ------- src/settings/dolphinsettingsdialog.cpp | 12 +- src/settings/general/behaviorsettingspage.cpp | 223 +++++++++++++++++++ src/settings/general/behaviorsettingspage.h | 80 +++++++ src/settings/general/contextmenusettingspage.cpp | 94 ++++++++ src/settings/general/contextmenusettingspage.h | 51 +++++ src/settings/general/generalsettingspage.cpp | 92 ++++++++ src/settings/general/generalsettingspage.h | 56 +++++ src/settings/general/previewssettingspage.cpp | 182 +++++++++++++++ src/settings/general/previewssettingspage.h | 66 ++++++ src/settings/general/statusbarsettingspage.cpp | 85 +++++++ src/settings/general/statusbarsettingspage.h | 51 +++++ src/settings/generalsettingspage.cpp | 92 -------- src/settings/generalsettingspage.h | 56 ----- src/settings/iconsizegroupbox.cpp | 119 ---------- src/settings/iconsizegroupbox.h | 66 ------ src/settings/iconsviewsettingspage.cpp | 247 --------------------- src/settings/iconsviewsettingspage.h | 87 -------- src/settings/navigation/navigationsettingspage.cpp | 120 ++++++++++ src/settings/navigation/navigationsettingspage.h | 54 +++++ src/settings/navigationsettingspage.cpp | 120 ---------- src/settings/navigationsettingspage.h | 54 ----- src/settings/previewssettingspage.cpp | 181 --------------- src/settings/previewssettingspage.h | 66 ------ src/settings/services/servicessettingspage.cpp | 222 ++++++++++++++++++ src/settings/services/servicessettingspage.h | 72 ++++++ src/settings/servicessettingspage.cpp | 222 ------------------ src/settings/servicessettingspage.h | 72 ------ src/settings/startup/startupsettingspage.cpp | 173 +++++++++++++++ src/settings/startup/startupsettingspage.h | 66 ++++++ src/settings/startupsettingspage.cpp | 173 --------------- src/settings/startupsettingspage.h | 66 ------ src/settings/statusbarsettingspage.cpp | 83 ------- src/settings/statusbarsettingspage.h | 51 ----- src/settings/trash/trashsettingspage.cpp | 71 ++++++ src/settings/trash/trashsettingspage.h | 47 ++++ src/settings/trashsettingspage.cpp | 72 ------ src/settings/trashsettingspage.h | 47 ---- src/settings/viewmodes/columnviewsettingspage.cpp | 159 +++++++++++++ src/settings/viewmodes/columnviewsettingspage.h | 66 ++++++ src/settings/viewmodes/detailsviewsettingspage.cpp | 152 +++++++++++++ src/settings/viewmodes/detailsviewsettingspage.h | 60 +++++ src/settings/viewmodes/dolphinfontrequester.cpp | 111 +++++++++ src/settings/viewmodes/dolphinfontrequester.h | 79 +++++++ src/settings/viewmodes/iconsizegroupbox.cpp | 119 ++++++++++ src/settings/viewmodes/iconsizegroupbox.h | 66 ++++++ src/settings/viewmodes/iconsviewsettingspage.cpp | 247 +++++++++++++++++++++ src/settings/viewmodes/iconsviewsettingspage.h | 87 ++++++++ src/settings/viewmodes/viewsettingspage.cpp | 84 +++++++ src/settings/viewmodes/viewsettingspage.h | 52 +++++ src/settings/viewmodes/viewsettingspagebase.cpp | 31 +++ src/settings/viewmodes/viewsettingspagebase.h | 55 +++++ src/settings/viewsettingspage.cpp | 84 ------- src/settings/viewsettingspage.h | 52 ----- src/settings/viewsettingspagebase.cpp | 31 --- src/settings/viewsettingspagebase.h | 55 ----- 70 files changed, 3218 insertions(+), 3214 deletions(-) delete mode 100644 src/settings/behaviorsettingspage.cpp delete mode 100644 src/settings/behaviorsettingspage.h delete mode 100644 src/settings/columnviewsettingspage.cpp delete mode 100644 src/settings/columnviewsettingspage.h delete mode 100644 src/settings/contextmenusettingspage.cpp delete mode 100644 src/settings/contextmenusettingspage.h delete mode 100644 src/settings/detailsviewsettingspage.cpp delete mode 100644 src/settings/detailsviewsettingspage.h delete mode 100644 src/settings/dolphinfontrequester.cpp delete mode 100644 src/settings/dolphinfontrequester.h create mode 100644 src/settings/general/behaviorsettingspage.cpp create mode 100644 src/settings/general/behaviorsettingspage.h create mode 100644 src/settings/general/contextmenusettingspage.cpp create mode 100644 src/settings/general/contextmenusettingspage.h create mode 100644 src/settings/general/generalsettingspage.cpp create mode 100644 src/settings/general/generalsettingspage.h create mode 100644 src/settings/general/previewssettingspage.cpp create mode 100644 src/settings/general/previewssettingspage.h create mode 100644 src/settings/general/statusbarsettingspage.cpp create mode 100644 src/settings/general/statusbarsettingspage.h delete mode 100644 src/settings/generalsettingspage.cpp delete mode 100644 src/settings/generalsettingspage.h delete mode 100644 src/settings/iconsizegroupbox.cpp delete mode 100644 src/settings/iconsizegroupbox.h delete mode 100644 src/settings/iconsviewsettingspage.cpp delete mode 100644 src/settings/iconsviewsettingspage.h create mode 100644 src/settings/navigation/navigationsettingspage.cpp create mode 100644 src/settings/navigation/navigationsettingspage.h delete mode 100644 src/settings/navigationsettingspage.cpp delete mode 100644 src/settings/navigationsettingspage.h delete mode 100644 src/settings/previewssettingspage.cpp delete mode 100644 src/settings/previewssettingspage.h create mode 100644 src/settings/services/servicessettingspage.cpp create mode 100644 src/settings/services/servicessettingspage.h delete mode 100644 src/settings/servicessettingspage.cpp delete mode 100644 src/settings/servicessettingspage.h create mode 100644 src/settings/startup/startupsettingspage.cpp create mode 100644 src/settings/startup/startupsettingspage.h delete mode 100644 src/settings/startupsettingspage.cpp delete mode 100644 src/settings/startupsettingspage.h delete mode 100644 src/settings/statusbarsettingspage.cpp delete mode 100644 src/settings/statusbarsettingspage.h create mode 100644 src/settings/trash/trashsettingspage.cpp create mode 100644 src/settings/trash/trashsettingspage.h delete mode 100644 src/settings/trashsettingspage.cpp delete mode 100644 src/settings/trashsettingspage.h create mode 100644 src/settings/viewmodes/columnviewsettingspage.cpp create mode 100644 src/settings/viewmodes/columnviewsettingspage.h create mode 100644 src/settings/viewmodes/detailsviewsettingspage.cpp create mode 100644 src/settings/viewmodes/detailsviewsettingspage.h create mode 100644 src/settings/viewmodes/dolphinfontrequester.cpp create mode 100644 src/settings/viewmodes/dolphinfontrequester.h create mode 100644 src/settings/viewmodes/iconsizegroupbox.cpp create mode 100644 src/settings/viewmodes/iconsizegroupbox.h create mode 100644 src/settings/viewmodes/iconsviewsettingspage.cpp create mode 100644 src/settings/viewmodes/iconsviewsettingspage.h create mode 100644 src/settings/viewmodes/viewsettingspage.cpp create mode 100644 src/settings/viewmodes/viewsettingspage.h create mode 100644 src/settings/viewmodes/viewsettingspagebase.cpp create mode 100644 src/settings/viewmodes/viewsettingspagebase.h delete mode 100644 src/settings/viewsettingspage.cpp delete mode 100644 src/settings/viewsettingspage.h delete mode 100644 src/settings/viewsettingspagebase.cpp delete mode 100644 src/settings/viewsettingspagebase.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cdfd4d7d2..0cbe663ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,24 +114,24 @@ set(dolphin_SRCS panels/folders/folderspanel.cpp panels/folders/paneltreeview.cpp search/dolphinsearchbox.cpp - settings/behaviorsettingspage.cpp - settings/columnviewsettingspage.cpp - settings/contextmenusettingspage.cpp - settings/dolphinfontrequester.cpp + settings/general/behaviorsettingspage.cpp + settings/general/contextmenusettingspage.cpp + settings/general/generalsettingspage.cpp + settings/general/previewssettingspage.cpp + settings/general/statusbarsettingspage.cpp settings/dolphinsettingsdialog.cpp - settings/detailsviewsettingspage.cpp - settings/generalsettingspage.cpp - settings/iconsizegroupbox.cpp - settings/iconsviewsettingspage.cpp - settings/navigationsettingspage.cpp - settings/previewssettingspage.cpp - settings/servicessettingspage.cpp + settings/navigation/navigationsettingspage.cpp + settings/services/servicessettingspage.cpp settings/settingspagebase.cpp - settings/startupsettingspage.cpp - settings/statusbarsettingspage.cpp - settings/trashsettingspage.cpp - settings/viewsettingspage.cpp - settings/viewsettingspagebase.cpp + settings/startup/startupsettingspage.cpp + settings/trash/trashsettingspage.cpp + settings/viewmodes/columnviewsettingspage.cpp + settings/viewmodes/detailsviewsettingspage.cpp + settings/viewmodes/dolphinfontrequester.cpp + settings/viewmodes/iconsizegroupbox.cpp + settings/viewmodes/iconsviewsettingspage.cpp + settings/viewmodes/viewsettingspage.cpp + settings/viewmodes/viewsettingspagebase.cpp statusbar/dolphinstatusbar.cpp statusbar/statusbarspaceinfo.cpp statusbar/statusbarmessagelabel.cpp @@ -199,29 +199,29 @@ install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) set(kcm_dolphinviewmodes_PART_SRCS kcm/kcmdolphinviewmodes.cpp pixmapviewer.cpp - settings/columnviewsettingspage.cpp - settings/detailsviewsettingspage.cpp - settings/dolphinfontrequester.cpp - settings/iconsizegroupbox.cpp - settings/iconsviewsettingspage.cpp - settings/viewsettingspagebase.cpp + settings/viewmodes/columnviewsettingspage.cpp + settings/viewmodes/detailsviewsettingspage.cpp + settings/viewmodes/dolphinfontrequester.cpp + settings/viewmodes/iconsizegroupbox.cpp + settings/viewmodes/iconsviewsettingspage.cpp + settings/viewmodes/viewsettingspagebase.cpp zoomlevelinfo.cpp) set(kcm_dolphinnavigation_PART_SRCS kcm/kcmdolphinnavigation.cpp - settings/navigationsettingspage.cpp + settings/navigation/navigationsettingspage.cpp settings/settingspagebase.cpp) set(kcm_dolphinservices_PART_SRCS kcm/kcmdolphinservices.cpp - settings/servicessettingspage.cpp + settings/services/servicessettingspage.cpp settings/settingspagebase.cpp) set(kcm_dolphingeneral_PART_SRCS kcm/kcmdolphingeneral.cpp - settings/behaviorsettingspage.cpp - settings/previewssettingspage.cpp - settings/contextmenusettingspage.cpp + settings/general/behaviorsettingspage.cpp + settings/general/previewssettingspage.cpp + settings/general/contextmenusettingspage.cpp settings/settingspagebase.cpp) kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS diff --git a/src/kcm/kcmdolphingeneral.cpp b/src/kcm/kcmdolphingeneral.cpp index 6f539674d..fb4a643ea 100644 --- a/src/kcm/kcmdolphingeneral.cpp +++ b/src/kcm/kcmdolphingeneral.cpp @@ -19,16 +19,16 @@ #include "kcmdolphingeneral.h" -#include "settings/behaviorsettingspage.h" -#include "settings/previewssettingspage.h" -#include "settings/contextmenusettingspage.h" - #include #include #include #include #include +#include +#include +#include + #include #include diff --git a/src/kcm/kcmdolphinnavigation.cpp b/src/kcm/kcmdolphinnavigation.cpp index b0e5a9ffb..fdf9de550 100644 --- a/src/kcm/kcmdolphinnavigation.cpp +++ b/src/kcm/kcmdolphinnavigation.cpp @@ -19,14 +19,14 @@ #include "kcmdolphinnavigation.h" -#include "settings/navigationsettingspage.h" - #include #include #include #include #include +#include + #include K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin("dolphinnavigation");) diff --git a/src/kcm/kcmdolphinservices.cpp b/src/kcm/kcmdolphinservices.cpp index f82804620..22e4e32cc 100644 --- a/src/kcm/kcmdolphinservices.cpp +++ b/src/kcm/kcmdolphinservices.cpp @@ -19,14 +19,14 @@ #include "kcmdolphinservices.h" -#include "settings/servicessettingspage.h" - #include #include #include #include #include +#include + #include K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin("dolphinservices");) diff --git a/src/kcm/kcmdolphinviewmodes.cpp b/src/kcm/kcmdolphinviewmodes.cpp index 9aa53cf8b..e24d549e0 100644 --- a/src/kcm/kcmdolphinviewmodes.cpp +++ b/src/kcm/kcmdolphinviewmodes.cpp @@ -19,16 +19,16 @@ #include "kcmdolphinviewmodes.h" -#include "settings/columnviewsettingspage.h" -#include "settings/detailsviewsettingspage.h" -#include "settings/iconsviewsettingspage.h" - #include #include #include #include #include +#include +#include +#include + #include #include #include diff --git a/src/settings/behaviorsettingspage.cpp b/src/settings/behaviorsettingspage.cpp deleted file mode 100644 index dae2e4577..000000000 --- a/src/settings/behaviorsettingspage.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) and * - * and Patrice Tremblay * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "behaviorsettingspage.h" - -#include "dolphinsettings.h" -#include "dolphin_generalsettings.h" -#include "filemetadataconfigurationdialog.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -const bool CONFIRM_TRASH = false; -const bool CONFIRM_DELETE = true; - -BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) : - SettingsPageBase(parent), - m_url(url), - m_localProps(0), - m_globalProps(0), - m_confirmMoveToTrash(0), - m_confirmDelete(0), - m_renameInline(0), - m_showToolTips(0), - m_configureToolTips(0), - m_showSelectionToggle(0), - m_naturalSorting(0) -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - - // 'View Properties' box - QGroupBox* propsBox = new QGroupBox(i18nc("@title:group", "View Properties"), this); - propsBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - - m_localProps = new QRadioButton(i18nc("@option:radio", "Remember view properties for each folder"), propsBox); - connect(m_localProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - m_globalProps = new QRadioButton(i18nc("@option:radio", "Use common view properties for all folders"), propsBox); - connect(m_globalProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - QVBoxLayout* propsBoxLayout = new QVBoxLayout(propsBox); - propsBoxLayout->addWidget(m_localProps); - propsBoxLayout->addWidget(m_globalProps); - - // 'Ask Confirmation For' box - QGroupBox* confirmBox = new QGroupBox(i18nc("@title:group", "Ask For Confirmation When"), this); - confirmBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - m_confirmMoveToTrash = new QCheckBox(i18nc("@option:check Ask for Confirmation When", - "Moving files or folders to trash"), confirmBox); - connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for Confirmation When", - "Deleting files or folders"), confirmBox); - connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for Confirmation When", - "Closing windows with multiple tabs"), confirmBox); - connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox); - confirmBoxLayout->addWidget(m_confirmMoveToTrash); - confirmBoxLayout->addWidget(m_confirmDelete); - confirmBoxLayout->addWidget(m_confirmClosingMultipleTabs); - - // 'Rename inline' - m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), this); - connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // 'Show tooltips' - QWidget* toolTipContainer = new QWidget(this); - QHBoxLayout* toolTipsLayout = new QHBoxLayout(toolTipContainer); - toolTipsLayout->setMargin(0); - m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), toolTipContainer); - connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_showToolTips, SIGNAL(toggled(bool)), this, SLOT(updateConfigureButton())); - - m_configureToolTips = new QLabel(toolTipContainer); - connect(m_configureToolTips, SIGNAL(linkActivated(const QString&)), - this, SLOT(configureToolTips())); - - toolTipsLayout->addWidget(m_showToolTips); - toolTipsLayout->addWidget(m_configureToolTips, 1, Qt::AlignLeft); - - // 'Show selection marker' - m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), this); - connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // 'Natural sorting of items' - m_naturalSorting = new QCheckBox(i18nc("option:check", "Natural sorting of items"), this); - connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - topLayout->addWidget(propsBox); - topLayout->addWidget(confirmBox); - topLayout->addWidget(m_renameInline); - topLayout->addWidget(toolTipContainer); - topLayout->addWidget(m_showSelectionToggle); - topLayout->addWidget(m_naturalSorting); - topLayout->addStretch(); - - loadSettings(); -} - -BehaviorSettingsPage::~BehaviorSettingsPage() -{ -} - -void BehaviorSettingsPage::applySettings() -{ - ViewProperties props(m_url); // read current view properties - - const bool useGlobalProps = m_globalProps->isChecked(); - - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setGlobalViewProps(useGlobalProps); - - if (useGlobalProps) { - // Remember the global view properties by applying the current view properties. - // It is important that GeneralSettings::globalViewProps() is set before - // the class ViewProperties is used, as ViewProperties uses this setting - // to find the destination folder for storing the view properties. - ViewProperties globalProps(m_url); - globalProps.setDirProperties(props); - } - - KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::NoGlobals); - KConfigGroup confirmationGroup(kioConfig, "Confirmations"); - confirmationGroup.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked()); - confirmationGroup.writeEntry("ConfirmDelete", m_confirmDelete->isChecked()); - confirmationGroup.sync(); - - settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked()); - settings->setRenameInline(m_renameInline->isChecked()); - settings->setShowToolTips(m_showToolTips->isChecked()); - settings->setShowSelectionToggle(m_showSelectionToggle->isChecked()); - settings->writeConfig(); - - const bool naturalSorting = m_naturalSorting->isChecked(); - if (KGlobalSettings::naturalSorting() != naturalSorting) { - KConfigGroup group(KGlobal::config(), "KDE"); - group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persistent | KConfig::Global); - KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged); - } -} - -void BehaviorSettingsPage::restoreDefaults() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); - m_confirmMoveToTrash->setChecked(CONFIRM_TRASH); - m_confirmDelete->setChecked(CONFIRM_DELETE); -} - -void BehaviorSettingsPage::updateConfigureButton() -{ - if (m_showToolTips->isChecked()) { - m_configureToolTips->setText("" + - i18nc("@action:button", "Configure...") + - ""); - } else { - m_configureToolTips->setText(QString()); - } -} - -void BehaviorSettingsPage::configureToolTips() -{ - FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(); - dialog->setDescription(i18nc("@label::textbox", - "Select which data should be shown in the tooltip.")); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->show(); - dialog->raise(); - dialog->activateWindow(); -} - -void BehaviorSettingsPage::loadSettings() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - if (settings->globalViewProps()) { - m_globalProps->setChecked(true); - } else { - m_localProps->setChecked(true); - } - - KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::IncludeGlobals); - const KConfigGroup confirmationGroup(kioConfig, "Confirmations"); - m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", CONFIRM_TRASH)); - m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", CONFIRM_DELETE)); - - m_confirmClosingMultipleTabs->setChecked(settings->confirmClosingMultipleTabs()); - m_renameInline->setChecked(settings->renameInline()); - m_showToolTips->setChecked(settings->showToolTips()); - m_showSelectionToggle->setChecked(settings->showSelectionToggle()); - m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); - - updateConfigureButton(); -} - -#include "behaviorsettingspage.moc" diff --git a/src/settings/behaviorsettingspage.h b/src/settings/behaviorsettingspage.h deleted file mode 100644 index 331e45806..000000000 --- a/src/settings/behaviorsettingspage.h +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef BEHAVIORSETTINGSPAGE_H -#define BEHAVIORSETTINGSPAGE_H - -#include -#include - -class QCheckBox; -class QLabel; -class QRadioButton; - -/** - * @brief Tab page for the 'Behavior' settings of the Dolphin settings dialog. - */ -class BehaviorSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - BehaviorSettingsPage(const KUrl& url, QWidget* parent); - virtual ~BehaviorSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private slots: - /** - * Updates the visibility state of the configure - * button m_configureToolTips. - */ - void updateConfigureButton(); - - /** - * Opens a dialog which allows the user to specify which - * meta data should be shown in the tooltip. - */ - void configureToolTips(); - -private: - void loadSettings(); - -private: - KUrl m_url; - - QRadioButton* m_localProps; - QRadioButton* m_globalProps; - - QCheckBox* m_confirmMoveToTrash; - QCheckBox* m_confirmDelete; - QCheckBox* m_confirmClosingMultipleTabs; - - QCheckBox* m_renameInline; - QCheckBox* m_showToolTips; - QLabel* m_configureToolTips; - QCheckBox* m_showSelectionToggle; - QCheckBox* m_naturalSorting; -}; - -#endif diff --git a/src/settings/columnviewsettingspage.cpp b/src/settings/columnviewsettingspage.cpp deleted file mode 100644 index b1c3e119c..000000000 --- a/src/settings/columnviewsettingspage.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "columnviewsettingspage.h" - -#include "dolphinfontrequester.h" -#include "dolphinsettings.h" -#include "dolphin_columnmodesettings.h" -#include "iconsizegroupbox.h" -#include "zoomlevelinfo.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -ColumnViewSettingsPage::ColumnViewSettingsPage(QWidget* parent) : - ViewSettingsPageBase(parent), - m_iconSizeGroupBox(0), - m_fontRequester(0), - m_textWidthBox(0) -{ - const int spacing = KDialog::spacingHint(); - const int margin = KDialog::marginHint(); - const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - - setSpacing(spacing); - setMargin(margin); - - // Create "Icon" properties - m_iconSizeGroupBox = new IconSizeGroupBox(this); - m_iconSizeGroupBox->setSizePolicy(sizePolicy); - - const int min = ZoomLevelInfo::minimumLevel(); - const int max = ZoomLevelInfo::maximumLevel(); - m_iconSizeGroupBox->setDefaultSizeRange(min, max); - m_iconSizeGroupBox->setPreviewSizeRange(min, max); - - connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), - this, SIGNAL(changed())); - connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), - this, SIGNAL(changed())); - - // create "Text" properties - QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); - textGroup->setSizePolicy(sizePolicy); - - QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); - m_fontRequester = new DolphinFontRequester(textGroup); - connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); - - QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup); - m_textWidthBox = new KComboBox(textGroup); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge")); - connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); - - QGridLayout* textGroupLayout = new QGridLayout(textGroup); - textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight); - textGroupLayout->addWidget(m_fontRequester, 0, 1); - textGroupLayout->addWidget(textWidthLabel, 1, 0, Qt::AlignRight); - textGroupLayout->addWidget(m_textWidthBox, 1, 1); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(this); - - loadSettings(); -} - -ColumnViewSettingsPage::~ColumnViewSettingsPage() -{ -} - -void ColumnViewSettingsPage::applySettings() -{ - ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); - - const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); - const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); - settings->setIconSize(iconSize); - settings->setPreviewSize(previewSize); - - const QFont font = m_fontRequester->font(); - settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); - settings->setFontFamily(font.family()); - settings->setFontSize(font.pointSizeF()); - settings->setItalicFont(font.italic()); - settings->setFontWeight(font.weight()); - - const int columnWidth = BaseTextWidth + (m_textWidthBox->currentIndex() * TextInc); - settings->setColumnWidth(columnWidth); - - settings->writeConfig(); -} - -void ColumnViewSettingsPage::restoreDefaults() -{ - ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); -} - -void ColumnViewSettingsPage::loadSettings() -{ - ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); - - const QSize iconSize(settings->iconSize(), settings->iconSize()); - const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); - m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); - - const QSize previewSize(settings->previewSize(), settings->previewSize()); - const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); - m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); - - if (settings->useSystemFont()) { - m_fontRequester->setMode(DolphinFontRequester::SystemFont); - } else { - QFont font(settings->fontFamily(), - qRound(settings->fontSize())); - font.setItalic(settings->italicFont()); - font.setWeight(settings->fontWeight()); - font.setPointSizeF(settings->fontSize()); - m_fontRequester->setMode(DolphinFontRequester::CustomFont); - m_fontRequester->setCustomFont(font); - } - - m_textWidthBox->setCurrentIndex((settings->columnWidth() - BaseTextWidth) / TextInc); -} - -#include "columnviewsettingspage.moc" diff --git a/src/settings/columnviewsettingspage.h b/src/settings/columnviewsettingspage.h deleted file mode 100644 index c68221e90..000000000 --- a/src/settings/columnviewsettingspage.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef COLUMNVIEWSETTINGSPAGE_H -#define COLUMNVIEWSETTINGSPAGE_H - -#include - -class DolphinFontRequester; -class IconSizeGroupBox; -class KComboBox; - -/** - * @brief Represents the page from the Dolphin Settings which allows - * to modify the settings for the details view. - */ -class ColumnViewSettingsPage : public ViewSettingsPageBase -{ - Q_OBJECT - -public: - ColumnViewSettingsPage(QWidget* parent); - virtual ~ColumnViewSettingsPage(); - - /** - * Applies the settings for the details view. - * The settings are persisted automatically when - * closing Dolphin. - */ - virtual void applySettings(); - - /** Restores the settings to default values. */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - enum - { - BaseTextWidth = 200, - TextInc = 50 - }; - - IconSizeGroupBox* m_iconSizeGroupBox; - DolphinFontRequester* m_fontRequester; - KComboBox* m_textWidthBox; -}; - -#endif diff --git a/src/settings/contextmenusettingspage.cpp b/src/settings/contextmenusettingspage.cpp deleted file mode 100644 index 14b4286f9..000000000 --- a/src/settings/contextmenusettingspage.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "contextmenusettingspage.h" -#include "dolphinsettings.h" -#include "dolphin_generalsettings.h" - -#include -#include -#include - -#include -#include - -const bool SHOW_DELETE = false; - -ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_showDeleteCommand(0), - m_showCopyMoveMenu(0) -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - KVBox* vBox = new KVBox(this); - vBox->setSpacing(KDialog::spacingHint()); - - m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command"), vBox); - connect(m_showDeleteCommand, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - m_showCopyMoveMenu = new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands"), vBox); - connect(m_showCopyMoveMenu, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(vBox); - - topLayout->addWidget(vBox); - - loadSettings(); -} - -ContextMenuSettingsPage::~ContextMenuSettingsPage() -{ -} - -void ContextMenuSettingsPage::applySettings() -{ - KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals); - KConfigGroup configGroup(globalConfig, "KDE"); - configGroup.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked()); - configGroup.sync(); - - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked()); - settings->writeConfig(); -} - -void ContextMenuSettingsPage::restoreDefaults() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); - m_showDeleteCommand->setChecked(SHOW_DELETE); -} - -void ContextMenuSettingsPage::loadSettings() -{ - KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals); - KConfigGroup configGroup(globalConfig, "KDE"); - m_showDeleteCommand->setChecked(configGroup.readEntry("ShowDeleteCommand", SHOW_DELETE)); - - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu()); -} - -#include "contextmenusettingspage.moc" diff --git a/src/settings/contextmenusettingspage.h b/src/settings/contextmenusettingspage.h deleted file mode 100644 index 8a11c23c5..000000000 --- a/src/settings/contextmenusettingspage.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef CONTEXTMENUSETTINGSPAGE_H -#define CONTEXTMENUSETTINGSPAGE_H - -#include - -class QCheckBox; - -/** - * @brief Page for the 'Context Menu' settings of the Dolphin settings dialog. - */ -class ContextMenuSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - ContextMenuSettingsPage(QWidget* parent); - virtual ~ContextMenuSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - QCheckBox* m_showDeleteCommand; - QCheckBox* m_showCopyMoveMenu; -}; - -#endif diff --git a/src/settings/detailsviewsettingspage.cpp b/src/settings/detailsviewsettingspage.cpp deleted file mode 100644 index dd819be70..000000000 --- a/src/settings/detailsviewsettingspage.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "detailsviewsettingspage.h" - -#include "iconsizegroupbox.h" -#include "dolphinfontrequester.h" -#include "dolphinsettings.h" -#include "dolphin_detailsmodesettings.h" -#include "zoomlevelinfo.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -DetailsViewSettingsPage::DetailsViewSettingsPage(QWidget* parent) : - ViewSettingsPageBase(parent), - m_iconSizeGroupBox(0), - m_fontRequester(0), - m_expandableFolders(0) -{ - const int spacing = KDialog::spacingHint(); - const int margin = KDialog::marginHint(); - const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - - setSpacing(spacing); - setMargin(margin); - - // Create "Icon" properties - m_iconSizeGroupBox = new IconSizeGroupBox(this); - m_iconSizeGroupBox->setSizePolicy(sizePolicy); - - const int min = ZoomLevelInfo::minimumLevel(); - const int max = ZoomLevelInfo::maximumLevel(); - m_iconSizeGroupBox->setDefaultSizeRange(min, max); - m_iconSizeGroupBox->setPreviewSizeRange(min, max); - - connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), - this, SIGNAL(changed())); - connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), - this, SIGNAL(changed())); - - // create "Text" properties - QWidget* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); - textGroup->setSizePolicy(sizePolicy); - - QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); - m_fontRequester = new DolphinFontRequester(textGroup); - connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); - - QHBoxLayout* textLayout = new QHBoxLayout(textGroup); - textLayout->addWidget(fontLabel, 0, Qt::AlignRight); - textLayout->addWidget(m_fontRequester); - - // create "Expandable Folders" checkbox - m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable folders"), this); - connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(this); - - loadSettings(); -} - -DetailsViewSettingsPage::~DetailsViewSettingsPage() -{ -} - -void DetailsViewSettingsPage::applySettings() -{ - DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); - - const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); - const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); - settings->setIconSize(iconSize); - settings->setPreviewSize(previewSize); - - const QFont font = m_fontRequester->font(); - settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); - settings->setFontFamily(font.family()); - settings->setFontSize(font.pointSizeF()); - settings->setItalicFont(font.italic()); - settings->setFontWeight(font.weight()); - - settings->setExpandableFolders(m_expandableFolders->isChecked()); - - settings->writeConfig(); -} - -void DetailsViewSettingsPage::restoreDefaults() -{ - DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); -} - -void DetailsViewSettingsPage::loadSettings() -{ - DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); - - const QSize iconSize(settings->iconSize(), settings->iconSize()); - const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); - m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); - - const QSize previewSize(settings->previewSize(), settings->previewSize()); - const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); - m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); - - if (settings->useSystemFont()) { - m_fontRequester->setMode(DolphinFontRequester::SystemFont); - } else { - QFont font(settings->fontFamily(), - qRound(settings->fontSize())); - font.setItalic(settings->italicFont()); - font.setWeight(settings->fontWeight()); - font.setPointSizeF(settings->fontSize()); - m_fontRequester->setMode(DolphinFontRequester::CustomFont); - m_fontRequester->setCustomFont(font); - } - - m_expandableFolders->setChecked(settings->expandableFolders()); -} - -#include "detailsviewsettingspage.moc" diff --git a/src/settings/detailsviewsettingspage.h b/src/settings/detailsviewsettingspage.h deleted file mode 100644 index 58e3fd905..000000000 --- a/src/settings/detailsviewsettingspage.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef DETAILSVIEWSETTINGSPAGE_H -#define DETAILSVIEWSETTINGSPAGE_H - -#include - -class DolphinFontRequester; -class IconSizeGroupBox; -class QCheckBox; - -/** - * @brief Represents the page from the Dolphin Settings which allows - * to modify the settings for the details view. - */ -class DetailsViewSettingsPage : public ViewSettingsPageBase -{ - Q_OBJECT - -public: - DetailsViewSettingsPage(QWidget* parent); - virtual ~DetailsViewSettingsPage(); - - /** - * Applies the settings for the details view. - * The settings are persisted automatically when - * closing Dolphin. - */ - virtual void applySettings(); - - /** Restores the settings to default values. */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - IconSizeGroupBox* m_iconSizeGroupBox; - DolphinFontRequester* m_fontRequester; - QCheckBox* m_expandableFolders; -}; - -#endif diff --git a/src/settings/dolphinfontrequester.cpp b/src/settings/dolphinfontrequester.cpp deleted file mode 100644 index 04c5ed586..000000000 --- a/src/settings/dolphinfontrequester.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "dolphinfontrequester.h" - -#include -#include -#include -#include - -#include -#include - -DolphinFontRequester::DolphinFontRequester(QWidget* parent) : - KHBox(parent), - m_modeCombo(0), - m_chooseFontButton(0), - m_mode(SystemFont), - m_customFont() -{ - setSpacing(KDialog::spacingHint()); - - m_modeCombo = new KComboBox(this); - m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font")); - m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font")); - connect(m_modeCombo, SIGNAL(activated(int)), - this, SLOT(changeMode(int))); - - m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this); - connect(m_chooseFontButton, SIGNAL(clicked()), - this, SLOT(openFontDialog())); - - changeMode(m_modeCombo->currentIndex()); -} - -DolphinFontRequester::~DolphinFontRequester() -{ -} - -void DolphinFontRequester::setMode(Mode mode) -{ - m_mode = mode; - m_modeCombo->setCurrentIndex(m_mode); - m_modeCombo->setFont(font()); - m_chooseFontButton->setEnabled(m_mode == CustomFont); -} - -DolphinFontRequester::Mode DolphinFontRequester::mode() const -{ - return m_mode; -} - -QFont DolphinFontRequester::font() const -{ - return (m_mode == CustomFont) ? m_customFont : KGlobalSettings::generalFont(); -} - -void DolphinFontRequester::setCustomFont(const QFont& font) -{ - m_customFont = font; -} - -QFont DolphinFontRequester::customFont() const -{ - return m_customFont; -} - -bool DolphinFontRequester::event(QEvent* event) -{ - if (event->type() == QEvent::Polish) { - m_modeCombo->setFont(font()); - } - return KHBox::event(event); -} - -void DolphinFontRequester::openFontDialog() -{ - QFont font = m_customFont; - const int result = KFontDialog::getFont(font, - KFontChooser::NoDisplayFlags, - this); - if (result == KFontDialog::Accepted) { - m_customFont = font; - m_modeCombo->setFont(m_customFont); - emit changed(); - } -} - -void DolphinFontRequester::changeMode(int index) -{ - setMode((index == CustomFont) ? CustomFont : SystemFont); - emit changed(); -} - -#include "dolphinfontrequester.moc" diff --git a/src/settings/dolphinfontrequester.h b/src/settings/dolphinfontrequester.h deleted file mode 100644 index 03a062b2e..000000000 --- a/src/settings/dolphinfontrequester.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef DOLPHINFONTREQUESTER_H -#define DOLPHINFONTREQUESTER_H - -#include - -#include - -class KComboBox; -class QPushButton; - -/** - * @brief Allows to select between using the system font or a custom font. - */ -class DolphinFontRequester : public KHBox -{ - Q_OBJECT - -public: - enum Mode - { - SystemFont = 0, - CustomFont = 1 - }; - - DolphinFontRequester(QWidget* parent); - virtual ~DolphinFontRequester(); - - void setMode(Mode mode); - Mode mode() const; - - /** - * Returns the custom font (see DolphinFontRequester::customFont()), - * if the mode is \a CustomFont, otherwise the system font is - * returned. - */ - QFont font() const; - - void setCustomFont(const QFont& font); - QFont customFont() const; - -signals: - /** Is emitted, if the font has been changed. */ - void changed(); - -protected: - bool event(QEvent* event); - -private slots: - void openFontDialog(); - void changeMode(int index); - -private: - KComboBox* m_modeCombo; - QPushButton* m_chooseFontButton; - - Mode m_mode; - QFont m_customFont; -}; - -#endif diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 93f95ca44..4762ae457 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -22,12 +22,12 @@ #include #include -#include "generalsettingspage.h" -#include "navigationsettingspage.h" -#include "servicessettingspage.h" -#include "startupsettingspage.h" -#include "viewsettingspage.h" -#include "trashsettingspage.h" +#include "general/generalsettingspage.h" +#include "navigation/navigationsettingspage.h" +#include "services/servicessettingspage.h" +#include "startup/startupsettingspage.h" +#include "viewmodes/viewsettingspage.h" +#include "trash/trashsettingspage.h" #include #include diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp new file mode 100644 index 000000000..0d7a4a0ab --- /dev/null +++ b/src/settings/general/behaviorsettingspage.cpp @@ -0,0 +1,223 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) and * + * and Patrice Tremblay * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "behaviorsettingspage.h" + +#include "dolphin_generalsettings.h" +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +const bool CONFIRM_TRASH = false; +const bool CONFIRM_DELETE = true; + +BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) : + SettingsPageBase(parent), + m_url(url), + m_localProps(0), + m_globalProps(0), + m_confirmMoveToTrash(0), + m_confirmDelete(0), + m_renameInline(0), + m_showToolTips(0), + m_configureToolTips(0), + m_showSelectionToggle(0), + m_naturalSorting(0) +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + + // 'View Properties' box + QGroupBox* propsBox = new QGroupBox(i18nc("@title:group", "View Properties"), this); + propsBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + + m_localProps = new QRadioButton(i18nc("@option:radio", "Remember view properties for each folder"), propsBox); + connect(m_localProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + m_globalProps = new QRadioButton(i18nc("@option:radio", "Use common view properties for all folders"), propsBox); + connect(m_globalProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + QVBoxLayout* propsBoxLayout = new QVBoxLayout(propsBox); + propsBoxLayout->addWidget(m_localProps); + propsBoxLayout->addWidget(m_globalProps); + + // 'Ask Confirmation For' box + QGroupBox* confirmBox = new QGroupBox(i18nc("@title:group", "Ask For Confirmation When"), this); + confirmBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + m_confirmMoveToTrash = new QCheckBox(i18nc("@option:check Ask for Confirmation When", + "Moving files or folders to trash"), confirmBox); + connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for Confirmation When", + "Deleting files or folders"), confirmBox); + connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for Confirmation When", + "Closing windows with multiple tabs"), confirmBox); + connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox); + confirmBoxLayout->addWidget(m_confirmMoveToTrash); + confirmBoxLayout->addWidget(m_confirmDelete); + confirmBoxLayout->addWidget(m_confirmClosingMultipleTabs); + + // 'Rename inline' + m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), this); + connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // 'Show tooltips' + QWidget* toolTipContainer = new QWidget(this); + QHBoxLayout* toolTipsLayout = new QHBoxLayout(toolTipContainer); + toolTipsLayout->setMargin(0); + m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), toolTipContainer); + connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_showToolTips, SIGNAL(toggled(bool)), this, SLOT(updateConfigureButton())); + + m_configureToolTips = new QLabel(toolTipContainer); + connect(m_configureToolTips, SIGNAL(linkActivated(const QString&)), + this, SLOT(configureToolTips())); + + toolTipsLayout->addWidget(m_showToolTips); + toolTipsLayout->addWidget(m_configureToolTips, 1, Qt::AlignLeft); + + // 'Show selection marker' + m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), this); + connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // 'Natural sorting of items' + m_naturalSorting = new QCheckBox(i18nc("option:check", "Natural sorting of items"), this); + connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + topLayout->addWidget(propsBox); + topLayout->addWidget(confirmBox); + topLayout->addWidget(m_renameInline); + topLayout->addWidget(toolTipContainer); + topLayout->addWidget(m_showSelectionToggle); + topLayout->addWidget(m_naturalSorting); + topLayout->addStretch(); + + loadSettings(); +} + +BehaviorSettingsPage::~BehaviorSettingsPage() +{ +} + +void BehaviorSettingsPage::applySettings() +{ + ViewProperties props(m_url); // read current view properties + + const bool useGlobalProps = m_globalProps->isChecked(); + + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->setGlobalViewProps(useGlobalProps); + + if (useGlobalProps) { + // Remember the global view properties by applying the current view properties. + // It is important that GeneralSettings::globalViewProps() is set before + // the class ViewProperties is used, as ViewProperties uses this setting + // to find the destination folder for storing the view properties. + ViewProperties globalProps(m_url); + globalProps.setDirProperties(props); + } + + KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::NoGlobals); + KConfigGroup confirmationGroup(kioConfig, "Confirmations"); + confirmationGroup.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked()); + confirmationGroup.writeEntry("ConfirmDelete", m_confirmDelete->isChecked()); + confirmationGroup.sync(); + + settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked()); + settings->setRenameInline(m_renameInline->isChecked()); + settings->setShowToolTips(m_showToolTips->isChecked()); + settings->setShowSelectionToggle(m_showSelectionToggle->isChecked()); + settings->writeConfig(); + + const bool naturalSorting = m_naturalSorting->isChecked(); + if (KGlobalSettings::naturalSorting() != naturalSorting) { + KConfigGroup group(KGlobal::config(), "KDE"); + group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persistent | KConfig::Global); + KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged); + } +} + +void BehaviorSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); + m_confirmMoveToTrash->setChecked(CONFIRM_TRASH); + m_confirmDelete->setChecked(CONFIRM_DELETE); +} + +void BehaviorSettingsPage::updateConfigureButton() +{ + if (m_showToolTips->isChecked()) { + m_configureToolTips->setText("" + + i18nc("@action:button", "Configure...") + + ""); + } else { + m_configureToolTips->setText(QString()); + } +} + +void BehaviorSettingsPage::configureToolTips() +{ + FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(); + dialog->setDescription(i18nc("@label::textbox", + "Select which data should be shown in the tooltip.")); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); + dialog->raise(); + dialog->activateWindow(); +} + +void BehaviorSettingsPage::loadSettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + if (settings->globalViewProps()) { + m_globalProps->setChecked(true); + } else { + m_localProps->setChecked(true); + } + + KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::IncludeGlobals); + const KConfigGroup confirmationGroup(kioConfig, "Confirmations"); + m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", CONFIRM_TRASH)); + m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", CONFIRM_DELETE)); + + m_confirmClosingMultipleTabs->setChecked(settings->confirmClosingMultipleTabs()); + m_renameInline->setChecked(settings->renameInline()); + m_showToolTips->setChecked(settings->showToolTips()); + m_showSelectionToggle->setChecked(settings->showSelectionToggle()); + m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); + + updateConfigureButton(); +} + +#include "behaviorsettingspage.moc" diff --git a/src/settings/general/behaviorsettingspage.h b/src/settings/general/behaviorsettingspage.h new file mode 100644 index 000000000..331e45806 --- /dev/null +++ b/src/settings/general/behaviorsettingspage.h @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * peter.penz@gmx.at * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef BEHAVIORSETTINGSPAGE_H +#define BEHAVIORSETTINGSPAGE_H + +#include +#include + +class QCheckBox; +class QLabel; +class QRadioButton; + +/** + * @brief Tab page for the 'Behavior' settings of the Dolphin settings dialog. + */ +class BehaviorSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + BehaviorSettingsPage(const KUrl& url, QWidget* parent); + virtual ~BehaviorSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private slots: + /** + * Updates the visibility state of the configure + * button m_configureToolTips. + */ + void updateConfigureButton(); + + /** + * Opens a dialog which allows the user to specify which + * meta data should be shown in the tooltip. + */ + void configureToolTips(); + +private: + void loadSettings(); + +private: + KUrl m_url; + + QRadioButton* m_localProps; + QRadioButton* m_globalProps; + + QCheckBox* m_confirmMoveToTrash; + QCheckBox* m_confirmDelete; + QCheckBox* m_confirmClosingMultipleTabs; + + QCheckBox* m_renameInline; + QCheckBox* m_showToolTips; + QLabel* m_configureToolTips; + QCheckBox* m_showSelectionToggle; + QCheckBox* m_naturalSorting; +}; + +#endif diff --git a/src/settings/general/contextmenusettingspage.cpp b/src/settings/general/contextmenusettingspage.cpp new file mode 100644 index 000000000..233e899b4 --- /dev/null +++ b/src/settings/general/contextmenusettingspage.cpp @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "contextmenusettingspage.h" + +#include +#include + +#include +#include +#include + +#include +#include + +const bool SHOW_DELETE = false; + +ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_showDeleteCommand(0), + m_showCopyMoveMenu(0) +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + KVBox* vBox = new KVBox(this); + vBox->setSpacing(KDialog::spacingHint()); + + m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command"), vBox); + connect(m_showDeleteCommand, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + m_showCopyMoveMenu = new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands"), vBox); + connect(m_showCopyMoveMenu, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(vBox); + + topLayout->addWidget(vBox); + + loadSettings(); +} + +ContextMenuSettingsPage::~ContextMenuSettingsPage() +{ +} + +void ContextMenuSettingsPage::applySettings() +{ + KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals); + KConfigGroup configGroup(globalConfig, "KDE"); + configGroup.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked()); + configGroup.sync(); + + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked()); + settings->writeConfig(); +} + +void ContextMenuSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); + m_showDeleteCommand->setChecked(SHOW_DELETE); +} + +void ContextMenuSettingsPage::loadSettings() +{ + KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals); + KConfigGroup configGroup(globalConfig, "KDE"); + m_showDeleteCommand->setChecked(configGroup.readEntry("ShowDeleteCommand", SHOW_DELETE)); + + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu()); +} + +#include "contextmenusettingspage.moc" diff --git a/src/settings/general/contextmenusettingspage.h b/src/settings/general/contextmenusettingspage.h new file mode 100644 index 000000000..8a11c23c5 --- /dev/null +++ b/src/settings/general/contextmenusettingspage.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef CONTEXTMENUSETTINGSPAGE_H +#define CONTEXTMENUSETTINGSPAGE_H + +#include + +class QCheckBox; + +/** + * @brief Page for the 'Context Menu' settings of the Dolphin settings dialog. + */ +class ContextMenuSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + ContextMenuSettingsPage(QWidget* parent); + virtual ~ContextMenuSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + QCheckBox* m_showDeleteCommand; + QCheckBox* m_showCopyMoveMenu; +}; + +#endif diff --git a/src/settings/general/generalsettingspage.cpp b/src/settings/general/generalsettingspage.cpp new file mode 100644 index 000000000..e156dadfc --- /dev/null +++ b/src/settings/general/generalsettingspage.cpp @@ -0,0 +1,92 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * peter.penz@gmx.at * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "generalsettingspage.h" + +#include "behaviorsettingspage.h" +#include "contextmenusettingspage.h" +#include "previewssettingspage.h" +#include +#include "statusbarsettingspage.h" + +#include +#include +#include +#include + +#include + +GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) : + SettingsPageBase(parent), + m_pages() +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + topLayout->setMargin(0); + topLayout->setSpacing(KDialog::spacingHint()); + + KTabWidget* tabWidget = new KTabWidget(this); + + // initialize 'Behavior' tab + BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(url, tabWidget); + tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); + connect(behaviorPage, SIGNAL(changed()), this, SIGNAL(changed())); + + // initialize 'Previews' tab + PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget); + tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews")); + connect(previewsPage, SIGNAL(changed()), this, SIGNAL(changed())); + + // initialize 'Context Menu' tab + ContextMenuSettingsPage* contextMenuPage = new ContextMenuSettingsPage(tabWidget); + tabWidget->addTab(contextMenuPage, i18nc("@title:tab Context Menu settings", "Context Menu")); + connect(contextMenuPage, SIGNAL(changed()), this, SIGNAL(changed())); + + // initialize 'Status Bar' tab + StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget); + tabWidget->addTab(statusBarPage, i18nc("@title:tab Status Bar settings", "Status Bar")); + connect(statusBarPage, SIGNAL(changed()), this, SIGNAL(changed())); + + m_pages.append(behaviorPage); + m_pages.append(previewsPage); + m_pages.append(contextMenuPage); + m_pages.append(statusBarPage); + + topLayout->addWidget(tabWidget, 0, 0); +} + +GeneralSettingsPage::~GeneralSettingsPage() +{ +} + +void GeneralSettingsPage::applySettings() +{ + foreach (SettingsPageBase* page, m_pages) { + page->applySettings(); + } +} + +void GeneralSettingsPage::restoreDefaults() +{ + foreach (SettingsPageBase* page, m_pages) { + page->restoreDefaults(); + } +} + +#include "generalsettingspage.moc" diff --git a/src/settings/general/generalsettingspage.h b/src/settings/general/generalsettingspage.h new file mode 100644 index 000000000..0d28664f5 --- /dev/null +++ b/src/settings/general/generalsettingspage.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * peter.penz@gmx.at * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef GENERALSETTINGSPAGE_H +#define GENERALSETTINGSPAGE_H + +#include +#include + +class KUrl; +class SettingsPageBase; + +/** + * @brief Page for the 'General' settings of the Dolphin settings dialog. + * + * The general settings include: + * - Behavior + * - Previews + * - Context Menu + * - Status Bar + */ +class GeneralSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + GeneralSettingsPage(const KUrl& url, QWidget* parent); + virtual ~GeneralSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + QList m_pages; +}; + +#endif diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp new file mode 100644 index 000000000..1059e8547 --- /dev/null +++ b/src/settings/general/previewssettingspage.cpp @@ -0,0 +1,182 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "previewssettingspage.h" + +#include "dolphin_generalsettings.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// default settings +namespace { + const bool UseThumbnails = true; + const int MaxLocalPreviewSize = 5; // 5 MB + const int MaxRemotePreviewSize = 0; // 0 MB +} + +PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_initialized(false), + m_previewPluginsList(0), + m_enabledPreviewPlugins(), + m_localFileSizeBox(0), + m_remoteFileSizeBox(0) +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + topLayout->setSpacing(KDialog::spacingHint()); + topLayout->setMargin(KDialog::marginHint()); + + // Create group box "Show previews for:" + QGroupBox* listBox = new QGroupBox(i18nc("@title:group", "Show previews for"), this); + + m_previewPluginsList = new QListWidget(this); + m_previewPluginsList->setSortingEnabled(true); + m_previewPluginsList->setSelectionMode(QAbstractItemView::NoSelection); + connect(m_previewPluginsList, SIGNAL(itemClicked(QListWidgetItem*)), + this, SIGNAL(changed())); + + QVBoxLayout* listBoxLayout = new QVBoxLayout(listBox); + listBoxLayout->addWidget(m_previewPluginsList); + + // Create group box "Don't create previews for" + QGroupBox* fileSizeBox = new QGroupBox(i18nc("@title:group", "Do not create previews for"), this); + + QLabel* localFileSizeLabel = new QLabel(i18nc("@label Don't create previews for: XX MByte", + "Local files above:"), this); + + m_localFileSizeBox = new KIntSpinBox(this); + m_localFileSizeBox->setSingleStep(1); + m_localFileSizeBox->setSuffix(QLatin1String(" MB")); + m_localFileSizeBox->setRange(0, 9999); /* MB */ + connect(m_localFileSizeBox, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); + + QLabel* remoteFileSizeLabel = new QLabel(i18nc("@label Don't create previews for: XX MByte", + "Remote files above:"), this); + + m_remoteFileSizeBox = new KIntSpinBox(this); + m_remoteFileSizeBox->setSingleStep(1); + m_remoteFileSizeBox->setSuffix(QLatin1String(" MB")); + m_remoteFileSizeBox->setRange(0, 9999); /* MB */ + connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); + + QGridLayout* fileSizeBoxLayout = new QGridLayout(fileSizeBox); + fileSizeBoxLayout->addWidget(localFileSizeLabel, 0, 0, Qt::AlignRight); + fileSizeBoxLayout->addWidget(m_localFileSizeBox, 0, 1); + fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 1, 0, Qt::AlignRight); + fileSizeBoxLayout->addWidget(m_remoteFileSizeBox, 1, 1); + + topLayout->addWidget(listBox); + topLayout->addWidget(fileSizeBox); + + loadSettings(); +} + + +PreviewsSettingsPage::~PreviewsSettingsPage() +{ +} + +void PreviewsSettingsPage::applySettings() +{ + m_enabledPreviewPlugins.clear(); + const int count = m_previewPluginsList->count(); + for (int i = 0; i < count; ++i) { + const QListWidgetItem* item = m_previewPluginsList->item(i); + if (item->checkState() == Qt::Checked) { + const QString enabledPlugin = item->data(Qt::UserRole).toString(); + m_enabledPreviewPlugins.append(enabledPlugin); + } + } + + KConfigGroup globalConfig(KGlobal::config(), QLatin1String("PreviewSettings")); + globalConfig.writeEntry("Plugins", m_enabledPreviewPlugins); + + globalConfig.writeEntry("MaximumSize", + m_localFileSizeBox->value() * 1024 * 1024, + KConfigBase::Normal | KConfigBase::Global); + globalConfig.writeEntry("MaximumRemoteSize", + m_remoteFileSizeBox->value() * 1024 * 1024, + KConfigBase::Normal | KConfigBase::Global); + globalConfig.sync(); +} + +void PreviewsSettingsPage::restoreDefaults() +{ + m_localFileSizeBox->setValue(MaxLocalPreviewSize); + m_remoteFileSizeBox->setValue(MaxRemotePreviewSize); +} + +void PreviewsSettingsPage::showEvent(QShowEvent* event) +{ + if (!event->spontaneous() && !m_initialized) { + QMetaObject::invokeMethod(this, "loadPreviewPlugins", Qt::QueuedConnection); + m_initialized = true; + } + SettingsPageBase::showEvent(event); +} + +void PreviewsSettingsPage::loadPreviewPlugins() +{ + const KService::List plugins = KServiceTypeTrader::self()->query(QLatin1String("ThumbCreator")); + foreach (const KSharedPtr& service, plugins) { + QListWidgetItem* item = new QListWidgetItem(service->name(), + m_previewPluginsList); + item->setData(Qt::UserRole, service->desktopEntryName()); + const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName()); + item->setCheckState(show ? Qt::Checked : Qt::Unchecked); + } +} + +void PreviewsSettingsPage::loadSettings() +{ + KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings"); + m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList() + << QLatin1String("directorythumbnail") + << QLatin1String("imagethumbnail") + << QLatin1String("jpegthumbnail")); + + const int maxLocalByteSize = globalConfig.readEntry("MaximumSize", MaxLocalPreviewSize * 1024 * 1024); + const int maxLocalMByteSize = maxLocalByteSize / (1024 * 1024); + m_localFileSizeBox->setValue(maxLocalMByteSize); + + const int maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", MaxRemotePreviewSize * 1024 * 1024); + const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024); + m_remoteFileSizeBox->setValue(maxRemoteMByteSize); +} + +#include "previewssettingspage.moc" diff --git a/src/settings/general/previewssettingspage.h b/src/settings/general/previewssettingspage.h new file mode 100644 index 000000000..4b59ec87b --- /dev/null +++ b/src/settings/general/previewssettingspage.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef PREVIEWSSETTINGSPAGE_H +#define PREVIEWSSETTINGSPAGE_H + +#include + +class QListWidget; +class KIntSpinBox; + +/** + * @brief Allows the configuration of file previews. + */ +class PreviewsSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + PreviewsSettingsPage(QWidget* parent); + virtual ~PreviewsSettingsPage(); + + /** + * Applies the general settings for the view modes + * The settings are persisted automatically when + * closing Dolphin. + */ + virtual void applySettings(); + + /** Restores the settings to default values. */ + virtual void restoreDefaults(); + +protected: + virtual void showEvent(QShowEvent* event); + +private slots: + void loadPreviewPlugins(); + +private: + void loadSettings(); + +private: + bool m_initialized; + QListWidget* m_previewPluginsList; + QStringList m_enabledPreviewPlugins; + KIntSpinBox* m_localFileSizeBox; + KIntSpinBox* m_remoteFileSizeBox; +}; + +#endif diff --git a/src/settings/general/statusbarsettingspage.cpp b/src/settings/general/statusbarsettingspage.cpp new file mode 100644 index 000000000..5c2d34af8 --- /dev/null +++ b/src/settings/general/statusbarsettingspage.cpp @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "statusbarsettingspage.h" + +#include + +#include +#include +#include + +#include + +#include +#include + +StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_showZoomSlider(0), + m_showSpaceInfo(0) +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + KVBox* vBox = new KVBox(this); + vBox->setSpacing(KDialog::spacingHint()); + + m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), vBox); + connect(m_showZoomSlider, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), vBox); + connect(m_showSpaceInfo, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(vBox); + + topLayout->addWidget(vBox); + + loadSettings(); +} + +StatusBarSettingsPage::~StatusBarSettingsPage() +{ +} + +void StatusBarSettingsPage::applySettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->setShowZoomSlider(m_showZoomSlider->isChecked()); + settings->setShowSpaceInfo(m_showSpaceInfo->isChecked()); + settings->writeConfig(); +} + +void StatusBarSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); +} + +void StatusBarSettingsPage::loadSettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + m_showZoomSlider->setChecked(settings->showZoomSlider()); + m_showSpaceInfo->setChecked(settings->showSpaceInfo()); +} + +#include "statusbarsettingspage.moc" diff --git a/src/settings/general/statusbarsettingspage.h b/src/settings/general/statusbarsettingspage.h new file mode 100644 index 000000000..6e9667be4 --- /dev/null +++ b/src/settings/general/statusbarsettingspage.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef STATUSBARSETTINGSPAGE_H +#define STATUSBARSETTINGSPAGE_H + +#include + +class QCheckBox; + +/** + * @brief Tab page for the 'Status Bar' settings of the Dolphin settings dialog. + */ +class StatusBarSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + StatusBarSettingsPage(QWidget* parent); + virtual ~StatusBarSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + QCheckBox* m_showZoomSlider; + QCheckBox* m_showSpaceInfo; +}; + +#endif diff --git a/src/settings/generalsettingspage.cpp b/src/settings/generalsettingspage.cpp deleted file mode 100644 index 6b7d5917c..000000000 --- a/src/settings/generalsettingspage.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "generalsettingspage.h" - -#include "behaviorsettingspage.h" -#include "contextmenusettingspage.h" -#include "previewssettingspage.h" -#include "settingspagebase.h" -#include "statusbarsettingspage.h" - -#include -#include -#include -#include - -#include - -GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) : - SettingsPageBase(parent), - m_pages() -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - topLayout->setMargin(0); - topLayout->setSpacing(KDialog::spacingHint()); - - KTabWidget* tabWidget = new KTabWidget(this); - - // initialize 'Behavior' tab - BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(url, tabWidget); - tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); - connect(behaviorPage, SIGNAL(changed()), this, SIGNAL(changed())); - - // initialize 'Previews' tab - PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget); - tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews")); - connect(previewsPage, SIGNAL(changed()), this, SIGNAL(changed())); - - // initialize 'Context Menu' tab - ContextMenuSettingsPage* contextMenuPage = new ContextMenuSettingsPage(tabWidget); - tabWidget->addTab(contextMenuPage, i18nc("@title:tab Context Menu settings", "Context Menu")); - connect(contextMenuPage, SIGNAL(changed()), this, SIGNAL(changed())); - - // initialize 'Status Bar' tab - StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget); - tabWidget->addTab(statusBarPage, i18nc("@title:tab Status Bar settings", "Status Bar")); - connect(statusBarPage, SIGNAL(changed()), this, SIGNAL(changed())); - - m_pages.append(behaviorPage); - m_pages.append(previewsPage); - m_pages.append(contextMenuPage); - m_pages.append(statusBarPage); - - topLayout->addWidget(tabWidget, 0, 0); -} - -GeneralSettingsPage::~GeneralSettingsPage() -{ -} - -void GeneralSettingsPage::applySettings() -{ - foreach (SettingsPageBase* page, m_pages) { - page->applySettings(); - } -} - -void GeneralSettingsPage::restoreDefaults() -{ - foreach (SettingsPageBase* page, m_pages) { - page->restoreDefaults(); - } -} - -#include "generalsettingspage.moc" diff --git a/src/settings/generalsettingspage.h b/src/settings/generalsettingspage.h deleted file mode 100644 index 0d28664f5..000000000 --- a/src/settings/generalsettingspage.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef GENERALSETTINGSPAGE_H -#define GENERALSETTINGSPAGE_H - -#include -#include - -class KUrl; -class SettingsPageBase; - -/** - * @brief Page for the 'General' settings of the Dolphin settings dialog. - * - * The general settings include: - * - Behavior - * - Previews - * - Context Menu - * - Status Bar - */ -class GeneralSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - GeneralSettingsPage(const KUrl& url, QWidget* parent); - virtual ~GeneralSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - QList m_pages; -}; - -#endif diff --git a/src/settings/iconsizegroupbox.cpp b/src/settings/iconsizegroupbox.cpp deleted file mode 100644 index d8e0e889a..000000000 --- a/src/settings/iconsizegroupbox.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "iconsizegroupbox.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "zoomlevelinfo.h" - -IconSizeGroupBox::IconSizeGroupBox(QWidget* parent) : - QGroupBox(i18nc("@title:group", "Icon Size"), parent), - m_defaultSizeSlider(0), - m_previewSizeSlider(0) -{ - QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this); - m_defaultSizeSlider = new QSlider(Qt::Horizontal, this); - m_defaultSizeSlider->setPageStep(1); - m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow); - connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), - this, SLOT(slotDefaultSliderMoved(int))); - - QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this); - m_previewSizeSlider = new QSlider(Qt::Horizontal, this); - m_previewSizeSlider->setPageStep(1); - m_previewSizeSlider->setTickPosition(QSlider::TicksBelow); - connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), - this, SLOT(slotPreviewSliderMoved(int))); - - QGridLayout* layout = new QGridLayout(this); - layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight); - layout->addWidget(m_defaultSizeSlider, 0, 1); - layout->addWidget(previewLabel, 1, 0, Qt::AlignRight); - layout->addWidget(m_previewSizeSlider, 1, 1); -} - -IconSizeGroupBox::~IconSizeGroupBox() -{ -} - -void IconSizeGroupBox::setDefaultSizeRange(int min, int max) -{ - m_defaultSizeSlider->setRange(min, max); -} - -void IconSizeGroupBox::setPreviewSizeRange(int min, int max) -{ - m_previewSizeSlider->setRange(min, max); -} - -void IconSizeGroupBox::setDefaultSizeValue(int value) -{ - m_defaultSizeSlider->setValue(value); -} - -int IconSizeGroupBox::defaultSizeValue() const -{ - return m_defaultSizeSlider->value(); -} - -void IconSizeGroupBox::setPreviewSizeValue(int value) -{ - m_previewSizeSlider->setValue(value); -} - -int IconSizeGroupBox::previewSizeValue() const -{ - return m_previewSizeSlider->value(); -} - -void IconSizeGroupBox::slotDefaultSliderMoved(int value) -{ - showToolTip(m_defaultSizeSlider, value); - emit defaultSizeChanged(value); -} - -void IconSizeGroupBox::slotPreviewSliderMoved(int value) -{ - showToolTip(m_previewSizeSlider, value); - emit previewSizeChanged(value); -} - -void IconSizeGroupBox::showToolTip(QSlider* slider, int value) -{ - const int size = ZoomLevelInfo::iconSizeForZoomLevel(value); - slider->setToolTip(i18ncp("@info:tooltip", "Size: 1 pixel", "Size: %1 pixels", size)); - if (!slider->isVisible()) { - return; - } - QPoint global = slider->rect().topLeft(); - global.ry() += slider->height() / 2; - QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), slider->mapToGlobal(global)); - QApplication::sendEvent(slider, &toolTipEvent); -} - -#include "iconsizegroupbox.moc" diff --git a/src/settings/iconsizegroupbox.h b/src/settings/iconsizegroupbox.h deleted file mode 100644 index 3ec51c3a5..000000000 --- a/src/settings/iconsizegroupbox.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef ICONSIZEGROUPBOX_H -#define ICONSIZEGROUPBOX_H - -#include - -class QSlider; - -/** - * @short Provides a group box for adjusting the icon sizes. - * - * It is possible to adjust the default icon size and the icon - * size when previews are used. - */ -class IconSizeGroupBox : public QGroupBox -{ - Q_OBJECT - -public: - explicit IconSizeGroupBox(QWidget* parent); - virtual ~IconSizeGroupBox(); - - void setDefaultSizeRange(int min, int max); - void setPreviewSizeRange(int min, int max); - - void setDefaultSizeValue(int value); - int defaultSizeValue() const; - - void setPreviewSizeValue(int value); - int previewSizeValue() const; - -signals: - void defaultSizeChanged(int value); - void previewSizeChanged(int value); - -private slots: - void slotDefaultSliderMoved(int value); - void slotPreviewSliderMoved(int value); - -private: - void showToolTip(QSlider* slider, int value); - -private: - QSlider* m_defaultSizeSlider; - QSlider* m_previewSizeSlider; -}; - -#endif diff --git a/src/settings/iconsviewsettingspage.cpp b/src/settings/iconsviewsettingspage.cpp deleted file mode 100644 index 059a4a846..000000000 --- a/src/settings/iconsviewsettingspage.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "iconsviewsettingspage.h" - -#include "dolphinfontrequester.h" -#include "settings/dolphinsettings.h" -#include "iconsizegroupbox.h" -#include "zoomlevelinfo.h" - -#include "dolphin_iconsmodesettings.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -IconsViewSettingsPage::IconsViewSettingsPage(QWidget* parent) : - ViewSettingsPageBase(parent), - m_iconSizeGroupBox(0), - m_textWidthBox(0), - m_fontRequester(0), - m_textlinesCountBox(0), - m_arrangementBox(0), - m_gridSpacingBox(0) -{ - const int spacing = KDialog::spacingHint(); - const int margin = KDialog::marginHint(); - const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - - setSpacing(spacing); - setMargin(margin); - - // Create "Icon" properties - m_iconSizeGroupBox = new IconSizeGroupBox(this); - m_iconSizeGroupBox->setSizePolicy(sizePolicy); - - const int min = ZoomLevelInfo::minimumLevel(); - const int max = ZoomLevelInfo::maximumLevel(); - m_iconSizeGroupBox->setDefaultSizeRange(min, max); - m_iconSizeGroupBox->setPreviewSizeRange(min, max); - - connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), - this, SIGNAL(changed())); - connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), - this, SIGNAL(changed())); - - // create 'Text' group for selecting the font, the number of lines - // and the text width - QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); - textGroup->setSizePolicy(sizePolicy); - - QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); - m_fontRequester = new DolphinFontRequester(textGroup); - connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); - - QLabel* textlinesCountLabel = new QLabel(i18nc("@label:textbox", "Number of lines:"), textGroup); - m_textlinesCountBox = new KIntSpinBox(textGroup); - m_textlinesCountBox->setMinimum(1); - m_textlinesCountBox->setMaximum(5); - connect(m_textlinesCountBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); - - QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup); - m_textWidthBox = new KComboBox(textGroup); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large")); - m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge")); - connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); - - QGridLayout* textGroupLayout = new QGridLayout(textGroup); - textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight); - textGroupLayout->addWidget(m_fontRequester, 0, 1); - textGroupLayout->addWidget(textlinesCountLabel, 1, 0, Qt::AlignRight); - textGroupLayout->addWidget(m_textlinesCountBox, 1, 1); - textGroupLayout->addWidget(textWidthLabel, 2, 0, Qt::AlignRight); - textGroupLayout->addWidget(m_textWidthBox, 2, 1); - - // create the 'Grid' group for selecting the arrangement and the grid spacing - QGroupBox* gridGroup = new QGroupBox(i18nc("@title:group", "Grid"), this); - gridGroup->setSizePolicy(sizePolicy); - - QLabel* arrangementLabel = new QLabel(i18nc("@label:listbox", "Arrangement:"), gridGroup); - m_arrangementBox = new KComboBox(gridGroup); - m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Columns")); - m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Rows")); - connect(m_arrangementBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); - - QLabel* gridSpacingLabel = new QLabel(i18nc("@label:listbox", "Grid spacing:"), gridGroup); - m_gridSpacingBox = new KComboBox(gridGroup); - m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "None")); - m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Small")); - m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Medium")); - m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Large")); - connect(m_gridSpacingBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); - - QGridLayout* gridGroupLayout = new QGridLayout(gridGroup); - gridGroupLayout->addWidget(arrangementLabel, 0, 0, Qt::AlignRight); - gridGroupLayout->addWidget(m_arrangementBox, 0, 1); - gridGroupLayout->addWidget(gridSpacingLabel, 1, 0, Qt::AlignRight); - gridGroupLayout->addWidget(m_gridSpacingBox, 1, 1); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(this); - - loadSettings(); -} - -IconsViewSettingsPage::~IconsViewSettingsPage() -{ -} - -void IconsViewSettingsPage::applySettings() -{ - IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); - - const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); - const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); - settings->setIconSize(iconSize); - settings->setPreviewSize(previewSize); - - const QFont font = m_fontRequester->font(); - const int fontHeight = QFontMetrics(font).height(); - - const int arrangement = (m_arrangementBox->currentIndex() == 0) ? - QListView::LeftToRight : - QListView::TopToBottom; - settings->setArrangement(arrangement); - - const int numberOfTextlines = m_textlinesCountBox->value(); - - const int defaultSize = settings->iconSize(); - int itemWidth = defaultSize; - int itemHeight = defaultSize; - const int textSizeIndex = m_textWidthBox->currentIndex(); - if (arrangement == QListView::TopToBottom) { - itemWidth += TopToBottomBase + textSizeIndex * TopToBottomInc; - itemHeight += fontHeight * numberOfTextlines + 10; - } else { - itemWidth += LeftToRightBase + textSizeIndex * LeftToRightInc; - } - - settings->setItemWidth(itemWidth); - settings->setItemHeight(itemHeight); - - settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); - settings->setFontFamily(font.family()); - settings->setFontSize(font.pointSizeF()); - settings->setItalicFont(font.italic()); - settings->setFontWeight(font.weight()); - - settings->setNumberOfTextlines(numberOfTextlines); - - const int index = m_gridSpacingBox->currentIndex(); - if (index == 0) { - // No grid spacing - settings->setGridSpacing(0); - } else { - settings->setGridSpacing(GridSpacingBase + (index - 1) * GridSpacingInc); - } - - settings->writeConfig(); -} - -void IconsViewSettingsPage::restoreDefaults() -{ - IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); -} - -void IconsViewSettingsPage::loadSettings() -{ - IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); - - const QSize iconSize(settings->iconSize(), settings->iconSize()); - const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); - m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); - - const QSize previewSize(settings->previewSize(), settings->previewSize()); - const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); - m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); - - if (settings->useSystemFont()) { - m_fontRequester->setMode(DolphinFontRequester::SystemFont); - } else { - QFont font(settings->fontFamily(), - qRound(settings->fontSize())); - font.setItalic(settings->italicFont()); - font.setWeight(settings->fontWeight()); - font.setPointSizeF(settings->fontSize()); - m_fontRequester->setMode(DolphinFontRequester::CustomFont); - m_fontRequester->setCustomFont(font); - } - - m_textlinesCountBox->setValue(settings->numberOfTextlines()); - - const bool leftToRightArrangement = (settings->arrangement() == QListView::LeftToRight); - int textWidthIndex = 0; - const int remainingWidth = settings->itemWidth() - settings->iconSize(); - if (leftToRightArrangement) { - textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc; - } else { - textWidthIndex = (remainingWidth - TopToBottomBase) / TopToBottomInc; - } - // ensure that chosen index is always valid - textWidthIndex = qMax(textWidthIndex, 0); - textWidthIndex = qMin(textWidthIndex, m_textWidthBox->count() - 1); - - m_textWidthBox->setCurrentIndex(textWidthIndex); - m_arrangementBox->setCurrentIndex(leftToRightArrangement ? 0 : 1); - - const int spacing = settings->gridSpacing(); - const int index = (spacing <= 0) ? 0 : 1 + (spacing - GridSpacingBase) / GridSpacingInc; - m_gridSpacingBox->setCurrentIndex(index); -} - -#include "iconsviewsettingspage.moc" diff --git a/src/settings/iconsviewsettingspage.h b/src/settings/iconsviewsettingspage.h deleted file mode 100644 index 345c9f407..000000000 --- a/src/settings/iconsviewsettingspage.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef ICONSVIEWSETTINGSPAGE_H -#define ICONSVIEWSETTINGSPAGE_H - -#include -#include - -class DolphinFontRequester; -class IconSizeGroupBox; -class KComboBox; -class KIntSpinBox; - -/** - * @brief Tab page for the 'Icons Mode' and 'Previews Mode' settings - * of the Dolphin settings dialog. - * - * Allows to set: - * - icon size - * - preview size - * - text width - * - grid spacing - * - font - * - number of text lines - * - arrangement - * - * @see DolphinIconsViewSettings - */ -class IconsViewSettingsPage : public ViewSettingsPageBase -{ - Q_OBJECT - -public: - IconsViewSettingsPage(QWidget* parent); - virtual ~IconsViewSettingsPage(); - - /** - * Applies the settings for the icons view. - * The settings are persisted automatically when - * closing Dolphin. - */ - virtual void applySettings(); - - /** Restores the settings to default values. */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - enum - { - GridSpacingBase = 8, - GridSpacingInc = 12, - LeftToRightBase = 128, - LeftToRightInc = 64, - TopToBottomBase = 32, - TopToBottomInc = 32 - }; - - IconSizeGroupBox* m_iconSizeGroupBox; - KComboBox* m_textWidthBox; - DolphinFontRequester* m_fontRequester; - KIntSpinBox* m_textlinesCountBox; - - KComboBox* m_arrangementBox; - KComboBox* m_gridSpacingBox; -}; - -#endif diff --git a/src/settings/navigation/navigationsettingspage.cpp b/src/settings/navigation/navigationsettingspage.cpp new file mode 100644 index 000000000..31f4d47c0 --- /dev/null +++ b/src/settings/navigation/navigationsettingspage.cpp @@ -0,0 +1,120 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "navigationsettingspage.h" + +#include "settings/dolphinsettings.h" + +#include "dolphin_generalsettings.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_openArchivesAsFolder(0), + m_autoExpandFolders(0) +{ + const int spacing = KDialog::spacingHint(); + + QVBoxLayout* topLayout = new QVBoxLayout(this); + KVBox* vBox = new KVBox(this); + vBox->setSpacing(spacing); + + // create 'Mouse' group + QGroupBox* mouseBox = new QGroupBox(i18nc("@title:group", "Mouse"), vBox); + mouseBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + m_singleClick = new QRadioButton(i18nc("@option:check Mouse Settings", + "Single-click to open files and folders"), mouseBox); + connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + m_doubleClick = new QRadioButton(i18nc("@option:check Mouse Settings", + "Double-click to open files and folders"), mouseBox); + connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + QVBoxLayout* mouseBoxLayout = new QVBoxLayout(mouseBox); + mouseBoxLayout->addWidget(m_singleClick); + mouseBoxLayout->addWidget(m_doubleClick); + + m_openArchivesAsFolder = new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox); + connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox); + connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(vBox); + + topLayout->addWidget(vBox); + + loadSettings(); +} + +NavigationSettingsPage::~NavigationSettingsPage() +{ +} + +void NavigationSettingsPage::applySettings() +{ + KConfig config("kcminputrc"); + KConfigGroup group = config.group("KDE"); + group.writeEntry("SingleClick", m_singleClick->isChecked(), KConfig::Persistent|KConfig::Global); + config.sync(); + KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE); + + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked()); + settings->setAutoExpandFolders(m_autoExpandFolders->isChecked()); + + settings->writeConfig(); +} + +void NavigationSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); + + // The mouse settings stored in KGlobalSettings must be reset to + // the default values (= single click) manually. + m_singleClick->setChecked(true); + m_doubleClick->setChecked(false); +} + +void NavigationSettingsPage::loadSettings() +{ + const bool singleClick = KGlobalSettings::singleClick(); + m_singleClick->setChecked(singleClick); + m_doubleClick->setChecked(!singleClick); + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + m_openArchivesAsFolder->setChecked(settings->browseThroughArchives()); + m_autoExpandFolders->setChecked(settings->autoExpandFolders()); +} + +#include "navigationsettingspage.moc" diff --git a/src/settings/navigation/navigationsettingspage.h b/src/settings/navigation/navigationsettingspage.h new file mode 100644 index 000000000..8178d6095 --- /dev/null +++ b/src/settings/navigation/navigationsettingspage.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef NAVIGATIONSETTINGSPAGE_H +#define NAVIGATIONSETTINGSPAGE_H + +#include + +class QCheckBox; +class QRadioButton; + +/** + * @brief Page for the 'Navigation' settings of the Dolphin settings dialog. + */ +class NavigationSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + NavigationSettingsPage(QWidget* parent); + virtual ~NavigationSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + QRadioButton* m_singleClick; + QRadioButton* m_doubleClick; + QCheckBox* m_openArchivesAsFolder; + QCheckBox* m_autoExpandFolders; +}; + +#endif diff --git a/src/settings/navigationsettingspage.cpp b/src/settings/navigationsettingspage.cpp deleted file mode 100644 index 31f4d47c0..000000000 --- a/src/settings/navigationsettingspage.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "navigationsettingspage.h" - -#include "settings/dolphinsettings.h" - -#include "dolphin_generalsettings.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_openArchivesAsFolder(0), - m_autoExpandFolders(0) -{ - const int spacing = KDialog::spacingHint(); - - QVBoxLayout* topLayout = new QVBoxLayout(this); - KVBox* vBox = new KVBox(this); - vBox->setSpacing(spacing); - - // create 'Mouse' group - QGroupBox* mouseBox = new QGroupBox(i18nc("@title:group", "Mouse"), vBox); - mouseBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - m_singleClick = new QRadioButton(i18nc("@option:check Mouse Settings", - "Single-click to open files and folders"), mouseBox); - connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - m_doubleClick = new QRadioButton(i18nc("@option:check Mouse Settings", - "Double-click to open files and folders"), mouseBox); - connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - QVBoxLayout* mouseBoxLayout = new QVBoxLayout(mouseBox); - mouseBoxLayout->addWidget(m_singleClick); - mouseBoxLayout->addWidget(m_doubleClick); - - m_openArchivesAsFolder = new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox); - connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox); - connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(vBox); - - topLayout->addWidget(vBox); - - loadSettings(); -} - -NavigationSettingsPage::~NavigationSettingsPage() -{ -} - -void NavigationSettingsPage::applySettings() -{ - KConfig config("kcminputrc"); - KConfigGroup group = config.group("KDE"); - group.writeEntry("SingleClick", m_singleClick->isChecked(), KConfig::Persistent|KConfig::Global); - config.sync(); - KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE); - - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked()); - settings->setAutoExpandFolders(m_autoExpandFolders->isChecked()); - - settings->writeConfig(); -} - -void NavigationSettingsPage::restoreDefaults() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); - - // The mouse settings stored in KGlobalSettings must be reset to - // the default values (= single click) manually. - m_singleClick->setChecked(true); - m_doubleClick->setChecked(false); -} - -void NavigationSettingsPage::loadSettings() -{ - const bool singleClick = KGlobalSettings::singleClick(); - m_singleClick->setChecked(singleClick); - m_doubleClick->setChecked(!singleClick); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_openArchivesAsFolder->setChecked(settings->browseThroughArchives()); - m_autoExpandFolders->setChecked(settings->autoExpandFolders()); -} - -#include "navigationsettingspage.moc" diff --git a/src/settings/navigationsettingspage.h b/src/settings/navigationsettingspage.h deleted file mode 100644 index 8178d6095..000000000 --- a/src/settings/navigationsettingspage.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef NAVIGATIONSETTINGSPAGE_H -#define NAVIGATIONSETTINGSPAGE_H - -#include - -class QCheckBox; -class QRadioButton; - -/** - * @brief Page for the 'Navigation' settings of the Dolphin settings dialog. - */ -class NavigationSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - NavigationSettingsPage(QWidget* parent); - virtual ~NavigationSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - QRadioButton* m_singleClick; - QRadioButton* m_doubleClick; - QCheckBox* m_openArchivesAsFolder; - QCheckBox* m_autoExpandFolders; -}; - -#endif diff --git a/src/settings/previewssettingspage.cpp b/src/settings/previewssettingspage.cpp deleted file mode 100644 index 1d50f41f0..000000000 --- a/src/settings/previewssettingspage.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "previewssettingspage.h" -#include "dolphinsettings.h" - -#include "dolphin_generalsettings.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// default settings -namespace { - const bool UseThumbnails = true; - const int MaxLocalPreviewSize = 5; // 5 MB - const int MaxRemotePreviewSize = 0; // 0 MB -} - -PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_initialized(false), - m_previewPluginsList(0), - m_enabledPreviewPlugins(), - m_localFileSizeBox(0), - m_remoteFileSizeBox(0) -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - topLayout->setSpacing(KDialog::spacingHint()); - topLayout->setMargin(KDialog::marginHint()); - - // Create group box "Show previews for:" - QGroupBox* listBox = new QGroupBox(i18nc("@title:group", "Show previews for"), this); - - m_previewPluginsList = new QListWidget(this); - m_previewPluginsList->setSortingEnabled(true); - m_previewPluginsList->setSelectionMode(QAbstractItemView::NoSelection); - connect(m_previewPluginsList, SIGNAL(itemClicked(QListWidgetItem*)), - this, SIGNAL(changed())); - - QVBoxLayout* listBoxLayout = new QVBoxLayout(listBox); - listBoxLayout->addWidget(m_previewPluginsList); - - // Create group box "Don't create previews for" - QGroupBox* fileSizeBox = new QGroupBox(i18nc("@title:group", "Do not create previews for"), this); - - QLabel* localFileSizeLabel = new QLabel(i18nc("@label Don't create previews for: XX MByte", - "Local files above:"), this); - - m_localFileSizeBox = new KIntSpinBox(this); - m_localFileSizeBox->setSingleStep(1); - m_localFileSizeBox->setSuffix(QLatin1String(" MB")); - m_localFileSizeBox->setRange(0, 9999); /* MB */ - connect(m_localFileSizeBox, SIGNAL(valueChanged(int)), - this, SIGNAL(changed())); - - QLabel* remoteFileSizeLabel = new QLabel(i18nc("@label Don't create previews for: XX MByte", - "Remote files above:"), this); - - m_remoteFileSizeBox = new KIntSpinBox(this); - m_remoteFileSizeBox->setSingleStep(1); - m_remoteFileSizeBox->setSuffix(QLatin1String(" MB")); - m_remoteFileSizeBox->setRange(0, 9999); /* MB */ - connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), - this, SIGNAL(changed())); - - QGridLayout* fileSizeBoxLayout = new QGridLayout(fileSizeBox); - fileSizeBoxLayout->addWidget(localFileSizeLabel, 0, 0, Qt::AlignRight); - fileSizeBoxLayout->addWidget(m_localFileSizeBox, 0, 1); - fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 1, 0, Qt::AlignRight); - fileSizeBoxLayout->addWidget(m_remoteFileSizeBox, 1, 1); - - topLayout->addWidget(listBox); - topLayout->addWidget(fileSizeBox); - - loadSettings(); -} - - -PreviewsSettingsPage::~PreviewsSettingsPage() -{ -} - -void PreviewsSettingsPage::applySettings() -{ - m_enabledPreviewPlugins.clear(); - const int count = m_previewPluginsList->count(); - for (int i = 0; i < count; ++i) { - const QListWidgetItem* item = m_previewPluginsList->item(i); - if (item->checkState() == Qt::Checked) { - const QString enabledPlugin = item->data(Qt::UserRole).toString(); - m_enabledPreviewPlugins.append(enabledPlugin); - } - } - - KConfigGroup globalConfig(KGlobal::config(), QLatin1String("PreviewSettings")); - globalConfig.writeEntry("Plugins", m_enabledPreviewPlugins); - - globalConfig.writeEntry("MaximumSize", - m_localFileSizeBox->value() * 1024 * 1024, - KConfigBase::Normal | KConfigBase::Global); - globalConfig.writeEntry("MaximumRemoteSize", - m_remoteFileSizeBox->value() * 1024 * 1024, - KConfigBase::Normal | KConfigBase::Global); - globalConfig.sync(); -} - -void PreviewsSettingsPage::restoreDefaults() -{ - m_localFileSizeBox->setValue(MaxLocalPreviewSize); - m_remoteFileSizeBox->setValue(MaxRemotePreviewSize); -} - -void PreviewsSettingsPage::showEvent(QShowEvent* event) -{ - if (!event->spontaneous() && !m_initialized) { - QMetaObject::invokeMethod(this, "loadPreviewPlugins", Qt::QueuedConnection); - m_initialized = true; - } - SettingsPageBase::showEvent(event); -} - -void PreviewsSettingsPage::loadPreviewPlugins() -{ - const KService::List plugins = KServiceTypeTrader::self()->query(QLatin1String("ThumbCreator")); - foreach (const KSharedPtr& service, plugins) { - QListWidgetItem* item = new QListWidgetItem(service->name(), - m_previewPluginsList); - item->setData(Qt::UserRole, service->desktopEntryName()); - const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName()); - item->setCheckState(show ? Qt::Checked : Qt::Unchecked); - } -} - -void PreviewsSettingsPage::loadSettings() -{ - KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings"); - m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList() - << QLatin1String("directorythumbnail") - << QLatin1String("imagethumbnail") - << QLatin1String("jpegthumbnail")); - - const int maxLocalByteSize = globalConfig.readEntry("MaximumSize", MaxLocalPreviewSize * 1024 * 1024); - const int maxLocalMByteSize = maxLocalByteSize / (1024 * 1024); - m_localFileSizeBox->setValue(maxLocalMByteSize); - - const int maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", MaxRemotePreviewSize * 1024 * 1024); - const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024); - m_remoteFileSizeBox->setValue(maxRemoteMByteSize); -} - -#include "previewssettingspage.moc" diff --git a/src/settings/previewssettingspage.h b/src/settings/previewssettingspage.h deleted file mode 100644 index 4b59ec87b..000000000 --- a/src/settings/previewssettingspage.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef PREVIEWSSETTINGSPAGE_H -#define PREVIEWSSETTINGSPAGE_H - -#include - -class QListWidget; -class KIntSpinBox; - -/** - * @brief Allows the configuration of file previews. - */ -class PreviewsSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - PreviewsSettingsPage(QWidget* parent); - virtual ~PreviewsSettingsPage(); - - /** - * Applies the general settings for the view modes - * The settings are persisted automatically when - * closing Dolphin. - */ - virtual void applySettings(); - - /** Restores the settings to default values. */ - virtual void restoreDefaults(); - -protected: - virtual void showEvent(QShowEvent* event); - -private slots: - void loadPreviewPlugins(); - -private: - void loadSettings(); - -private: - bool m_initialized; - QListWidget* m_previewPluginsList; - QStringList m_enabledPreviewPlugins; - KIntSpinBox* m_localFileSizeBox; - KIntSpinBox* m_remoteFileSizeBox; -}; - -#endif diff --git a/src/settings/services/servicessettingspage.cpp b/src/settings/services/servicessettingspage.cpp new file mode 100644 index 000000000..7da299399 --- /dev/null +++ b/src/settings/services/servicessettingspage.cpp @@ -0,0 +1,222 @@ +/*************************************************************************** + * Copyright (C) 2009-2010 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "servicessettingspage.h" + +#include "dolphin_versioncontrolsettings.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_initialized(false), + m_servicesList(0), + m_vcsGroupBox(0), + m_vcsPluginsMap(), + m_enabledVcsPlugins() +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + + QLabel* label = new QLabel(i18nc("@label:textbox", + "Select which services should " + "be shown in the context menu."), this); + label->setWordWrap(true); + + m_servicesList = new QListWidget(this); + m_servicesList->setSortingEnabled(true); + m_servicesList->setSelectionMode(QAbstractItemView::NoSelection); + connect(m_servicesList, SIGNAL(itemClicked(QListWidgetItem*)), + this, SIGNAL(changed())); + + KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."), + "servicemenu.knsrc", + this); + connect(downloadButton, SIGNAL(dialogFinished(KNS3::Entry::List)), this, SLOT(loadServices())); + + m_vcsGroupBox = new QGroupBox(i18nc("@title:group", "Version Control Systems"), this); + // Only show the version control group box, if a version + // control system could be found (see loadVersionControlSystems()) + m_vcsGroupBox->hide(); + + topLayout->addWidget(label); + topLayout->addWidget(m_servicesList); + topLayout->addWidget(downloadButton); + topLayout->addWidget(m_vcsGroupBox); + + m_enabledVcsPlugins = VersionControlSettings::enabledPlugins(); +} + +ServicesSettingsPage::~ServicesSettingsPage() +{ +} + +void ServicesSettingsPage::applySettings() +{ + // Apply service menu settings + KConfig config("kservicemenurc", KConfig::NoGlobals); + KConfigGroup showGroup = config.group("Show"); + + const int count = m_servicesList->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem* item = m_servicesList->item(i); + const bool show = (item->checkState() == Qt::Checked); + const QString service = item->data(Qt::UserRole).toString(); + showGroup.writeEntry(service, show); + } + + showGroup.sync(); + + // Apply version control settings + QStringList enabledPlugins; + QMap::const_iterator it = m_vcsPluginsMap.constBegin(); + while (it != m_vcsPluginsMap.constEnd()) { + if (it.value()->isChecked()) { + enabledPlugins.append(it.key()); + } + ++it; + } + + if (m_enabledVcsPlugins != enabledPlugins) { + VersionControlSettings::setEnabledPlugins(enabledPlugins); + VersionControlSettings::self()->writeConfig(); + + KMessageBox::information(window(), + i18nc("@info", "Dolphin must be restarted to apply the " + "updated version control systems settings."), + QString(), // default title + QLatin1String("ShowVcsRestartInformation")); + } +} + +void ServicesSettingsPage::restoreDefaults() +{ + const int count = m_servicesList->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem* item = m_servicesList->item(i); + item->setCheckState(Qt::Checked); + } +} + +void ServicesSettingsPage::showEvent(QShowEvent* event) +{ + if (!event->spontaneous() && !m_initialized) { + QMetaObject::invokeMethod(this, "loadServices", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "loadVersionControlSystems", Qt::QueuedConnection); + m_initialized = true; + } + SettingsPageBase::showEvent(event); +} + +void ServicesSettingsPage::loadServices() +{ + const KConfig config("kservicemenurc", KConfig::NoGlobals); + const KConfigGroup showGroup = config.group("Show"); + + const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin"); + foreach (const KSharedPtr& service, entries) { + const QString file = KStandardDirs::locate("services", service->entryPath()); + const QList serviceActions = + KDesktopFileActions::userDefinedServices(file, true); + + KDesktopFile desktopFile(file); + const QString subMenuName = desktopFile.desktopGroup().readEntry("X-KDE-Submenu"); + + foreach (const KServiceAction& action, serviceActions) { + const QString service = action.name(); + const bool addService = !action.noDisplay() + && !action.isSeparator() + && !isInServicesList(service); + + if (addService) { + const QString itemName = subMenuName.isEmpty() + ? action.text() + : i18nc("@item:inmenu", "%1: %2", subMenuName, action.text()); + QListWidgetItem* item = new QListWidgetItem(KIcon(action.icon()), + itemName, + m_servicesList); + item->setData(Qt::UserRole, service); + const bool show = showGroup.readEntry(service, true); + item->setCheckState(show ? Qt::Checked : Qt::Unchecked); + } + } + } +} + +void ServicesSettingsPage::loadVersionControlSystems() +{ + const QStringList enabledPlugins = VersionControlSettings::enabledPlugins(); + + // Create a checkbox for each available version control plugin + const KService::List pluginServices = KServiceTypeTrader::self()->query("FileViewVersionControlPlugin"); + for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { + const QString pluginName = (*it)->name(); + QCheckBox* checkBox = new QCheckBox(pluginName, m_vcsGroupBox); + checkBox->setChecked(enabledPlugins.contains(pluginName)); + connect(checkBox, SIGNAL(clicked()), this, SIGNAL(changed())); + m_vcsPluginsMap.insert(pluginName, checkBox); + } + + // Add the checkboxes into a grid layout of 2 columns + QGridLayout* layout = new QGridLayout(m_vcsGroupBox); + const int maxRows = (m_vcsPluginsMap.count() + 1) / 2; + + int index = 0; + QMap::const_iterator it = m_vcsPluginsMap.constBegin(); + while (it != m_vcsPluginsMap.constEnd()) { + const int column = index / maxRows; + const int row = index % maxRows; + layout->addWidget(it.value(), row, column); + ++it; + ++index; + } + + m_vcsGroupBox->setVisible(!m_vcsPluginsMap.isEmpty()); +} + +bool ServicesSettingsPage::isInServicesList(const QString& service) const +{ + const int count = m_servicesList->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem* item = m_servicesList->item(i); + if (item->data(Qt::UserRole).toString() == service) { + return true; + } + } + return false; +} + +#include "servicessettingspage.moc" diff --git a/src/settings/services/servicessettingspage.h b/src/settings/services/servicessettingspage.h new file mode 100644 index 000000000..cb526460f --- /dev/null +++ b/src/settings/services/servicessettingspage.h @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (C) 2009-2010 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef SERVICESSETTINGSPAGE_H +#define SERVICESSETTINGSPAGE_H + +#include + +#include +#include + +class QCheckBox; +class QGroupBox; +class QListWidget; + +/** + * @brief Page for the 'Services' settings of the Dolphin settings dialog. + */ +class ServicesSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + ServicesSettingsPage(QWidget* parent); + virtual ~ServicesSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +protected: + virtual void showEvent(QShowEvent* event); + +private slots: + /** + * Loads locally installed services. + */ + void loadServices(); + + /** + * Loads installed version control systems. + */ + void loadVersionControlSystems(); + + bool isInServicesList(const QString& service) const; + +private: + bool m_initialized; + QListWidget* m_servicesList; + QGroupBox* m_vcsGroupBox; + QMap m_vcsPluginsMap; + QStringList m_enabledVcsPlugins; +}; + +#endif diff --git a/src/settings/servicessettingspage.cpp b/src/settings/servicessettingspage.cpp deleted file mode 100644 index 7da299399..000000000 --- a/src/settings/servicessettingspage.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009-2010 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "servicessettingspage.h" - -#include "dolphin_versioncontrolsettings.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_initialized(false), - m_servicesList(0), - m_vcsGroupBox(0), - m_vcsPluginsMap(), - m_enabledVcsPlugins() -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - - QLabel* label = new QLabel(i18nc("@label:textbox", - "Select which services should " - "be shown in the context menu."), this); - label->setWordWrap(true); - - m_servicesList = new QListWidget(this); - m_servicesList->setSortingEnabled(true); - m_servicesList->setSelectionMode(QAbstractItemView::NoSelection); - connect(m_servicesList, SIGNAL(itemClicked(QListWidgetItem*)), - this, SIGNAL(changed())); - - KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."), - "servicemenu.knsrc", - this); - connect(downloadButton, SIGNAL(dialogFinished(KNS3::Entry::List)), this, SLOT(loadServices())); - - m_vcsGroupBox = new QGroupBox(i18nc("@title:group", "Version Control Systems"), this); - // Only show the version control group box, if a version - // control system could be found (see loadVersionControlSystems()) - m_vcsGroupBox->hide(); - - topLayout->addWidget(label); - topLayout->addWidget(m_servicesList); - topLayout->addWidget(downloadButton); - topLayout->addWidget(m_vcsGroupBox); - - m_enabledVcsPlugins = VersionControlSettings::enabledPlugins(); -} - -ServicesSettingsPage::~ServicesSettingsPage() -{ -} - -void ServicesSettingsPage::applySettings() -{ - // Apply service menu settings - KConfig config("kservicemenurc", KConfig::NoGlobals); - KConfigGroup showGroup = config.group("Show"); - - const int count = m_servicesList->count(); - for (int i = 0; i < count; ++i) { - QListWidgetItem* item = m_servicesList->item(i); - const bool show = (item->checkState() == Qt::Checked); - const QString service = item->data(Qt::UserRole).toString(); - showGroup.writeEntry(service, show); - } - - showGroup.sync(); - - // Apply version control settings - QStringList enabledPlugins; - QMap::const_iterator it = m_vcsPluginsMap.constBegin(); - while (it != m_vcsPluginsMap.constEnd()) { - if (it.value()->isChecked()) { - enabledPlugins.append(it.key()); - } - ++it; - } - - if (m_enabledVcsPlugins != enabledPlugins) { - VersionControlSettings::setEnabledPlugins(enabledPlugins); - VersionControlSettings::self()->writeConfig(); - - KMessageBox::information(window(), - i18nc("@info", "Dolphin must be restarted to apply the " - "updated version control systems settings."), - QString(), // default title - QLatin1String("ShowVcsRestartInformation")); - } -} - -void ServicesSettingsPage::restoreDefaults() -{ - const int count = m_servicesList->count(); - for (int i = 0; i < count; ++i) { - QListWidgetItem* item = m_servicesList->item(i); - item->setCheckState(Qt::Checked); - } -} - -void ServicesSettingsPage::showEvent(QShowEvent* event) -{ - if (!event->spontaneous() && !m_initialized) { - QMetaObject::invokeMethod(this, "loadServices", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "loadVersionControlSystems", Qt::QueuedConnection); - m_initialized = true; - } - SettingsPageBase::showEvent(event); -} - -void ServicesSettingsPage::loadServices() -{ - const KConfig config("kservicemenurc", KConfig::NoGlobals); - const KConfigGroup showGroup = config.group("Show"); - - const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin"); - foreach (const KSharedPtr& service, entries) { - const QString file = KStandardDirs::locate("services", service->entryPath()); - const QList serviceActions = - KDesktopFileActions::userDefinedServices(file, true); - - KDesktopFile desktopFile(file); - const QString subMenuName = desktopFile.desktopGroup().readEntry("X-KDE-Submenu"); - - foreach (const KServiceAction& action, serviceActions) { - const QString service = action.name(); - const bool addService = !action.noDisplay() - && !action.isSeparator() - && !isInServicesList(service); - - if (addService) { - const QString itemName = subMenuName.isEmpty() - ? action.text() - : i18nc("@item:inmenu", "%1: %2", subMenuName, action.text()); - QListWidgetItem* item = new QListWidgetItem(KIcon(action.icon()), - itemName, - m_servicesList); - item->setData(Qt::UserRole, service); - const bool show = showGroup.readEntry(service, true); - item->setCheckState(show ? Qt::Checked : Qt::Unchecked); - } - } - } -} - -void ServicesSettingsPage::loadVersionControlSystems() -{ - const QStringList enabledPlugins = VersionControlSettings::enabledPlugins(); - - // Create a checkbox for each available version control plugin - const KService::List pluginServices = KServiceTypeTrader::self()->query("FileViewVersionControlPlugin"); - for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { - const QString pluginName = (*it)->name(); - QCheckBox* checkBox = new QCheckBox(pluginName, m_vcsGroupBox); - checkBox->setChecked(enabledPlugins.contains(pluginName)); - connect(checkBox, SIGNAL(clicked()), this, SIGNAL(changed())); - m_vcsPluginsMap.insert(pluginName, checkBox); - } - - // Add the checkboxes into a grid layout of 2 columns - QGridLayout* layout = new QGridLayout(m_vcsGroupBox); - const int maxRows = (m_vcsPluginsMap.count() + 1) / 2; - - int index = 0; - QMap::const_iterator it = m_vcsPluginsMap.constBegin(); - while (it != m_vcsPluginsMap.constEnd()) { - const int column = index / maxRows; - const int row = index % maxRows; - layout->addWidget(it.value(), row, column); - ++it; - ++index; - } - - m_vcsGroupBox->setVisible(!m_vcsPluginsMap.isEmpty()); -} - -bool ServicesSettingsPage::isInServicesList(const QString& service) const -{ - const int count = m_servicesList->count(); - for (int i = 0; i < count; ++i) { - QListWidgetItem* item = m_servicesList->item(i); - if (item->data(Qt::UserRole).toString() == service) { - return true; - } - } - return false; -} - -#include "servicessettingspage.moc" diff --git a/src/settings/servicessettingspage.h b/src/settings/servicessettingspage.h deleted file mode 100644 index cb526460f..000000000 --- a/src/settings/servicessettingspage.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009-2010 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef SERVICESSETTINGSPAGE_H -#define SERVICESSETTINGSPAGE_H - -#include - -#include -#include - -class QCheckBox; -class QGroupBox; -class QListWidget; - -/** - * @brief Page for the 'Services' settings of the Dolphin settings dialog. - */ -class ServicesSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - ServicesSettingsPage(QWidget* parent); - virtual ~ServicesSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -protected: - virtual void showEvent(QShowEvent* event); - -private slots: - /** - * Loads locally installed services. - */ - void loadServices(); - - /** - * Loads installed version control systems. - */ - void loadVersionControlSystems(); - - bool isInServicesList(const QString& service) const; - -private: - bool m_initialized; - QListWidget* m_servicesList; - QGroupBox* m_vcsGroupBox; - QMap m_vcsPluginsMap; - QStringList m_enabledVcsPlugins; -}; - -#endif diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp new file mode 100644 index 000000000..1e1c6ed87 --- /dev/null +++ b/src/settings/startup/startupsettingspage.cpp @@ -0,0 +1,173 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "startupsettingspage.h" + +#include "settings/dolphinsettings.h" +#include "dolphinmainwindow.h" +#include "dolphinview.h" +#include "dolphinviewcontainer.h" + +#include "dolphin_generalsettings.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) : + SettingsPageBase(parent), + m_url(url), + m_homeUrl(0), + m_splitView(0), + m_editableUrl(0), + m_showFullPath(0), + m_filterBar(0) +{ + const int spacing = KDialog::spacingHint(); + + QVBoxLayout* topLayout = new QVBoxLayout(this); + KVBox* vBox = new KVBox(this); + vBox->setSpacing(spacing); + + // create 'Home URL' editor + QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox); + + KHBox* homeUrlBox = new KHBox(homeBox); + homeUrlBox->setSpacing(spacing); + + new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox); + m_homeUrl = new KLineEdit(homeUrlBox); + m_homeUrl->setClearButtonShown(true); + + QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox); + connect(selectHomeUrlButton, SIGNAL(clicked()), + this, SLOT(selectHomeUrl())); + + KHBox* buttonBox = new KHBox(homeBox); + buttonBox->setSpacing(spacing); + + QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox); + connect(useCurrentButton, SIGNAL(clicked()), + this, SLOT(useCurrentLocation())); + QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox); + connect(useDefaultButton, SIGNAL(clicked()), + this, SLOT(useDefaultLocation())); + + QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); + homeBoxLayout->addWidget(homeUrlBox); + homeBoxLayout->addWidget(buttonBox); + + // create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes + m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox); + m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox); + m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox); + m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox); + connect(m_splitView, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_editableUrl, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_showFullPath, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_filterBar, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(vBox); + + topLayout->addWidget(vBox); + + loadSettings(); + + // it's important connecting 'textChanged' after loadSettings(), as loadSettings() + // invokes m_homeUrl->setText() + connect(m_homeUrl, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); +} + +StartupSettingsPage::~StartupSettingsPage() +{ +} + +void StartupSettingsPage::applySettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + + const KUrl url(m_homeUrl->text()); + KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url); + if (url.isValid() && fileItem.isDir()) { + settings->setHomeUrl(url.prettyUrl()); + } else { + KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied.")); + } + + settings->setSplitView(m_splitView->isChecked()); + settings->setEditableUrl(m_editableUrl->isChecked()); + settings->setShowFullPath(m_showFullPath->isChecked()); + settings->setFilterBar(m_filterBar->isChecked()); + + settings->writeConfig(); +} + +void StartupSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); +} + +void StartupSettingsPage::selectHomeUrl() +{ + const QString homeUrl = m_homeUrl->text(); + KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this); + if (!url.isEmpty()) { + m_homeUrl->setText(url.prettyUrl()); + emit changed(); + } +} + +void StartupSettingsPage::useCurrentLocation() +{ + m_homeUrl->setText(m_url.prettyUrl()); +} + +void StartupSettingsPage::useDefaultLocation() +{ + KUrl url(QDir::homePath()); + m_homeUrl->setText(url.prettyUrl()); +} + +void StartupSettingsPage::loadSettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + KUrl url(settings->homeUrl()); + m_homeUrl->setText(url.prettyUrl()); + m_splitView->setChecked(settings->splitView()); + m_editableUrl->setChecked(settings->editableUrl()); + m_showFullPath->setChecked(settings->showFullPath()); + m_filterBar->setChecked(settings->filterBar()); +} + +#include "startupsettingspage.moc" diff --git a/src/settings/startup/startupsettingspage.h b/src/settings/startup/startupsettingspage.h new file mode 100644 index 000000000..98219a5a4 --- /dev/null +++ b/src/settings/startup/startupsettingspage.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef STARTUPSETTINGSPAGE_H +#define STARTUPSETTINGSPAGE_H + +#include +#include + +class KLineEdit; +class QCheckBox; + +/** + * @brief Page for the 'Startup' settings of the Dolphin settings dialog. + * + * The startup settings allow to set the home URL and to configure the + * state of the view mode, split mode and the filter bar when starting Dolphin. + */ +class StartupSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + StartupSettingsPage(const KUrl& url, QWidget* parent); + virtual ~StartupSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private slots: + void selectHomeUrl(); + void useCurrentLocation(); + void useDefaultLocation(); + +private: + void loadSettings(); + +private: + KUrl m_url; + KLineEdit* m_homeUrl; + + QCheckBox* m_splitView; + QCheckBox* m_editableUrl; + QCheckBox* m_showFullPath; + QCheckBox* m_filterBar; +}; + +#endif diff --git a/src/settings/startupsettingspage.cpp b/src/settings/startupsettingspage.cpp deleted file mode 100644 index 1e1c6ed87..000000000 --- a/src/settings/startupsettingspage.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "startupsettingspage.h" - -#include "settings/dolphinsettings.h" -#include "dolphinmainwindow.h" -#include "dolphinview.h" -#include "dolphinviewcontainer.h" - -#include "dolphin_generalsettings.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) : - SettingsPageBase(parent), - m_url(url), - m_homeUrl(0), - m_splitView(0), - m_editableUrl(0), - m_showFullPath(0), - m_filterBar(0) -{ - const int spacing = KDialog::spacingHint(); - - QVBoxLayout* topLayout = new QVBoxLayout(this); - KVBox* vBox = new KVBox(this); - vBox->setSpacing(spacing); - - // create 'Home URL' editor - QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox); - - KHBox* homeUrlBox = new KHBox(homeBox); - homeUrlBox->setSpacing(spacing); - - new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox); - m_homeUrl = new KLineEdit(homeUrlBox); - m_homeUrl->setClearButtonShown(true); - - QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox); - connect(selectHomeUrlButton, SIGNAL(clicked()), - this, SLOT(selectHomeUrl())); - - KHBox* buttonBox = new KHBox(homeBox); - buttonBox->setSpacing(spacing); - - QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox); - connect(useCurrentButton, SIGNAL(clicked()), - this, SLOT(useCurrentLocation())); - QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox); - connect(useDefaultButton, SIGNAL(clicked()), - this, SLOT(useDefaultLocation())); - - QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); - homeBoxLayout->addWidget(homeUrlBox); - homeBoxLayout->addWidget(buttonBox); - - // create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes - m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox); - m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox); - m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox); - m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox); - connect(m_splitView, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_editableUrl, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_showFullPath, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_filterBar, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(vBox); - - topLayout->addWidget(vBox); - - loadSettings(); - - // it's important connecting 'textChanged' after loadSettings(), as loadSettings() - // invokes m_homeUrl->setText() - connect(m_homeUrl, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); -} - -StartupSettingsPage::~StartupSettingsPage() -{ -} - -void StartupSettingsPage::applySettings() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - - const KUrl url(m_homeUrl->text()); - KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url); - if (url.isValid() && fileItem.isDir()) { - settings->setHomeUrl(url.prettyUrl()); - } else { - KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied.")); - } - - settings->setSplitView(m_splitView->isChecked()); - settings->setEditableUrl(m_editableUrl->isChecked()); - settings->setShowFullPath(m_showFullPath->isChecked()); - settings->setFilterBar(m_filterBar->isChecked()); - - settings->writeConfig(); -} - -void StartupSettingsPage::restoreDefaults() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); -} - -void StartupSettingsPage::selectHomeUrl() -{ - const QString homeUrl = m_homeUrl->text(); - KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this); - if (!url.isEmpty()) { - m_homeUrl->setText(url.prettyUrl()); - emit changed(); - } -} - -void StartupSettingsPage::useCurrentLocation() -{ - m_homeUrl->setText(m_url.prettyUrl()); -} - -void StartupSettingsPage::useDefaultLocation() -{ - KUrl url(QDir::homePath()); - m_homeUrl->setText(url.prettyUrl()); -} - -void StartupSettingsPage::loadSettings() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - KUrl url(settings->homeUrl()); - m_homeUrl->setText(url.prettyUrl()); - m_splitView->setChecked(settings->splitView()); - m_editableUrl->setChecked(settings->editableUrl()); - m_showFullPath->setChecked(settings->showFullPath()); - m_filterBar->setChecked(settings->filterBar()); -} - -#include "startupsettingspage.moc" diff --git a/src/settings/startupsettingspage.h b/src/settings/startupsettingspage.h deleted file mode 100644 index 98219a5a4..000000000 --- a/src/settings/startupsettingspage.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef STARTUPSETTINGSPAGE_H -#define STARTUPSETTINGSPAGE_H - -#include -#include - -class KLineEdit; -class QCheckBox; - -/** - * @brief Page for the 'Startup' settings of the Dolphin settings dialog. - * - * The startup settings allow to set the home URL and to configure the - * state of the view mode, split mode and the filter bar when starting Dolphin. - */ -class StartupSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - StartupSettingsPage(const KUrl& url, QWidget* parent); - virtual ~StartupSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private slots: - void selectHomeUrl(); - void useCurrentLocation(); - void useDefaultLocation(); - -private: - void loadSettings(); - -private: - KUrl m_url; - KLineEdit* m_homeUrl; - - QCheckBox* m_splitView; - QCheckBox* m_editableUrl; - QCheckBox* m_showFullPath; - QCheckBox* m_filterBar; -}; - -#endif diff --git a/src/settings/statusbarsettingspage.cpp b/src/settings/statusbarsettingspage.cpp deleted file mode 100644 index 74a453eff..000000000 --- a/src/settings/statusbarsettingspage.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "statusbarsettingspage.h" -#include "dolphinsettings.h" -#include "dolphin_generalsettings.h" - -#include -#include -#include - -#include -#include - -StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_showZoomSlider(0), - m_showSpaceInfo(0) -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - KVBox* vBox = new KVBox(this); - vBox->setSpacing(KDialog::spacingHint()); - - m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), vBox); - connect(m_showZoomSlider, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), vBox); - connect(m_showSpaceInfo, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(vBox); - - topLayout->addWidget(vBox); - - loadSettings(); -} - -StatusBarSettingsPage::~StatusBarSettingsPage() -{ -} - -void StatusBarSettingsPage::applySettings() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->setShowZoomSlider(m_showZoomSlider->isChecked()); - settings->setShowSpaceInfo(m_showSpaceInfo->isChecked()); - settings->writeConfig(); -} - -void StatusBarSettingsPage::restoreDefaults() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - settings->useDefaults(true); - loadSettings(); - settings->useDefaults(false); -} - -void StatusBarSettingsPage::loadSettings() -{ - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - m_showZoomSlider->setChecked(settings->showZoomSlider()); - m_showSpaceInfo->setChecked(settings->showSpaceInfo()); -} - -#include "statusbarsettingspage.moc" diff --git a/src/settings/statusbarsettingspage.h b/src/settings/statusbarsettingspage.h deleted file mode 100644 index 6e9667be4..000000000 --- a/src/settings/statusbarsettingspage.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef STATUSBARSETTINGSPAGE_H -#define STATUSBARSETTINGSPAGE_H - -#include - -class QCheckBox; - -/** - * @brief Tab page for the 'Status Bar' settings of the Dolphin settings dialog. - */ -class StatusBarSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - StatusBarSettingsPage(QWidget* parent); - virtual ~StatusBarSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - -private: - QCheckBox* m_showZoomSlider; - QCheckBox* m_showSpaceInfo; -}; - -#endif diff --git a/src/settings/trash/trashsettingspage.cpp b/src/settings/trash/trashsettingspage.cpp new file mode 100644 index 000000000..e23028b08 --- /dev/null +++ b/src/settings/trash/trashsettingspage.cpp @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2009 by Shaun Reich shaun.reich@kdemail.net * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "trashsettingspage.h" + +#include +#include +#include + +#include + +#include + +TrashSettingsPage::TrashSettingsPage(QWidget* parent) : + SettingsPageBase(parent) +{ + const int spacing = KDialog::spacingHint(); + + QVBoxLayout* topLayout = new QVBoxLayout(this); + KVBox* vBox = new KVBox(this); + vBox->setSpacing(spacing); + + m_proxy = new KCModuleProxy("kcmtrash"); + connect(m_proxy, SIGNAL(changed(bool)), this, SIGNAL(changed())); + topLayout->addWidget(m_proxy); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(vBox); + topLayout->addWidget(vBox); + + loadSettings(); +} + +TrashSettingsPage::~TrashSettingsPage() +{ +} + +void TrashSettingsPage::applySettings() +{ + m_proxy->save(); +} + +void TrashSettingsPage::restoreDefaults() +{ + m_proxy->defaults(); +} + +void TrashSettingsPage::loadSettings() +{ + m_proxy->load(); +} + +#include "trashsettingspage.moc" diff --git a/src/settings/trash/trashsettingspage.h b/src/settings/trash/trashsettingspage.h new file mode 100644 index 000000000..bf4a71ea4 --- /dev/null +++ b/src/settings/trash/trashsettingspage.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2009 by Shaun Reich shaun.reich@kdemail.net * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef TRASHSETTINGSPAGE_H +#define TRASHSETTINGSPAGE_H + +#include "settings/settingspagebase.h" +class KCModuleProxy; + +/** + * @brief Tab page for the 'Trash' settings of the Dolphin settings dialog, it uses the KCM. + */ +class TrashSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + TrashSettingsPage(QWidget* parent); + virtual ~TrashSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + KCModuleProxy *m_proxy; +}; + +#endif diff --git a/src/settings/trashsettingspage.cpp b/src/settings/trashsettingspage.cpp deleted file mode 100644 index 90670cb09..000000000 --- a/src/settings/trashsettingspage.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Shaun Reich shaun.reich@kdemail.net * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -//Own -#include "trashsettingspage.h" -#include "dolphinsettings.h" -//KDE -#include -#include -#include -//Qt -#include - - -TrashSettingsPage::TrashSettingsPage(QWidget* parent) : - SettingsPageBase(parent) -{ - const int spacing = KDialog::spacingHint(); - - QVBoxLayout* topLayout = new QVBoxLayout(this); - KVBox* vBox = new KVBox(this); - vBox->setSpacing(spacing); - - m_proxy = new KCModuleProxy("kcmtrash"); - connect(m_proxy, SIGNAL(changed(bool)), this, SIGNAL(changed())); - topLayout->addWidget(m_proxy); - - // Add a dummy widget with no restriction regarding - // a vertical resizing. This assures that the dialog layout - // is not stretched vertically. - new QWidget(vBox); - topLayout->addWidget(vBox); - - loadSettings(); -} - -TrashSettingsPage::~TrashSettingsPage() -{ -} - -void TrashSettingsPage::applySettings() -{ - m_proxy->save(); -} - -void TrashSettingsPage::restoreDefaults() -{ - m_proxy->defaults(); -} - -void TrashSettingsPage::loadSettings() -{ - m_proxy->load(); -} - -#include "trashsettingspage.moc" diff --git a/src/settings/trashsettingspage.h b/src/settings/trashsettingspage.h deleted file mode 100644 index bf4a71ea4..000000000 --- a/src/settings/trashsettingspage.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Shaun Reich shaun.reich@kdemail.net * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef TRASHSETTINGSPAGE_H -#define TRASHSETTINGSPAGE_H - -#include "settings/settingspagebase.h" -class KCModuleProxy; - -/** - * @brief Tab page for the 'Trash' settings of the Dolphin settings dialog, it uses the KCM. - */ -class TrashSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - TrashSettingsPage(QWidget* parent); - virtual ~TrashSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - void loadSettings(); - KCModuleProxy *m_proxy; -}; - -#endif diff --git a/src/settings/viewmodes/columnviewsettingspage.cpp b/src/settings/viewmodes/columnviewsettingspage.cpp new file mode 100644 index 000000000..aac28f0fd --- /dev/null +++ b/src/settings/viewmodes/columnviewsettingspage.cpp @@ -0,0 +1,159 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "columnviewsettingspage.h" + +#include "dolphinfontrequester.h" +#include +#include "iconsizegroupbox.h" +#include "zoomlevelinfo.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +ColumnViewSettingsPage::ColumnViewSettingsPage(QWidget* parent) : + ViewSettingsPageBase(parent), + m_iconSizeGroupBox(0), + m_fontRequester(0), + m_textWidthBox(0) +{ + const int spacing = KDialog::spacingHint(); + const int margin = KDialog::marginHint(); + const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + setSpacing(spacing); + setMargin(margin); + + // Create "Icon" properties + m_iconSizeGroupBox = new IconSizeGroupBox(this); + m_iconSizeGroupBox->setSizePolicy(sizePolicy); + + const int min = ZoomLevelInfo::minimumLevel(); + const int max = ZoomLevelInfo::maximumLevel(); + m_iconSizeGroupBox->setDefaultSizeRange(min, max); + m_iconSizeGroupBox->setPreviewSizeRange(min, max); + + connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), + this, SIGNAL(changed())); + connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), + this, SIGNAL(changed())); + + // create "Text" properties + QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); + textGroup->setSizePolicy(sizePolicy); + + QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); + m_fontRequester = new DolphinFontRequester(textGroup); + connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); + + QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup); + m_textWidthBox = new KComboBox(textGroup); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge")); + connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + + QGridLayout* textGroupLayout = new QGridLayout(textGroup); + textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight); + textGroupLayout->addWidget(m_fontRequester, 0, 1); + textGroupLayout->addWidget(textWidthLabel, 1, 0, Qt::AlignRight); + textGroupLayout->addWidget(m_textWidthBox, 1, 1); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(this); + + loadSettings(); +} + +ColumnViewSettingsPage::~ColumnViewSettingsPage() +{ +} + +void ColumnViewSettingsPage::applySettings() +{ + ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); + + const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); + const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); + settings->setIconSize(iconSize); + settings->setPreviewSize(previewSize); + + const QFont font = m_fontRequester->font(); + settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); + settings->setFontFamily(font.family()); + settings->setFontSize(font.pointSizeF()); + settings->setItalicFont(font.italic()); + settings->setFontWeight(font.weight()); + + const int columnWidth = BaseTextWidth + (m_textWidthBox->currentIndex() * TextInc); + settings->setColumnWidth(columnWidth); + + settings->writeConfig(); +} + +void ColumnViewSettingsPage::restoreDefaults() +{ + ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); +} + +void ColumnViewSettingsPage::loadSettings() +{ + ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); + + const QSize iconSize(settings->iconSize(), settings->iconSize()); + const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); + m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); + + const QSize previewSize(settings->previewSize(), settings->previewSize()); + const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); + m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); + + if (settings->useSystemFont()) { + m_fontRequester->setMode(DolphinFontRequester::SystemFont); + } else { + QFont font(settings->fontFamily(), + qRound(settings->fontSize())); + font.setItalic(settings->italicFont()); + font.setWeight(settings->fontWeight()); + font.setPointSizeF(settings->fontSize()); + m_fontRequester->setMode(DolphinFontRequester::CustomFont); + m_fontRequester->setCustomFont(font); + } + + m_textWidthBox->setCurrentIndex((settings->columnWidth() - BaseTextWidth) / TextInc); +} + +#include "columnviewsettingspage.moc" diff --git a/src/settings/viewmodes/columnviewsettingspage.h b/src/settings/viewmodes/columnviewsettingspage.h new file mode 100644 index 000000000..1ef0a524e --- /dev/null +++ b/src/settings/viewmodes/columnviewsettingspage.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef COLUMNVIEWSETTINGSPAGE_H +#define COLUMNVIEWSETTINGSPAGE_H + +#include "viewsettingspagebase.h" + +class DolphinFontRequester; +class IconSizeGroupBox; +class KComboBox; + +/** + * @brief Represents the page from the Dolphin Settings which allows + * to modify the settings for the details view. + */ +class ColumnViewSettingsPage : public ViewSettingsPageBase +{ + Q_OBJECT + +public: + ColumnViewSettingsPage(QWidget* parent); + virtual ~ColumnViewSettingsPage(); + + /** + * Applies the settings for the details view. + * The settings are persisted automatically when + * closing Dolphin. + */ + virtual void applySettings(); + + /** Restores the settings to default values. */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + enum + { + BaseTextWidth = 200, + TextInc = 50 + }; + + IconSizeGroupBox* m_iconSizeGroupBox; + DolphinFontRequester* m_fontRequester; + KComboBox* m_textWidthBox; +}; + +#endif diff --git a/src/settings/viewmodes/detailsviewsettingspage.cpp b/src/settings/viewmodes/detailsviewsettingspage.cpp new file mode 100644 index 000000000..67cef32fe --- /dev/null +++ b/src/settings/viewmodes/detailsviewsettingspage.cpp @@ -0,0 +1,152 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "detailsviewsettingspage.h" + +#include "iconsizegroupbox.h" +#include "dolphinfontrequester.h" +#include "dolphin_detailsmodesettings.h" +#include "zoomlevelinfo.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +DetailsViewSettingsPage::DetailsViewSettingsPage(QWidget* parent) : + ViewSettingsPageBase(parent), + m_iconSizeGroupBox(0), + m_fontRequester(0), + m_expandableFolders(0) +{ + const int spacing = KDialog::spacingHint(); + const int margin = KDialog::marginHint(); + const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + setSpacing(spacing); + setMargin(margin); + + // Create "Icon" properties + m_iconSizeGroupBox = new IconSizeGroupBox(this); + m_iconSizeGroupBox->setSizePolicy(sizePolicy); + + const int min = ZoomLevelInfo::minimumLevel(); + const int max = ZoomLevelInfo::maximumLevel(); + m_iconSizeGroupBox->setDefaultSizeRange(min, max); + m_iconSizeGroupBox->setPreviewSizeRange(min, max); + + connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), + this, SIGNAL(changed())); + connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), + this, SIGNAL(changed())); + + // create "Text" properties + QWidget* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); + textGroup->setSizePolicy(sizePolicy); + + QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); + m_fontRequester = new DolphinFontRequester(textGroup); + connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); + + QHBoxLayout* textLayout = new QHBoxLayout(textGroup); + textLayout->addWidget(fontLabel, 0, Qt::AlignRight); + textLayout->addWidget(m_fontRequester); + + // create "Expandable Folders" checkbox + m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable folders"), this); + connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(this); + + loadSettings(); +} + +DetailsViewSettingsPage::~DetailsViewSettingsPage() +{ +} + +void DetailsViewSettingsPage::applySettings() +{ + DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); + + const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); + const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); + settings->setIconSize(iconSize); + settings->setPreviewSize(previewSize); + + const QFont font = m_fontRequester->font(); + settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); + settings->setFontFamily(font.family()); + settings->setFontSize(font.pointSizeF()); + settings->setItalicFont(font.italic()); + settings->setFontWeight(font.weight()); + + settings->setExpandableFolders(m_expandableFolders->isChecked()); + + settings->writeConfig(); +} + +void DetailsViewSettingsPage::restoreDefaults() +{ + DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); +} + +void DetailsViewSettingsPage::loadSettings() +{ + DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); + + const QSize iconSize(settings->iconSize(), settings->iconSize()); + const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); + m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); + + const QSize previewSize(settings->previewSize(), settings->previewSize()); + const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); + m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); + + if (settings->useSystemFont()) { + m_fontRequester->setMode(DolphinFontRequester::SystemFont); + } else { + QFont font(settings->fontFamily(), + qRound(settings->fontSize())); + font.setItalic(settings->italicFont()); + font.setWeight(settings->fontWeight()); + font.setPointSizeF(settings->fontSize()); + m_fontRequester->setMode(DolphinFontRequester::CustomFont); + m_fontRequester->setCustomFont(font); + } + + m_expandableFolders->setChecked(settings->expandableFolders()); +} + +#include "detailsviewsettingspage.moc" diff --git a/src/settings/viewmodes/detailsviewsettingspage.h b/src/settings/viewmodes/detailsviewsettingspage.h new file mode 100644 index 000000000..a4cbdd019 --- /dev/null +++ b/src/settings/viewmodes/detailsviewsettingspage.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DETAILSVIEWSETTINGSPAGE_H +#define DETAILSVIEWSETTINGSPAGE_H + +#include "viewsettingspagebase.h" + +class DolphinFontRequester; +class IconSizeGroupBox; +class QCheckBox; + +/** + * @brief Represents the page from the Dolphin Settings which allows + * to modify the settings for the details view. + */ +class DetailsViewSettingsPage : public ViewSettingsPageBase +{ + Q_OBJECT + +public: + DetailsViewSettingsPage(QWidget* parent); + virtual ~DetailsViewSettingsPage(); + + /** + * Applies the settings for the details view. + * The settings are persisted automatically when + * closing Dolphin. + */ + virtual void applySettings(); + + /** Restores the settings to default values. */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + IconSizeGroupBox* m_iconSizeGroupBox; + DolphinFontRequester* m_fontRequester; + QCheckBox* m_expandableFolders; +}; + +#endif diff --git a/src/settings/viewmodes/dolphinfontrequester.cpp b/src/settings/viewmodes/dolphinfontrequester.cpp new file mode 100644 index 000000000..04c5ed586 --- /dev/null +++ b/src/settings/viewmodes/dolphinfontrequester.cpp @@ -0,0 +1,111 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphinfontrequester.h" + +#include +#include +#include +#include + +#include +#include + +DolphinFontRequester::DolphinFontRequester(QWidget* parent) : + KHBox(parent), + m_modeCombo(0), + m_chooseFontButton(0), + m_mode(SystemFont), + m_customFont() +{ + setSpacing(KDialog::spacingHint()); + + m_modeCombo = new KComboBox(this); + m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font")); + m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font")); + connect(m_modeCombo, SIGNAL(activated(int)), + this, SLOT(changeMode(int))); + + m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this); + connect(m_chooseFontButton, SIGNAL(clicked()), + this, SLOT(openFontDialog())); + + changeMode(m_modeCombo->currentIndex()); +} + +DolphinFontRequester::~DolphinFontRequester() +{ +} + +void DolphinFontRequester::setMode(Mode mode) +{ + m_mode = mode; + m_modeCombo->setCurrentIndex(m_mode); + m_modeCombo->setFont(font()); + m_chooseFontButton->setEnabled(m_mode == CustomFont); +} + +DolphinFontRequester::Mode DolphinFontRequester::mode() const +{ + return m_mode; +} + +QFont DolphinFontRequester::font() const +{ + return (m_mode == CustomFont) ? m_customFont : KGlobalSettings::generalFont(); +} + +void DolphinFontRequester::setCustomFont(const QFont& font) +{ + m_customFont = font; +} + +QFont DolphinFontRequester::customFont() const +{ + return m_customFont; +} + +bool DolphinFontRequester::event(QEvent* event) +{ + if (event->type() == QEvent::Polish) { + m_modeCombo->setFont(font()); + } + return KHBox::event(event); +} + +void DolphinFontRequester::openFontDialog() +{ + QFont font = m_customFont; + const int result = KFontDialog::getFont(font, + KFontChooser::NoDisplayFlags, + this); + if (result == KFontDialog::Accepted) { + m_customFont = font; + m_modeCombo->setFont(m_customFont); + emit changed(); + } +} + +void DolphinFontRequester::changeMode(int index) +{ + setMode((index == CustomFont) ? CustomFont : SystemFont); + emit changed(); +} + +#include "dolphinfontrequester.moc" diff --git a/src/settings/viewmodes/dolphinfontrequester.h b/src/settings/viewmodes/dolphinfontrequester.h new file mode 100644 index 000000000..03a062b2e --- /dev/null +++ b/src/settings/viewmodes/dolphinfontrequester.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHINFONTREQUESTER_H +#define DOLPHINFONTREQUESTER_H + +#include + +#include + +class KComboBox; +class QPushButton; + +/** + * @brief Allows to select between using the system font or a custom font. + */ +class DolphinFontRequester : public KHBox +{ + Q_OBJECT + +public: + enum Mode + { + SystemFont = 0, + CustomFont = 1 + }; + + DolphinFontRequester(QWidget* parent); + virtual ~DolphinFontRequester(); + + void setMode(Mode mode); + Mode mode() const; + + /** + * Returns the custom font (see DolphinFontRequester::customFont()), + * if the mode is \a CustomFont, otherwise the system font is + * returned. + */ + QFont font() const; + + void setCustomFont(const QFont& font); + QFont customFont() const; + +signals: + /** Is emitted, if the font has been changed. */ + void changed(); + +protected: + bool event(QEvent* event); + +private slots: + void openFontDialog(); + void changeMode(int index); + +private: + KComboBox* m_modeCombo; + QPushButton* m_chooseFontButton; + + Mode m_mode; + QFont m_customFont; +}; + +#endif diff --git a/src/settings/viewmodes/iconsizegroupbox.cpp b/src/settings/viewmodes/iconsizegroupbox.cpp new file mode 100644 index 000000000..d8e0e889a --- /dev/null +++ b/src/settings/viewmodes/iconsizegroupbox.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "iconsizegroupbox.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "zoomlevelinfo.h" + +IconSizeGroupBox::IconSizeGroupBox(QWidget* parent) : + QGroupBox(i18nc("@title:group", "Icon Size"), parent), + m_defaultSizeSlider(0), + m_previewSizeSlider(0) +{ + QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this); + m_defaultSizeSlider = new QSlider(Qt::Horizontal, this); + m_defaultSizeSlider->setPageStep(1); + m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow); + connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), + this, SLOT(slotDefaultSliderMoved(int))); + + QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this); + m_previewSizeSlider = new QSlider(Qt::Horizontal, this); + m_previewSizeSlider->setPageStep(1); + m_previewSizeSlider->setTickPosition(QSlider::TicksBelow); + connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), + this, SLOT(slotPreviewSliderMoved(int))); + + QGridLayout* layout = new QGridLayout(this); + layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight); + layout->addWidget(m_defaultSizeSlider, 0, 1); + layout->addWidget(previewLabel, 1, 0, Qt::AlignRight); + layout->addWidget(m_previewSizeSlider, 1, 1); +} + +IconSizeGroupBox::~IconSizeGroupBox() +{ +} + +void IconSizeGroupBox::setDefaultSizeRange(int min, int max) +{ + m_defaultSizeSlider->setRange(min, max); +} + +void IconSizeGroupBox::setPreviewSizeRange(int min, int max) +{ + m_previewSizeSlider->setRange(min, max); +} + +void IconSizeGroupBox::setDefaultSizeValue(int value) +{ + m_defaultSizeSlider->setValue(value); +} + +int IconSizeGroupBox::defaultSizeValue() const +{ + return m_defaultSizeSlider->value(); +} + +void IconSizeGroupBox::setPreviewSizeValue(int value) +{ + m_previewSizeSlider->setValue(value); +} + +int IconSizeGroupBox::previewSizeValue() const +{ + return m_previewSizeSlider->value(); +} + +void IconSizeGroupBox::slotDefaultSliderMoved(int value) +{ + showToolTip(m_defaultSizeSlider, value); + emit defaultSizeChanged(value); +} + +void IconSizeGroupBox::slotPreviewSliderMoved(int value) +{ + showToolTip(m_previewSizeSlider, value); + emit previewSizeChanged(value); +} + +void IconSizeGroupBox::showToolTip(QSlider* slider, int value) +{ + const int size = ZoomLevelInfo::iconSizeForZoomLevel(value); + slider->setToolTip(i18ncp("@info:tooltip", "Size: 1 pixel", "Size: %1 pixels", size)); + if (!slider->isVisible()) { + return; + } + QPoint global = slider->rect().topLeft(); + global.ry() += slider->height() / 2; + QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), slider->mapToGlobal(global)); + QApplication::sendEvent(slider, &toolTipEvent); +} + +#include "iconsizegroupbox.moc" diff --git a/src/settings/viewmodes/iconsizegroupbox.h b/src/settings/viewmodes/iconsizegroupbox.h new file mode 100644 index 000000000..3ec51c3a5 --- /dev/null +++ b/src/settings/viewmodes/iconsizegroupbox.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef ICONSIZEGROUPBOX_H +#define ICONSIZEGROUPBOX_H + +#include + +class QSlider; + +/** + * @short Provides a group box for adjusting the icon sizes. + * + * It is possible to adjust the default icon size and the icon + * size when previews are used. + */ +class IconSizeGroupBox : public QGroupBox +{ + Q_OBJECT + +public: + explicit IconSizeGroupBox(QWidget* parent); + virtual ~IconSizeGroupBox(); + + void setDefaultSizeRange(int min, int max); + void setPreviewSizeRange(int min, int max); + + void setDefaultSizeValue(int value); + int defaultSizeValue() const; + + void setPreviewSizeValue(int value); + int previewSizeValue() const; + +signals: + void defaultSizeChanged(int value); + void previewSizeChanged(int value); + +private slots: + void slotDefaultSliderMoved(int value); + void slotPreviewSliderMoved(int value); + +private: + void showToolTip(QSlider* slider, int value); + +private: + QSlider* m_defaultSizeSlider; + QSlider* m_previewSizeSlider; +}; + +#endif diff --git a/src/settings/viewmodes/iconsviewsettingspage.cpp b/src/settings/viewmodes/iconsviewsettingspage.cpp new file mode 100644 index 000000000..059a4a846 --- /dev/null +++ b/src/settings/viewmodes/iconsviewsettingspage.cpp @@ -0,0 +1,247 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "iconsviewsettingspage.h" + +#include "dolphinfontrequester.h" +#include "settings/dolphinsettings.h" +#include "iconsizegroupbox.h" +#include "zoomlevelinfo.h" + +#include "dolphin_iconsmodesettings.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +IconsViewSettingsPage::IconsViewSettingsPage(QWidget* parent) : + ViewSettingsPageBase(parent), + m_iconSizeGroupBox(0), + m_textWidthBox(0), + m_fontRequester(0), + m_textlinesCountBox(0), + m_arrangementBox(0), + m_gridSpacingBox(0) +{ + const int spacing = KDialog::spacingHint(); + const int margin = KDialog::marginHint(); + const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + setSpacing(spacing); + setMargin(margin); + + // Create "Icon" properties + m_iconSizeGroupBox = new IconSizeGroupBox(this); + m_iconSizeGroupBox->setSizePolicy(sizePolicy); + + const int min = ZoomLevelInfo::minimumLevel(); + const int max = ZoomLevelInfo::maximumLevel(); + m_iconSizeGroupBox->setDefaultSizeRange(min, max); + m_iconSizeGroupBox->setPreviewSizeRange(min, max); + + connect(m_iconSizeGroupBox, SIGNAL(defaultSizeChanged(int)), + this, SIGNAL(changed())); + connect(m_iconSizeGroupBox, SIGNAL(previewSizeChanged(int)), + this, SIGNAL(changed())); + + // create 'Text' group for selecting the font, the number of lines + // and the text width + QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); + textGroup->setSizePolicy(sizePolicy); + + QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); + m_fontRequester = new DolphinFontRequester(textGroup); + connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); + + QLabel* textlinesCountLabel = new QLabel(i18nc("@label:textbox", "Number of lines:"), textGroup); + m_textlinesCountBox = new KIntSpinBox(textGroup); + m_textlinesCountBox->setMinimum(1); + m_textlinesCountBox->setMaximum(5); + connect(m_textlinesCountBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); + + QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup); + m_textWidthBox = new KComboBox(textGroup); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large")); + m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Huge")); + connect(m_textWidthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + + QGridLayout* textGroupLayout = new QGridLayout(textGroup); + textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight); + textGroupLayout->addWidget(m_fontRequester, 0, 1); + textGroupLayout->addWidget(textlinesCountLabel, 1, 0, Qt::AlignRight); + textGroupLayout->addWidget(m_textlinesCountBox, 1, 1); + textGroupLayout->addWidget(textWidthLabel, 2, 0, Qt::AlignRight); + textGroupLayout->addWidget(m_textWidthBox, 2, 1); + + // create the 'Grid' group for selecting the arrangement and the grid spacing + QGroupBox* gridGroup = new QGroupBox(i18nc("@title:group", "Grid"), this); + gridGroup->setSizePolicy(sizePolicy); + + QLabel* arrangementLabel = new QLabel(i18nc("@label:listbox", "Arrangement:"), gridGroup); + m_arrangementBox = new KComboBox(gridGroup); + m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Columns")); + m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Rows")); + connect(m_arrangementBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + + QLabel* gridSpacingLabel = new QLabel(i18nc("@label:listbox", "Grid spacing:"), gridGroup); + m_gridSpacingBox = new KComboBox(gridGroup); + m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "None")); + m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Small")); + m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Medium")); + m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Large")); + connect(m_gridSpacingBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + + QGridLayout* gridGroupLayout = new QGridLayout(gridGroup); + gridGroupLayout->addWidget(arrangementLabel, 0, 0, Qt::AlignRight); + gridGroupLayout->addWidget(m_arrangementBox, 0, 1); + gridGroupLayout->addWidget(gridSpacingLabel, 1, 0, Qt::AlignRight); + gridGroupLayout->addWidget(m_gridSpacingBox, 1, 1); + + // Add a dummy widget with no restriction regarding + // a vertical resizing. This assures that the dialog layout + // is not stretched vertically. + new QWidget(this); + + loadSettings(); +} + +IconsViewSettingsPage::~IconsViewSettingsPage() +{ +} + +void IconsViewSettingsPage::applySettings() +{ + IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + + const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->defaultSizeValue()); + const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(m_iconSizeGroupBox->previewSizeValue()); + settings->setIconSize(iconSize); + settings->setPreviewSize(previewSize); + + const QFont font = m_fontRequester->font(); + const int fontHeight = QFontMetrics(font).height(); + + const int arrangement = (m_arrangementBox->currentIndex() == 0) ? + QListView::LeftToRight : + QListView::TopToBottom; + settings->setArrangement(arrangement); + + const int numberOfTextlines = m_textlinesCountBox->value(); + + const int defaultSize = settings->iconSize(); + int itemWidth = defaultSize; + int itemHeight = defaultSize; + const int textSizeIndex = m_textWidthBox->currentIndex(); + if (arrangement == QListView::TopToBottom) { + itemWidth += TopToBottomBase + textSizeIndex * TopToBottomInc; + itemHeight += fontHeight * numberOfTextlines + 10; + } else { + itemWidth += LeftToRightBase + textSizeIndex * LeftToRightInc; + } + + settings->setItemWidth(itemWidth); + settings->setItemHeight(itemHeight); + + settings->setUseSystemFont(m_fontRequester->mode() == DolphinFontRequester::SystemFont); + settings->setFontFamily(font.family()); + settings->setFontSize(font.pointSizeF()); + settings->setItalicFont(font.italic()); + settings->setFontWeight(font.weight()); + + settings->setNumberOfTextlines(numberOfTextlines); + + const int index = m_gridSpacingBox->currentIndex(); + if (index == 0) { + // No grid spacing + settings->setGridSpacing(0); + } else { + settings->setGridSpacing(GridSpacingBase + (index - 1) * GridSpacingInc); + } + + settings->writeConfig(); +} + +void IconsViewSettingsPage::restoreDefaults() +{ + IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + settings->useDefaults(true); + loadSettings(); + settings->useDefaults(false); +} + +void IconsViewSettingsPage::loadSettings() +{ + IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + + const QSize iconSize(settings->iconSize(), settings->iconSize()); + const int iconSizeValue = ZoomLevelInfo::zoomLevelForIconSize(iconSize); + m_iconSizeGroupBox->setDefaultSizeValue(iconSizeValue); + + const QSize previewSize(settings->previewSize(), settings->previewSize()); + const int previewSizeValue = ZoomLevelInfo::zoomLevelForIconSize(previewSize); + m_iconSizeGroupBox->setPreviewSizeValue(previewSizeValue); + + if (settings->useSystemFont()) { + m_fontRequester->setMode(DolphinFontRequester::SystemFont); + } else { + QFont font(settings->fontFamily(), + qRound(settings->fontSize())); + font.setItalic(settings->italicFont()); + font.setWeight(settings->fontWeight()); + font.setPointSizeF(settings->fontSize()); + m_fontRequester->setMode(DolphinFontRequester::CustomFont); + m_fontRequester->setCustomFont(font); + } + + m_textlinesCountBox->setValue(settings->numberOfTextlines()); + + const bool leftToRightArrangement = (settings->arrangement() == QListView::LeftToRight); + int textWidthIndex = 0; + const int remainingWidth = settings->itemWidth() - settings->iconSize(); + if (leftToRightArrangement) { + textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc; + } else { + textWidthIndex = (remainingWidth - TopToBottomBase) / TopToBottomInc; + } + // ensure that chosen index is always valid + textWidthIndex = qMax(textWidthIndex, 0); + textWidthIndex = qMin(textWidthIndex, m_textWidthBox->count() - 1); + + m_textWidthBox->setCurrentIndex(textWidthIndex); + m_arrangementBox->setCurrentIndex(leftToRightArrangement ? 0 : 1); + + const int spacing = settings->gridSpacing(); + const int index = (spacing <= 0) ? 0 : 1 + (spacing - GridSpacingBase) / GridSpacingInc; + m_gridSpacingBox->setCurrentIndex(index); +} + +#include "iconsviewsettingspage.moc" diff --git a/src/settings/viewmodes/iconsviewsettingspage.h b/src/settings/viewmodes/iconsviewsettingspage.h new file mode 100644 index 000000000..17fda4e26 --- /dev/null +++ b/src/settings/viewmodes/iconsviewsettingspage.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef ICONSVIEWSETTINGSPAGE_H +#define ICONSVIEWSETTINGSPAGE_H + +#include +#include "viewsettingspagebase.h" + +class DolphinFontRequester; +class IconSizeGroupBox; +class KComboBox; +class KIntSpinBox; + +/** + * @brief Tab page for the 'Icons Mode' settings + * of the Dolphin settings dialog. + * + * Allows to set: + * - icon size + * - preview size + * - text width + * - grid spacing + * - font + * - number of text lines + * - arrangement + * + * @see DolphinIconsViewSettings + */ +class IconsViewSettingsPage : public ViewSettingsPageBase +{ + Q_OBJECT + +public: + IconsViewSettingsPage(QWidget* parent); + virtual ~IconsViewSettingsPage(); + + /** + * Applies the settings for the icons view. + * The settings are persisted automatically when + * closing Dolphin. + */ + virtual void applySettings(); + + /** Restores the settings to default values. */ + virtual void restoreDefaults(); + +private: + void loadSettings(); + +private: + enum + { + GridSpacingBase = 8, + GridSpacingInc = 12, + LeftToRightBase = 128, + LeftToRightInc = 64, + TopToBottomBase = 32, + TopToBottomInc = 32 + }; + + IconSizeGroupBox* m_iconSizeGroupBox; + KComboBox* m_textWidthBox; + DolphinFontRequester* m_fontRequester; + KIntSpinBox* m_textlinesCountBox; + + KComboBox* m_arrangementBox; + KComboBox* m_gridSpacingBox; +}; + +#endif diff --git a/src/settings/viewmodes/viewsettingspage.cpp b/src/settings/viewmodes/viewsettingspage.cpp new file mode 100644 index 000000000..deb7a31bb --- /dev/null +++ b/src/settings/viewmodes/viewsettingspage.cpp @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * peter.penz@gmx.at * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "viewsettingspage.h" + +#include "columnviewsettingspage.h" +#include "iconsviewsettingspage.h" +#include "detailsviewsettingspage.h" + +#include + +#include +#include +#include +#include + +ViewSettingsPage::ViewSettingsPage(QWidget* parent) : + SettingsPageBase(parent), + m_pages() +{ + QVBoxLayout* topLayout = new QVBoxLayout(this); + topLayout->setMargin(0); + topLayout->setSpacing(KDialog::spacingHint()); + + KTabWidget* tabWidget = new KTabWidget(this); + + // initialize 'Icons' tab + IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget); + tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons")); + connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed())); + + // initialize 'Details' tab + DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget); + tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details")); + connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed())); + + // initialize 'Column' tab + ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget); + tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column")); + connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed())); + + m_pages.append(iconsPage); + m_pages.append(detailsPage); + m_pages.append(columnPage); + + topLayout->addWidget(tabWidget, 0, 0); +} + +ViewSettingsPage::~ViewSettingsPage() +{ +} + +void ViewSettingsPage::applySettings() +{ + foreach (ViewSettingsPageBase* page, m_pages) { + page->applySettings(); + } +} + +void ViewSettingsPage::restoreDefaults() +{ + foreach (ViewSettingsPageBase* page, m_pages) { + page->restoreDefaults(); + } +} + +#include "viewsettingspage.moc" diff --git a/src/settings/viewmodes/viewsettingspage.h b/src/settings/viewmodes/viewsettingspage.h new file mode 100644 index 000000000..56e9f910d --- /dev/null +++ b/src/settings/viewmodes/viewsettingspage.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2006 by Peter Penz * + * peter.penz@gmx.at * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ +#ifndef VIEWSETTINGSPAGE_H +#define VIEWSETTINGSPAGE_H + +#include + +class ViewSettingsPageBase; +class QWidget; + +/** + * @brief Page for the 'View' settings of the Dolphin settings dialog. + * + * The views settings allow to set the properties for the icons mode, + * the details mode and the column mode. + */ +class ViewSettingsPage : public SettingsPageBase +{ + Q_OBJECT + +public: + ViewSettingsPage(QWidget* parent); + virtual ~ViewSettingsPage(); + + /** @see SettingsPageBase::applySettings() */ + virtual void applySettings(); + + /** @see SettingsPageBase::restoreDefaults() */ + virtual void restoreDefaults(); + +private: + QList m_pages; +}; + +#endif diff --git a/src/settings/viewmodes/viewsettingspagebase.cpp b/src/settings/viewmodes/viewsettingspagebase.cpp new file mode 100644 index 000000000..b610bb0f5 --- /dev/null +++ b/src/settings/viewmodes/viewsettingspagebase.cpp @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "viewsettingspagebase.h" + +ViewSettingsPageBase::ViewSettingsPageBase(QWidget* parent) : + KVBox(parent) +{ +} + +ViewSettingsPageBase::~ViewSettingsPageBase() +{ +} + +#include "viewsettingspagebase.moc" diff --git a/src/settings/viewmodes/viewsettingspagebase.h b/src/settings/viewmodes/viewsettingspagebase.h new file mode 100644 index 000000000..3e85e25cb --- /dev/null +++ b/src/settings/viewmodes/viewsettingspagebase.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz * + * * + * 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) any later version. * + * * + * 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef VIEWSETTINGSPAGEBASE_H +#define VIEWSETTINGSPAGEBASE_H + +#include + +/** + * @brief Base class for view settings configuration pages. + * + * @see GeneralViewSettingsPage; + * @see IconViewSettingsPage + * @see DetailsViewSettingsPage + * @see ColumnViewSettingsPage + */ +class ViewSettingsPageBase : public KVBox +{ + Q_OBJECT + +public: + ViewSettingsPageBase(QWidget* parent); + virtual ~ViewSettingsPageBase(); + + /** + * Applies the settings for the view. + * The settings are persisted automatically when + * closing Dolphin. + */ + virtual void applySettings() = 0; + + /** Restores the settings to default values. */ + virtual void restoreDefaults() = 0; + +signals: + void changed(); +}; + +#endif diff --git a/src/settings/viewsettingspage.cpp b/src/settings/viewsettingspage.cpp deleted file mode 100644 index deb7a31bb..000000000 --- a/src/settings/viewsettingspage.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "viewsettingspage.h" - -#include "columnviewsettingspage.h" -#include "iconsviewsettingspage.h" -#include "detailsviewsettingspage.h" - -#include - -#include -#include -#include -#include - -ViewSettingsPage::ViewSettingsPage(QWidget* parent) : - SettingsPageBase(parent), - m_pages() -{ - QVBoxLayout* topLayout = new QVBoxLayout(this); - topLayout->setMargin(0); - topLayout->setSpacing(KDialog::spacingHint()); - - KTabWidget* tabWidget = new KTabWidget(this); - - // initialize 'Icons' tab - IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget); - tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons")); - connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed())); - - // initialize 'Details' tab - DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget); - tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details")); - connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed())); - - // initialize 'Column' tab - ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget); - tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column")); - connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed())); - - m_pages.append(iconsPage); - m_pages.append(detailsPage); - m_pages.append(columnPage); - - topLayout->addWidget(tabWidget, 0, 0); -} - -ViewSettingsPage::~ViewSettingsPage() -{ -} - -void ViewSettingsPage::applySettings() -{ - foreach (ViewSettingsPageBase* page, m_pages) { - page->applySettings(); - } -} - -void ViewSettingsPage::restoreDefaults() -{ - foreach (ViewSettingsPageBase* page, m_pages) { - page->restoreDefaults(); - } -} - -#include "viewsettingspage.moc" diff --git a/src/settings/viewsettingspage.h b/src/settings/viewsettingspage.h deleted file mode 100644 index 56e9f910d..000000000 --- a/src/settings/viewsettingspage.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ -#ifndef VIEWSETTINGSPAGE_H -#define VIEWSETTINGSPAGE_H - -#include - -class ViewSettingsPageBase; -class QWidget; - -/** - * @brief Page for the 'View' settings of the Dolphin settings dialog. - * - * The views settings allow to set the properties for the icons mode, - * the details mode and the column mode. - */ -class ViewSettingsPage : public SettingsPageBase -{ - Q_OBJECT - -public: - ViewSettingsPage(QWidget* parent); - virtual ~ViewSettingsPage(); - - /** @see SettingsPageBase::applySettings() */ - virtual void applySettings(); - - /** @see SettingsPageBase::restoreDefaults() */ - virtual void restoreDefaults(); - -private: - QList m_pages; -}; - -#endif diff --git a/src/settings/viewsettingspagebase.cpp b/src/settings/viewsettingspagebase.cpp deleted file mode 100644 index b610bb0f5..000000000 --- a/src/settings/viewsettingspagebase.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "viewsettingspagebase.h" - -ViewSettingsPageBase::ViewSettingsPageBase(QWidget* parent) : - KVBox(parent) -{ -} - -ViewSettingsPageBase::~ViewSettingsPageBase() -{ -} - -#include "viewsettingspagebase.moc" diff --git a/src/settings/viewsettingspagebase.h b/src/settings/viewsettingspagebase.h deleted file mode 100644 index 3e85e25cb..000000000 --- a/src/settings/viewsettingspagebase.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Peter Penz * - * * - * 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) any later version. * - * * - * 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, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef VIEWSETTINGSPAGEBASE_H -#define VIEWSETTINGSPAGEBASE_H - -#include - -/** - * @brief Base class for view settings configuration pages. - * - * @see GeneralViewSettingsPage; - * @see IconViewSettingsPage - * @see DetailsViewSettingsPage - * @see ColumnViewSettingsPage - */ -class ViewSettingsPageBase : public KVBox -{ - Q_OBJECT - -public: - ViewSettingsPageBase(QWidget* parent); - virtual ~ViewSettingsPageBase(); - - /** - * Applies the settings for the view. - * The settings are persisted automatically when - * closing Dolphin. - */ - virtual void applySettings() = 0; - - /** Restores the settings to default values. */ - virtual void restoreDefaults() = 0; - -signals: - void changed(); -}; - -#endif -- cgit v1.3