1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
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. *
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. *
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 ***************************************************************************/
20 #include "kcmdolphingeneral.h"
25 #include <kpluginfactory.h>
26 #include <kpluginloader.h>
28 #include <settings/general/behaviorsettingspage.h>
29 #include <settings/general/previewssettingspage.h>
30 #include <settings/general/contextmenusettingspage.h>
33 #include <QVBoxLayout>
35 K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory
, registerPlugin
<DolphinGeneralConfigModule
>("dolphingeneral");)
36 K_EXPORT_PLUGIN(KCMDolphinGeneralConfigFactory("kcmdolphingeneral"))
38 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget
* parent
, const QVariantList
& args
) :
39 KCModule(KCMDolphinGeneralConfigFactory::componentData(), parent
),
44 KGlobal::locale()->insertCatalog("dolphin");
46 setButtons(KCModule::Default
| KCModule::Help
);
48 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
49 topLayout
->setMargin(0);
50 topLayout
->setSpacing(KDialog::spacingHint());
52 KTabWidget
* tabWidget
= new KTabWidget(this);
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()));
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()));
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()));
69 m_pages
.append(behaviorPage
);
70 m_pages
.append(previewsPage
);
71 m_pages
.append(contextMenuPage
);
73 topLayout
->addWidget(tabWidget
, 0, 0);
76 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
80 void DolphinGeneralConfigModule::save()
82 foreach (SettingsPageBase
* page
, m_pages
) {
83 page
->applySettings();
87 void DolphinGeneralConfigModule::defaults()
89 foreach (SettingsPageBase
* page
, m_pages
) {
90 page
->applySettings();
94 #include "kcmdolphingeneral.moc"