add more spacing
[personal-kdebase.git] / workspace / solid / kcm / kcmsolid.cpp
blob775251ecf8ed6d04f6ce9a23d53c3a3f3db48599
1 /* This file is part of the KDE project
2 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (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 Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
21 #include "kcmsolid.h"
24 #include <kaboutdata.h>
25 #include <kdeversion.h>
27 #include <QVBoxLayout>
29 #include "backendchooser.h"
30 #include <KPluginFactory>
31 #include <KPluginLoader>
34 K_PLUGIN_FACTORY(KcmSolidFactory,
35 registerPlugin<KcmSolid>();
37 K_EXPORT_PLUGIN(KcmSolidFactory("kcm_solid"))
40 KcmSolid::KcmSolid(QWidget *parent, const QVariantList &args)
41 : KCModule(KcmSolidFactory::componentData(), parent, args),
42 m_changedChooser(0)
44 KAboutData *about = new KAboutData(
45 "kcm_solid", 0, ki18n("Solid Configuration Module"),
46 KDE_VERSION_STRING, KLocalizedString(), KAboutData::License_GPL,
47 ki18n("Copyright 2006 Kevin Ottens"));
48 about->addAuthor(ki18n("Kevin Ottens"), KLocalizedString(), "ervin@kde.org");
49 setAboutData(about);
50 setButtons(Apply | Default);
52 setLayout(new QVBoxLayout);
53 layout()->setMargin(0);
54 layout()->setSpacing(0);
56 m_powerChooser = new BackendChooser(this, "SolidPowerManager");
57 m_networkChooser = new BackendChooser(this, "SolidNetworkManager");
58 m_bluetoothChooser = new BackendChooser(this, "SolidBluetoothManager");
60 layout()->addWidget(m_powerChooser);
61 layout()->addWidget(m_networkChooser);
62 layout()->addWidget(m_bluetoothChooser);
64 load();
66 connect(m_powerChooser, SIGNAL(changed(bool)),
67 this, SLOT(slotChooserChanged(bool)));
68 connect(m_networkChooser, SIGNAL(changed(bool)),
69 this, SLOT(slotChooserChanged(bool)));
70 connect(m_bluetoothChooser, SIGNAL(changed(bool)),
71 this, SLOT(slotChooserChanged(bool)));
75 void KcmSolid::load()
77 m_powerChooser->load();
78 m_networkChooser->load();
79 m_bluetoothChooser->load();
82 void KcmSolid::save()
84 m_powerChooser->save();
85 m_networkChooser->save();
86 m_bluetoothChooser->save();
89 void KcmSolid::defaults()
91 m_powerChooser->defaults();
92 m_networkChooser->defaults();
93 m_bluetoothChooser->defaults();
96 void KcmSolid::slotChooserChanged(bool state)
98 if (state)
100 m_changedChooser++;
102 else
104 m_changedChooser--;
108 emit changed(m_changedChooser!= 0);
111 #include "kcmsolid.moc"