DCOPClient Class Reference
Inter-process communication and remote procedure calls for KDE applications. More...
#include <dcopclient.h>
Inheritance diagram for DCOPClient:


Signals | |
void | applicationRegistered (const QCString &appId) |
void | applicationRemoved (const QCString &appId) |
void | attachFailed (const QString &msg) |
void | blockUserInput (bool block) |
void | callBack (int, const QCString &, const QByteArray &) |
Public Member Functions | |
DCOPClient () | |
virtual | ~DCOPClient () |
bool | attach () |
void | bindToApp () |
bool | detach () |
bool | isAttached () const |
bool | isAttachedToForeignServer () const |
bool | acceptCalls () const |
void | setAcceptCalls (bool b) |
bool | qtBridgeEnabled () |
void | setQtBridgeEnabled (bool b) |
QCString | registerAs (const QCString &appId, bool addPID=true) |
bool | isRegistered () const |
QCString | appId () const |
int | socket () const |
void | suspend () |
void | resume () |
bool | isSuspended () const |
bool | send (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data) |
bool | send (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QString &data) |
bool | call (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data, QCString &replyType, QByteArray &replyData, bool useEventLoop, int timeout) |
bool | call (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data, QCString &replyType, QByteArray &replyData, bool useEventLoop=false) |
int | callAsync (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data, QObject *callBackObj, const char *callBackSlot) |
bool | findObject (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data, QCString &foundApp, QCString &foundObj, bool useEventLoop, int timeout) |
bool | findObject (const QCString &remApp, const QCString &remObj, const QCString &remFun, const QByteArray &data, QCString &foundApp, QCString &foundObj, bool useEventLoop=false) |
void | emitDCOPSignal (const QCString &object, const QCString &signal, const QByteArray &data) |
void | emitDCOPSignal (const QCString &signal, const QByteArray &data) |
bool | connectDCOPSignal (const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &receiverObj, const QCString &slot, bool Volatile) |
bool | connectDCOPSignal (const QCString &sender, const QCString &signal, const QCString &receiverObj, const QCString &slot, bool Volatile) KDE_DEPRECATED |
bool | disconnectDCOPSignal (const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &receiverObj, const QCString &slot) |
bool | disconnectDCOPSignal (const QCString &sender, const QCString &signal, const QCString &receiverObj, const QCString &slot) KDE_DEPRECATED |
virtual bool | process (const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData) |
DCOPClientTransaction * | beginTransaction () |
void | endTransaction (DCOPClientTransaction *t, QCString &replyType, QByteArray &replyData) |
Q_INT32 | transactionId () const |
bool | isApplicationRegistered (const QCString &remApp) |
QCStringList | registeredApplications () |
QCStringList | remoteObjects (const QCString &remApp, bool *ok=0) |
QCStringList | remoteInterfaces (const QCString &remApp, const QCString &remObj, bool *ok=0) |
QCStringList | remoteFunctions (const QCString &remApp, const QCString &remObj, bool *ok=0) |
bool | receive (const QCString &app, const QCString &obj, const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData) |
bool | find (const QCString &app, const QCString &obj, const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData) |
QCString | senderId () const |
void | setDefaultObject (const QCString &objId) |
QCString | defaultObject () const |
void | setNotifications (bool enabled) |
void | setDaemonMode (bool daemonMode) |
void | setPriorityCall (bool) |
void | handleAsyncReply (ReplyStruct *replyStruct) |
Static Public Member Functions | |
static void | setServerAddress (const QCString &addr) |
static QCString | normalizeFunctionSignature (const QCString &fun) |
static DCOPClient * | mainClient () |
static void | setMainClient (DCOPClient *mainClient) |
static DCOPClient * | findLocalClient (const QCString &_appId) |
static void | emergencyClose () |
static const char * | postMortemSender () |
static const char * | postMortemObject () |
static const char * | postMortemFunction () |
static QCString | dcopServerFile (const QCString &hostname=0) |
static QCString | dcopServerFileOld (const QCString &hostname=0) KDE_DEPRECATED |
static QCString | iceauthPath () |
Protected Slots | |
void | processSocketData (int socknum) |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Related Functions | |
(Note that these are not member functions.) | |
Bool | dcop_attach (void) |
char * | dcop_register (const char *app_name, Bool add_pid) |
Bool | dcop_detach (void) |
Bool | dcop_register_callback (const char *object_id, dcop_callback_t callback) |
Bool | dcop_send_signal (const char *receiving_app, const char *object, const char *function, char *data, int data_length) |
Bool | dcop_call (const char *app_name, const char *remote_app_name, const char *remote_object_id, const char *remote_function, const char *data, int data_length, char **reply_type, char **reply_data, int *reply_data_length) |
Detailed Description
Inter-process communication and remote procedure calls for KDE applications.This class provides IPC and RPC for KDE applications. Usually you will not have to instantiate one yourself because KApplication contains a method to return a pointer to a DCOPClient object which can be used for your whole application.
Before being able to send or receive any DCOP messages, you will have to attach your client object to the DCOP server, and then register your application with a specific name. See attach() and registerAs() for more information.
Data to be sent should be serialized into a QDataStream which was initialized with the QByteArray that you actually intend to send the data in. An example of how you might do this:
QByteArray data; QDataStream arg(data, IO_WriteOnly); arg << QString("This is text I am serializing"); client->send("someApp", "someObject", "someFunction(QString)", data);
- See also:
- KApplication::dcopClient()
- Author:
- Preston Brown <pbrown@kde.org>, Matthias Ettrich <ettrich@kde.org>
Definition at line 68 of file dcopclient.h.
Constructor & Destructor Documentation
|
Constructs a new DCOP client, but does not attach to any server.
Definition at line 602 of file dcopclient.cpp. References QObject::connect(), mainClient(), and setMainClient(). |
|
Cleans up any open connections and dynamic data.
Definition at line 629 of file dcopclient.cpp. References QPtrListIterator::current(), detach(), mainClient(), and setMainClient(). |
Member Function Documentation
|
Sets the address of a server to use upon attaching. If no server address is ever specified, attach will try its best to find the server anyway.
Definition at line 667 of file dcopclient.cpp. |
|
Attaches to the DCOP server. If the connection was already attached, the connection will be re-established with the current server address. Naturally, only attached application can use DCOP services. If a QApplication object exists then client registers itself as QApplication::name() + "-" + <pid>. If no QApplication object exists the client registers itself as "anonymous". If you want to register differently, you should use registerAs() instead.
Definition at line 675 of file dcopclient.cpp. |
|
Detaches from the DCOP server.
Definition at line 883 of file dcopclient.cpp. Referenced by processSocketData(), registerAs(), and ~DCOPClient(). |
|
Returns whether or not the client is attached to the server.
Definition at line 910 of file dcopclient.cpp. Referenced by acceptCalls(), endTransaction(), isAttachedToForeignServer(), registerAs(), and send(). |
|
Returns whether the client is attached to a server owned by another user.
Definition at line 922 of file dcopclient.cpp. References isAttached(). |
|
Returns whether the client handles incoming calls.
Definition at line 927 of file dcopclient.cpp. References isAttached(). |
|
Specify whether the client should accept incoming calls. By default clients accept incoming calls, but not when connected to a foreign server.
Definition at line 932 of file dcopclient.cpp. |
|
Returns whether the DCOP - Qt bridge is enabled. By default the DCOP - Qt bridge is enabled.
Definition at line 938 of file dcopclient.cpp. |
|
Specify whether Qt objects of the application should be accessible via DCOP. By default the DCOP - Qt bridge is enabled.
Definition at line 943 of file dcopclient.cpp. |
|
Registers at the DCOP server. If the application was already registered, the registration will be re-done with the new appId.
Registration is necessary if you want to allow other clients to talk to you. They can do so using your
Definition at line 948 of file dcopclient.cpp. References call(), detach(), isAttached(), QCString::isNull(), isRegistered(), and QCString::sprintf(). |
|
Returns whether or not the client is registered at the server.
Definition at line 995 of file dcopclient.cpp. Referenced by registerAs(). |
|
Returns the current app id or a null string if the application hasn't yet been registered.
Definition at line 1001 of file dcopclient.cpp. |
|
Returns the socket fd that is used for communication with the server.
Definition at line 1007 of file dcopclient.cpp. Referenced by bindToApp(). |
|
Temporarily suspends processing of DCOP events. This can be useful if you need to show e.g. a dialog before your application is ready to accept DCOP requests. Normally the dialog would start an event loop and in this event loop DCOP requests will be handled. Be aware that not responding to DCOP requests may cause other programs that want to communicate with your application, to hang.
Definition at line 697 of file dcopclient.cpp. |
|
Resumes the processing of DCOP events.
Definition at line 703 of file dcopclient.cpp. |
|
Returns whether DCOP events are being processed.
Definition at line 709 of file dcopclient.cpp. |
|
Sends a data block to the server.
Definition at line 1056 of file dcopclient.cpp. References findLocalClient(), isAttached(), QCString::isEmpty(), normalizeFunctionSignature(), and receive(). Referenced by emitDCOPSignal(), and send(). |
|
This function acts exactly the same as the above, but the data parameter can be specified as a QString for convenience.
Definition at line 1112 of file dcopclient.cpp. References send(). |
|
Performs a synchronous send and receive. The parameters are the same as for send, with the exception of another QByteArray being provided for results to be (optionally) returned in. A call blocks the application until the process receives the answer.
If
Definition at line 1746 of file dcopclient.cpp. References QApplication::eventLoop(), findLocalClient(), QCString::isEmpty(), isLocalTransactionFinished(), receive(), and transactionId(). Referenced by call(), connectDCOPSignal(), disconnectDCOPSignal(), isApplicationRegistered(), registerAs(), registeredApplications(), remoteFunctions(), remoteInterfaces(), remoteObjects(), setDaemonMode(), and setNotifications(). |
|
Definition at line 1738 of file dcopclient.cpp. References call(). |
|
Performs a asynchronous send with receive callback. The first four parameters are the same as for send.
The slot should have the following signature: callBackSlot(int callId, const QCString& replyType, const QByteArray &replyData);
Definition at line 1790 of file dcopclient.cpp. References QTimer::singleShot(). |
|
Searches for an object which matches a criteria.
findObject calls
If A findObject blocks the application until the process receives the answer.
If
Definition at line 1129 of file dcopclient.cpp. References QValueList::append(), QValueList::begin(), QValueList::ConstIterator(), QValueList::end(), QApplication::eventLoop(), find(), findLocalClient(), QCString::isEmpty(), isLocalTransactionFinished(), QCString::length(), registeredApplications(), and transactionId(). Referenced by findObject(). |
|
Definition at line 1121 of file dcopclient.cpp. References findObject(). |
|
Emits
Definition at line 2151 of file dcopclient.cpp. References normalizeFunctionSignature(), and send(). Referenced by DCOPObject::emitDCOPSignal(), and emitDCOPSignal(). |
|
Connects to a DCOP signal.
Definition at line 2164 of file dcopclient.cpp. References call(), and normalizeFunctionSignature(). Referenced by DCOPObject::connectDCOPSignal(), and connectDCOPSignal(). |
|
Definition at line 2192 of file dcopclient.cpp. References connectDCOPSignal(). |
|
Disconnects a DCOP signal.
A special case is when both
Definition at line 2199 of file dcopclient.cpp. References call(), and normalizeFunctionSignature(). Referenced by DCOPObject::disconnectDCOPSignal(), disconnectDCOPSignal(), DCOPObject::setObjId(), and DCOPObject::~DCOPObject(). |
|
Definition at line 2226 of file dcopclient.cpp. References disconnectDCOPSignal(). |
|
Reimplement this function to handle app-wide function calls unassociated w/an object.
Note that If you do not want to reimplement this function for whatever reason, you can also use a default object or a DCOPObjectProxy.
Definition at line 1225 of file dcopclient.cpp. Referenced by receive(). |
|
Delays the reply of the current function call until endTransaction() is called. This allows a server to queue requests. Note: Should be called from inside process() only!
Definition at line 2067 of file dcopclient.cpp. |
|
Sends the delayed reply of a function call.
Definition at line 2099 of file dcopclient.cpp. References isAttached(). |
|
Test whether the current function call is delayed. Note: Should be called from inside process() only!
Definition at line 2090 of file dcopclient.cpp. Referenced by call(), and findObject(). |
|
Checks whether
Definition at line 1231 of file dcopclient.cpp. References call(). |
|
Retrieves the list of all currently registered applications from dcopserver.
Definition at line 1245 of file dcopclient.cpp. References call(). Referenced by findObject(). |
|
Retrieves the list of objects of the remote application
Definition at line 1257 of file dcopclient.cpp. References call(). |
|
Retrieves the list of interfaces of the remote object
Definition at line 1273 of file dcopclient.cpp. References call(). |
|
Retrieves the list of functions of the remote object
Definition at line 1289 of file dcopclient.cpp. References call(). |
|
Normalizes the function signature A normalized signature doesn't contain any unnecessary whitespace anymore. The remaining whitespace consists of single blanks only (0x20). Example for a normalized signature: "someFunction(QString,int)"
When using send() or call(), normalization is done automatically for you.
Definition at line 1022 of file dcopclient.cpp. References QCString::copy(), QCString::isEmpty(), and QCString::resize(). Referenced by connectDCOPSignal(), disconnectDCOPSignal(), emitDCOPSignal(), and send(). |
|
Returns the appId of the last application that talked to us.
Definition at line 1050 of file dcopclient.cpp. |
|
Installs object
All app-wide messages that have not been processed by the dcopclient will be send further to
Definition at line 2041 of file dcopclient.cpp. |
|
Returns the current default object or an empty string if no object is installed as default object. A default object receives application-wide messages that have not been processed by the DCOPClient itself.
Definition at line 2047 of file dcopclient.cpp. |
|
Enables / disables the applicationRegistered() / applicationRemoved() signals.
Note that a counter is maintained about how often this method was called. If this method is called twice with They are disabled by default.
Definition at line 1305 of file dcopclient.cpp. References call(). |
|
Tells the dcopserver to treat the client as daemon client, not as regular client. If the number of regular clients drops down to zero, the dcopserver will emit a KDE termination signal after 10 seconds.
Definition at line 1317 of file dcopclient.cpp. References call(). |
|
Returns the application's main dcop client. The main client can be used by objects that do not have any specific access to a dcop client. In KDE applications, the main client usually is the same as KApplication::dcopClient().
Definition at line 591 of file dcopclient.cpp. Referenced by DCOPObject::connectDCOPSignal(), DCOPStub::dcopClient(), DCOPRef::dcopClient(), DCOPClient(), DCOPObject::disconnectDCOPSignal(), DCOPObject::emitDCOPSignal(), DCOPObject::setObjId(), ~DCOPClient(), and DCOPObject::~DCOPObject(). |
|
Sets the application's main dcop client. The main client can be used by objects that do not have any specific access to a dcop client. In KDE applications, the main client usually is the same as KApplication::dcopClient().
Definition at line 596 of file dcopclient.cpp. Referenced by DCOPClient(), and ~DCOPClient(). |
|
Look for the given client only in this process. This can be used to check whether a given client (by name) is running in the same process or in another one. Definition at line 98 of file dcopclient.cpp. References QAsciiDict::find(). Referenced by call(), findObject(), and send(). |
|
File with information how to reach the dcopserver.
Definition at line 300 of file dcopclient.cpp. |
|
Definition at line 307 of file dcopclient.cpp. |
|
Return the path of iceauth or an empty string if not found.
Definition at line 223 of file dcopclient.cpp. References QCString::isEmpty(), and QCString::isNull(). |
|
Indicates that the application You need to call setNotifications() first, to tell the DCOP server that you want to get these events.
Referenced by receive(). |
|
Indicates that the formerly registered application You need to call setNotifications() first, to tell the DCOP server that you want to get these events.
Referenced by receive(). |
|
Indicates that the process of establishing DCOP communications failed in some manner. Usually attached to a dialog box or some other visual aid.
|
|
Indicates that user input shall be blocked or released, depending on the argument. The signal is emitted whenever the client has to wait too long (i.e. more than 1/10 of a second) for an answer to a synchronous call. In that case, it will enter a local event loop to keep the GUI updated until finally an answer arrives. In KDE, the KApplication object connects to this signal to be able to block any user input (i.e. mouse and key events) while we are waiting for an answer. If we did not do this, the application might end up in an illegal state, as a keyboard shortcut or a mouse action might cause another dcop call to be issued.
|
|
Process data from the socket.
Definition at line 2005 of file dcopclient.cpp. References detach(). Referenced by bindToApp(). |
The documentation for this class was generated from the following files: