]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphingeneral.cpp
Use capitalized KDE includes
[dolphin.git] / src / settings / kcm / kcmdolphingeneral.cpp
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
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 <KTabWidget>
23 #include <KDialog>
24 #include <KLocale>
25 #include <kpluginfactory.h>
26 #include <kpluginloader.h>
27
28 #include <settings/general/behaviorsettingspage.h>
29 #include <settings/general/previewssettingspage.h>
30 #include <settings/general/contextmenusettingspage.h>
31
32 #include <QDir>
33 #include <QVBoxLayout>
34
35 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>("dolphingeneral");)
36 K_EXPORT_PLUGIN(KCMDolphinGeneralConfigFactory("kcmdolphingeneral"))
37
38 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args) :
39 KCModule(KCMDolphinGeneralConfigFactory::componentData(), parent),
40 m_pages()
41 {
42 Q_UNUSED(args);
43
44 KGlobal::locale()->insertCatalog("dolphin");
45
46 setButtons(KCModule::Default | KCModule::Help);
47
48 QVBoxLayout* topLayout = new QVBoxLayout(this);
49 topLayout->setMargin(0);
50 topLayout->setSpacing(KDialog::spacingHint());
51
52 KTabWidget* tabWidget = new KTabWidget(this);
53
54 // initialize 'Behavior' tab
55 BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QDir::homePath(), tabWidget);
56 tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior"));
57 connect(behaviorPage, SIGNAL(changed()), this, SLOT(changed()));
58
59 // initialize 'Previews' tab
60 PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
61 tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
62 connect(previewsPage, SIGNAL(changed()), this, SLOT(changed()));
63
64 // initialize 'Context Menu' tab
65 ContextMenuSettingsPage *contextMenuPage = new ContextMenuSettingsPage(tabWidget);
66 tabWidget->addTab(contextMenuPage, i18nc("@title:tab Context Menu settings", "Context Menu"));
67 connect(contextMenuPage, SIGNAL(changed()), this, SLOT(changed()));
68
69 m_pages.append(behaviorPage);
70 m_pages.append(previewsPage);
71 m_pages.append(contextMenuPage);
72
73 topLayout->addWidget(tabWidget, 0, 0);
74 }
75
76 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
77 {
78 }
79
80 void DolphinGeneralConfigModule::save()
81 {
82 foreach (SettingsPageBase* page, m_pages) {
83 page->applySettings();
84 }
85 }
86
87 void DolphinGeneralConfigModule::defaults()
88 {
89 foreach (SettingsPageBase* page, m_pages) {
90 page->applySettings();
91 }
92 }
93
94 #include "kcmdolphingeneral.moc"