kcmodule.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "kcmodule.h"
00024 #include <kinstance.h>
00025 #include <kglobal.h>
00026 #include <klocale.h>
00027 #include <kdebug.h>
00028
00029 class KCModulePrivate
00030 {
00031 public:
00032 KInstance *_instance;
00033 QString _rootOnlyMsg;
00034 bool _useRootOnlyMsg;
00035 bool _hasOwnInstance;
00036 };
00037
00038 KCModule::KCModule(QWidget *parent, const char *name, const QStringList &)
00039 : QWidget(parent, name), _btn(Help|Default|Apply)
00040 {
00041 kdDebug() << "KCModule " << name << endl;
00042 d = new KCModulePrivate;
00043 d->_useRootOnlyMsg = true;
00044 d->_instance = new KInstance(name);
00045 if (name && strlen(name)) {
00046 d->_instance = new KInstance(name);
00047 KGlobal::locale()->insertCatalogue(name);
00048 } else
00049 d->_instance = new KInstance("kcmunnamed");
00050 d->_hasOwnInstance = true;
00051 KGlobal::setActiveInstance(this->instance());
00052 }
00053
00054 KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & )
00055 : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply)
00056 {
00057 kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl;
00058 d = new KCModulePrivate;
00059 d->_useRootOnlyMsg = true;
00060 d->_instance = instance;
00061 KGlobal::locale()->insertCatalogue(instance->instanceName());
00062 d->_hasOwnInstance = false;
00063 KGlobal::setActiveInstance(this->instance());
00064 }
00065
00066 KCModule::~KCModule()
00067 {
00068 if (d->_hasOwnInstance)
00069 delete d->_instance;
00070 delete d;
00071 }
00072
00073 void KCModule::setRootOnlyMsg(const QString& msg)
00074 {
00075 d->_rootOnlyMsg = msg;
00076 }
00077
00078 QString KCModule::rootOnlyMsg() const
00079 {
00080 return d->_rootOnlyMsg;
00081 }
00082
00083 void KCModule::setUseRootOnlyMsg(bool on)
00084 {
00085 d->_useRootOnlyMsg = on;
00086 }
00087
00088 bool KCModule::useRootOnlyMsg() const
00089 {
00090 return d->_useRootOnlyMsg;
00091 }
00092
00093 KInstance *KCModule::instance() const
00094 {
00095 return d->_instance;
00096 }
00097
00098 void KCModule::virtual_hook( int, void* )
00099 { }
00100
00101 #include "kcmodule.moc"
This file is part of the documentation for kdelibs Version 3.1.0.