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 setButtons(Apply | Default);
00051
00052 setLayout(new QVBoxLayout);
00053 layout()->setMargin(0);
00054 layout()->setSpacing(0);
00055
00056 m_powerChooser = new BackendChooser(this, "SolidPowerManager");
00057 m_networkChooser = new BackendChooser(this, "SolidNetworkManager");
00058 m_bluetoothChooser = new BackendChooser(this, "SolidBluetoothManager");
00059
00060 layout()->addWidget(m_powerChooser);
00061 layout()->addWidget(m_networkChooser);
00062 layout()->addWidget(m_bluetoothChooser);
00063
00064 load();
00065
00066 connect(m_powerChooser, SIGNAL(changed(bool)),
00067 this, SLOT(slotChooserChanged(bool)));
00068 connect(m_networkChooser, SIGNAL(changed(bool)),
00069 this, SLOT(slotChooserChanged(bool)));
00070 connect(m_bluetoothChooser, SIGNAL(changed(bool)),
00071 this, SLOT(slotChooserChanged(bool)));
00072
00073 }
00074
00075 void KcmSolid::load()
00076 {
00077 m_powerChooser->load();
00078 m_networkChooser->load();
00079 m_bluetoothChooser->load();
00080 }
00081
00082 void KcmSolid::save()
00083 {
00084 m_powerChooser->save();
00085 m_networkChooser->save();
00086 m_bluetoothChooser->save();
00087 }
00088
00089 void KcmSolid::defaults()
00090 {
00091 m_powerChooser->defaults();
00092 m_networkChooser->defaults();
00093 m_bluetoothChooser->defaults();
00094 }
00095
00096 void KcmSolid::slotChooserChanged(bool state)
00097 {
00098 if (state)
00099 {
00100 m_changedChooser++;
00101 }
00102 else
00103 {
00104 m_changedChooser--;
00105 }
00106
00107
00108 emit changed(m_changedChooser!= 0);
00109 }
00110
00111 #include "kcmsolid.moc"