kutils Library API Documentation

kcmodulecontainer.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2004 Frans Englich <frans.englich@telia.com>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef KCMODULECONTAINER_H
00021 #define KCMODULECONTAINER_H
00022 
00023 #include <qvaluelist.h>
00024 #include <qstring.h>
00025 #include <qstringlist.h>
00026 
00027 #include <kcmodule.h>
00028 #include <kcmoduleloader.h>
00029 
00030 class QTabWidget;
00031 class QWidget;
00032 class QVBoxLayout;
00033 
00034 class KCModuleProxy;
00035 
00052 class KUTILS_EXPORT KCModuleContainer : public KCModule
00053 {
00054     Q_OBJECT
00055     public:
00065         KCModuleContainer( QWidget* parent, const char* name, const QStringList& mods );
00066 
00082         KCModuleContainer( QWidget *parent, const char* name, const QString& mods = QString() ); 
00083 
00091         void addModule( const QString& module );
00092 
00096         virtual ~KCModuleContainer();
00097 
00102         void save();
00103 
00108         void load();
00109 
00114         void defaults();
00115 
00116     protected:
00117 
00124         void finalize();
00125 
00126         typedef QValueList<KCModuleProxy*> ModuleList;
00131         ModuleList changedModules;  
00132 
00136         ModuleList allModules;
00137         
00138     private slots:
00139 
00143         void tabSwitched( QWidget * module );
00144 
00145         void moduleChanged(KCModuleProxy *proxy);
00146 
00150         void runAsRoot();
00151 
00155         void rootExited();
00156 
00157     private:
00158 
00159         void init();
00160 
00161         class KCModuleContainerPrivate;
00162         KCModuleContainerPrivate *d;
00163 
00164 };
00165 
00181 #define KCMODULECONTAINER( modules, factoryName ) \
00182 extern "C" \
00183 { \
00184     KCModule *create_## factoryName(QWidget *parent, const char *name) \
00185     { \
00186         return new KCModuleContainer( parent, name, QString( modules ) ); \
00187     } \
00188     \
00189     bool test_## factoryName() \
00190     { \
00191         QStringList modList = QStringList::split( ",", QString(modules).remove( " " )); \
00192         for ( QStringList::Iterator it = modList.begin(); it != modList.end(); ++it ) \
00193             if ( KCModuleLoader::testModule( *it ) ) \
00194                 return true; \
00195         return false; \
00196     } \
00197 }
00198 
00199 #endif // KCMODULECONTAINER_H
00200 
KDE Logo
This file is part of the documentation for kutils Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 7 22:10:27 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003