dcop Library: dcopclient.h Source File (dcop Library)

| # dcop Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# dcopclient.h

    00001 /*
    00002 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
    00003 Copyright (c) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
    00004
    00005 Permission is hereby granted, free of charge, to any person obtaining a copy
    00006 of this software and associated documentation files (the "Software"), to deal
    00007 in the Software without restriction, including without limitation the rights
    00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00009 copies of the Software, and to permit persons to whom the Software is
    00010 furnished to do so, subject to the following conditions:
    00011
    00012 The above copyright notice and this permission notice shall be included in
    00013 all copies or substantial portions of the Software.
    00014
    00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00021 */
    00022
    00023 #ifndef _DCOPCLIENT_H
    00024 #define _DCOPCLIENT_H
    00025
    00026 #include <qobject.h>
    00027 #include <qcstring.h>
    00028 #include <qvaluelist.h>
    00029 #include <qstring.h>
    00030 #include <kdatastream.h> // needed for proper bool marshalling
    00031 #include <kdelibs_export.h>
    00032
    00033 class DCOPObjectProxy;
    00034 class DCOPClientPrivate;
    00035 class DCOPClientTransaction;
    00036
    00037 typedef QValueList<QCString> QCStringList;
    00038
    00068 class DCOP_EXPORT DCOPClient : public QObject
    00069 {
    00070   Q_OBJECT
    00071
    00072  public:
    00075   DCOPClient();
    00076
    00080   virtual ~DCOPClient();
    00081
    00089   static void setServerAddress(const QCString &addr);
    00090
    00109   bool attach();
    00110
    00117   void bindToApp();
    00118
    00123   bool detach();
    00124
    00129   bool isAttached() const;
    00130
    00136   bool isAttachedToForeignServer() const;
    00137
    00142   bool acceptCalls() const;
    00143
    00150   void setAcceptCalls(bool b);
    00151
    00158   bool qtBridgeEnabled(); // ### KDE 4.0: make const
    00159
    00167   void setQtBridgeEnabled(bool b);
    00168
    00194   QCString registerAs( const QCString &appId, bool addPID = true );
    00195
    00200   bool isRegistered() const;
    00201
    00207   QCString appId() const;
    00208
    00213   int socket() const;
    00214
    00227   void suspend();
    00228
    00234   void resume();
    00235
    00242   bool isSuspended() const;
    00243
    00254   bool send(const QCString &remApp, const QCString &remObj,
    00255         const QCString &remFun, const QByteArray &data);
    00256
    00268   bool send(const QCString &remApp, const QCString &remObj,
    00269         const QCString &remFun, const QString &data);
    00270
    00300   bool call(const QCString &remApp, const QCString &remObj,
    00301         const QCString &remFun, const QByteArray &data,
    00302         QCString& replyType, QByteArray &replyData,
    00303         bool useEventLoop/*=false*/, int timeout/*=-1*/);
    00307   // KDE4 merge with above
    00308   bool call(const QCString &remApp, const QCString &remObj,
    00309         const QCString &remFun, const QByteArray &data,
    00310         QCString& replyType, QByteArray &replyData,
    00311         bool useEventLoop=false);
    00312
    00341   int callAsync(const QCString &remApp, const QCString &remObj,
    00342                 const QCString &remFun, const QByteArray &data,
    00343                 QObject *callBackObj, const char *callBackSlot);
    00344
    00381   bool findObject(const QCString &remApp, const QCString &remObj,
    00382         const QCString &remFun, const QByteArray &data,
    00383         QCString &foundApp, QCString &foundObj,
    00384         bool useEventLoop/*=false*/, int timeout/*=-1*/);
    00385
    00389   // KDE4 merge with above
    00390   bool findObject(const QCString &remApp, const QCString &remObj,
    00391         const QCString &remFun, const QByteArray &data,
    00392         QCString &foundApp, QCString &foundObj,
    00393         bool useEventLoop=false);
    00394
    00395
    00400   void emitDCOPSignal( const QCString &object, const QCString &signal,
    00401                        const QByteArray &data);
    00402
    00403   /* For backwards compatibility */
    00404   void emitDCOPSignal( const QCString &signal, const QByteArray &data);
    00405
    00426   bool connectDCOPSignal( const QCString &sender, const QCString &senderObj,
    00427                           const QCString &signal,
    00428                           const QCString &receiverObj, const QCString &slot,
    00429                           bool Volatile);
    00430
    00435   bool connectDCOPSignal( const QCString &sender, const QCString &signal,
    00436                           const QCString &receiverObj, const QCString &slot,
    00437                           bool Volatile) KDE_DEPRECATED;
    00438
    00456   bool disconnectDCOPSignal( const QCString &sender, const QCString &senderObj,
    00457                           const QCString &signal,
    00458                           const QCString &receiverObj, const QCString &slot);
    00459
    00464   bool disconnectDCOPSignal( const QCString &sender, const QCString &signal,
    00465                           const QCString &receiverObj, const QCString &slot) KDE_DEPRECATED;
    00466
    00482   virtual bool process(const QCString &fun, const QByteArray &data,
    00483                QCString& replyType, QByteArray &replyData);
    00484
    00494   DCOPClientTransaction *beginTransaction( );
    00495
    00503   void endTransaction( DCOPClientTransaction *t, QCString& replyType, QByteArray &replyData);
    00504
    00514   Q_INT32 transactionId() const;
    00515
    00521   bool isApplicationRegistered( const QCString& remApp);
    00522
    00528   QCStringList registeredApplications();
    00529
    00537   QCStringList remoteObjects( const QCString& remApp, bool *ok = 0 );
    00538
    00548   QCStringList remoteInterfaces( const QCString& remApp, const QCString& remObj , bool *ok = 0 );
    00549
    00559   QCStringList remoteFunctions( const QCString& remApp, const QCString& remObj , bool *ok = 0 );
    00560
    00573   bool receive(const QCString &app, const QCString &obj,
    00574            const QCString &fun, const QByteArray& data,
    00575            QCString& replyType, QByteArray &replyData);
    00576
    00588   bool find(const QCString &app, const QCString &obj,
    00589         const QCString &fun, const QByteArray& data,
    00590         QCString& replyType, QByteArray &replyData);
    00591
    00609   static QCString normalizeFunctionSignature( const QCString& fun );
    00610
    00611
    00617   QCString senderId() const;
    00618
    00619
    00627   void setDefaultObject( const QCString& objId );
    00628
    00637   QCString defaultObject() const;
    00638
    00650   void setNotifications( bool enabled );
    00651
    00660   void setDaemonMode( bool daemonMode );
    00661
    00667   void setPriorityCall(bool);
    00668
    00676   static DCOPClient* mainClient();
    00677
    00685   static void setMainClient( DCOPClient* mainClient);
    00686
    00692   static DCOPClient* findLocalClient( const QCString &_appId );
    00693
    00697   static void emergencyClose();
    00698
    00704   static const char *postMortemSender();
    00706   static const char *postMortemObject();
    00708   static const char *postMortemFunction();
    00709
    00717   static QCString dcopServerFile(const QCString &hostname=0);
    00718
    00724   static QCString dcopServerFileOld(const QCString &hostname=0) KDE_DEPRECATED;
    00725
    00729   static QCString iceauthPath();
    00730
    00731 signals:
    00740   void applicationRegistered( const QCString& appId );
    00749   void applicationRemoved( const QCString& appId );
    00750
    00759   void attachFailed(const QString &msg);
    00760
    00778   void blockUserInput( bool block );
    00779
    00789   void callBack(int, const QCString&, const QByteArray &);
    00790
    00791 public slots:
    00792
    00793 protected slots:
    00798   void processSocketData(int socknum);
    00799
    00800 private slots:
    00801   void processPostedMessagesInternal();
    00802   void asyncReplyReady();
    00803   void eventLoopTimeout();
    00804
    00805 public:
    00806   class ReplyStruct;
    00807
    00811   void handleAsyncReply(ReplyStruct *replyStruct);
    00812
    00813 private:
    00814
    00815   bool isLocalTransactionFinished(Q_INT32 id, QCString &replyType, QByteArray &replyData);
    00816
    00817   bool attachInternal( bool registerAsAnonymous = true );
    00818
    00819   bool callInternal(const QCString &remApp, const QCString &remObj,
    00820         const QCString &remFun, const QByteArray &data,
    00821         QCString& replyType, QByteArray &replyData,
    00822         bool useEventLoop, int timeout, int minor_opcode);
    00823
    00824
    00825   bool callInternal(const QCString &remApp, const QCString &remObjId,
    00826             const QCString &remFun, const QByteArray &data,
    00827             ReplyStruct *replyStruct,
    00828             bool useEventLoop, int timeout, int minor_opcode);
    00829
    00830 protected:
    00831   virtual void virtual_hook( int id, void* data );
    00832 private:
    00833   DCOPClientPrivate *d;
    00834 };
    00835
    00836 #endif

This file is part of the documentation for dcop Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:16:55 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003