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( 281 ) <<
"KCModule " <<
name <<
endl;
00042 d =
new KCModulePrivate;
00043 d->_useRootOnlyMsg =
true;
00044
if (
name && strlen(name)) {
00045 d->_instance =
new KInstance(name);
00046
KGlobal::locale()->
insertCatalogue(name);
00047 }
else
00048 d->_instance =
new KInstance(
"kcmunnamed");
00049 d->_hasOwnInstance =
true;
00050
KGlobal::setActiveInstance(this->instance());
00051 }
00052
00053 KCModule::KCModule(
KInstance *instance,
QWidget *parent,
const QStringList & )
00054 :
QWidget(parent,
instance ?
instance->instanceName().data() : 0), _btn(Help|Default|Apply)
00055 {
00056
kdDebug( 281 ) <<
"KCModule instance " << (
instance ?
instance->
instanceName().data() :
"none") <<
endl;
00057 d =
new KCModulePrivate;
00058 d->_useRootOnlyMsg =
true;
00059 d->_instance =
instance;
00060
KGlobal::locale()->
insertCatalogue(
instance->
instanceName());
00061 d->_hasOwnInstance =
false;
00062
KGlobal::setActiveInstance(this->instance());
00063 }
00064
00065 KCModule::~KCModule()
00066 {
00067
if (d->_hasOwnInstance)
00068
delete d->_instance;
00069
delete d;
00070 }
00071
00072 void KCModule::setRootOnlyMsg(
const QString& msg)
00073 {
00074 d->_rootOnlyMsg = msg;
00075 }
00076
00077 QString KCModule::rootOnlyMsg()
const
00078
{
00079
return d->_rootOnlyMsg;
00080 }
00081
00082 void KCModule::setUseRootOnlyMsg(
bool on)
00083 {
00084 d->_useRootOnlyMsg = on;
00085 }
00086
00087 bool KCModule::useRootOnlyMsg()
const
00088
{
00089
return d->_useRootOnlyMsg;
00090 }
00091
00092
KInstance *KCModule::instance()
const
00093
{
00094
return d->_instance;
00095 }
00096
00097
void KCModule::virtual_hook(
int,
void* )
00098 { }
00099
00100
#include "kcmodule.moc"
00101
00102