55 #define QDBUSPENDINGCALL_P_H |
55 #define QDBUSPENDINGCALL_P_H |
56 |
56 |
57 #include <qshareddata.h> |
57 #include <qshareddata.h> |
58 #include <qpointer.h> |
58 #include <qpointer.h> |
59 #include <qlist.h> |
59 #include <qlist.h> |
60 #include <qmutex.h> |
|
61 #include <qwaitcondition.h> |
|
62 |
60 |
63 #include "qdbusmessage.h" |
61 #include "qdbusmessage.h" |
64 #include "qdbus_symbols_p.h" |
62 #include "qdbus_symbols_p.h" |
|
63 |
|
64 #ifndef QT_NO_DBUS |
65 |
65 |
66 QT_BEGIN_NAMESPACE |
66 QT_BEGIN_NAMESPACE |
67 |
67 |
68 class QDBusPendingCall; |
68 class QDBusPendingCall; |
69 class QDBusPendingCallWatcher; |
69 class QDBusPendingCallWatcher; |
71 class QDBusConnectionPrivate; |
71 class QDBusConnectionPrivate; |
72 |
72 |
73 class QDBusPendingCallPrivate: public QSharedData |
73 class QDBusPendingCallPrivate: public QSharedData |
74 { |
74 { |
75 public: |
75 public: |
76 // { |
76 QDBusMessage sentMessage; |
77 // set only during construction: |
77 QDBusMessage replyMessage; |
78 const QDBusMessage sentMessage; |
78 // QDBusMessage pendingReplyMessage; // used in the local loop |
79 QDBusConnectionPrivate * const connection; |
79 QDBusPendingCallWatcherHelper *watcherHelper; |
|
80 DBusPendingCall *pending; |
|
81 QDBusConnectionPrivate *connection; |
80 |
82 |
81 // for the callback mechanism (see setReplyCallback and QDBusConnectionPrivate::sendWithReplyAsync) |
83 QString expectedReplySignature; |
|
84 int expectedReplyCount; |
|
85 |
|
86 // for the callback |
82 QPointer<QObject> receiver; |
87 QPointer<QObject> receiver; |
83 QList<int> metaTypes; |
88 QList<int> metaTypes; |
84 int methodIdx; |
89 int methodIdx; |
85 |
90 |
86 bool autoDelete; |
91 bool autoDelete; |
87 // } |
|
88 |
92 |
89 mutable QMutex mutex; |
93 QDBusPendingCallPrivate() : watcherHelper(0), pending(0), autoDelete(false) |
90 QWaitCondition waitForFinishedCondition; |
|
91 |
|
92 // { |
|
93 // protected by the mutex above: |
|
94 QDBusPendingCallWatcherHelper *watcherHelper; |
|
95 QDBusMessage replyMessage; |
|
96 DBusPendingCall *pending; |
|
97 volatile bool waitingForFinished; |
|
98 |
|
99 QString expectedReplySignature; |
|
100 int expectedReplyCount; |
|
101 // } |
|
102 |
|
103 QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection) |
|
104 : sentMessage(sent), connection(connection), autoDelete(false), watcherHelper(0), pending(0), waitingForFinished(false) |
|
105 { } |
94 { } |
106 ~QDBusPendingCallPrivate(); |
95 ~QDBusPendingCallPrivate(); |
107 bool setReplyCallback(QObject *target, const char *member); |
96 bool setReplyCallback(QObject *target, const char *member); |
108 void waitForFinished(); |
97 void waitForFinished(); |
109 void setMetaTypes(int count, const int *types); |
98 void setMetaTypes(int count, const int *types); |