1 /***************************************************************************
2 * Copyright (C) 2008 by Peter Penz <peter.penz19@gmail.com> *
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 "kcmdolphinviewmodes.h"
25 #include <KPluginFactory>
26 #include <KPluginLoader>
28 #include <settings/viewmodes/viewsettingstab.h>
30 #include <QDBusConnection>
31 #include <QDBusMessage>
33 #include <QPushButton>
34 #include <QVBoxLayout>
36 K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory
, registerPlugin
<DolphinViewModesConfigModule
>("dolphinviewmodes");)
37 K_EXPORT_PLUGIN(KCMDolphinViewModesConfigFactory("kcmdolphinviewmodes"))
39 DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget
* parent
, const QVariantList
& args
) :
40 KCModule(KCMDolphinViewModesConfigFactory::componentData(), parent
),
45 KGlobal::locale()->insertCatalog("dolphin");
47 setButtons(KCModule::Default
| KCModule::Help
);
49 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
50 topLayout
->setMargin(0);
51 topLayout
->setSpacing(KDialog::spacingHint());
53 KTabWidget
* tabWidget
= new KTabWidget(this);
55 // Initialize 'Icons' tab
56 ViewSettingsTab
* iconsTab
= new ViewSettingsTab(ViewSettingsTab::IconsMode
, tabWidget
);
57 tabWidget
->addTab(iconsTab
, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
58 connect(iconsTab
, SIGNAL(changed()), this, SIGNAL(changed()));
60 // Initialize 'Compact' tab
61 ViewSettingsTab
* compactTab
= new ViewSettingsTab(ViewSettingsTab::CompactMode
, tabWidget
);
62 tabWidget
->addTab(compactTab
, KIcon("view-list-details"), i18nc("@title:tab", "Compact"));
63 connect(compactTab
, SIGNAL(changed()), this, SIGNAL(changed()));
65 // Initialize 'Details' tab
66 ViewSettingsTab
* detailsTab
= new ViewSettingsTab(ViewSettingsTab::DetailsMode
, tabWidget
);
67 tabWidget
->addTab(detailsTab
, KIcon("view-list-tree"), i18nc("@title:tab", "Details"));
68 connect(detailsTab
, SIGNAL(changed()), this, SIGNAL(changed()));
70 m_tabs
.append(iconsTab
);
71 m_tabs
.append(compactTab
);
72 m_tabs
.append(detailsTab
);
74 topLayout
->addWidget(tabWidget
, 0, 0);
77 DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
81 void DolphinViewModesConfigModule::save()
83 foreach (ViewSettingsTab
* tab
, m_tabs
) {
86 reparseConfiguration();
89 void DolphinViewModesConfigModule::defaults()
91 foreach (ViewSettingsTab
* tab
, m_tabs
) {
92 tab
->restoreDefaultSettings();
94 reparseConfiguration();
97 void DolphinViewModesConfigModule::reparseConfiguration()
99 QDBusMessage message
= QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
100 QDBusConnection::sessionBus().send(message
);
103 #include "kcmdolphinviewmodes.moc"