25 #include <dcopobject.h>
26 #include <dcopclient.h>
28 TQMap<TQCString, DCOPObject *> *kde_dcopObjMap = 0;
30 static inline TQMap<TQCString, DCOPObject *> *objMap()
33 kde_dcopObjMap =
new TQMap<TQCString, DCOPObject *>;
34 return kde_dcopObjMap;
37 class DCOPObject::DCOPObjectPrivate
41 { m_signalConnections = 0; m_dcopClient = 0; }
43 unsigned int m_signalConnections;
49 d =
new DCOPObjectPrivate;
50 ident.sprintf(
"%p", (
void *)
this );
51 objMap()->insert(ident,
this );
56 d =
new DCOPObjectPrivate;
57 TQObject *currentObj = obj;
58 while (currentObj != 0L) {
59 ident.prepend( currentObj->name() );
61 currentObj = TQT_TQOBJECT(currentObj->parent());
63 if ( ident[0] ==
'/' )
66 objMap()->insert(ident,
this);
72 d =
new DCOPObjectPrivate;
73 if ( ident.isEmpty() )
74 ident.sprintf(
"%p", (
void *)
this );
75 objMap()->insert(ident,
this);
81 if ( d->m_signalConnections > 0 && client )
84 objMap()->remove(ident);
90 return d->m_dcopClient;
93 void DCOPObject::setCallingDcopClient(
DCOPClient *client)
95 d->m_dcopClient = client;
100 if (objMap()->
find(objId)!=objMap()->end())
return false;
103 if ( d->m_signalConnections > 0 && client )
106 objMap()->remove(ident);
108 objMap()->insert(ident,
this);
119 if (objMap()->contains(_objId))
127 TQMap<TQCString, DCOPObject *>::ConstIterator it;
128 it = objMap()->find(_objId);
129 if (it != objMap()->end())
137 TQPtrList<DCOPObject> mlist;
138 TQMap<TQCString, DCOPObject *>::ConstIterator it(objMap()->begin());
139 for (; it != objMap()->end(); ++it)
140 if (it.key().left(partialId.length()) == partialId)
141 mlist.append(it.data());
153 TQObject *currentObj = obj;
154 while (currentObj != 0 )
156 identity.prepend( currentObj->name() );
157 identity.prepend(
"/");
158 currentObj = TQT_TQOBJECT(currentObj->parent());
160 if ( identity[0] ==
'/' )
161 identity = identity.mid(1);
167 TQCString& replyType, TQByteArray &replyData)
169 if ( fun ==
"interfaces()" ) {
170 replyType =
"QCStringList";
171 TQDataStream reply( replyData, IO_WriteOnly );
174 }
else if ( fun ==
"functions()" ) {
175 replyType =
"QCStringList";
176 TQDataStream reply( replyData, IO_WriteOnly );
201 result <<
"DCOPObject";
208 result.prepend(
"QCStringList functions()");
209 result.prepend(
"QCStringList interfaces()");
221 const TQCString &signal,
222 const TQCString &slot,
230 d->m_signalConnections++;
235 const TQCString &signal,
236 const TQCString &slot)
243 d->m_signalConnections--;
248 TQPtrList<DCOPObjectProxy>* DCOPObjectProxy::proxies = 0;
253 proxies =
new TQPtrList<DCOPObjectProxy>;
254 proxies->append(
this );
260 proxies =
new TQPtrList<DCOPObjectProxy>;
261 proxies->append(
this );
267 proxies->removeRef(
this );
279 void DCOPObject::virtual_hook(
int,
void* )
282 void DCOPObjectProxy::virtual_hook(
int,
void* )