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

kinit

klauncher.h
00001 /*
00002    This file is part of the KDE libraries
00003    Copyright (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 _KLAUNCHER_H_
00021 #define _KLAUNCHER_H_
00022 
00023 #include <sys/types.h>
00024 #include <unistd.h>
00025 #include <time.h>
00026 #include <tqstring.h>
00027 #include <tqvaluelist.h>
00028 #include <tqsocketnotifier.h>
00029 #include <tqptrlist.h>
00030 #include <tqtimer.h>
00031 
00032 #include <dcopclient.h>
00033 #include <kio/connection.h>
00034 #include <ksock.h>
00035 #include <kurl.h>
00036 #include <kuniqueapplication.h>
00037 
00038 #include <kservice.h>
00039 
00040 #include "autostart.h"
00041 
00042 class IdleSlave : public TQObject
00043 {
00044    Q_OBJECT
00045 public:
00046    IdleSlave(KSocket *socket);
00047    bool match( const TQString &protocol, const TQString &host, bool connected);
00048    void connect( const TQString &app_socket);
00049    pid_t pid() const { return mPid;}
00050    int age(time_t now);
00051    void reparseConfiguration();
00052    bool onHold(const KURL &url);
00053    TQString protocol() const   {return mProtocol;}
00054 
00055 signals:
00056    void statusUpdate(IdleSlave *);
00057 
00058 protected slots:
00059    void gotInput();
00060 
00061 protected:
00062    KIO::Connection mConn;
00063    TQString mProtocol;
00064    TQString mHost;
00065    bool mConnected;
00066    pid_t mPid;
00067    time_t mBirthDate;
00068    bool mOnHold;
00069    KURL mUrl;
00070 };
00071 
00072 class SlaveWaitRequest
00073 {
00074 public:
00075    pid_t pid;
00076    DCOPClientTransaction *transaction;
00077 };
00078 
00079 class KLaunchRequest
00080 {
00081 public:
00082    TQCString name;
00083    TQValueList<TQCString> arg_list;
00084    TQCString dcop_name;
00085    enum status_t { Init = 0, Launching, Running, Error, Done };
00086    pid_t pid;
00087    status_t status;
00088    DCOPClientTransaction *transaction;
00089    KService::DCOPServiceType_t dcop_service_type;
00090    bool autoStart;
00091    TQString errorMsg;
00092 #ifdef Q_WS_X11
00093    TQCString startup_id; // "" is the default, "0" for none
00094    TQCString startup_dpy; // Display to send startup notification to.
00095 #endif
00096    TQValueList<TQCString> envs; // env. variables to be app's environment
00097    TQCString cwd;
00098 };
00099 
00100 struct serviceResult
00101 {
00102   int result;        // 0 means success. > 0 means error (-1 means pending)
00103   TQCString dcopName; // Contains DCOP name on success
00104   TQString error;     // Contains error description on failure.
00105   pid_t pid;
00106 };
00107 
00108 class KLauncher : public KApplication, public DCOPObject
00109 {
00110    Q_OBJECT
00111 
00112 public:
00113    KLauncher(int _kdeinitSocket, bool new_startup);
00114 
00115    ~KLauncher();
00116 
00117    void close();
00118    static void destruct(int exit_code); // exit!
00119 
00120    // DCOP
00121    virtual bool process(const TQCString &fun, const TQByteArray &data,
00122                 TQCString &replyType, TQByteArray &replyData);
00123    virtual QCStringList functions();
00124    virtual QCStringList interfaces();
00125 
00126 protected:
00127    void processDied(pid_t pid, long exitStatus);
00128 
00129    void requestStart(KLaunchRequest *request);
00130    void requestDone(KLaunchRequest *request);
00131 
00132    void setLaunchEnv(const TQCString &name, const TQCString &value);
00133    void exec_blind(const TQCString &name, const TQValueList<TQCString> &arg_list,
00134        const TQValueList<TQCString> &envs, const TQCString& startup_id = "" );
00135    bool start_service(KService::Ptr service, const TQStringList &urls,
00136        const TQValueList<TQCString> &envs, const TQCString& startup_id = "",
00137        bool blind = false, bool autoStart = false );
00138    bool start_service_by_name(const TQString &serviceName, const TQStringList &urls,
00139        const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
00140    bool start_service_by_desktop_path(const TQString &serviceName, const TQStringList &urls,
00141        const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
00142    bool start_service_by_desktop_name(const TQString &serviceName, const TQStringList &urls,
00143        const TQValueList<TQCString> &envs, const TQCString& startup_id, bool blind);
00144    bool kdeinit_exec(const TQString &app, const TQStringList &args,
00145        const TQValueList<TQCString> &envs, TQCString startup_id, bool wait);
00146 
00147    void waitForSlave(pid_t pid);
00148 
00149    void autoStart(int phase);
00150 
00151    void createArgs( KLaunchRequest *request, const KService::Ptr service,
00152                     const TQStringList &url);
00153 
00154    pid_t requestHoldSlave(const KURL &url, const TQString &app_socket);
00155    pid_t requestSlave(const TQString &protocol, const TQString &host,
00156                       const TQString &app_socket, TQString &error);
00157 
00158 
00159    void queueRequest(KLaunchRequest *);
00160 
00161    void send_service_startup_info( KLaunchRequest *request, KService::Ptr service, const TQCString& startup_id,
00162        const TQValueList<TQCString> &envs );
00163    void cancel_service_startup_info( KLaunchRequest *request, const TQCString& startup_id,
00164        const TQValueList<TQCString> &envs );
00165 
00166 public slots:
00167    void slotAutoStart();
00168    void slotDequeue();
00169    void slotKDEInitData(int);
00170    void slotAppRegistered(const TQCString &appId);
00171    void slotSlaveStatus(IdleSlave *);
00172    void acceptSlave( KSocket *);
00173    void slotSlaveGone();
00174    void idleTimeout();
00175 
00176 protected:
00177    TQPtrList<KLaunchRequest> requestList; // Requests being handled
00178    TQPtrList<KLaunchRequest> requestQueue; // Requests waiting to being handled
00179    int kdeinitSocket;
00180    TQSocketNotifier *kdeinitNotifier;
00181    serviceResult DCOPresult;
00182    KLaunchRequest *lastRequest;
00183    TQPtrList<SlaveWaitRequest> mSlaveWaitRequest;
00184    TQString mPoolSocketName;
00185    KServerSocket *mPoolSocket;
00186    TQPtrList<IdleSlave> mSlaveList;
00187    TQTimer mTimer;
00188    TQTimer mAutoTimer;
00189    bool bProcessingQueue;
00190    AutoStart mAutoStart;
00191    TQCString mSlaveDebug;
00192    TQCString mSlaveValgrind;
00193    TQCString mSlaveValgrindSkin;
00194    bool dontBlockReading;
00195    bool newStartup;
00196 #ifdef Q_WS_X11
00197    Display *mCached_dpy;
00198 #endif
00199 };
00200 #endif

kinit

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

kinit

Skip menu "kinit"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kinit by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |