Relayout of the settings dialog, so that all Dolphin KPart relevant settings can be made available in Konqueror's settings dialog too. Further cleanups and layout fixes are required and will be done during the next week.

svn path=/trunk/KDE/kdebase/apps/; revision=912587
This commit is contained in:
Peter Penz 2009-01-17 18:42:06 +00:00
parent 9e6b85cd6e
commit 8acb68ed28
25 changed files with 924 additions and 313 deletions

View file

@ -111,16 +111,21 @@ set(dolphin_SRCS
panels/folders/treeviewcontextmenu.cpp
panels/folders/folderspanel.cpp
panels/folders/paneltreeview.cpp
settings/settingspagebase.cpp
settings/startupsettingspage.cpp
settings/behaviorsettingspage.cpp
settings/columnviewsettingspage.cpp
settings/contextmenusettingspage.cpp
settings/dolphinfontrequester.cpp
settings/dolphinsettingsdialog.cpp
settings/detailsviewsettingspage.cpp
settings/generalsettingspage.cpp
settings/generalviewsettingspage.cpp
settings/iconsizegroupbox.cpp
settings/iconsviewsettingspage.cpp
settings/navigationsettingspage.cpp
settings/previewssettingspage.cpp
settings/servicessettingspage.cpp
settings/settingspagebase.cpp
settings/startupsettingspage.cpp
settings/statusbarsettingspage.cpp
settings/viewsettingspage.cpp
settings/viewsettingspagebase.cpp
statusbarspaceinfo.cpp
@ -169,12 +174,11 @@ install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS})
##########################################
set(kcm_dolphin_PART_SRCS
kcmdolphin.cpp
set(kcm_dolphinviewmodes_PART_SRCS
kcmdolphinviewmodes.cpp
settings/columnviewsettingspage.cpp
settings/detailsviewsettingspage.cpp
settings/dolphinfontrequester.cpp
settings/generalviewsettingspage.cpp
settings/iconsizegroupbox.cpp
settings/iconsviewsettingspage.cpp
settings/viewsettingspagebase.cpp
@ -182,25 +186,25 @@ set(kcm_dolphin_PART_SRCS
zoomlevelinfo.cpp
)
kde4_add_kcfg_files(kcm_dolphin_PART_SRCS
kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS
settings/dolphin_columnmodesettings.kcfgc
settings/dolphin_directoryviewpropertysettings.kcfgc
settings/dolphin_detailsmodesettings.kcfgc
settings/dolphin_iconsmodesettings.kcfgc
settings/dolphin_generalsettings.kcfgc)
kde4_add_plugin(kcm_dolphin ${kcm_dolphin_PART_SRCS})
kde4_add_plugin(kcm_dolphinviewmodes ${kcm_dolphinviewmodes_PART_SRCS})
target_link_libraries(kcm_dolphin ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate)
target_link_libraries(kcm_dolphinviewmodes ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate)
if (Nepomuk_FOUND)
target_link_libraries(kcm_dolphin ${NEPOMUK_LIBRARIES})
target_link_libraries(kcm_dolphinviewmodes ${NEPOMUK_LIBRARIES})
endif (Nepomuk_FOUND)
install(TARGETS kcm_dolphin DESTINATION ${PLUGIN_INSTALL_DIR} )
install(TARGETS kcm_dolphinviewmodes DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_generalsettings.kcfg settings/dolphin_columnmodesettings.kcfg settings/dolphin_iconsmodesettings.kcfg settings/dolphin_detailsmodesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin )
install( FILES kcmdolphin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES kcmdolphinviewmodes.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -703,7 +703,8 @@ void DolphinMainWindow::toggleShowMenuBar()
void DolphinMainWindow::editSettings()
{
if (m_settingsDialog == 0) {
m_settingsDialog = new DolphinSettingsDialog(this);
const KUrl& url = activeViewContainer()->url();
m_settingsDialog = new DolphinSettingsDialog(url, this);
m_settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
m_settingsDialog->show();
} else {

View file

@ -17,11 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "kcmdolphin.h"
#include "kcmdolphinviewmodes.h"
#include "settings/columnviewsettingspage.h"
#include "settings/detailsviewsettingspage.h"
#include "settings/generalviewsettingspage.h"
#include "settings/iconsviewsettingspage.h"
#include <ktabwidget.h>
@ -36,16 +35,16 @@
#include <QPushButton>
#include <QVBoxLayout>
K_PLUGIN_FACTORY(KCMDolphinConfigFactory, registerPlugin<DolphinConfigModule>("dolphin");)
K_EXPORT_PLUGIN(KCMDolphinConfigFactory("kcmdolphin"))
K_PLUGIN_FACTORY(KCMDolphinConfigFactory, registerPlugin<DolphinViewModesConfigModule>("dolphinviewmodes");)
K_EXPORT_PLUGIN(KCMDolphinConfigFactory("kcmdolphinviewmodes"))
DolphinConfigModule::DolphinConfigModule(QWidget* parent, const QVariantList& args) :
DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args) :
KCModule(KCMDolphinConfigFactory::componentData(), parent),
m_pages()
{
Q_UNUSED(args);
KGlobal::locale()->insertCatalog("dolphin");
KGlobal::locale()->insertCatalog("dolphinviewmodes");
setButtons(KCModule::Default | KCModule::Help);
@ -55,11 +54,6 @@ DolphinConfigModule::DolphinConfigModule(QWidget* parent, const QVariantList& ar
KTabWidget* tabWidget = new KTabWidget(this);
// initialize 'General' tab
GeneralViewSettingsPage* generalPage = new GeneralViewSettingsPage(QDir::homePath(), tabWidget);
tabWidget->addTab(generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
connect(generalPage, SIGNAL(changed()), this, SLOT(changed()));
// initialize 'Icons' tab
IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
@ -75,7 +69,6 @@ DolphinConfigModule::DolphinConfigModule(QWidget* parent, const QVariantList& ar
tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
connect(columnPage, SIGNAL(changed()), this, SLOT(changed()));
m_pages.append(generalPage);
m_pages.append(iconsPage);
m_pages.append(detailsPage);
m_pages.append(columnPage);
@ -83,11 +76,11 @@ DolphinConfigModule::DolphinConfigModule(QWidget* parent, const QVariantList& ar
topLayout->addWidget(tabWidget, 0, 0);
}
DolphinConfigModule::~DolphinConfigModule()
DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
{
}
void DolphinConfigModule::save()
void DolphinViewModesConfigModule::save()
{
foreach (ViewSettingsPageBase* page, m_pages) {
page->applySettings();
@ -95,7 +88,7 @@ void DolphinConfigModule::save()
reparseConfiguration();
}
void DolphinConfigModule::defaults()
void DolphinViewModesConfigModule::defaults()
{
foreach (ViewSettingsPageBase* page, m_pages) {
page->restoreDefaults();
@ -103,10 +96,10 @@ void DolphinConfigModule::defaults()
reparseConfiguration();
}
void DolphinConfigModule::reparseConfiguration()
void DolphinViewModesConfigModule::reparseConfiguration()
{
QDBusMessage message = QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
QDBusConnection::sessionBus().send(message);
}
#include "kcmdolphin.moc"
#include "kcmdolphinviewmodes.moc"

View file

@ -27,13 +27,13 @@ class ViewSettingsPageBase;
/**
* @brief Allow to configure the Dolphin views.
*/
class DolphinConfigModule : public KCModule
class DolphinViewModesConfigModule : public KCModule
{
Q_OBJECT
public:
DolphinConfigModule(QWidget* parent, const QVariantList& args);
virtual ~DolphinConfigModule();
DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args);
virtual ~DolphinViewModesConfigModule();
virtual void save();
virtual void defaults();

View file

@ -0,0 +1,162 @@
/***************************************************************************
* 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 <viewproperties.h>
#include <kdialog.h>
#include <klocale.h>
#include <kvbox.h>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QRadioButton>
#include <QVBoxLayout>
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_showSelectionToggle(0)
{
const int spacing = KDialog::spacingHint();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(spacing);
// 'View Properties' box
QGroupBox* propsBox = new QGroupBox(i18nc("@title:group", "View Properties"), vBox);
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"), vBox);
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()));
QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox);
confirmBoxLayout->addWidget(m_confirmMoveToTrash);
confirmBoxLayout->addWidget(m_confirmDelete);
m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), vBox);
connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), vBox);
connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), vBox);
connect(m_showSelectionToggle, 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();
}
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->setRenameInline(m_renameInline->isChecked());
settings->setShowToolTips(m_showToolTips->isChecked());
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
}
void BehaviorSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
// TODO: reset default settings for trash and show delete command...
loadSettings();
}
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", false));
m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", true));
m_renameInline->setChecked(settings->renameInline());
m_showToolTips->setChecked(settings->showToolTips());
m_showSelectionToggle->setChecked(settings->showSelectionToggle());
}
#include "behaviorsettingspage.moc"

View file

@ -0,0 +1,64 @@
/***************************************************************************
* 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 <settings/settingspagebase.h>
#include <kurl.h>
class DolphinMainWindow;
class QCheckBox;
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:
void loadSettings();
private:
KUrl m_url;
QRadioButton* m_localProps;
QRadioButton* m_globalProps;
QCheckBox* m_confirmMoveToTrash;
QCheckBox* m_confirmDelete;
QCheckBox* m_renameInline;
QCheckBox* m_showToolTips;
QCheckBox* m_showSelectionToggle;
};
#endif

View file

@ -0,0 +1,88 @@
/***************************************************************************
* Copyright (C) 2009 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 "contextmenusettingspage.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include <kdialog.h>
#include <klocale.h>
#include <kvbox.h>
#include <QCheckBox>
#include <QVBoxLayout>
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());
}
void ContextMenuSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
loadSettings();
}
void ContextMenuSettingsPage::loadSettings()
{
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
m_showDeleteCommand->setChecked(configGroup.readEntry("ShowDeleteCommand", false));
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu());
}
#include "contextmenusettingspage.moc"

View file

@ -0,0 +1,51 @@
/***************************************************************************
* Copyright (C) 2009 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 CONTEXTMENUSETTINGSPAGE_H
#define CONTEXTMENUSETTINGSPAGE_H
#include <settings/settingspagebase.h>
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

View file

@ -23,6 +23,8 @@
#include <dolphinapplication.h>
#include <dolphinmainwindow.h>
#include "generalsettingspage.h"
#include "navigationsettingspage.h"
#include "servicessettingspage.h"
#include "startupsettingspage.h"
#include "viewsettingspage.h"
@ -30,8 +32,8 @@
#include <kmessagebox.h>
#include <kicon.h>
DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
KPageDialog(mainWindow),
DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) :
KPageDialog(parent),
m_pages()
{
@ -44,19 +46,36 @@ DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
enableButtonApply(false);
setDefaultButton(Ok);
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(mainWindow, this);
// Startup
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this);
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
i18nc("@title:group", "Startup"));
startupSettingsFrame->setIcon(KIcon("go-home"));
connect(startupSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(mainWindow, this);
// View Modes
ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(this);
KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage,
i18nc("@title:group", "View Modes"));
viewSettingsFrame->setIcon(KIcon("view-choose"));
connect(viewSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(mainWindow, this);
// Navigation
NavigationSettingsPage* navigationSettingsPage = new NavigationSettingsPage(this);
KPageWidgetItem* navigationSettingsFrame = addPage(navigationSettingsPage,
i18nc("@title:group", "Navigation"));
navigationSettingsFrame->setIcon(KIcon("input-mouse"));
connect(navigationSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
// Services
ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this);
KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage,
i18nc("@title:group", "Services"));
servicesSettingsFrame->setIcon(KIcon("services"));
connect(servicesSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
// General
GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this);
KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage,
i18nc("@title:group General settings", "General"));
generalSettingsFrame->setIcon(KIcon("system-run"));
@ -67,6 +86,8 @@ DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
m_pages.append(startupSettingsPage);
m_pages.append(viewSettingsPage);
m_pages.append(navigationSettingsPage);
m_pages.append(servicesSettingsPage);
m_pages.append(generalSettingsPage);
}

View file

@ -23,22 +23,21 @@
#include <kpagedialog.h>
class KUrl;
class DolphinMainWindow;
class SettingsPageBase;
/**
* @brief Settings dialog for Dolphin.
*
* Contains the pages for startup settings, general settings and view settings.
*
* @author Peter Penz <peter.penz@gmx.at>
* Contains the pages for Startup, View Modes, Navigation, Services and General.
*/
class DolphinSettingsDialog : public KPageDialog
{
Q_OBJECT
public:
explicit DolphinSettingsDialog(DolphinMainWindow* mainWindow);
explicit DolphinSettingsDialog(const KUrl& url, QWidget* parent);
virtual ~DolphinSettingsDialog();
protected slots:

View file

@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) and *
* and Patrice Tremblay *
* 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 *
@ -15,99 +15,60 @@
* 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 *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "generalsettingspage.h"
#include "settings/dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include "behaviorsettingspage.h"
#include "contextmenusettingspage.h"
#include "previewssettingspage.h"
#include "settingspagebase.h"
#include "statusbarsettingspage.h"
#include <kdialog.h>
#include <klocale.h>
#include <kvbox.h>
#include <kiconloader.h>
#include <ktabwidget.h>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) :
GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_confirmMoveToTrash(0),
m_confirmDelete(0),
m_showDeleteCommand(0),
m_showCopyMoveMenu(0),
m_showZoomSlider(0),
m_showSpaceInfo(0),
m_browseThroughArchives(0),
m_renameInline(0),
m_autoExpandFolders(0)
m_pages()
{
Q_UNUSED(mainWin);
const int spacing = KDialog::spacingHint();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(spacing);
topLayout->setMargin(0);
topLayout->setSpacing(KDialog::spacingHint());
// create 'Ask Confirmation For' group
QGroupBox* confirmBox = new QGroupBox(i18nc("@title:group", "Ask For Confirmation When"), vBox);
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()));
KTabWidget* tabWidget = new KTabWidget(this);
QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox);
confirmBoxLayout->addWidget(m_confirmMoveToTrash);
confirmBoxLayout->addWidget(m_confirmDelete);
// 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()));
QGroupBox* contextMenuBox = new QGroupBox(i18nc("@title:group", "Context Menu"), vBox);
// initialize 'Previews' tab
PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
connect(previewsPage, SIGNAL(changed()), this, SIGNAL(changed()));
// create 'Show the command 'Delete' in context menu' checkbox
m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command"), contextMenuBox);
connect(m_showDeleteCommand, SIGNAL(toggled(bool)), 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()));
m_showCopyMoveMenu = new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands"), contextMenuBox);
connect(m_showCopyMoveMenu, SIGNAL(toggled(bool)), 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()));
QVBoxLayout* contextMenuBoxLayout = new QVBoxLayout(contextMenuBox);
contextMenuBoxLayout->addWidget(m_showDeleteCommand);
contextMenuBoxLayout->addWidget(m_showCopyMoveMenu);
m_pages.append(behaviorPage);
m_pages.append(previewsPage);
m_pages.append(contextMenuPage);
m_pages.append(statusBarPage);
QGroupBox* statusBarBox = new QGroupBox(i18nc("@title:group", "Status Bar"), vBox);
m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), statusBarBox);
connect(m_showZoomSlider, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), statusBarBox);
connect(m_showSpaceInfo, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
QVBoxLayout* statusBarBoxLayout = new QVBoxLayout(statusBarBox);
statusBarBoxLayout->addWidget(m_showZoomSlider);
statusBarBoxLayout->addWidget(m_showSpaceInfo);
m_browseThroughArchives = new QCheckBox(i18nc("@option:check", "Browse through archives"), vBox);
connect(m_browseThroughArchives, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), vBox);
connect(m_renameInline, 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();
topLayout->addWidget(tabWidget, 0, 0);
}
GeneralSettingsPage::~GeneralSettingsPage()
@ -116,55 +77,16 @@ GeneralSettingsPage::~GeneralSettingsPage()
void GeneralSettingsPage::applySettings()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
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();
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
configGroup.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked());
configGroup.sync();
settings->setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked());
settings->setShowZoomSlider(m_showZoomSlider->isChecked());
settings->setShowSpaceInfo(m_showSpaceInfo->isChecked());
settings->setBrowseThroughArchives(m_browseThroughArchives->isChecked());
settings->setRenameInline(m_renameInline->isChecked());
settings->setAutoExpandFolders(m_autoExpandFolders->isChecked());
foreach (SettingsPageBase* page, m_pages) {
page->applySettings();
}
}
void GeneralSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
// TODO: reset default settings for trash and show delete command...
loadSettings();
}
void GeneralSettingsPage::loadSettings()
{
KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::IncludeGlobals);
const KConfigGroup confirmationGroup(kioConfig, "Confirmations");
m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", false));
m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", true));
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
m_showDeleteCommand->setChecked(configGroup.readEntry("ShowDeleteCommand", false));
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu());
m_showZoomSlider->setChecked(settings->showZoomSlider());
m_showSpaceInfo->setChecked(settings->showSpaceInfo());
m_browseThroughArchives->setChecked(settings->browseThroughArchives());
m_renameInline->setChecked(settings->renameInline());
m_autoExpandFolders->setChecked(settings->autoExpandFolders());
foreach (SettingsPageBase* page, m_pages) {
page->restoreDefaults();
}
}
#include "generalsettingspage.moc"

View file

@ -15,26 +15,33 @@
* 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 *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef GENERALSETTINGSPAGE_H
#define GENERALSETTINGSPAGE_H
#include <QWidget>
#include <settings/settingspagebase.h>
class KUrl;
class SettingsPageBase;
class DolphinMainWindow;
class QLineEdit;
class QCheckBox;
/**
* @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(DolphinMainWindow* mainWindow, QWidget* parent);
GeneralSettingsPage(const KUrl& url, QWidget* parent);
virtual ~GeneralSettingsPage();
/** @see SettingsPageBase::applySettings() */
@ -44,21 +51,7 @@ public:
virtual void restoreDefaults();
private:
void loadSettings();
private:
QCheckBox* m_confirmMoveToTrash;
QCheckBox* m_confirmDelete;
QCheckBox* m_showDeleteCommand;
QCheckBox* m_showCopyMoveMenu;
QCheckBox* m_showZoomSlider;
QCheckBox* m_showSpaceInfo;
QCheckBox* m_browseThroughArchives;
QCheckBox* m_renameInline;
QCheckBox* m_autoExpandFolders;
QList<SettingsPageBase*> m_pages;
};
#endif

View file

@ -0,0 +1,112 @@
/***************************************************************************
* Copyright (C) 2009 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 "navigationsettingspage.h"
#include "settings/dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include <kdialog.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <kvbox.h>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QRadioButton>
#include <QVBoxLayout>
NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_browseThroughArchives(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);
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_browseThroughArchives = new QCheckBox(i18nc("@option:check", "Browse through archives"), vBox);
connect(m_browseThroughArchives, 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("Mouse");
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_browseThroughArchives->isChecked());
settings->setAutoExpandFolders(m_autoExpandFolders->isChecked());
}
void NavigationSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
loadSettings();
}
void NavigationSettingsPage::loadSettings()
{
const bool singleClick = KGlobalSettings::singleClick();
m_singleClick->setChecked(singleClick);
m_doubleClick->setChecked(!singleClick);
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_browseThroughArchives->setChecked(settings->browseThroughArchives());
m_autoExpandFolders->setChecked(settings->autoExpandFolders());
}
#include "navigationsettingspage.moc"

View file

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (C) 2009 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 NAVIGATIONSETTINGSPAGE_H
#define NAVIGATIONSETTINGSPAGE_H
#include <settings/settingspagebase.h>
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_browseThroughArchives;
QCheckBox* m_autoExpandFolders;
};
#endif

View file

@ -17,11 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "generalviewsettingspage.h"
#include "dolphinmainwindow.h"
#include "settings/dolphinsettings.h"
#include "dolphinviewcontainer.h"
#include "viewproperties.h"
#include "previewssettingspage.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
@ -38,48 +35,27 @@
#include <kglobal.h>
#include <klocale.h>
#include <khbox.h>
#include <kvbox.h>
GeneralViewSettingsPage::GeneralViewSettingsPage(const KUrl& url,
QWidget* parent) :
ViewSettingsPageBase(parent),
m_url(url),
m_localProps(0),
m_globalProps(0),
PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_maxPreviewSize(0),
m_spinBox(0),
m_useFileThumbnails(0),
m_showSelectionToggle(0),
m_showToolTips(0)
m_useFileThumbnails(0)
{
const int spacing = KDialog::spacingHint();
const int margin = KDialog::marginHint();
const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(KDialog::spacingHint());
vBox->setMargin(KDialog::marginHint());
setSpacing(spacing);
setMargin(margin);
new QLabel("TODO: a major rewrite of this dialog will be done in 4.3", vBox);
QGroupBox* propsBox = new QGroupBox(i18nc("@title:group", "View Properties"), this);
KHBox* hBox = new KHBox(vBox);
hBox->setSpacing(KDialog::spacingHint());
m_localProps = new QRadioButton(i18nc("@option:radio", "Remember view properties for each folder"), propsBox);
connect(m_localProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
new QLabel(i18nc("@label:slider", "Maximum file size:"), hBox);
m_maxPreviewSize = new QSlider(Qt::Horizontal, hBox);
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);
// create 'File Previews' box
QGroupBox* previewBox = new QGroupBox(i18nc("@title:group", "File Previews"), this);
KHBox* vBox = new KHBox(previewBox);
vBox->setSpacing(spacing);
new QLabel(i18nc("@label:slider", "Maximum file size:"), vBox);
m_maxPreviewSize = new QSlider(Qt::Horizontal, vBox);
m_spinBox = new QSpinBox(vBox);
m_spinBox = new QSpinBox(hBox);
connect(m_maxPreviewSize, SIGNAL(valueChanged(int)),
m_spinBox, SLOT(setValue(int)));
@ -91,50 +67,24 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(const KUrl& url,
connect(m_spinBox, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
m_useFileThumbnails = new QCheckBox(i18nc("@option:check", "Use thumbnails embedded in files"), previewBox);
m_useFileThumbnails = new QCheckBox(i18nc("@option:check", "Use thumbnails embedded in files"), vBox);
connect(m_useFileThumbnails, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
QVBoxLayout* previewBoxLayout = new QVBoxLayout(previewBox);
previewBoxLayout->addWidget(vBox);
previewBoxLayout->addWidget(m_useFileThumbnails);
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), this);
connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), this);
connect(m_showToolTips, 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);
new QWidget(vBox);
loadSettings();
}
GeneralViewSettingsPage::~GeneralViewSettingsPage()
PreviewsSettingsPage::~PreviewsSettingsPage()
{
}
void GeneralViewSettingsPage::applySettings()
void PreviewsSettingsPage::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);
}
KConfigGroup globalConfig(KGlobal::config(), "PreviewSettings");
const int byteCount = m_maxPreviewSize->value() * 1024 * 1024; // value() returns size in MB
globalConfig.writeEntry("MaximumSize",
@ -144,27 +94,17 @@ void GeneralViewSettingsPage::applySettings()
m_useFileThumbnails->isChecked(),
KConfigBase::Normal | KConfigBase::Global);
globalConfig.sync();
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
settings->setShowToolTips(m_showToolTips->isChecked());
}
void GeneralViewSettingsPage::restoreDefaults()
void PreviewsSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
loadSettings();
}
void GeneralViewSettingsPage::loadSettings()
void PreviewsSettingsPage::loadSettings()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
if (settings->globalViewProps()) {
m_globalProps->setChecked(true);
} else {
m_localProps->setChecked(true);
}
const int min = 1; // MB
const int max = 100; // MB
m_maxPreviewSize->setRange(min, max);
@ -193,9 +133,6 @@ void GeneralViewSettingsPage::loadSettings()
const bool useFileThumbnails = globalConfig.readEntry("UseFileThumbnails", true);
m_useFileThumbnails->setChecked(useFileThumbnails);
m_showSelectionToggle->setChecked(settings->showSelectionToggle());
m_showToolTips->setChecked(settings->showToolTips());
}
#include "generalviewsettingspage.moc"
#include "previewssettingspage.moc"

View file

@ -17,11 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef GENERALVIEWSETTINGSPAGE_H
#define GENERALVIEWSETTINGSPAGE_H
#ifndef PREVIEWSSETTINGSPAGE_H
#define PREVIEWSSETTINGSPAGE_H
#include <kurl.h>
#include <settings/viewsettingspagebase.h>
#include <settings/settingspagebase.h>
class DolphinMainWindow;
class QCheckBox;
@ -30,21 +30,15 @@ class QSlider;
class QSpinBox;
/**
* @brief Represents the page from the Dolphin Settings which allows
* to modify general settings for the view modes.
* @brief Allows the configuration of file previews.
*/
class GeneralViewSettingsPage : public ViewSettingsPageBase
class PreviewsSettingsPage : public SettingsPageBase
{
Q_OBJECT
public:
/**
* @param url URL of the currently shown directory, which is used
* to read the viewproperties.
* @param parent Parent widget of the settings page.
*/
GeneralViewSettingsPage(const KUrl& url, QWidget* parent);
virtual ~GeneralViewSettingsPage();
PreviewsSettingsPage(QWidget* parent);
virtual ~PreviewsSettingsPage();
/**
* Applies the general settings for the view modes
@ -60,14 +54,9 @@ private:
void loadSettings();
private:
KUrl m_url;
QRadioButton* m_localProps;
QRadioButton* m_globalProps;
QSlider* m_maxPreviewSize;
QSpinBox* m_spinBox;
QCheckBox* m_useFileThumbnails;
QCheckBox* m_showSelectionToggle;
QCheckBox* m_showToolTips;
};
#endif

View file

@ -0,0 +1,55 @@
/***************************************************************************
* Copyright (C) 2009 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 "servicessettingspage.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include <kdialog.h>
#include <klocale.h>
#include <kvbox.h>
ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
SettingsPageBase(parent)
{
loadSettings();
}
ServicesSettingsPage::~ServicesSettingsPage()
{
}
void ServicesSettingsPage::applySettings()
{
}
void ServicesSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
loadSettings();
}
void ServicesSettingsPage::loadSettings()
{
}
#include "servicessettingspage.moc"

View file

@ -0,0 +1,50 @@
/***************************************************************************
* Copyright (C) 2009 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 SERVICESSETTINGSPAGE_H
#define SERVICESSETTINGSPAGE_H
#include <settings/settingspagebase.h>
class QLineEdit;
class QCheckBox;
/**
* @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();
private:
void loadSettings();
private:
};
#endif

View file

@ -39,9 +39,9 @@
#include <QPushButton>
#include <QRadioButton>
StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) :
StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_mainWindow(mainWin),
m_url(url),
m_homeUrl(0),
m_splitView(0),
m_editableUrl(0),
@ -147,8 +147,7 @@ void StartupSettingsPage::selectHomeUrl()
void StartupSettingsPage::useCurrentLocation()
{
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
m_homeUrl->setText(view->url().prettyUrl());
m_homeUrl->setText(m_url.prettyUrl());
}
void StartupSettingsPage::useDefaultLocation()

View file

@ -20,8 +20,8 @@
#define STARTUPSETTINGSPAGE_H
#include <settings/settingspagebase.h>
#include <kurl.h>
class DolphinMainWindow;
class KLineEdit;
class QCheckBox;
@ -36,7 +36,7 @@ class StartupSettingsPage : public SettingsPageBase
Q_OBJECT
public:
StartupSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
StartupSettingsPage(const KUrl& url, QWidget* parent);
virtual ~StartupSettingsPage();
/** @see SettingsPageBase::applySettings() */
@ -54,7 +54,7 @@ private:
void loadSettings();
private:
DolphinMainWindow* m_mainWindow;
KUrl m_url;
KLineEdit* m_homeUrl;
QCheckBox* m_splitView;

View file

@ -0,0 +1,81 @@
/***************************************************************************
* Copyright (C) 2009 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 "statusbarsettingspage.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include <kdialog.h>
#include <klocale.h>
#include <kvbox.h>
#include <QCheckBox>
#include <QVBoxLayout>
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());
}
void StatusBarSettingsPage::restoreDefaults()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
settings->setDefaults();
loadSettings();
}
void StatusBarSettingsPage::loadSettings()
{
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_showZoomSlider->setChecked(settings->showZoomSlider());
m_showSpaceInfo->setChecked(settings->showSpaceInfo());
}
#include "statusbarsettingspage.moc"

View file

@ -0,0 +1,51 @@
/***************************************************************************
* Copyright (C) 2009 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 STATUSBARSETTINGSPAGE_H
#define STATUSBARSETTINGSPAGE_H
#include <settings/settingspagebase.h>
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

View file

@ -20,25 +20,18 @@
#include "viewsettingspage.h"
#include "settings/columnviewsettingspage.h"
#include "settings/detailsviewsettingspage.h"
#include "dolphinmainwindow.h"
#include "dolphinviewcontainer.h"
#include "settings/generalviewsettingspage.h"
#include "settings/iconsviewsettingspage.h"
#include "columnviewsettingspage.h"
#include "iconsviewsettingspage.h"
#include "detailsviewsettingspage.h"
#include <QtGui/QBoxLayout>
#include <QtGui/QLayout>
#include <QtGui/QLabel>
#include <QVBoxLayout>
#include <kdialog.h>
#include <klocale.h>
#include <kiconloader.h>
#include <ktabwidget.h>
ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
QWidget* parent) :
ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_pages()
{
@ -48,12 +41,6 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
KTabWidget* tabWidget = new KTabWidget(this);
// initialize 'General' tab
const KUrl& url = mainWindow->activeViewContainer()->url();
GeneralViewSettingsPage* generalPage = new GeneralViewSettingsPage(url, tabWidget);
tabWidget->addTab(generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
connect(generalPage, SIGNAL(changed()), this, SIGNAL(changed()));
// initialize 'Icons' tab
IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
@ -69,7 +56,6 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed()));
m_pages.append(generalPage);
m_pages.append(iconsPage);
m_pages.append(detailsPage);
m_pages.append(columnPage);

View file

@ -20,11 +20,10 @@
#ifndef VIEWSETTINGSPAGE_H
#define VIEWSETTINGSPAGE_H
#include <QtGui/QWidget>
#include <settings/settingspagebase.h>
class ViewSettingsPageBase;
class DolphinMainWindow;
class QWidget;
/**
* @brief Page for the 'View' settings of the Dolphin settings dialog.
@ -37,7 +36,7 @@ class ViewSettingsPage : public SettingsPageBase
Q_OBJECT
public:
ViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
ViewSettingsPage(QWidget* parent);
virtual ~ViewSettingsPage();
/** @see SettingsPageBase::applySettings() */