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/confirmationssettingspage.h"
11 #include "settings/general/previewssettingspage.h"
13 #include <KLocalizedString>
14 #include <KPluginFactory>
15 #include <kconfigwidgets_version.h>
18 #include <QVBoxLayout>
20 K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule
, "kcmdolphingeneral.json")
22 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject
*parent
, const KPluginMetaData
&data
)
23 : KCModule(qobject_cast
<QWidget
*>(parent
), data
)
26 setButtons(KCModule::Default
| KCModule::Help
| KCModule::Apply
);
28 const auto parentWidget
= qobject_cast
<QWidget
*>(parent
);
29 QVBoxLayout
*topLayout
= new QVBoxLayout(parentWidget
);
30 topLayout
->setContentsMargins(0, 0, 0, 0);
32 QTabWidget
*tabWidget
= new QTabWidget(parentWidget
);
34 // initialize 'Behavior' tab
35 BehaviorSettingsPage
*behaviorPage
= new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget
);
36 tabWidget
->addTab(behaviorPage
, i18nc("@title:tab Behavior settings", "Behavior"));
37 connect(behaviorPage
, &BehaviorSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
39 // initialize 'Previews' tab
40 PreviewsSettingsPage
*previewsPage
= new PreviewsSettingsPage(tabWidget
);
41 tabWidget
->addTab(previewsPage
, i18nc("@title:tab Previews settings", "Previews"));
42 connect(previewsPage
, &PreviewsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
44 // initialize 'Confirmations' tab
45 ConfirmationsSettingsPage
*confirmationsPage
= new ConfirmationsSettingsPage(tabWidget
);
46 tabWidget
->addTab(confirmationsPage
, i18nc("@title:tab Confirmations settings", "Confirmations"));
47 connect(confirmationsPage
, &ConfirmationsSettingsPage::changed
, this, &DolphinGeneralConfigModule::markAsChanged
);
48 m_pages
.append(behaviorPage
);
49 m_pages
.append(previewsPage
);
50 m_pages
.append(confirmationsPage
);
52 topLayout
->addWidget(tabWidget
, 0, {});
55 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
59 void DolphinGeneralConfigModule::save()
61 for (SettingsPageBase
*page
: qAsConst(m_pages
)) {
62 page
->applySettings();
66 void DolphinGeneralConfigModule::defaults()
68 for (SettingsPageBase
*page
: qAsConst(m_pages
)) {
69 page
->applySettings();
73 #include "kcmdolphingeneral.moc"