kded.h
00001 /* This file is part of the KDE libraries 00002 * Copyright (C) 1999 David Faure <faure@kde.org> 00003 * (C) 1999 Waldo Bastian <bastian@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation; 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 __kded_h__ 00021 #define __kded_h__ 00022 00023 #include <tqobject.h> 00024 #include <tqstring.h> 00025 #include <tqtimer.h> 00026 #include <tqasciidict.h> 00027 #include <tqintdict.h> 00028 00029 #include <dcopclient.h> 00030 #include <dcopobject.h> 00031 00032 #include <tdesycoca.h> 00033 #include <tdesycocatype.h> 00034 #include <kdedmodule.h> 00035 #include <klibloader.h> 00036 00037 class KDirWatch; 00038 class KService; 00039 00040 // No need for this in libtdeio - apps only get readonly access 00041 class Kded : public TQObject, public DCOPObject, public DCOPObjectProxy 00042 { 00043 Q_OBJECT 00044 public: 00045 Kded(bool checkUpdates, bool new_startup); 00046 virtual ~Kded(); 00047 00048 static Kded *self() { return _self;} 00052 bool process(const TQCString &obj, const TQCString &fun, 00053 const TQByteArray &data, 00054 TQCString &replyType, TQByteArray &replyData); 00055 00060 bool process(const TQCString &fun, const TQByteArray &data, 00061 TQCString &replyType, TQByteArray &replyData); 00062 00063 virtual QCStringList functions(); 00064 00065 void noDemandLoad(const TQString &obj); // Don't load obj on demand 00066 00067 KDEDModule *loadModule(const TQCString &obj, bool onDemand); 00068 KDEDModule *loadModule(const KService *service, bool onDemand); 00069 QCStringList loadedModules(); 00070 bool unloadModule(const TQCString &obj); 00071 bool isWindowRegistered(long windowId); 00072 void registerWindowId(long windowId); 00073 void unregisterWindowId(long windowId); 00074 void recreate(bool initial); 00075 void loadSecondPhase(); 00076 00077 public slots: 00081 void initModules(); 00082 00086 void recreate(); 00087 00091 void recreateDone(); 00092 00096 void updateDirWatch(); 00097 00101 void updateResourceList(); 00102 00106 void slotApplicationRemoved(const TQCString &appId); 00107 00111 void slotKDEDModuleRemoved(KDEDModule *); 00112 00113 protected slots: 00114 00118 void dirDeleted(const TQString& path); 00119 00123 void update (const TQString& dir ); 00124 00128 void installCrashHandler(); 00129 00130 void runDelayedCheck(); 00131 00132 protected: 00136 void readDirectory(const TQString& dir ); 00137 00138 00139 static void crashHandler(int); 00140 00146 KDirWatch* m_pDirWatch; 00147 00148 bool b_checkUpdates; 00149 00155 TQTimer* m_pTimer; 00156 00157 TQValueList<DCOPClientTransaction *> m_recreateRequests; 00158 int m_recreateCount; 00159 bool m_recreateBusy; 00160 00161 TQAsciiDict<KDEDModule> m_modules; 00162 TQAsciiDict<KLibrary> m_libs; 00163 TQAsciiDict<TQObject> m_dontLoad; 00164 TQAsciiDict<TQValueList<long> > m_windowIdList; 00165 TQIntDict<long> m_globalWindowIdList; 00166 TQStringList m_allResourceDirs; 00167 bool m_needDelayedCheck; 00168 bool m_newStartup; 00169 public: 00170 bool newStartup() const { return m_newStartup; } 00171 private: 00172 00173 static Kded *_self; 00174 }; 00175 00176 class KUpdateD : public TQObject 00177 { 00178 Q_OBJECT 00179 public: 00180 KUpdateD(); 00181 ~KUpdateD(); 00182 00183 public slots: 00184 void runKonfUpdate(); 00185 void slotNewUpdateFile(); 00186 00187 private: 00193 KDirWatch* m_pDirWatch; 00194 00200 TQTimer* m_pTimer; 00201 }; 00202 00203 class KHostnameD : public TQObject 00204 { 00205 Q_OBJECT 00206 public: 00207 KHostnameD(int pollInterval); 00208 ~KHostnameD(); 00209 00210 public slots: 00211 void checkHostname(); 00212 00213 private: 00217 TQTimer m_Timer; 00218 TQCString m_hostname; 00219 }; 00220 00221 #endif