36 const int NoError = 0; |
32 const int NoError = 0; |
37 const int ParameterError = 10000; |
33 const int ParameterError = 10000; |
38 |
34 |
39 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
35 static const char NEW_MSG_ICON[] = "qtg_large_new_message"; |
40 |
36 |
41 bool serviceTaskLaunched = false; |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // ServiceRequestSenderTask::ServiceRequestSenderTask |
|
45 // @see msgnotificationdialogwidget.h |
|
46 // ---------------------------------------------------------------------------- |
|
47 ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId): |
|
48 mConvId(conversationId) |
|
49 { |
|
50 } |
|
51 |
|
52 // ---------------------------------------------------------------------------- |
|
53 // ServiceRequestSenderTask::~ServiceRequestSenderTask |
|
54 // @see msgnotificationdialogwidget.h |
|
55 // ---------------------------------------------------------------------------- |
|
56 ServiceRequestSenderTask::~ServiceRequestSenderTask() |
|
57 { |
|
58 } |
|
59 |
|
60 // ---------------------------------------------------------------------------- |
|
61 // ServiceRequestSenderTask::run |
|
62 // @see msgnotificationdialogwidget.h |
|
63 // ---------------------------------------------------------------------------- |
|
64 void ServiceRequestSenderTask::run() |
|
65 { |
|
66 QList<QVariant> args; |
|
67 QString serviceName("com.nokia.services.hbserviceprovider"); |
|
68 QString operation("open(qint64)"); |
|
69 XQAiwRequest* request; |
|
70 XQApplicationManager appManager; |
|
71 request = appManager.create(serviceName, "conversationview", operation, false); // not embedded |
|
72 if ( request == NULL ) |
|
73 { |
|
74 return; |
|
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 |
|
82 args << QVariant(mConvId); |
|
83 request->setArguments(args); |
|
84 request->setSynchronous(true); |
|
85 request->send(); |
|
86 delete request; |
|
87 } |
|
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 } |
|
103 |
|
104 // ---------------------------------------------------------------------------- |
37 // ---------------------------------------------------------------------------- |
105 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
38 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
106 // @see msgnotificationdialogwidget.h |
39 // @see msgnotificationdialogwidget.h |
107 // ---------------------------------------------------------------------------- |
40 // ---------------------------------------------------------------------------- |
108 MsgNotificationDialogWidget::MsgNotificationDialogWidget( |
41 MsgNotificationDialogWidget::MsgNotificationDialogWidget( |
109 const QVariantMap ¶meters) |
42 const QVariantMap ¶meters) |
110 : HbNotificationDialog(), |
43 : HbNotificationDialog(), |
|
44 mConversationId(-1), |
111 mLastError(NoError), |
45 mLastError(NoError), |
112 mShowEventReceived(false), |
46 mShowEventReceived(false) |
113 mConversationId(-1) |
|
114 { |
47 { |
115 constructDialog(parameters); |
48 constructDialog(parameters); |
116 } |
49 } |
117 |
50 |
118 |
51 // ---------------------------------------------------------------------------- |
|
52 // MsgNotificationDialogWidget::~MsgNotificationDialogWidget |
|
53 // @see msgnotificationdialogwidget.h |
|
54 // ---------------------------------------------------------------------------- |
|
55 MsgNotificationDialogWidget::~MsgNotificationDialogWidget() |
|
56 { |
|
57 } |
|
58 |
119 // ---------------------------------------------------------------------------- |
59 // ---------------------------------------------------------------------------- |
120 // MsgNotificationDialogWidget::setDeviceDialogParameters |
60 // MsgNotificationDialogWidget::setDeviceDialogParameters |
121 // @see msgnotificationdialogwidget.h |
61 // @see msgnotificationdialogwidget.h |
122 // ---------------------------------------------------------------------------- |
62 // ---------------------------------------------------------------------------- |
123 bool MsgNotificationDialogWidget::setDeviceDialogParameters( |
63 bool MsgNotificationDialogWidget::setDeviceDialogParameters( |
221 // @see msgnotificationdialogwidget.h |
158 // @see msgnotificationdialogwidget.h |
222 // ---------------------------------------------------------------------------- |
159 // ---------------------------------------------------------------------------- |
223 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
160 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event) |
224 { |
161 { |
225 HbNotificationDialog::hideEvent(event); |
162 HbNotificationDialog::hideEvent(event); |
226 if (serviceTaskLaunched == false) |
163 emit deviceDialogClosed(); |
227 { |
|
228 emit deviceDialogClosed(); |
|
229 } |
|
230 } |
164 } |
231 |
165 |
232 // ---------------------------------------------------------------------------- |
166 // ---------------------------------------------------------------------------- |
233 // MsgNotificationDialogWidget::showEvent |
167 // MsgNotificationDialogWidget::showEvent |
234 // @see msgnotificationdialogwidget.h |
168 // @see msgnotificationdialogwidget.h |
243 // MsgNotificationDialogWidget::widgetActivated |
177 // MsgNotificationDialogWidget::widgetActivated |
244 // @see msgnotificationdialogwidget.h |
178 // @see msgnotificationdialogwidget.h |
245 // ---------------------------------------------------------------------------- |
179 // ---------------------------------------------------------------------------- |
246 void MsgNotificationDialogWidget::widgetActivated() |
180 void MsgNotificationDialogWidget::widgetActivated() |
247 { |
181 { |
248 ServiceRequestSenderTask* task = |
182 //Emit data to be used by msgnotifier |
249 new ServiceRequestSenderTask(mConversationId); |
183 QVariantMap data; |
250 connect(task,SIGNAL(serviceRequestCompleted()), |
184 data.insert(KConversationIdKey,mConversationId); |
251 this,SIGNAL(deviceDialogClosed())); |
185 emit deviceDialogData(data); |
252 serviceTaskLaunched = true; |
186 enableTouchActivation(false); |
253 QThreadPool::globalInstance()->start(task); |
|
254 enableTouchActivation(false); |
|
255 |
|
256 } |
187 } |
257 |
188 |
258 // ---------------------------------------------------------------------------- |
189 // ---------------------------------------------------------------------------- |
259 // MsgNotificationDialogWidget::prepareDisplayName |
190 // MsgNotificationDialogWidget::prepareDisplayName |
260 // @see msgnotificationdialogwidget.h |
191 // @see msgnotificationdialogwidget.h |