20 #ifndef _TDELAUNCHER_H_
21 #define _TDELAUNCHER_H_
23 #include <sys/types.h>
27 #include <tqvaluelist.h>
28 #include <tqsocketnotifier.h>
29 #include <tqptrlist.h>
32 #include <dcopclient.h>
33 #include <tdeio/connection.h>
36 #include <tdeuniqueapplication.h>
40 #include "autostart.h"
42 class IdleSlave :
public TQObject
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;}
51 void reparseConfiguration();
52 bool onHold(
const KURL &url);
53 TQString protocol()
const {
return mProtocol;}
56 void statusUpdate(IdleSlave *);
62 TDEIO::Connection mConn;
72 class SlaveWaitRequest
76 DCOPClientTransaction *transaction;
79 class TDELaunchRequest
83 TQValueList<TQCString> arg_list;
85 enum status_t { Init = 0, Launching, Running, Error, Done };
88 DCOPClientTransaction *transaction;
89 KService::DCOPServiceType_t dcop_service_type;
94 TQCString startup_dpy;
96 TQValueList<TQCString> envs;
108 class TDELauncher :
public TDEApplication,
public DCOPObject
113 TDELauncher(
int _tdeinitSocket,
bool new_startup);
118 static void destruct(
int exit_code);
121 virtual bool process(
const TQCString &fun,
const TQByteArray &data,
122 TQCString &replyType, TQByteArray &replyData);
123 virtual QCStringList functions();
124 virtual QCStringList interfaces();
127 void processDied(pid_t pid,
long exitStatus);
129 void requestStart(TDELaunchRequest *request);
130 void requestDone(TDELaunchRequest *request);
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);
147 void waitForSlave(pid_t pid);
149 void autoStart(
int phase);
151 void createArgs( TDELaunchRequest *request,
const KService::Ptr service,
152 const TQStringList &url);
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);
159 void queueRequest(TDELaunchRequest *);
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 );
167 void slotAutoStart();
169 void slotKDEInitData(
int);
170 void slotAppRegistered(
const TQCString &appId);
171 void slotSlaveStatus(IdleSlave *);
172 void acceptSlave( TDESocket *);
173 void slotSlaveGone();
177 TQPtrList<TDELaunchRequest> requestList;
178 TQPtrList<TDELaunchRequest> requestQueue;
180 TQSocketNotifier *tdeinitNotifier;
181 serviceResult DCOPresult;
182 TDELaunchRequest *lastRequest;
183 TQPtrList<SlaveWaitRequest> mSlaveWaitRequest;
184 TQString mPoolSocketName;
185 TDEServerSocket *mPoolSocket;
186 TQPtrList<IdleSlave> mSlaveList;
189 bool bProcessingQueue;
190 AutoStart mAutoStart;
191 TQCString mSlaveDebug;
192 TQCString mSlaveValgrind;
193 TQCString mSlaveValgrindSkin;
194 bool dontBlockReading;
197 Display *mCached_dpy;