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 "settings/general/behaviorsettingspage.h"
23 #include "settings/general/previewssettingspage.h"
24 #include "settings/general/confirmationssettingspage.h"
26 #include <KLocalizedString>
27 #include <KPluginFactory>
28 #include <KPluginLoader>
29 #include <kconfigwidgets_version.h>
32 #include <QVBoxLayout>
34 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory
, registerPlugin
<DolphinGeneralConfigModule
>(QStringLiteral("dolphingeneral"));)
36 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget
*parent
, const QVariantList
&args
) :
37 KCModule(parent
, args
),
40 setButtons(KCModule::Default
| KCModule::Help
);
42 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
43 topLayout
->setContentsMargins(0, 0, 0, 0);
45 QTabWidget
* tabWidget
= new QTabWidget(this);
47 // initialize 'Behavior' tab
48 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget
);
49 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
50 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
52 // initialize 'Previews' tab
53 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
54 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
55 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
57 // initialize 'Confirmations' tab
58 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
59 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
60 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
61 m_pages
.append(behaviorPage
);
62 m_pages
.append(previewsPage
);
63 m_pages
.append(confirmationsPage
);
65 topLayout
->addWidget(tabWidget
, 0, {});
68 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
72 void DolphinGeneralConfigModule::save()
74 for (SettingsPageBase
* page
: qAsConst(m_pages
)) {
75 page
->applySettings();
79 void DolphinGeneralConfigModule::defaults()
81 for (SettingsPageBase
* page
: qAsConst(m_pages
)) {
82 page
->applySettings();
86 #include "kcmdolphingeneral.moc"