SolidModules
kcmsolid.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kcmsolid.h"
00022
00023
00024 #include <kaboutdata.h>
00025 #include <kdeversion.h>
00026
00027 #include <QVBoxLayout>
00028
00029 #include "backendchooser.h"
00030 #include <KPluginFactory>
00031 #include <KPluginLoader>
00032
00033
00034 K_PLUGIN_FACTORY(KcmSolidFactory,
00035 registerPlugin<KcmSolid>();
00036 )
00037 K_EXPORT_PLUGIN(KcmSolidFactory("kcm_solid"))
00038
00039
00040 KcmSolid::KcmSolid(QWidget *parent, const QVariantList &args)
00041 : KCModule(KcmSolidFactory::componentData(), parent, args),
00042 m_changedChooser(0)
00043 {
00044 KAboutData *about = new KAboutData(
00045 "kcm_solid", 0, ki18n("Solid Configuration Module"),
00046 KDE_VERSION_STRING, KLocalizedString(), KAboutData::License_GPL,
00047 ki18n("Copyright 2006 Kevin Ottens"));
00048 about->addAuthor(ki18n("Kevin Ottens"), KLocalizedString(), "ervin@kde.org");
00049 setAboutData(about);
00050
00051 setLayout(new QVBoxLayout);
00052 layout()->setMargin(0);
00053 layout()->setSpacing(0);
00054
00055 m_powerChooser = new BackendChooser(this, "SolidPowerManager");
00056 m_networkChooser = new BackendChooser(this, "SolidNetworkManager");
00057 m_bluetoothChooser = new BackendChooser(this, "SolidBluetoothManager");
00058
00059 layout()->addWidget(m_powerChooser);
00060 layout()->addWidget(m_networkChooser);
00061 layout()->addWidget(m_bluetoothChooser);
00062
00063 load();
00064
00065 connect(m_powerChooser, SIGNAL(changed(bool)),
00066 this, SLOT(slotChooserChanged(bool)));
00067 connect(m_networkChooser, SIGNAL(changed(bool)),
00068 this, SLOT(slotChooserChanged(bool)));
00069 connect(m_bluetoothChooser, SIGNAL(changed(bool)),
00070 this, SLOT(slotChooserChanged(bool)));
00071
00072 }
00073
00074 void KcmSolid::load()
00075 {
00076 m_powerChooser->load();
00077 m_networkChooser->load();
00078 m_bluetoothChooser->load();
00079 }
00080
00081 void KcmSolid::save()
00082 {
00083 m_powerChooser->save();
00084 m_networkChooser->save();
00085 m_bluetoothChooser->save();
00086 }
00087
00088 void KcmSolid::defaults()
00089 {
00090 m_powerChooser->defaults();
00091 m_networkChooser->defaults();
00092 m_bluetoothChooser->defaults();
00093 }
00094
00095 void KcmSolid::slotChooserChanged(bool state)
00096 {
00097 if (state)
00098 {
00099 m_changedChooser++;
00100 }
00101 else
00102 {
00103 m_changedChooser--;
00104 }
00105
00106
00107 emit changed(m_changedChooser!= 0);
00108 }
00109
00110 #include "kcmsolid.moc"