00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MODULES_H
00021 #define MODULES_H
00022
00023 #include <kcmoduleinfo.h>
00024 #include <tqobject.h>
00025 #include <tqdict.h>
00026 #include <qxembed.h>
00027
00028 template<class ConfigModule> class TQPtrList;
00029 class TQStringList;
00030 class KAboutData;
00031 class KCModule;
00032 class ProxyWidget;
00033 class KProcess;
00034 class QXEmbed;
00035 class TQVBoxLayout;
00036 class TQVBox;
00037 class TQWidgetStack;
00038
00039 class ConfigModule : public TQObject, public KCModuleInfo
00040 {
00041 Q_OBJECT
00042
00043 public:
00044
00045 ConfigModule(const KService::Ptr &s);
00046 ~ConfigModule();
00047
00048 bool isChanged() { return _changed; };
00049 void setChanged(bool changed) { _changed = changed; };
00050
00051 bool isActive() { return _module != 0; };
00052 ProxyWidget *module();
00053 const KAboutData *aboutData() const;
00054
00055
00056 public slots:
00057
00058 void deleteClient();
00059
00060
00061 private slots:
00062
00063 void clientClosed();
00064 void clientChanged(bool state);
00065 void runAsRoot();
00066 void rootExited(KProcess *proc);
00067 void embedded();
00068
00069
00070 signals:
00071
00072 void changed(ConfigModule *module);
00073 void childClosed();
00074 void handbookRequest();
00075 void helpRequest();
00076
00077
00078 private:
00079
00080 bool _changed;
00081 ProxyWidget *_module;
00082 QXEmbed *_embedWidget;
00083 KProcess *_rootProcess;
00084 TQVBoxLayout *_embedLayout;
00085 TQVBox *_embedFrame;
00086 TQWidgetStack *_embedStack;
00087
00088 };
00089
00090 class ConfigModuleList : public TQPtrList<ConfigModule>
00091 {
00092 public:
00093
00094 ConfigModuleList();
00095
00096 void readDesktopEntries();
00097 bool readDesktopEntriesRecursive(const TQString &path);
00098
00102 TQPtrList<ConfigModule> modules(const TQString &path);
00103
00107 TQStringList submenus(const TQString &path);
00108
00112 TQString findModule(ConfigModule *module);
00113
00114 protected:
00115
00116 class Menu
00117 {
00118 public:
00119 TQPtrList<ConfigModule> modules;
00120 TQStringList submenus;
00121 };
00122
00123 TQDict<Menu> subMenus;
00124 };
00125
00126 class KControlEmbed : public QXEmbed
00127 {
00128 Q_OBJECT
00129 public:
00130 KControlEmbed( TQWidget* w ) : QXEmbed( w ) {}
00131 virtual void windowChanged( WId w ) { if( w ) emit windowEmbedded( w ); }
00132 signals:
00133 void windowEmbedded( WId w );
00134 };
00135
00136 #endif