]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphingeneral.cpp
Output of licensedigger + manual cleanup afterwards.
[dolphin.git] / src / settings / kcm / kcmdolphingeneral.cpp
1 /*
2 * SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #include "kcmdolphingeneral.h"
8
9 #include "settings/general/behaviorsettingspage.h"
10 #include "settings/general/previewssettingspage.h"
11 #include "settings/general/confirmationssettingspage.h"
12
13 #include <KLocalizedString>
14 #include <KPluginFactory>
15 #include <KPluginLoader>
16 #include <kconfigwidgets_version.h>
17
18 #include <QTabWidget>
19 #include <QVBoxLayout>
20
21 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>(QStringLiteral("dolphingeneral"));)
22
23 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args) :
24 KCModule(parent, args),
25 m_pages()
26 {
27 setButtons(KCModule::Default | KCModule::Help);
28
29 QVBoxLayout* topLayout = new QVBoxLayout(this);
30 topLayout->setContentsMargins(0, 0, 0, 0);
31
32 QTabWidget* tabWidget = new QTabWidget(this);
33
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);
38
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);
43
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);
51
52 topLayout->addWidget(tabWidget, 0, {});
53 }
54
55 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
56 {
57 }
58
59 void DolphinGeneralConfigModule::save()
60 {
61 for (SettingsPageBase* page : qAsConst(m_pages)) {
62 page->applySettings();
63 }
64 }
65
66 void DolphinGeneralConfigModule::defaults()
67 {
68 for (SettingsPageBase* page : qAsConst(m_pages)) {
69 page->applySettings();
70 }
71 }
72
73 #include "kcmdolphingeneral.moc"