]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphingeneral.cpp
Apply 1 suggestion(s) to 1 file(s)
[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/interface/confirmationssettingspage.h"
10 #include "settings/interface/folderstabssettingspage.h"
11 #include "settings/interface/interfacesettingspage.h"
12 #include "settings/interface/previewssettingspage.h"
13
14 #include <KLocalizedString>
15 #include <KPluginFactory>
16 #include <kconfigwidgets_version.h>
17
18 #include <QTabBar>
19 #include <QTabWidget>
20 #include <QVBoxLayout>
21
22 K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
23
24 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data)
25 : KCModule(parent, data)
26 , m_pages()
27 {
28 setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
29
30 QVBoxLayout *topLayout = new QVBoxLayout(widget());
31 topLayout->setContentsMargins(0, 0, 0, 0);
32
33 QTabWidget *tabWidget = new QTabWidget(widget());
34 tabWidget->setDocumentMode(true);
35 tabWidget->tabBar()->setExpanding(true);
36
37 // initialize 'Folders & Tabs' tab
38 FoldersTabsSettingsPage *foldersTabsPage = new FoldersTabsSettingsPage(tabWidget);
39 tabWidget->addTab(foldersTabsPage, i18nc("@title:tab Behavior settings", "Behavior"));
40 connect(foldersTabsPage, &FoldersTabsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
41
42 // initialize 'Previews' tab
43 PreviewsSettingsPage *previewsPage = new PreviewsSettingsPage(tabWidget);
44 tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
45 connect(previewsPage, &PreviewsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
46
47 // initialize 'Confirmations' tab
48 ConfirmationsSettingsPage *confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
49 tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
50 connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
51 m_pages.append(foldersTabsPage);
52 m_pages.append(previewsPage);
53 m_pages.append(confirmationsPage);
54
55 topLayout->addWidget(tabWidget, 0, {});
56 }
57
58 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
59 {
60 }
61
62 void DolphinGeneralConfigModule::save()
63 {
64 for (SettingsPageBase *page : std::as_const(m_pages)) {
65 page->applySettings();
66 }
67 }
68
69 void DolphinGeneralConfigModule::defaults()
70 {
71 for (SettingsPageBase *page : std::as_const(m_pages)) {
72 page->applySettings();
73 }
74 }
75
76 #include "kcmdolphingeneral.moc"
77
78 #include "moc_kcmdolphingeneral.cpp"