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/detailsviewsettingspage.h>
29 #include <settings/viewmodes/iconsviewsettingspage.h>
31 #include <QDBusConnection>
32 #include <QDBusMessage>
34 #include <QPushButton>
35 #include <QVBoxLayout>
37 K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory
, registerPlugin
<DolphinViewModesConfigModule
>("dolphinviewmodes");)
38 K_EXPORT_PLUGIN(KCMDolphinViewModesConfigFactory("kcmdolphinviewmodes"))
40 DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget
* parent
, const QVariantList
& args
) :
41 KCModule(KCMDolphinViewModesConfigFactory::componentData(), parent
),
46 KGlobal::locale()->insertCatalog("dolphin");
48 setButtons(KCModule::Default
| KCModule::Help
);
50 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
51 topLayout
->setMargin(0);
52 topLayout
->setSpacing(KDialog::spacingHint());
54 KTabWidget
* tabWidget
= new KTabWidget(this);
56 // initialize 'Icons' tab
57 IconsViewSettingsPage
* iconsPage
= new IconsViewSettingsPage(tabWidget
);
58 tabWidget
->addTab(iconsPage
, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
59 connect(iconsPage
, SIGNAL(changed()), this, SLOT(changed()));
61 // TODO: initialize 'Compact' tab
63 // initialize 'Details' tab
64 DetailsViewSettingsPage
* detailsPage
= new DetailsViewSettingsPage(tabWidget
);
65 tabWidget
->addTab(detailsPage
, KIcon("view-list-text"), i18nc("@title:tab", "Details"));
66 connect(detailsPage
, SIGNAL(changed()), this, SLOT(changed()));
68 m_pages
.append(iconsPage
);
69 m_pages
.append(detailsPage
);
71 topLayout
->addWidget(tabWidget
, 0, 0);
74 DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
78 void DolphinViewModesConfigModule::save()
80 foreach (ViewSettingsPageBase
* page
, m_pages
) {
81 page
->applySettings();
83 reparseConfiguration();
86 void DolphinViewModesConfigModule::defaults()
88 foreach (ViewSettingsPageBase
* page
, m_pages
) {
89 page
->restoreDefaults();
91 reparseConfiguration();
94 void DolphinViewModesConfigModule::reparseConfiguration()
96 QDBusMessage message
= QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
97 QDBusConnection::sessionBus().send(message
);
100 #include "kcmdolphinviewmodes.moc"