kdeui Library API Documentation

kcmodule.cpp

00001 /* 00002 This file is part of the KDE libraries 00003 00004 Copyright (c) 2001 Michael Goffioul <goffioul@imec.be> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 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 { /*BASE::virtual_hook( id, data );*/ } 00099 00100 #include "kcmodule.moc" 00101 00102 // vim: sw=4 et sts=4
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 16 17:21:59 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003