]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphingeneral.cpp
Remove unused #include
[dolphin.git] / src / settings / kcm / kcmdolphingeneral.cpp
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #include "kcmdolphingeneral.h"
21
22 #include "settings/general/behaviorsettingspage.h"
23 #include "settings/general/previewssettingspage.h"
24 #include "settings/general/confirmationssettingspage.h"
25
26 #include <KLocalizedString>
27 #include <KPluginFactory>
28 #include <KPluginLoader>
29
30 #include <QTabWidget>
31 #include <QVBoxLayout>
32
33 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>(QStringLiteral("dolphingeneral"));)
34
35 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args) :
36 KCModule(parent),
37 m_pages()
38 {
39 Q_UNUSED(args);
40
41 setButtons(KCModule::Default | KCModule::Help);
42
43 QVBoxLayout* topLayout = new QVBoxLayout(this);
44 topLayout->setMargin(0);
45
46 QTabWidget* tabWidget = new QTabWidget(this);
47
48 // initialize 'Behavior' tab
49 BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget);
50 tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior"));
51 connect(behaviorPage, &BehaviorSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
52
53 // initialize 'Previews' tab
54 PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
55 tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
56 connect(previewsPage, &PreviewsSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
57
58 // initialize 'Confirmations' tab
59 ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
60 tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
61 connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
62
63 m_pages.append(behaviorPage);
64 m_pages.append(previewsPage);
65 m_pages.append(confirmationsPage);
66
67 topLayout->addWidget(tabWidget, 0, nullptr);
68 }
69
70 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
71 {
72 }
73
74 void DolphinGeneralConfigModule::save()
75 {
76 foreach (SettingsPageBase* page, m_pages) {
77 page->applySettings();
78 }
79 }
80
81 void DolphinGeneralConfigModule::defaults()
82 {
83 foreach (SettingsPageBase* page, m_pages) {
84 page->applySettings();
85 }
86 }
87
88 #include "kcmdolphingeneral.moc"