1 /***************************************************************************
2 * Copyright (C) 2008 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 "kcmdolphinviewmodes.h"
22 #include "settings/columnviewsettingspage.h"
23 #include "settings/detailsviewsettingspage.h"
24 #include "settings/iconsviewsettingspage.h"
26 #include <ktabwidget.h>
29 #include <kpluginfactory.h>
30 #include <kpluginloader.h>
32 #include <QDBusConnection>
33 #include <QDBusMessage>
35 #include <QPushButton>
36 #include <QVBoxLayout>
38 K_PLUGIN_FACTORY(KCMDolphinConfigFactory
, registerPlugin
<DolphinViewModesConfigModule
>("dolphinviewmodes");)
39 K_EXPORT_PLUGIN(KCMDolphinConfigFactory("kcmdolphinviewmodes"))
41 DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget
* parent
, const QVariantList
& args
) :
42 KCModule(KCMDolphinConfigFactory::componentData(), parent
),
47 KGlobal::locale()->insertCatalog("dolphinviewmodes");
49 setButtons(KCModule::Default
| KCModule::Help
);
51 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
52 topLayout
->setMargin(0);
53 topLayout
->setSpacing(KDialog::spacingHint());
55 KTabWidget
* tabWidget
= new KTabWidget(this);
57 // initialize 'Icons' tab
58 IconsViewSettingsPage
* iconsPage
= new IconsViewSettingsPage(tabWidget
);
59 tabWidget
->addTab(iconsPage
, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
60 connect(iconsPage
, SIGNAL(changed()), this, SLOT(changed()));
62 // initialize 'Details' tab
63 DetailsViewSettingsPage
* detailsPage
= new DetailsViewSettingsPage(tabWidget
);
64 tabWidget
->addTab(detailsPage
, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
65 connect(detailsPage
, SIGNAL(changed()), this, SLOT(changed()));
67 // initialize 'Column' tab
68 ColumnViewSettingsPage
* columnPage
= new ColumnViewSettingsPage(tabWidget
);
69 tabWidget
->addTab(columnPage
, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
70 connect(columnPage
, SIGNAL(changed()), this, SLOT(changed()));
72 m_pages
.append(iconsPage
);
73 m_pages
.append(detailsPage
);
74 m_pages
.append(columnPage
);
76 topLayout
->addWidget(tabWidget
, 0, 0);
79 DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
83 void DolphinViewModesConfigModule::save()
85 foreach (ViewSettingsPageBase
* page
, m_pages
) {
86 page
->applySettings();
88 reparseConfiguration();
91 void DolphinViewModesConfigModule::defaults()
93 foreach (ViewSettingsPageBase
* page
, m_pages
) {
94 page
->restoreDefaults();
96 reparseConfiguration();
99 void DolphinViewModesConfigModule::reparseConfiguration()
101 QDBusMessage message
= QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
102 QDBusConnection::sessionBus().send(message
);
105 #include "kcmdolphinviewmodes.moc"