dcop Library API Documentation

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 <kdemacros.h> 00032 00033 class DCOPObjectProxy; 00034 class DCOPClientPrivate; 00035 class DCOPClientTransaction; 00036 00037 typedef QValueList<QCString> QCStringList; 00038 00068 class 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 00723 static QCString dcopServerFileOld(const QCString &hostname=0) KDE_DEPRECATED; 00724 00728 static QCString iceauthPath(); 00729 00730 signals: 00739 void applicationRegistered( const QCString& appId ); 00748 void applicationRemoved( const QCString& appId ); 00749 00758 void attachFailed(const QString &msg); 00759 00777 void blockUserInput( bool block ); 00778 00788 void callBack(int, const QCString&, const QByteArray &); 00789 00790 public slots: 00791 00792 protected slots: 00797 void processSocketData(int socknum); 00798 00799 private slots: 00800 void processPostedMessagesInternal(); 00801 void asyncReplyReady(); 00802 00803 public: 00804 class ReplyStruct; 00805 00809 void handleAsyncReply(ReplyStruct *replyStruct); 00810 00811 private: 00812 00813 bool isLocalTransactionFinished(Q_INT32 id, QCString &replyType, QByteArray &replyData); 00814 00815 bool attachInternal( bool registerAsAnonymous = true ); 00816 00817 bool callInternal(const QCString &remApp, const QCString &remObj, 00818 const QCString &remFun, const QByteArray &data, 00819 QCString& replyType, QByteArray &replyData, 00820 bool useEventLoop, int timeout, int minor_opcode); 00821 00822 00823 bool callInternal(const QCString &remApp, const QCString &remObjId, 00824 const QCString &remFun, const QByteArray &data, 00825 ReplyStruct *replyStruct, 00826 bool useEventLoop, int timeout, int minor_opcode); 00827 00828 protected: 00829 virtual void virtual_hook( int id, void* data ); 00830 private: 00831 DCOPClientPrivate *d; 00832 }; 00833 00834 #endif
KDE Logo
This file is part of the documentation for dcop Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 12 15:07:45 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003