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"
22 #include <KLocalizedString>
23 #include <KPluginFactory>
24 #include <KPluginLoader>
26 #include <settings/general/behaviorsettingspage.h>
27 #include <settings/general/previewssettingspage.h>
28 #include <settings/general/confirmationssettingspage.h>
31 #include <QVBoxLayout>
34 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory
, registerPlugin
<DolphinGeneralConfigModule
>(QStringLiteral("dolphingeneral"));)
36 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget
* parent
, const QVariantList
& args
) :
42 setButtons(KCModule::Default
| KCModule::Help
);
44 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
45 topLayout
->setMargin(0);
47 QTabWidget
* tabWidget
= new QTabWidget(this);
49 // initialize 'Behavior' tab
50 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget
);
51 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
52 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
54 // initialize 'Previews' tab
55 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
56 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
57 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
59 // initialize 'Confirmations' tab
60 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
61 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
62 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed
));
64 m_pages
.append(behaviorPage
);
65 m_pages
.append(previewsPage
);
66 m_pages
.append(confirmationsPage
);
68 topLayout
->addWidget(tabWidget
, 0, 0);
71 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
75 void DolphinGeneralConfigModule::save()
77 foreach (SettingsPageBase
* page
, m_pages
) {
78 page
->applySettings();
82 void DolphinGeneralConfigModule::defaults()
84 foreach (SettingsPageBase
* page
, m_pages
) {
85 page
->applySettings();
89 #include "kcmdolphingeneral.moc"