36 const int NoError = 0; |
34 const int NoError = 0; |
37 const int ParameterError = 10000; |
35 const int ParameterError = 10000; |
38 |
36 |
39 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
37 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
40 |
38 |
|
39 bool serviceTaskLaunched = false; |
|
40 |
41 // ---------------------------------------------------------------------------- |
41 // ---------------------------------------------------------------------------- |
42 // ServiceRequestSenderTask::ServiceRequestSenderTask |
42 // ServiceRequestSenderTask::ServiceRequestSenderTask |
43 // @see msgnotificationdialogwidget.h |
43 // @see msgnotificationdialogwidget.h |
44 // ---------------------------------------------------------------------------- |
44 // ---------------------------------------------------------------------------- |
45 ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId): |
45 ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId, |
|
46 QObject* parent): |
|
47 QThread(parent), |
46 mConvId(conversationId) |
48 mConvId(conversationId) |
47 { |
49 { |
48 } |
50 } |
49 |
51 |
50 // ---------------------------------------------------------------------------- |
52 // ---------------------------------------------------------------------------- |
69 request = appManager.create(serviceName, "conversationview", operation, false); // not embedded |
71 request = appManager.create(serviceName, "conversationview", operation, false); // not embedded |
70 if ( request == NULL ) |
72 if ( request == NULL ) |
71 { |
73 { |
72 return; |
74 return; |
73 } |
75 } |
|
76 connect(request,SIGNAL(requestOk(const QVariant&)), |
|
77 this,SLOT(onRequestCompleted(const QVariant&))); |
|
78 |
|
79 connect(request,SIGNAL(requestError(int, const QString&)), |
|
80 this,SLOT(onRequestError(int, const QString&))); |
|
81 |
74 args << QVariant(mConvId); |
82 args << QVariant(mConvId); |
75 request->setArguments(args); |
83 request->setArguments(args); |
76 request->send(); |
84 request->send(); |
77 delete request; |
85 delete request; |
|
86 |
|
87 exec(); |
78 } |
88 } |
79 |
89 |
|
90 void ServiceRequestSenderTask::onRequestCompleted(const QVariant& value) |
|
91 { |
|
92 Q_UNUSED(value); |
|
93 serviceTaskLaunched = false; |
|
94 emit serviceRequestCompleted(); |
|
95 |
|
96 quit(); |
|
97 } |
|
98 |
|
99 void ServiceRequestSenderTask::onRequestError(int errorCode, const QString& errorMessage) |
|
100 { |
|
101 Q_UNUSED(errorCode); |
|
102 Q_UNUSED(errorMessage); |
|
103 serviceTaskLaunched = false; |
|
104 emit serviceRequestCompleted(); |
|
105 |
|
106 quit(); |
|
107 } |
80 |
108 |
81 // ---------------------------------------------------------------------------- |
109 // ---------------------------------------------------------------------------- |
82 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
110 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
83 // @see msgnotificationdialogwidget.h |
111 // @see msgnotificationdialogwidget.h |
84 // ---------------------------------------------------------------------------- |
112 // ---------------------------------------------------------------------------- |
168 void MsgNotificationDialogWidget::closeDeviceDialog(bool byClient) |
196 void MsgNotificationDialogWidget::closeDeviceDialog(bool byClient) |
169 { |
197 { |
170 // Close device dialog |
198 // Close device dialog |
171 Q_UNUSED(byClient); |
199 Q_UNUSED(byClient); |
172 close(); |
200 close(); |
173 // If show event has been received, close is signalled from hide event. If not, |
201 |
174 // hide event does not come and close is signalled from here. |
202 if (serviceTaskLaunched == false) |
175 if (!mShowEventReceived) { |
203 { |
176 emit deviceDialogClosed(); |
204 // If show event has been received, close is signalled from hide event. If not, |
177 } |
205 // hide event does not come and close is signalled from here. |
178 |
206 if (!mShowEventReceived) |
|
207 { |
|
208 emit deviceDialogClosed(); |
|
209 } |
|
210 } |
179 } |
211 } |
180 |
212 |
181 // ---------------------------------------------------------------------------- |
213 // ---------------------------------------------------------------------------- |
182 // MsgNotificationDialogWidget::deviceDialogWidget |
214 // MsgNotificationDialogWidget::deviceDialogWidget |
183 // @see msgnotificationdialogwidget.h |
215 // @see msgnotificationdialogwidget.h |
194 // @see msgnotificationdialogwidget.h |
226 // @see msgnotificationdialogwidget.h |
195 // ---------------------------------------------------------------------------- |
227 // ---------------------------------------------------------------------------- |
196 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
228 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
197 { |
229 { |
198 HbNotificationDialog::hideEvent(event); |
230 HbNotificationDialog::hideEvent(event); |
199 emit deviceDialogClosed(); |
231 if (serviceTaskLaunched == false) |
|
232 { |
|
233 emit deviceDialogClosed(); |
|
234 } |
200 } |
235 } |
201 |
236 |
202 // ---------------------------------------------------------------------------- |
237 // ---------------------------------------------------------------------------- |
203 // MsgNotificationDialogWidget::showEvent |
238 // MsgNotificationDialogWidget::showEvent |
204 // @see msgnotificationdialogwidget.h |
239 // @see msgnotificationdialogwidget.h |
212 // ---------------------------------------------------------------------------- |
247 // ---------------------------------------------------------------------------- |
213 // MsgNotificationDialogWidget::widgetActivated |
248 // MsgNotificationDialogWidget::widgetActivated |
214 // @see msgnotificationdialogwidget.h |
249 // @see msgnotificationdialogwidget.h |
215 // ---------------------------------------------------------------------------- |
250 // ---------------------------------------------------------------------------- |
216 void MsgNotificationDialogWidget::widgetActivated() |
251 void MsgNotificationDialogWidget::widgetActivated() |
217 { |
252 { |
218 QThreadPool::globalInstance()->start( |
253 ServiceRequestSenderTask* task = |
219 new ServiceRequestSenderTask(mConversationId)); |
254 new ServiceRequestSenderTask(mConversationId,this); |
220 enableTouchActivation(false); |
255 connect(task,SIGNAL(serviceRequestCompleted()), |
|
256 this,SIGNAL(deviceDialogClosed())); |
|
257 serviceTaskLaunched = true; |
|
258 task->start(); |
|
259 enableTouchActivation(false); |
|
260 |
221 } |
261 } |
222 |
262 |
223 // ---------------------------------------------------------------------------- |
263 // ---------------------------------------------------------------------------- |
224 // MsgNotificationDialogWidget::prepareDisplayName |
264 // MsgNotificationDialogWidget::prepareDisplayName |
225 // @see msgnotificationdialogwidget.h |
265 // @see msgnotificationdialogwidget.h |