KUtils
kcmodulecontainer.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KCMODULECONTAINER_H 00021 #define KCMODULECONTAINER_H 00022 00023 #include <QtCore/QString> 00024 #include <QtCore/QStringList> 00025 00026 #include <kcmodule.h> 00027 #include <kcmoduleloader.h> 00028 #include <QtCore/QList> 00029 00030 class QWidget; 00031 00032 class KCModuleProxy; 00033 00049 class KCMUTILS_EXPORT KCModuleContainer : public KCModule 00050 { 00051 Q_OBJECT 00052 public: 00063 KCModuleContainer( QWidget* parent, const QStringList& mods ); 00064 00081 explicit KCModuleContainer( QWidget *parent, const QString& mods = QString() ); 00082 00090 void addModule( const QString& module ); 00091 00095 virtual ~KCModuleContainer(); 00096 00101 void save(); 00102 00107 void load(); 00108 00113 void defaults(); 00114 00115 protected: 00116 typedef QList<KCModuleProxy*> ModuleList; 00117 00122 ModuleList changedModules; 00123 00127 ModuleList allModules; // KDE 4 put in the Private class and abstract with getter 00128 00129 private Q_SLOTS: 00130 00134 void tabSwitched(int); 00135 00136 void moduleChanged(KCModuleProxy *proxy); 00137 00138 private: 00139 00140 void init(); 00141 00142 class KCModuleContainerPrivate; 00143 KCModuleContainerPrivate* const d; 00144 00145 }; 00146 00162 #define KCMODULECONTAINER(modules, factoryName) \ 00163 class KCModuleContainer##factoryName : public KCModuleContainer \ 00164 { \ 00165 public: \ 00166 KCModuleContainer##factoryName(QWidget *parent, const QStringList &) \ 00167 : KCModuleContainer(parent, QLatin1String(modules)) \ 00168 { \ 00169 } \ 00170 }; \ 00171 typedef KGenericFactory<KCModuleContainer#factoryName> KCModuleContainer##factoryName##Factory; \ 00172 K_EXPORT_COMPONENT_FACTORY(factoryName, KCModuleContainer##factoryName##Factory) 00173 00174 #endif // KCMODULECONTAINER_H 00175 00176
KDE 4.6 API Reference