1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
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 "kcmdolphingeneral.h"
25 #include <KPluginFactory>
26 #include <KPluginLoader>
29 #include <settings/general/behaviorsettingspage.h>
30 #include <settings/general/previewssettingspage.h>
31 #include <settings/general/confirmationssettingspage.h>
34 #include <QVBoxLayout>
36 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory
, registerPlugin
<DolphinGeneralConfigModule
>("dolphingeneral");)
37 K_EXPORT_PLUGIN(KCMDolphinGeneralConfigFactory("kcmdolphingeneral"))
39 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget
* parent
, const QVariantList
& args
) :
45 KGlobal::locale()->insertCatalog("dolphin");
47 setButtons(KCModule::Default
| KCModule::Help
);
49 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
50 topLayout
->setMargin(0);
51 topLayout
->setSpacing(KDialog::spacingHint());
53 KTabWidget
* tabWidget
= new KTabWidget(this);
55 // initialize 'Behavior' tab
56 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(QDir::homePath(), tabWidget
);
57 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
58 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
60 // initialize 'Previews' tab
61 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
62 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
63 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
65 // initialize 'Confirmations' tab
66 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
67 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
68 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
70 m_pages
.append(behaviorPage
);
71 m_pages
.append(previewsPage
);
72 m_pages
.append(confirmationsPage
);
74 topLayout
->addWidget(tabWidget
, 0, 0);
77 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
81 void DolphinGeneralConfigModule::save()
83 foreach (SettingsPageBase
* page
, m_pages
) {
84 page
->applySettings();
88 void DolphinGeneralConfigModule::defaults()
90 foreach (SettingsPageBase
* page
, m_pages
) {
91 page
->applySettings();
95 #include "kcmdolphingeneral.moc"