TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kded.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /* This file is part of the KDE libraries
  2. * Copyright (C) 1999 David Faure <faure@kde.org>
  3. * (C) 1999 Waldo Bastian <bastian@kde.org>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License version 2 as published by the Free Software Foundation;
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public License
  15. * along with this library; see the file COPYING.LIB. If not, write to
  16. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. **/
  19. #ifndef __kded_h__
  20. #define __kded_h__
  21. #include <tqobject.h>
  22. #include <tqstring.h>
  23. #include <tqtimer.h>
  24. #include <tqasciidict.h>
  25. #include <tqintdict.h>
  26. #include <dcopclient.h>
  27. #include <dcopobject.h>
  28. #include <tdesycoca.h>
  29. #include <tdesycocatype.h>
  30. #include <kdedmodule.h>
  31. #include <klibloader.h>
  32. class KDirWatch;
  33. class KService;
  34. // No need for this in libtdeio - apps only get readonly access
  35. class Kded : public TQObject, public DCOPObject, public DCOPObjectProxy
  36. {
  37. Q_OBJECT
  38. public:
  39. Kded(bool checkUpdates, bool new_startup);
  40. virtual ~Kded();
  41. static Kded *self() { return _self;}
  42. /**
  43. * Catch calls to unknown objects.
  44. */
  45. bool process(const TQCString &obj, const TQCString &fun,
  46. const TQByteArray &data,
  47. TQCString &replyType, TQByteArray &replyData);
  48. /**
  49. * process DCOP message. Only calls to "recreate" are supported at
  50. * this time.
  51. */
  52. bool process(const TQCString &fun, const TQByteArray &data,
  53. TQCString &replyType, TQByteArray &replyData);
  54. virtual QCStringList functions();
  55. void noDemandLoad(const TQString &obj); // Don't load obj on demand
  56. KDEDModule *loadModule(const TQCString &obj, bool onDemand);
  57. KDEDModule *loadModule(const KService *service, bool onDemand);
  58. QCStringList loadedModules();
  59. bool unloadModule(const TQCString &obj);
  60. bool isWindowRegistered(long windowId);
  61. void registerWindowId(long windowId);
  62. void unregisterWindowId(long windowId);
  63. void recreate(bool initial);
  64. void loadSecondPhase();
  65. public slots:
  66. /**
  67. * Loads / unloads modules according to config.
  68. */
  69. void initModules();
  70. /**
  71. * Recreate the database file
  72. */
  73. void recreate();
  74. /**
  75. * Recreating finished
  76. */
  77. void recreateDone();
  78. /**
  79. * Collect all directories to watch
  80. */
  81. void updateDirWatch();
  82. /**
  83. * Update directories to watch
  84. */
  85. void updateResourceList();
  86. /**
  87. * An application unregistered itself with DCOP
  88. */
  89. void slotApplicationRemoved(const TQCString &appId);
  90. /**
  91. * A KDEDModule is about to get destroyed.
  92. */
  93. void slotKDEDModuleRemoved(KDEDModule *);
  94. protected slots:
  95. /**
  96. * @internal Triggers rebuilding
  97. */
  98. void dirDeleted(const TQString& path);
  99. /**
  100. * @internal Triggers rebuilding
  101. */
  102. void update (const TQString& dir );
  103. /**
  104. * @internal Installs crash handler
  105. */
  106. void installCrashHandler();
  107. void runDelayedCheck();
  108. protected:
  109. /**
  110. * Scans dir for new files and new subdirectories.
  111. */
  112. void readDirectory(const TQString& dir );
  113. static void crashHandler(int);
  114. /**
  115. * Pointer to the dirwatch class which tells us, when some directories
  116. * changed.
  117. * Slower polling for remote file systems is now done in KDirWatch (JW).
  118. */
  119. KDirWatch* m_pDirWatch;
  120. bool b_checkUpdates;
  121. /**
  122. * When a desktop file is updated, a timer is started (5 sec)
  123. * before rebuilding the binary - so that multiple updates result
  124. * in only one rebuilding.
  125. */
  126. TQTimer* m_pTimer;
  127. TQValueList<DCOPClientTransaction *> m_recreateRequests;
  128. int m_recreateCount;
  129. bool m_recreateBusy;
  130. TQAsciiDict<KDEDModule> m_modules;
  131. TQAsciiDict<KLibrary> m_libs;
  132. TQAsciiDict<TQObject> m_dontLoad;
  133. TQAsciiDict<TQValueList<long> > m_windowIdList;
  134. TQIntDict<long> m_globalWindowIdList;
  135. TQStringList m_allResourceDirs;
  136. bool m_needDelayedCheck;
  137. bool m_newStartup;
  138. public:
  139. bool newStartup() const { return m_newStartup; }
  140. private:
  141. static Kded *_self;
  142. };
  143. class KUpdateD : public TQObject
  144. {
  145. Q_OBJECT
  146. public:
  147. KUpdateD();
  148. ~KUpdateD();
  149. public slots:
  150. void runKonfUpdate();
  151. void slotNewUpdateFile();
  152. private:
  153. /**
  154. * Pointer to the dirwatch class which tells us, when some directories
  155. * changed.
  156. * Slower polling for remote file systems is now done in KDirWatch (JW).
  157. */
  158. KDirWatch* m_pDirWatch;
  159. /**
  160. * When a desktop file is updated, a timer is started (5 sec)
  161. * before rebuilding the binary - so that multiple updates result
  162. * in only one rebuilding.
  163. */
  164. TQTimer* m_pTimer;
  165. };
  166. class KHostnameD : public TQObject
  167. {
  168. Q_OBJECT
  169. public:
  170. KHostnameD(int pollInterval);
  171. ~KHostnameD();
  172. public slots:
  173. void checkHostname();
  174. private:
  175. /**
  176. * Timer for interval hostname checking.
  177. */
  178. TQTimer m_Timer;
  179. TQCString m_hostname;
  180. };
  181. #endif