• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeinit
 

tdeinit

  • tdeinit
tdelauncher.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (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 
20 #ifndef _TDELAUNCHER_H_
21 #define _TDELAUNCHER_H_
22 
23 #include <sys/types.h>
24 #include <unistd.h>
25 #include <time.h>
26 #include <tqstring.h>
27 #include <tqvaluelist.h>
28 #include <tqsocketnotifier.h>
29 #include <tqptrlist.h>
30 #include <tqtimer.h>
31 
32 #include <dcopclient.h>
33 #include <tdeio/connection.h>
34 #include <ksock.h>
35 #include <kurl.h>
36 #include <kuniqueapplication.h>
37 
38 #include <kservice.h>
39 
40 #include "autostart.h"
41 
42 class IdleSlave : public TQObject
43 {
44  Q_OBJECT
45 public:
46  IdleSlave(TDESocket *socket);
47  bool match( const TQString &protocol, const TQString &host, bool connected);
48  void connect( const TQString &app_socket);
49  pid_t pid() const { return mPid;}
50  int age(time_t now);
51  void reparseConfiguration();
52  bool onHold(const KURL &url);
53  TQString protocol() const {return mProtocol;}
54 
55 signals:
56  void statusUpdate(IdleSlave *);
57 
58 protected slots:
59  void gotInput();
60 
61 protected:
62  TDEIO::Connection mConn;
63  TQString mProtocol;
64  TQString mHost;
65  bool mConnected;
66  pid_t mPid;
67  time_t mBirthDate;
68  bool mOnHold;
69  KURL mUrl;
70 };
71 
72 class SlaveWaitRequest
73 {
74 public:
75  pid_t pid;
76  DCOPClientTransaction *transaction;
77 };
78 
79 class TDELaunchRequest
80 {
81 public:
82  TQCString name;
83  TQValueList<TQCString> arg_list;
84  TQCString dcop_name;
85  enum status_t { Init = 0, Launching, Running, Error, Done };
86  pid_t pid;
87  status_t status;
88  DCOPClientTransaction *transaction;
89  KService::DCOPServiceType_t dcop_service_type;
90  bool autoStart;
91  TQString errorMsg;
92 #ifdef Q_WS_X11
93  TQCString startup_id; // "" is the default, "0" for none
94  TQCString startup_dpy; // Display to send startup notification to.
95 #endif
96  TQValueList<TQCString> envs; // env. variables to be app's environment
97  TQCString cwd;
98 };
99 
100 struct serviceResult
101 {
102  int result; // 0 means success. > 0 means error (-1 means pending)
103  TQCString dcopName; // Contains DCOP name on success
104  TQString error; // Contains error description on failure.
105  pid_t pid;
106 };
107 
108 class TDELauncher : public TDEApplication, public DCOPObject
109 {
110  Q_OBJECT
111 
112 public:
113  TDELauncher(int _tdeinitSocket, bool new_startup);
114 
115  ~TDELauncher();
116 
117  void close();
118  static void destruct(int exit_code); // exit!
119 
120  // DCOP
121  virtual bool process(const TQCString &fun, const TQByteArray &data,
122  TQCString &replyType, TQByteArray &replyData);
123  virtual QCStringList functions();
124  virtual QCStringList interfaces();
125 
126 protected:
127  void processDied(pid_t pid, long exitStatus);
128 
129  void requestStart(TDELaunchRequest *request);
130  void requestDone(TDELaunchRequest *request);
131 
132  void setLaunchEnv(const TQCString &name, const TQCString &value);
133  void exec_blind(const TQCString &name, const TQValueList<TQCString> &arg_list,
134  const TQValueList<TQCString> &envs, const TQCString& startup_id = "" );
135  bool start_service(KService::Ptr service, const TQStringList &urls,
136  const TQValueList<TQCString> &envs, const TQCString& startup_id = "",
137  bool blind = false, bool autoStart = false );
138  bool start_service_by_name(const TQString &serviceName, const TQStringList &urls,
139  const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
140  bool start_service_by_desktop_path(const TQString &serviceName, const TQStringList &urls,
141  const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
142  bool start_service_by_desktop_name(const TQString &serviceName, const TQStringList &urls,
143  const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
144  bool tdeinit_exec(const TQString &app, const TQStringList &args,
145  const TQValueList<TQCString> &envs, TQCString startup_id, bool wait);
146 
147  void waitForSlave(pid_t pid);
148 
149  void autoStart(int phase);
150 
151  void createArgs( TDELaunchRequest *request, const KService::Ptr service,
152  const TQStringList &url);
153 
154  pid_t requestHoldSlave(const KURL &url, const TQString &app_socket);
155  pid_t requestSlave(const TQString &protocol, const TQString &host,
156  const TQString &app_socket, TQString &error);
157 
158 
159  void queueRequest(TDELaunchRequest *);
160 
161  void send_service_startup_info( TDELaunchRequest *request, KService::Ptr service, const TQCString& startup_id,
162  const TQValueList<TQCString> &envs );
163  void cancel_service_startup_info( TDELaunchRequest *request, const TQCString& startup_id,
164  const TQValueList<TQCString> &envs );
165 
166 public slots:
167  void slotAutoStart();
168  void slotDequeue();
169  void slotKDEInitData(int);
170  void slotAppRegistered(const TQCString &appId);
171  void slotSlaveStatus(IdleSlave *);
172  void acceptSlave( TDESocket *);
173  void slotSlaveGone();
174  void idleTimeout();
175 
176 protected:
177  TQPtrList<TDELaunchRequest> requestList; // Requests being handled
178  TQPtrList<TDELaunchRequest> requestQueue; // Requests waiting to being handled
179  int tdeinitSocket;
180  TQSocketNotifier *tdeinitNotifier;
181  serviceResult DCOPresult;
182  TDELaunchRequest *lastRequest;
183  TQPtrList<SlaveWaitRequest> mSlaveWaitRequest;
184  TQString mPoolSocketName;
185  TDEServerSocket *mPoolSocket;
186  TQPtrList<IdleSlave> mSlaveList;
187  TQTimer mTimer;
188  TQTimer mAutoTimer;
189  bool bProcessingQueue;
190  AutoStart mAutoStart;
191  TQCString mSlaveDebug;
192  TQCString mSlaveValgrind;
193  TQCString mSlaveValgrindSkin;
194  bool dontBlockReading;
195  bool newStartup;
196 #ifdef Q_WS_X11
197  Display *mCached_dpy;
198 #endif
199 };
200 #endif

tdeinit

Skip menu "tdeinit"
  • Main Page
  • File List
  • Related Pages

tdeinit

Skip menu "tdeinit"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeinit by doxygen 1.8.8
This website is maintained by Timothy Pearson.