35 |
35 |
36 const int NoError = 0; |
36 const int NoError = 0; |
37 const int ParameterError = 10000; |
37 const int ParameterError = 10000; |
38 |
38 |
39 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
39 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
|
40 |
|
41 bool serviceTaskLaunched = false; |
40 |
42 |
41 // ---------------------------------------------------------------------------- |
43 // ---------------------------------------------------------------------------- |
42 // ServiceRequestSenderTask::ServiceRequestSenderTask |
44 // ServiceRequestSenderTask::ServiceRequestSenderTask |
43 // @see msgnotificationdialogwidget.h |
45 // @see msgnotificationdialogwidget.h |
44 // ---------------------------------------------------------------------------- |
46 // ---------------------------------------------------------------------------- |
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); |
|
84 request->setSynchronous(true); |
76 request->send(); |
85 request->send(); |
77 delete request; |
86 delete request; |
78 } |
87 } |
79 |
88 |
|
89 void ServiceRequestSenderTask::onRequestCompleted(const QVariant& value) |
|
90 { |
|
91 Q_UNUSED(value); |
|
92 serviceTaskLaunched = false; |
|
93 emit serviceRequestCompleted(); |
|
94 } |
|
95 |
|
96 void ServiceRequestSenderTask::onRequestError(int errorCode, const QString& errorMessage) |
|
97 { |
|
98 Q_UNUSED(errorCode); |
|
99 Q_UNUSED(errorMessage); |
|
100 serviceTaskLaunched = false; |
|
101 emit serviceRequestCompleted(); |
|
102 } |
80 |
103 |
81 // ---------------------------------------------------------------------------- |
104 // ---------------------------------------------------------------------------- |
82 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
105 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
83 // @see msgnotificationdialogwidget.h |
106 // @see msgnotificationdialogwidget.h |
84 // ---------------------------------------------------------------------------- |
107 // ---------------------------------------------------------------------------- |
168 void MsgNotificationDialogWidget::closeDeviceDialog(bool byClient) |
191 void MsgNotificationDialogWidget::closeDeviceDialog(bool byClient) |
169 { |
192 { |
170 // Close device dialog |
193 // Close device dialog |
171 Q_UNUSED(byClient); |
194 Q_UNUSED(byClient); |
172 close(); |
195 close(); |
173 // If show event has been received, close is signalled from hide event. If not, |
196 |
174 // hide event does not come and close is signalled from here. |
197 if (serviceTaskLaunched == false) |
175 if (!mShowEventReceived) { |
198 { |
176 emit deviceDialogClosed(); |
199 // If show event has been received, close is signalled from hide event. If not, |
177 } |
200 // hide event does not come and close is signalled from here. |
178 |
201 if (!mShowEventReceived) |
|
202 { |
|
203 emit deviceDialogClosed(); |
|
204 } |
|
205 } |
179 } |
206 } |
180 |
207 |
181 // ---------------------------------------------------------------------------- |
208 // ---------------------------------------------------------------------------- |
182 // MsgNotificationDialogWidget::deviceDialogWidget |
209 // MsgNotificationDialogWidget::deviceDialogWidget |
183 // @see msgnotificationdialogwidget.h |
210 // @see msgnotificationdialogwidget.h |
194 // @see msgnotificationdialogwidget.h |
221 // @see msgnotificationdialogwidget.h |
195 // ---------------------------------------------------------------------------- |
222 // ---------------------------------------------------------------------------- |
196 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
223 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
197 { |
224 { |
198 HbNotificationDialog::hideEvent(event); |
225 HbNotificationDialog::hideEvent(event); |
199 emit deviceDialogClosed(); |
226 if (serviceTaskLaunched == false) |
|
227 { |
|
228 emit deviceDialogClosed(); |
|
229 } |
200 } |
230 } |
201 |
231 |
202 // ---------------------------------------------------------------------------- |
232 // ---------------------------------------------------------------------------- |
203 // MsgNotificationDialogWidget::showEvent |
233 // MsgNotificationDialogWidget::showEvent |
204 // @see msgnotificationdialogwidget.h |
234 // @see msgnotificationdialogwidget.h |
212 // ---------------------------------------------------------------------------- |
242 // ---------------------------------------------------------------------------- |
213 // MsgNotificationDialogWidget::widgetActivated |
243 // MsgNotificationDialogWidget::widgetActivated |
214 // @see msgnotificationdialogwidget.h |
244 // @see msgnotificationdialogwidget.h |
215 // ---------------------------------------------------------------------------- |
245 // ---------------------------------------------------------------------------- |
216 void MsgNotificationDialogWidget::widgetActivated() |
246 void MsgNotificationDialogWidget::widgetActivated() |
217 { |
247 { |
218 QThreadPool::globalInstance()->start( |
248 ServiceRequestSenderTask* task = |
219 new ServiceRequestSenderTask(mConversationId)); |
249 new ServiceRequestSenderTask(mConversationId); |
220 enableTouchActivation(false); |
250 connect(task,SIGNAL(serviceRequestCompleted()), |
|
251 this,SIGNAL(deviceDialogClosed())); |
|
252 serviceTaskLaunched = true; |
|
253 QThreadPool::globalInstance()->start(task); |
|
254 enableTouchActivation(false); |
|
255 |
221 } |
256 } |
222 |
257 |
223 // ---------------------------------------------------------------------------- |
258 // ---------------------------------------------------------------------------- |
224 // MsgNotificationDialogWidget::prepareDisplayName |
259 // MsgNotificationDialogWidget::prepareDisplayName |
225 // @see msgnotificationdialogwidget.h |
260 // @see msgnotificationdialogwidget.h |