]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphinviewmodes.cpp
Respect Shift- and Control-key for the rubberband selection
[dolphin.git] / src / settings / kcm / kcmdolphinviewmodes.cpp
1 /***************************************************************************
2 * Copyright (C) 2008 by Peter Penz <peter.penz19@gmail.com> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #include "kcmdolphinviewmodes.h"
21
22 #include <KTabWidget>
23 #include <KDialog>
24 #include <KLocale>
25 #include <KPluginFactory>
26 #include <KPluginLoader>
27
28 #include <settings/viewmodes/detailsviewsettingspage.h>
29 #include <settings/viewmodes/iconsviewsettingspage.h>
30
31 #include <QDBusConnection>
32 #include <QDBusMessage>
33 #include <QDir>
34 #include <QPushButton>
35 #include <QVBoxLayout>
36
37 K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>("dolphinviewmodes");)
38 K_EXPORT_PLUGIN(KCMDolphinViewModesConfigFactory("kcmdolphinviewmodes"))
39
40 DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args) :
41 KCModule(KCMDolphinViewModesConfigFactory::componentData(), parent),
42 m_pages()
43 {
44 Q_UNUSED(args);
45
46 KGlobal::locale()->insertCatalog("dolphin");
47
48 setButtons(KCModule::Default | KCModule::Help);
49
50 QVBoxLayout* topLayout = new QVBoxLayout(this);
51 topLayout->setMargin(0);
52 topLayout->setSpacing(KDialog::spacingHint());
53
54 KTabWidget* tabWidget = new KTabWidget(this);
55
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()));
60
61 // TODO: initialize 'Compact' tab
62
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()));
67
68 m_pages.append(iconsPage);
69 m_pages.append(detailsPage);
70
71 topLayout->addWidget(tabWidget, 0, 0);
72 }
73
74 DolphinViewModesConfigModule::~DolphinViewModesConfigModule()
75 {
76 }
77
78 void DolphinViewModesConfigModule::save()
79 {
80 foreach (ViewSettingsPageBase* page, m_pages) {
81 page->applySettings();
82 }
83 reparseConfiguration();
84 }
85
86 void DolphinViewModesConfigModule::defaults()
87 {
88 foreach (ViewSettingsPageBase* page, m_pages) {
89 page->restoreDefaults();
90 }
91 reparseConfiguration();
92 }
93
94 void DolphinViewModesConfigModule::reparseConfiguration()
95 {
96 QDBusMessage message = QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
97 QDBusConnection::sessionBus().send(message);
98 }
99
100 #include "kcmdolphinviewmodes.moc"