1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "contextmenusettingspage.h"
21 #include "dolphinsettings.h"
22 #include "dolphin_generalsettings.h"
29 #include <QVBoxLayout>
31 ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget
* parent
) :
32 SettingsPageBase(parent
),
33 m_showDeleteCommand(0),
36 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
37 KVBox
* vBox
= new KVBox(this);
38 vBox
->setSpacing(KDialog::spacingHint());
40 m_showDeleteCommand
= new QCheckBox(i18nc("@option:check", "Show 'Delete' command"), vBox
);
41 connect(m_showDeleteCommand
, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
43 m_showCopyMoveMenu
= new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands"), vBox
);
44 connect(m_showCopyMoveMenu
, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
46 // Add a dummy widget with no restriction regarding
47 // a vertical resizing. This assures that the dialog layout
48 // is not stretched vertically.
51 topLayout
->addWidget(vBox
);
56 ContextMenuSettingsPage::~ContextMenuSettingsPage()
60 void ContextMenuSettingsPage::applySettings()
62 KSharedConfig::Ptr globalConfig
= KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals
);
63 KConfigGroup
configGroup(globalConfig
, "KDE");
64 configGroup
.writeEntry("ShowDeleteCommand", m_showDeleteCommand
->isChecked());
67 GeneralSettings
* settings
= DolphinSettings::instance().generalSettings();
68 settings
->setShowCopyMoveMenu(m_showCopyMoveMenu
->isChecked());
71 void ContextMenuSettingsPage::restoreDefaults()
73 GeneralSettings
* settings
= DolphinSettings::instance().generalSettings();
74 settings
->setDefaults();
78 void ContextMenuSettingsPage::loadSettings()
80 KSharedConfig::Ptr globalConfig
= KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals
);
81 KConfigGroup
configGroup(globalConfig
, "KDE");
82 m_showDeleteCommand
->setChecked(configGroup
.readEntry("ShowDeleteCommand", false));
84 GeneralSettings
* settings
= DolphinSettings::instance().generalSettings();
85 m_showCopyMoveMenu
->setChecked(settings
->showCopyMoveMenu());
88 #include "contextmenusettingspage.moc"