mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Layout improvements for settings
- Handle 'Context Menu' settings as part of the services - Handle 'Version Control' settings as part of the services - Move the confirmations-settings into own tab - Use combobox for view-property settings - A lot of minor spacing cleanups
This commit is contained in:
parent
05082aed16
commit
e0ac8b61fb
|
@ -145,7 +145,7 @@ set(dolphin_SRCS
|
|||
search/dolphinsearchinformation.cpp
|
||||
settings/general/behaviorsettingspage.cpp
|
||||
settings/general/configurepreviewplugindialog.cpp
|
||||
settings/general/contextmenusettingspage.cpp
|
||||
settings/general/confirmationssettingspage.cpp
|
||||
settings/general/generalsettingspage.cpp
|
||||
settings/general/previewssettingspage.cpp
|
||||
settings/general/statusbarsettingspage.cpp
|
||||
|
@ -239,7 +239,7 @@ set(kcm_dolphingeneral_PART_SRCS
|
|||
settings/general/behaviorsettingspage.cpp
|
||||
settings/general/previewssettingspage.cpp
|
||||
settings/general/configurepreviewplugindialog.cpp
|
||||
settings/general/contextmenusettingspage.cpp
|
||||
settings/general/confirmationssettingspage.cpp
|
||||
settings/settingspagebase.cpp
|
||||
settings/serviceitemdelegate.cpp
|
||||
settings/servicemodel.cpp)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "dolphin_generalsettings.h"
|
||||
|
||||
#include <KComboBox>
|
||||
#include <KDialog>
|
||||
#include <KLocale>
|
||||
|
||||
|
@ -34,48 +35,27 @@
|
|||
|
||||
#include <views/viewproperties.h>
|
||||
|
||||
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_viewProps(0),
|
||||
m_showToolTips(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);
|
||||
// View properties
|
||||
QLabel* viewPropsLabel = new QLabel(i18nc("@label", "View properties:"), this);
|
||||
|
||||
m_localProps = new QRadioButton(i18nc("@option:radio", "Remember view properties for each folder"), propsBox);
|
||||
m_viewProps = new KComboBox(this);
|
||||
const bool useGlobalProps = true;
|
||||
m_viewProps->addItem(i18nc("@option:radio", "Remember view properties for each folder"), !useGlobalProps);
|
||||
m_viewProps->addItem(i18nc("@option:radio", "Use common view properties for all folders"), useGlobalProps);
|
||||
|
||||
m_globalProps = new QRadioButton(i18nc("@option:radio", "Use common view properties for all folders"), propsBox);
|
||||
|
||||
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);
|
||||
m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for Confirmation When",
|
||||
"Deleting files or folders"), confirmBox);
|
||||
m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for Confirmation When",
|
||||
"Closing windows with multiple tabs"), confirmBox);
|
||||
|
||||
QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox);
|
||||
confirmBoxLayout->addWidget(m_confirmMoveToTrash);
|
||||
confirmBoxLayout->addWidget(m_confirmDelete);
|
||||
confirmBoxLayout->addWidget(m_confirmClosingMultipleTabs);
|
||||
QHBoxLayout* viewPropsLayout = new QHBoxLayout(this);
|
||||
viewPropsLayout->addWidget(viewPropsLabel, 0, Qt::AlignRight);
|
||||
viewPropsLayout->addWidget(m_viewProps);
|
||||
|
||||
// 'Show tooltips'
|
||||
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), this);
|
||||
|
@ -86,8 +66,9 @@ BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) :
|
|||
// 'Natural sorting of items'
|
||||
m_naturalSorting = new QCheckBox(i18nc("option:check", "Natural sorting of items"), this);
|
||||
|
||||
topLayout->addWidget(propsBox);
|
||||
topLayout->addWidget(confirmBox);
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addLayout(viewPropsLayout);
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(m_showToolTips);
|
||||
topLayout->addWidget(m_showSelectionToggle);
|
||||
topLayout->addWidget(m_naturalSorting);
|
||||
|
@ -95,11 +76,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) :
|
|||
|
||||
loadSettings();
|
||||
|
||||
connect(m_localProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_globalProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_viewProps, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
||||
connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
@ -111,13 +88,17 @@ BehaviorSettingsPage::~BehaviorSettingsPage()
|
|||
|
||||
void BehaviorSettingsPage::applySettings()
|
||||
{
|
||||
GeneralSettings* settings = GeneralSettings::self();
|
||||
ViewProperties props(m_url); // read current view properties
|
||||
|
||||
const bool useGlobalProps = m_globalProps->isChecked();
|
||||
|
||||
GeneralSettings* settings = GeneralSettings::self();
|
||||
const int index = m_viewProps->currentIndex();
|
||||
const bool useGlobalProps = m_viewProps->itemData(index).toBool();
|
||||
settings->setGlobalViewProps(useGlobalProps);
|
||||
|
||||
settings->setShowToolTips(m_showToolTips->isChecked());
|
||||
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
|
||||
settings->writeConfig();
|
||||
|
||||
if (useGlobalProps) {
|
||||
// Remember the global view properties by applying the current view properties.
|
||||
// It is important that GeneralSettings::globalViewProps() is set before
|
||||
|
@ -127,17 +108,6 @@ void BehaviorSettingsPage::applySettings()
|
|||
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->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");
|
||||
|
@ -152,24 +122,13 @@ void BehaviorSettingsPage::restoreDefaults()
|
|||
settings->useDefaults(true);
|
||||
loadSettings();
|
||||
settings->useDefaults(false);
|
||||
m_confirmMoveToTrash->setChecked(CONFIRM_TRASH);
|
||||
m_confirmDelete->setChecked(CONFIRM_DELETE);
|
||||
}
|
||||
|
||||
void BehaviorSettingsPage::loadSettings()
|
||||
{
|
||||
if (GeneralSettings::globalViewProps()) {
|
||||
m_globalProps->setChecked(true);
|
||||
} else {
|
||||
m_localProps->setChecked(true);
|
||||
}
|
||||
const int index = (m_viewProps->itemData(0).toBool() == GeneralSettings::globalViewProps()) ? 0 : 1;
|
||||
m_viewProps->setCurrentIndex(index);
|
||||
|
||||
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(GeneralSettings::confirmClosingMultipleTabs());
|
||||
m_showToolTips->setChecked(GeneralSettings::showToolTips());
|
||||
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
|
||||
m_naturalSorting->setChecked(KGlobalSettings::naturalSorting());
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <settings/settingspagebase.h>
|
||||
#include <KUrl>
|
||||
|
||||
class KComboBox;
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
|
@ -50,12 +51,7 @@ private:
|
|||
private:
|
||||
KUrl m_url;
|
||||
|
||||
QRadioButton* m_localProps;
|
||||
QRadioButton* m_globalProps;
|
||||
|
||||
QCheckBox* m_confirmMoveToTrash;
|
||||
QCheckBox* m_confirmDelete;
|
||||
QCheckBox* m_confirmClosingMultipleTabs;
|
||||
KComboBox* m_viewProps;
|
||||
|
||||
QCheckBox* m_showToolTips;
|
||||
QLabel* m_configureToolTips;
|
||||
|
|
106
src/settings/general/confirmationssettingspage.cpp
Normal file
106
src/settings/general/confirmationssettingspage.cpp
Normal file
|
@ -0,0 +1,106 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) 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 "confirmationssettingspage.h"
|
||||
|
||||
#include <dolphin_generalsettings.h>
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocale>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace {
|
||||
const bool ConfirmTrash = false;
|
||||
const bool ConfirmDelete = true;
|
||||
}
|
||||
|
||||
ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) :
|
||||
SettingsPageBase(parent),
|
||||
m_confirmMoveToTrash(0),
|
||||
m_confirmDelete(0),
|
||||
m_confirmClosingMultipleTabs(0)
|
||||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
|
||||
QLabel* confirmLabel = new QLabel(i18nc("@title:group", "Ask for confirmation when:"), this);
|
||||
|
||||
m_confirmMoveToTrash = new QCheckBox(i18nc("@option:check Ask for confirmation when",
|
||||
"Moving files or folders to trash"), this);
|
||||
m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for confirmation when",
|
||||
"Deleting files or folders"), this);
|
||||
m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for confirmation when",
|
||||
"Closing windows with multiple tabs"), this);
|
||||
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(confirmLabel);
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(m_confirmMoveToTrash);
|
||||
topLayout->addWidget(m_confirmDelete);
|
||||
topLayout->addWidget(m_confirmClosingMultipleTabs);
|
||||
topLayout->addStretch();
|
||||
|
||||
loadSettings();
|
||||
|
||||
connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
}
|
||||
|
||||
ConfirmationsSettingsPage::~ConfirmationsSettingsPage()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfirmationsSettingsPage::applySettings()
|
||||
{
|
||||
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();
|
||||
|
||||
GeneralSettings* settings = GeneralSettings::self();
|
||||
settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked());
|
||||
settings->writeConfig();
|
||||
}
|
||||
|
||||
void ConfirmationsSettingsPage::restoreDefaults()
|
||||
{
|
||||
GeneralSettings* settings = GeneralSettings::self();
|
||||
settings->useDefaults(true);
|
||||
loadSettings();
|
||||
settings->useDefaults(false);
|
||||
|
||||
m_confirmMoveToTrash->setChecked(ConfirmTrash);
|
||||
m_confirmDelete->setChecked(ConfirmDelete);
|
||||
}
|
||||
|
||||
void ConfirmationsSettingsPage::loadSettings()
|
||||
{
|
||||
KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::IncludeGlobals);
|
||||
const KConfigGroup confirmationGroup(kioConfig, "Confirmations");
|
||||
m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", ConfirmTrash));
|
||||
m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", ConfirmDelete));
|
||||
|
||||
m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs());
|
||||
}
|
||||
|
||||
#include "confirmationssettingspage.moc"
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
|
||||
* Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
@ -16,23 +16,23 @@
|
|||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
#ifndef CONTEXTMENUSETTINGSPAGE_H
|
||||
#define CONTEXTMENUSETTINGSPAGE_H
|
||||
#ifndef CONFIRMATIONSSETTINGSPAGE_H
|
||||
#define CONFIRMATIONSSETTINGSPAGE_H
|
||||
|
||||
#include <settings/settingspagebase.h>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
/**
|
||||
* @brief Page for the 'Context Menu' settings of the Dolphin settings dialog.
|
||||
* @brief Page for the enabling or disabling confirmation dialogs.
|
||||
*/
|
||||
class ContextMenuSettingsPage : public SettingsPageBase
|
||||
class ConfirmationsSettingsPage : public SettingsPageBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ContextMenuSettingsPage(QWidget* parent);
|
||||
virtual ~ContextMenuSettingsPage();
|
||||
ConfirmationsSettingsPage(QWidget* parent);
|
||||
virtual ~ConfirmationsSettingsPage();
|
||||
|
||||
/** @see SettingsPageBase::applySettings() */
|
||||
virtual void applySettings();
|
||||
|
@ -44,8 +44,9 @@ private:
|
|||
void loadSettings();
|
||||
|
||||
private:
|
||||
QCheckBox* m_showDeleteCommand;
|
||||
QCheckBox* m_showCopyMoveMenu;
|
||||
QCheckBox* m_confirmMoveToTrash;
|
||||
QCheckBox* m_confirmDelete;
|
||||
QCheckBox* m_confirmClosingMultipleTabs;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,92 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) 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 <dolphin_generalsettings.h>
|
||||
|
||||
#include <KDialog>
|
||||
#include <KLocale>
|
||||
#include <KVBox>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
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);
|
||||
|
||||
m_showCopyMoveMenu = new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands"), vBox);
|
||||
|
||||
// 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();
|
||||
|
||||
connect(m_showDeleteCommand, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_showCopyMoveMenu, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
}
|
||||
|
||||
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::setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked());
|
||||
GeneralSettings::self()->writeConfig();
|
||||
}
|
||||
|
||||
void ContextMenuSettingsPage::restoreDefaults()
|
||||
{
|
||||
GeneralSettings* settings = GeneralSettings::self();
|
||||
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));
|
||||
|
||||
m_showCopyMoveMenu->setChecked(GeneralSettings::showCopyMoveMenu());
|
||||
}
|
||||
|
||||
#include "contextmenusettingspage.moc"
|
|
@ -21,7 +21,7 @@
|
|||
#include "generalsettingspage.h"
|
||||
|
||||
#include "behaviorsettingspage.h"
|
||||
#include "contextmenusettingspage.h"
|
||||
#include "confirmationssettingspage.h"
|
||||
#include "previewssettingspage.h"
|
||||
#include <settings/settingspagebase.h>
|
||||
#include "statusbarsettingspage.h"
|
||||
|
@ -54,9 +54,9 @@ GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) :
|
|||
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()));
|
||||
ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
|
||||
tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
|
||||
connect(confirmationsPage, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
// initialize 'Status Bar' tab
|
||||
StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget);
|
||||
|
@ -65,7 +65,7 @@ GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) :
|
|||
|
||||
m_pages.append(behaviorPage);
|
||||
m_pages.append(previewsPage);
|
||||
m_pages.append(contextMenuPage);
|
||||
m_pages.append(confirmationsPage);
|
||||
m_pages.append(statusBarPage);
|
||||
|
||||
topLayout->addWidget(tabWidget, 0, 0);
|
||||
|
|
|
@ -59,11 +59,8 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
|
|||
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);
|
||||
QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews for:"), this);
|
||||
|
||||
m_listView = new QListView(this);
|
||||
|
||||
|
@ -80,11 +77,6 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
|
|||
m_listView->setItemDelegate(delegate);
|
||||
m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
|
||||
|
||||
QVBoxLayout* listBoxLayout = new QVBoxLayout(listBox);
|
||||
listBoxLayout->setSpacing(KDialog::spacingHint());
|
||||
listBoxLayout->setMargin(KDialog::marginHint());
|
||||
listBoxLayout->addWidget(m_listView);
|
||||
|
||||
QLabel* remoteFileSizeLabel = new QLabel(i18nc("@label", "Skip previews for remote files above:"), this);
|
||||
|
||||
m_remoteFileSizeBox = new KIntSpinBox(this);
|
||||
|
@ -96,7 +88,9 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
|
|||
fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight);
|
||||
fileSizeBoxLayout->addWidget(m_remoteFileSizeBox);
|
||||
|
||||
topLayout->addWidget(listBox);
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(showPreviewsLabel);
|
||||
topLayout->addWidget(m_listView);
|
||||
topLayout->addLayout(fileSizeBoxLayout);
|
||||
|
||||
loadSettings();
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <KDialog>
|
||||
#include <KLocale>
|
||||
#include <KVBox>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -33,20 +32,14 @@ StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) :
|
|||
m_showZoomSlider(0),
|
||||
m_showSpaceInfo(0)
|
||||
{
|
||||
m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), this);
|
||||
m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this);
|
||||
|
||||
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);
|
||||
|
||||
m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), vBox);
|
||||
|
||||
// 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);
|
||||
topLayout->addSpacing(KDialog::spacingHint());
|
||||
topLayout->addWidget(m_showZoomSlider);
|
||||
topLayout->addWidget(m_showSpaceInfo);
|
||||
topLayout->addStretch();
|
||||
|
||||
loadSettings();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <settings/general/behaviorsettingspage.h>
|
||||
#include <settings/general/previewssettingspage.h>
|
||||
#include <settings/general/contextmenusettingspage.h>
|
||||
#include <settings/general/confirmationssettingspage.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -61,14 +61,14 @@ DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QV
|
|||
tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
|
||||
connect(previewsPage, SIGNAL(changed()), this, SLOT(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, SLOT(changed()));
|
||||
// initialize 'Confirmations' tab
|
||||
ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
|
||||
tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
|
||||
connect(confirmationsPage, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
m_pages.append(behaviorPage);
|
||||
m_pages.append(previewsPage);
|
||||
m_pages.append(contextMenuPage);
|
||||
m_pages.append(confirmationsPage);
|
||||
|
||||
topLayout->addWidget(tabWidget, 0, 0);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "servicessettingspage.h"
|
||||
|
||||
#include "dolphin_generalsettings.h"
|
||||
#include "dolphin_versioncontrolsettings.h"
|
||||
|
||||
#include <KConfig>
|
||||
|
@ -45,12 +46,20 @@
|
|||
#include <QSortFilterProxyModel>
|
||||
#include <QShowEvent>
|
||||
|
||||
namespace
|
||||
{
|
||||
const bool ShowDeleteDefault = false;
|
||||
const char* VersionControlServicePrefix = "_version_control_";
|
||||
const char* DeleteService = "_delete";
|
||||
const char* CopyToMoveToService ="_copy_to_move_to";
|
||||
}
|
||||
|
||||
ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
|
||||
SettingsPageBase(parent),
|
||||
m_initialized(false),
|
||||
m_serviceModel(0),
|
||||
m_sortModel(0),
|
||||
m_listView(0),
|
||||
m_vcsGroupBox(0),
|
||||
m_vcsPluginsMap(),
|
||||
m_enabledVcsPlugins()
|
||||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
|
@ -62,11 +71,11 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
|
|||
|
||||
m_listView = new QListView(this);
|
||||
ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView);
|
||||
ServiceModel* serviceModel = new ServiceModel(this);
|
||||
QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
|
||||
proxyModel->setSourceModel(serviceModel);
|
||||
proxyModel->setSortRole(Qt::DisplayRole);
|
||||
m_listView->setModel(proxyModel);
|
||||
m_serviceModel = new ServiceModel(this);
|
||||
m_sortModel = new QSortFilterProxyModel(this);
|
||||
m_sortModel->setSourceModel(m_serviceModel);
|
||||
m_sortModel->setSortRole(Qt::DisplayRole);
|
||||
m_listView->setModel(m_sortModel);
|
||||
m_listView->setItemDelegate(delegate);
|
||||
m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
|
||||
connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed()));
|
||||
|
@ -76,17 +85,12 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
|
|||
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_listView);
|
||||
topLayout->addWidget(downloadButton);
|
||||
topLayout->addWidget(m_vcsGroupBox);
|
||||
|
||||
m_enabledVcsPlugins = VersionControlSettings::enabledPlugins();
|
||||
qSort(m_enabledVcsPlugins);
|
||||
}
|
||||
|
||||
ServicesSettingsPage::~ServicesSettingsPage()
|
||||
|
@ -99,30 +103,36 @@ void ServicesSettingsPage::applySettings()
|
|||
return;
|
||||
}
|
||||
|
||||
// Apply service menu settingsentries
|
||||
KConfig config("kservicemenurc", KConfig::NoGlobals);
|
||||
KConfigGroup showGroup = config.group("Show");
|
||||
|
||||
QStringList enabledPlugins;
|
||||
|
||||
const QAbstractItemModel* model = m_listView->model();
|
||||
for (int i = 0; i < model->rowCount(); ++i) {
|
||||
const QModelIndex index = model->index(i, 0);
|
||||
const bool show = model->data(index, Qt::CheckStateRole).toBool();
|
||||
const QString service = model->data(index, ServiceModel::DesktopEntryNameRole).toString();
|
||||
showGroup.writeEntry(service, show);
|
||||
const bool checked = model->data(index, Qt::CheckStateRole).toBool();
|
||||
|
||||
if (service.startsWith(VersionControlServicePrefix)) {
|
||||
if (checked) {
|
||||
enabledPlugins.append(model->data(index, Qt::DisplayRole).toString());
|
||||
}
|
||||
} else if (service == QLatin1String(DeleteService)) {
|
||||
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
|
||||
KConfigGroup configGroup(globalConfig, "KDE");
|
||||
configGroup.writeEntry("ShowDeleteCommand", checked);
|
||||
configGroup.sync();
|
||||
} else if (service == QLatin1String(CopyToMoveToService)) {
|
||||
GeneralSettings::setShowCopyMoveMenu(checked);
|
||||
GeneralSettings::self()->writeConfig();
|
||||
} else {
|
||||
showGroup.writeEntry(service, checked);
|
||||
}
|
||||
}
|
||||
|
||||
showGroup.sync();
|
||||
|
||||
// Apply version control settings
|
||||
QStringList enabledPlugins;
|
||||
QMap<QString, QCheckBox*>::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();
|
||||
|
@ -140,7 +150,12 @@ void ServicesSettingsPage::restoreDefaults()
|
|||
QAbstractItemModel* model = m_listView->model();
|
||||
for (int i = 0; i < model->rowCount(); ++i) {
|
||||
const QModelIndex index = model->index(i, 0);
|
||||
model->setData(index, true, Qt::CheckStateRole);
|
||||
const QString service = model->data(index, ServiceModel::DesktopEntryNameRole).toString();
|
||||
|
||||
const bool checked = !service.startsWith(VersionControlServicePrefix)
|
||||
&& service != QLatin1String(DeleteService)
|
||||
&& service != QLatin1String(CopyToMoveToService);
|
||||
model->setData(index, checked, Qt::CheckStateRole);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +163,25 @@ void ServicesSettingsPage::showEvent(QShowEvent* event)
|
|||
{
|
||||
if (!event->spontaneous() && !m_initialized) {
|
||||
loadServices();
|
||||
|
||||
loadVersionControlSystems();
|
||||
|
||||
// Add "Show 'Delete' command" as service
|
||||
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
|
||||
KConfigGroup configGroup(globalConfig, "KDE");
|
||||
addRow("edit-delete",
|
||||
i18nc("@option:check", "Delete"),
|
||||
DeleteService,
|
||||
configGroup.readEntry("ShowDeleteCommand", ShowDeleteDefault));
|
||||
|
||||
// Add "Show 'Copy To' and 'Move To' commands" as service
|
||||
addRow("edit-copy",
|
||||
i18nc("@option:check", "'Copy To' and 'Move To' commands"),
|
||||
CopyToMoveToService,
|
||||
GeneralSettings::showCopyMoveMenu());
|
||||
|
||||
m_sortModel->sort(Qt::DisplayRole);
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
SettingsPageBase::showEvent(event);
|
||||
|
@ -156,8 +189,6 @@ void ServicesSettingsPage::showEvent(QShowEvent* event)
|
|||
|
||||
void ServicesSettingsPage::loadServices()
|
||||
{
|
||||
QAbstractItemModel* model = m_listView->model();
|
||||
|
||||
const KConfig config("kservicemenurc", KConfig::NoGlobals);
|
||||
const KConfigGroup showGroup = config.group("Show");
|
||||
|
||||
|
@ -181,14 +212,8 @@ void ServicesSettingsPage::loadServices()
|
|||
const QString itemName = subMenuName.isEmpty()
|
||||
? action.text()
|
||||
: i18nc("@item:inmenu", "%1: %2", subMenuName, action.text());
|
||||
const bool show = showGroup.readEntry(serviceName, true);
|
||||
|
||||
model->insertRow(0);
|
||||
const QModelIndex index = model->index(0, 0);
|
||||
model->setData(index, action.icon(), Qt::DecorationRole);
|
||||
model->setData(index, show, Qt::CheckStateRole);
|
||||
model->setData(index, itemName, Qt::DisplayRole);
|
||||
model->setData(index, serviceName, ServiceModel::DesktopEntryNameRole);
|
||||
const bool checked = showGroup.readEntry(serviceName, true);
|
||||
addRow(action.icon(), itemName, serviceName, checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,18 +223,12 @@ void ServicesSettingsPage::loadServices()
|
|||
foreach (const KSharedPtr<KService>& service, pluginServices) {
|
||||
const QString desktopEntryName = service->desktopEntryName();
|
||||
if (!isInServicesList(desktopEntryName)) {
|
||||
const bool show = showGroup.readEntry(desktopEntryName, true);
|
||||
|
||||
model->insertRow(0);
|
||||
const QModelIndex index = model->index(0, 0);
|
||||
model->setData(index, service->icon(), Qt::DecorationRole);
|
||||
model->setData(index, show, Qt::CheckStateRole);
|
||||
model->setData(index, service->name(), Qt::DisplayRole);
|
||||
model->setData(index, desktopEntryName, ServiceModel::DesktopEntryNameRole);
|
||||
const bool checked = showGroup.readEntry(desktopEntryName, true);
|
||||
addRow(service->icon(), service->name(), desktopEntryName, checked);
|
||||
}
|
||||
}
|
||||
|
||||
model->sort(Qt::DisplayRole);
|
||||
m_sortModel->sort(Qt::DisplayRole);
|
||||
}
|
||||
|
||||
void ServicesSettingsPage::loadVersionControlSystems()
|
||||
|
@ -220,39 +239,38 @@ void ServicesSettingsPage::loadVersionControlSystems()
|
|||
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);
|
||||
addRow("code-class",
|
||||
pluginName,
|
||||
VersionControlServicePrefix + pluginName,
|
||||
enabledPlugins.contains(pluginName));
|
||||
}
|
||||
|
||||
// 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<QString, QCheckBox*>::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());
|
||||
m_sortModel->sort(Qt::DisplayRole);
|
||||
}
|
||||
|
||||
bool ServicesSettingsPage::isInServicesList(const QString& service) const
|
||||
{
|
||||
QAbstractItemModel* model = m_listView->model();
|
||||
for (int i = 0; i < model->rowCount(); ++i) {
|
||||
const QModelIndex index = model->index(i, 0);
|
||||
if (model->data(index, ServiceModel::DesktopEntryNameRole).toString() == service) {
|
||||
for (int i = 0; i < m_serviceModel->rowCount(); ++i) {
|
||||
const QModelIndex index = m_serviceModel->index(i, 0);
|
||||
if (m_serviceModel->data(index, ServiceModel::DesktopEntryNameRole).toString() == service) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ServicesSettingsPage::addRow(const QString& icon,
|
||||
const QString& text,
|
||||
const QString& value,
|
||||
bool checked)
|
||||
{
|
||||
m_serviceModel->insertRow(0);
|
||||
|
||||
const QModelIndex index = m_serviceModel->index(0, 0);
|
||||
m_serviceModel->setData(index, icon, Qt::DecorationRole);
|
||||
m_serviceModel->setData(index, text, Qt::DisplayRole);
|
||||
m_serviceModel->setData(index, value, ServiceModel::DesktopEntryNameRole);
|
||||
m_serviceModel->setData(index, checked, Qt::CheckStateRole);
|
||||
}
|
||||
|
||||
#include "servicessettingspage.moc"
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
class QListView;
|
||||
class QSortFilterProxyModel;
|
||||
class ServiceModel;
|
||||
|
||||
/**
|
||||
* @brief Page for the 'Services' settings of the Dolphin settings dialog.
|
||||
|
@ -62,11 +64,19 @@ private:
|
|||
|
||||
bool isInServicesList(const QString& service) const;
|
||||
|
||||
/**
|
||||
* Adds a row to the model of m_listView.
|
||||
*/
|
||||
void addRow(const QString& icon,
|
||||
const QString& text,
|
||||
const QString& value,
|
||||
bool checked);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
QListView *m_listView;
|
||||
QGroupBox* m_vcsGroupBox;
|
||||
QMap<QString, QCheckBox*> m_vcsPluginsMap;
|
||||
ServiceModel* m_serviceModel;
|
||||
QSortFilterProxyModel* m_sortModel;
|
||||
QListView* m_listView;
|
||||
QStringList m_enabledVcsPlugins;
|
||||
};
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ void DolphinFontRequester::setMode(Mode mode)
|
|||
{
|
||||
m_mode = mode;
|
||||
m_modeCombo->setCurrentIndex(m_mode);
|
||||
m_modeCombo->setFont(customFont());
|
||||
m_chooseFontButton->setEnabled(m_mode == CustomFont);
|
||||
}
|
||||
|
||||
|
@ -86,14 +85,6 @@ QFont DolphinFontRequester::customFont() const
|
|||
return m_customFont;
|
||||
}
|
||||
|
||||
bool DolphinFontRequester::event(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Polish) {
|
||||
m_modeCombo->setFont(customFont());
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void DolphinFontRequester::openFontDialog()
|
||||
{
|
||||
QFont font = m_customFont;
|
||||
|
|
|
@ -60,9 +60,6 @@ signals:
|
|||
/** Is emitted, if the font has been changed. */
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event);
|
||||
|
||||
private slots:
|
||||
void openFontDialog();
|
||||
void changeMode(int index);
|
||||
|
|
Loading…
Reference in a new issue