2 * SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #include "kcmdolphingeneral.h"
9 #include "settings/general/behaviorsettingspage.h"
10 #include "settings/general/previewssettingspage.h"
11 #include "settings/general/confirmationssettingspage.h"
13 #include <KLocalizedString>
14 #include <KPluginFactory>
15 #include <kconfigwidgets_version.h>
18 #include <QVBoxLayout>
20 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory
, registerPlugin
<DolphinGeneralConfigModule
>(QStringLiteral("dolphingeneral"));)
22 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget
*parent
, const QVariantList
&args
) :
23 KCModule(parent
, args
),
26 setButtons(KCModule::Default
| KCModule::Help
);
28 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
29 topLayout
->setContentsMargins(0, 0, 0, 0);
31 QTabWidget
* tabWidget
= new QTabWidget(this);
33 // initialize 'Behavior' tab
34 BehaviorSettingsPage
* behaviorPage
= new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget
);
35 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
36 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
38 // initialize 'Previews' tab
39 PreviewsSettingsPage
* previewsPage
= new PreviewsSettingsPage(tabWidget
);
40 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
41 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
43 // initialize 'Confirmations' tab
44 ConfirmationsSettingsPage
* confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
45 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
46 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
47 m_pages
.append(behaviorPage
);
48 m_pages
.append(previewsPage
);
49 m_pages
.append(confirmationsPage
);
51 topLayout
->addWidget(tabWidget
, 0, {});
54 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
58 void DolphinGeneralConfigModule::save()
60 for (SettingsPageBase
* page
: qAsConst(m_pages
)) {
61 page
->applySettings();
65 void DolphinGeneralConfigModule::defaults()
67 for (SettingsPageBase
* page
: qAsConst(m_pages
)) {
68 page
->applySettings();
72 #include "kcmdolphingeneral.moc"