kcmodule.h
00001 /* 00002 This file is part of the KDE libraries 00003 00004 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 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., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 00021 */ 00022 00023 #ifndef KCMODULE_H 00024 #define KCMODULE_H 00025 00026 #include <qwidget.h> 00027 00028 #include <kdelibs_export.h> 00029 00030 class QStringList; 00031 00032 class KAboutData; 00033 class KConfigDialogManager; 00034 class KConfigSkeleton; 00035 class KCModulePrivate; 00036 class KInstance; 00037 00069 class KDEUI_EXPORT KCModule : public QWidget 00070 { 00071 Q_OBJECT 00072 00073 public: 00074 00081 enum Button {Help=1, Default=2, Apply=16, 00082 Reset=4, /* obsolete, do not use! */ 00083 Cancel=8, /* obsolete, do not use! */ 00084 Ok=32, /* obsolete, do not use! */ 00085 SysDefault=64 /* obsolete, do not use! */ }; 00086 00087 /* 00088 * Base class for all KControlModules. 00089 * Make sure you have a QStringList argument in your 00090 * implementation. 00091 */ 00092 KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); 00093 00094 KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); 00095 00096 /* 00097 * Destroys the module. 00098 */ 00099 ~KCModule(); 00100 00120 virtual void load(); 00121 // ### KDE 4: Call load() automatically through a single-shot timer 00122 // from the constructor // and change documentation 00123 00143 virtual void save(); 00144 00156 virtual void defaults(); 00157 00166 virtual void sysdefaults() { defaults(); } 00167 // KDE 4 deprecate 00168 00178 virtual QString quickHelp() const; 00179 00187 virtual const KAboutData *aboutData() const; 00188 00193 void setAboutData( KAboutData* about ); 00194 00203 int buttons() const { return _btn; } 00204 00217 QString rootOnlyMsg() const; 00218 00229 bool useRootOnlyMsg() const; 00230 00231 KInstance *instance() const; 00232 00237 const QPtrList<KConfigDialogManager>& configs() const; 00238 00239 protected: 00250 KConfigDialogManager* addConfig( KConfigSkeleton *config, QWidget* widget ); 00251 00257 void setQuickHelp( const QString& help ); 00258 00259 signals: 00260 00268 void changed(bool state); 00269 00278 void quickHelpChanged(); 00279 00280 protected slots: 00281 00286 void changed(); 00287 00293 void widgetChanged(); 00294 00295 protected: 00296 00309 void setButtons(int btn) { _btn = btn; } 00310 00320 void setRootOnlyMsg(const QString& msg); 00321 00330 void setUseRootOnlyMsg(bool on); 00331 00336 bool managedWidgetChangeState() const; 00337 00343 void unmanagedWidgetChangeState(bool); 00344 00345 private: 00346 00347 int _btn; 00348 protected: 00349 virtual void virtual_hook( int id, void* data ); 00350 private: 00351 KCModulePrivate *d; 00352 00356 void init(); 00357 00358 }; 00359 00360 #endif //KCMODULE_H 00361