31 XQAiwRequest::XQAiwRequest(const XQAiwInterfaceDescriptor& descriptor, const QString &operation, bool embedded) |
31 XQAiwRequest::XQAiwRequest(const XQAiwInterfaceDescriptor& descriptor, const QString &operation, bool embedded) |
32 : QObject(), |
32 : QObject(), |
33 currentRequest(NULL), |
33 currentRequest(NULL), |
34 errorMsg(), |
34 errorMsg(), |
35 errorCode(0), |
35 errorCode(0), |
36 asyncErrorSet(false) |
36 completeSignalConnected(false), |
|
37 errorSignalConnected(false) |
37 { |
38 { |
38 |
39 |
39 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest: %s %s,%d,%x", |
40 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest: %s %s,%d,%x", |
40 qPrintable(descriptor.interfaceName()), |
41 qPrintable(descriptor.interfaceName()), |
41 qPrintable(operation), |
42 qPrintable(operation), |
55 const QUrl &uri, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
56 const QUrl &uri, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
56 : QObject(), |
57 : QObject(), |
57 currentRequest(NULL), |
58 currentRequest(NULL), |
58 errorMsg(), |
59 errorMsg(), |
59 errorCode(0), |
60 errorCode(0), |
60 asyncErrorSet(false) |
61 completeSignalConnected(false), |
|
62 errorSignalConnected(false) |
61 { |
63 { |
62 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (uri): %s %s,%x", |
64 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (uri): %s %s,%x", |
63 qPrintable(descriptor.interfaceName()), |
65 qPrintable(descriptor.interfaceName()), |
64 qPrintable(operation), |
66 qPrintable(operation), |
65 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
67 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
83 const QFile &file, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
85 const QFile &file, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
84 : QObject(), |
86 : QObject(), |
85 currentRequest(NULL), |
87 currentRequest(NULL), |
86 errorMsg(), |
88 errorMsg(), |
87 errorCode(0), |
89 errorCode(0), |
88 asyncErrorSet(false) |
90 completeSignalConnected(false), |
|
91 errorSignalConnected(false) |
89 { |
92 { |
90 |
93 |
91 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (file): %s %x", |
94 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (file): %s %x", |
92 qPrintable(file.fileName()), |
95 qPrintable(file.fileName()), |
93 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
96 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
114 const XQSharableFile &file, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
117 const XQSharableFile &file, const XQAiwInterfaceDescriptor& descriptor, const QString &operation) |
115 : QObject(), |
118 : QObject(), |
116 currentRequest(NULL), |
119 currentRequest(NULL), |
117 errorMsg(), |
120 errorMsg(), |
118 errorCode(0), |
121 errorCode(0), |
119 asyncErrorSet(false) |
122 completeSignalConnected(false), |
|
123 errorSignalConnected(false) |
120 { |
124 { |
121 |
125 |
122 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (file handle): %x", |
126 XQSERVICE_DEBUG_PRINT("XQAiwRequest::XQAiwRequest (file handle): %x", |
123 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
127 descriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt()); |
124 |
128 |
137 |
141 |
138 XQAiwRequest::~XQAiwRequest() |
142 XQAiwRequest::~XQAiwRequest() |
139 { |
143 { |
140 XQSERVICE_DEBUG_PRINT("~XQAiwRequest::XQAiwRequest"); |
144 XQSERVICE_DEBUG_PRINT("~XQAiwRequest::XQAiwRequest"); |
141 |
145 |
142 // Disconnect error |
146 // Disconnect signals |
143 if (asyncErrorSet) |
147 if (completeSignalConnected) |
144 { |
148 { |
145 disconnect(currentRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleAsyncResponse(const QVariant&))); |
149 disconnect(currentRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleAsyncResponse(const QVariant&))); |
|
150 } |
|
151 if (errorSignalConnected) |
|
152 { |
146 disconnect(currentRequest, SIGNAL(requestError(int,const QString&)), this, SLOT(handleAsyncError(int))); |
153 disconnect(currentRequest, SIGNAL(requestError(int,const QString&)), this, SLOT(handleAsyncError(int))); |
147 } |
154 } |
148 |
155 |
149 delete currentRequest; // Destructor cancels the async request |
156 delete currentRequest; // Destructor cancels the async request |
150 |
157 |
385 { |
392 { |
386 XQSERVICE_DEBUG_PRINT("XQAiwRequest::sendExecute>>>"); |
393 XQSERVICE_DEBUG_PRINT("XQAiwRequest::sendExecute>>>"); |
387 |
394 |
388 QStringList list; |
395 QStringList list; |
389 bool res = true; |
396 bool res = true; |
390 if (!isSynchronous() && !asyncErrorSet) |
397 if (!isSynchronous() && !completeSignalConnected) |
391 { |
398 { |
392 // Set async request signals once |
399 // Set async request signals once |
393 XQSERVICE_DEBUG_PRINT("request::async send"); |
400 XQSERVICE_DEBUG_PRINT("request::async send"); |
394 connect(currentRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleAsyncResponse(const QVariant&))); |
401 connect(currentRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleAsyncResponse(const QVariant&))); |
|
402 completeSignalConnected = true; |
|
403 } |
|
404 if (!errorSignalConnected) |
|
405 { |
|
406 // Connect always error signal once |
395 connect(currentRequest, SIGNAL(requestError(int,const QString&)), this, SLOT(handleAsyncError(int))); |
407 connect(currentRequest, SIGNAL(requestError(int,const QString&)), this, SLOT(handleAsyncError(int))); |
396 asyncErrorSet = true; |
408 errorSignalConnected = true; |
397 } |
409 } |
398 |
410 |
399 XQSERVICE_DEBUG_PRINT("request::send>>>"); |
411 XQSERVICE_DEBUG_PRINT("request::send>>>"); |
400 res = currentRequest->send(result); // Result is valid for sync request only |
412 res = currentRequest->send(result); // Result is valid for sync request only |
401 XQSERVICE_DEBUG_PRINT("request::send: %d<<<", res); |
413 XQSERVICE_DEBUG_PRINT("request::send: %d<<<", res); |