]>
cloud.milkyroute.net Git - dolphin.git/blob - src/kcmdolphin.cpp
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 "kcmdolphin.h"
22 #include "columnviewsettingspage.h"
23 #include "detailsviewsettingspage.h"
24 #include "generalviewsettingspage.h"
25 #include "iconsviewsettingspage.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
<DolphinConfigModule
>("dolphin");)
39 K_EXPORT_PLUGIN(KCMDolphinConfigFactory("kcmdolphin"))
41 DolphinConfigModule::DolphinConfigModule(QWidget
* parent
, const QVariantList
& args
) :
42 KCModule(KCMDolphinConfigFactory::componentData(), parent
),
47 setButtons(KCModule::Default
| KCModule::Help
);
49 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
50 topLayout
->setMargin(0);
51 topLayout
->setSpacing(KDialog::spacingHint());
53 QTabWidget
* tabWidget
= new QTabWidget(this);
55 // initialize 'General' tab
56 GeneralViewSettingsPage
* generalPage
= new GeneralViewSettingsPage(QDir::homePath(), tabWidget
);
57 tabWidget
->addTab(generalPage
, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
58 connect(generalPage
, SIGNAL(changed()), this, SLOT(changed()));
60 // initialize 'Icons' tab
61 IconsViewSettingsPage
* iconsPage
= new IconsViewSettingsPage(tabWidget
);
62 tabWidget
->addTab(iconsPage
, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
63 connect(iconsPage
, SIGNAL(changed()), this, SLOT(changed()));
65 // initialize 'Details' tab
66 DetailsViewSettingsPage
* detailsPage
= new DetailsViewSettingsPage(tabWidget
);
67 tabWidget
->addTab(detailsPage
, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
68 connect(detailsPage
, SIGNAL(changed()), this, SLOT(changed()));
70 // initialize 'Column' tab
71 ColumnViewSettingsPage
* columnPage
= new ColumnViewSettingsPage(tabWidget
);
72 tabWidget
->addTab(columnPage
, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
73 connect(columnPage
, SIGNAL(changed()), this, SLOT(changed()));
75 m_pages
.append(generalPage
);
76 m_pages
.append(iconsPage
);
77 m_pages
.append(detailsPage
);
78 m_pages
.append(columnPage
);
80 topLayout
->addWidget(tabWidget
, 0, 0);
83 DolphinConfigModule::~DolphinConfigModule()
87 void DolphinConfigModule::save()
89 foreach (ViewSettingsPageBase
* page
, m_pages
) {
90 page
->applySettings();
92 reparseConfiguration();
95 void DolphinConfigModule::defaults()
97 foreach (ViewSettingsPageBase
* page
, m_pages
) {
98 page
->restoreDefaults();
100 reparseConfiguration();
103 void DolphinConfigModule::reparseConfiguration()
105 QDBusMessage message
= QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
106 QDBusConnection::sessionBus().send(message
);
109 #include "kcmdolphin.moc"