23 #include <QVariant> |
23 #include <QVariant> |
24 #include <QList> |
24 #include <QList> |
25 #include <hbicon.h> |
25 #include <hbicon.h> |
26 #include <hbpopup.h> |
26 #include <hbpopup.h> |
27 #include <xqservicerequest.h> |
27 #include <xqservicerequest.h> |
|
28 #include <xqaiwrequest.h> |
|
29 #include <xqappmgr.h> |
|
30 |
28 #include "convergedmessage.h" |
31 #include "convergedmessage.h" |
29 |
32 |
30 #include "msgnotificationdialogpluginkeys.h" |
33 #include "msgnotificationdialogpluginkeys.h" |
31 #include "msgnotificationdialogwidget.h" |
34 #include "msgnotificationdialogwidget.h" |
32 |
35 |
33 const int NoError = 0; |
36 const int NoError = 0; |
34 const int ParameterError = 10000; |
37 const int ParameterError = 10000; |
35 |
38 |
36 |
39 const QString BT_ICON("qtg_large_bluetooth"); |
37 //---------------------------------------------------------------- |
40 const QString SMS_ICON("qtg_large_new_message"); |
38 |
41 const QString MMS_ICON("qtg_large_new_message"); |
39 class ServiceRequestSenderTask : public QRunnable |
42 const QString RINGTONE_ICON("qtg_large_tone"); |
40 { |
43 const QString VCARD_ICON("qtg_large_new_message"); |
41 public: |
44 // ---------------------------------------------------------------------------- |
42 ServiceRequestSenderTask(qint64 conversationId):mConvId(conversationId) {} |
45 // ServiceRequestSenderTask::ServiceRequestSenderTask |
43 |
46 // @see msgnotificationdialogwidget.h |
44 void run() |
47 // ---------------------------------------------------------------------------- |
45 { |
48 ServiceRequestSenderTask::ServiceRequestSenderTask(qint64 conversationId): |
46 XQServiceRequest snd( |
49 mConvId(conversationId) |
47 "com.nokia.services.hbserviceprovider.conversationview", |
50 { |
48 "open(qint64)",false); |
|
49 snd << mConvId; |
|
50 bool res=snd.send(); |
|
51 } |
51 } |
52 |
52 |
53 ~ServiceRequestSenderTask() |
53 // ---------------------------------------------------------------------------- |
|
54 // ServiceRequestSenderTask::~ServiceRequestSenderTask |
|
55 // @see msgnotificationdialogwidget.h |
|
56 // ---------------------------------------------------------------------------- |
|
57 ServiceRequestSenderTask::~ServiceRequestSenderTask() |
54 { |
58 { |
55 } |
59 } |
56 |
60 |
57 private: |
61 // ---------------------------------------------------------------------------- |
58 qint64 mConvId; |
62 // ServiceRequestSenderTask::run |
59 }; |
63 // @see msgnotificationdialogwidget.h |
60 |
64 // ---------------------------------------------------------------------------- |
61 // ------------------------------------------------------------------------ |
65 void ServiceRequestSenderTask::run() |
62 |
66 { |
|
67 QList<QVariant> args; |
|
68 QString serviceName("com.nokia.services.hbserviceprovider"); |
|
69 QString operation("open(qint64)"); |
|
70 XQAiwRequest* request; |
|
71 XQApplicationManager appManager; |
|
72 request = appManager.create(serviceName, "conversationview", operation, false); // not embedded |
|
73 if ( request == NULL ) |
|
74 { |
|
75 return; |
|
76 } |
|
77 args << QVariant(mConvId); |
|
78 request->setArguments(args); |
|
79 request->send(); |
|
80 delete request; |
|
81 } |
63 |
82 |
64 |
83 |
65 // ---------------------------------------------------------------------------- |
84 // ---------------------------------------------------------------------------- |
66 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
85 // MsgNotificationDialogWidget::MsgNotificationDialogWidget |
67 // @see msgnotificationdialogwidget.h |
86 // @see msgnotificationdialogwidget.h |
108 prepareDisplayName(parameters); |
127 prepareDisplayName(parameters); |
109 |
128 |
110 int messageType = parameters.value(KMessageTypeKey).toInt(); |
129 int messageType = parameters.value(KMessageTypeKey).toInt(); |
111 if( messageType == ECsSMS) |
130 if( messageType == ECsSMS) |
112 { |
131 { |
113 HbIcon icon(":/sms.svg"); |
132 HbIcon icon(SMS_ICON); |
|
133 setIcon(icon); |
|
134 QString messageBody; |
|
135 messageBody = parameters.value(KMessageBodyKey).toString(); |
|
136 messageBody.replace(QChar::ParagraphSeparator, QChar::LineSeparator); |
|
137 messageBody.replace('\r', QChar::LineSeparator); |
|
138 setText(messageBody); |
|
139 } |
|
140 else if(messageType == ECsMMS) |
|
141 { |
|
142 HbIcon icon(MMS_ICON); |
|
143 setIcon(icon); |
|
144 setText(parameters.value(KMessageSubjectKey).toString()); |
|
145 } |
|
146 else if(messageType == ECsMmsNotification) |
|
147 { |
|
148 HbIcon icon(MMS_ICON); |
|
149 setIcon(icon); |
|
150 setText(parameters.value(KMessageSubjectKey).toString()); |
|
151 } |
|
152 else if(messageType == ECsRingingTone) |
|
153 { |
|
154 HbIcon icon(RINGTONE_ICON); |
|
155 setIcon(icon); |
|
156 setText(parameters.value(KMessageBodyKey).toString()); |
|
157 } |
|
158 else if(messageType == ECsBlueTooth) |
|
159 { |
|
160 HbIcon icon(BT_ICON); // show default for other message types |
114 setIcon(icon); |
161 setIcon(icon); |
115 setText(parameters.value(KMessageBodyKey).toString()); |
162 setText(parameters.value(KMessageBodyKey).toString()); |
116 } |
163 } |
117 else if(messageType == ECsMMS) |
164 else if(messageType == ECsBioMsg_VCard) |
118 { |
165 { |
119 HbIcon icon(":/mms.svg"); |
166 HbIcon icon(VCARD_ICON); // show default for other message types |
120 setIcon(icon); |
167 setIcon(icon); |
121 setText(parameters.value(KMessageSubjectKey).toString()); |
168 setText(parameters.value(KMessageBodyKey).toString()); |
122 } |
|
123 else if(messageType == ECsRingingTone) |
|
124 { |
|
125 HbIcon icon(":/ringingtone.svg"); |
|
126 setIcon(icon); |
|
127 setText(parameters.value(KMessageBodyKey).toString()); |
|
128 } |
169 } |
129 else |
170 else |
130 { |
171 { |
131 HbIcon icon(":/sms.svg"); // show default for other message types |
|
132 setIcon(icon); |
|
133 setText(parameters.value(KMessageBodyKey).toString()); |
172 setText(parameters.value(KMessageBodyKey).toString()); |
134 } |
173 } |
135 |
174 |
136 // enable touch activation and connect to slot |
175 // enable touch activation and connect to slot |
137 enableTouchActivation(true); |
176 enableTouchActivation(true); |
217 // ---------------------------------------------------------------------------- |
256 // ---------------------------------------------------------------------------- |
218 void MsgNotificationDialogWidget::prepareDisplayName( |
257 void MsgNotificationDialogWidget::prepareDisplayName( |
219 const QVariantMap ¶meters) |
258 const QVariantMap ¶meters) |
220 { |
259 { |
221 //Set the Contact Name/Number |
260 //Set the Contact Name/Number |
222 QString firstName = parameters.value(KFirstNameKey).toString(); |
261 QString displayName = parameters.value(KDisplayNameKey).toString(); |
223 QString lastName = parameters.value(KLastNameKey).toString(); |
|
224 QString contactAddress = parameters.value(KContactAddressKey).toString(); |
262 QString contactAddress = parameters.value(KContactAddressKey).toString(); |
225 QString nickName = parameters.value(KNickNameKey).toString(); |
|
226 |
263 |
227 QString displayName; |
264 if (displayName.isEmpty()) |
228 |
|
229 if (!nickName.isEmpty()) |
|
230 { |
265 { |
231 displayName.append(nickName); |
266 setTitle(contactAddress); |
232 } |
|
233 else if ( firstName.isEmpty() && lastName.isEmpty()) |
|
234 { |
|
235 displayName.append(contactAddress); |
|
236 } |
|
237 else if (lastName.isEmpty() && !firstName.isEmpty()) |
|
238 { |
|
239 displayName.append(firstName); |
|
240 } |
|
241 else if (firstName.isEmpty() && !lastName.isEmpty()) |
|
242 { |
|
243 displayName.append(lastName); |
|
244 } |
267 } |
245 else |
268 else |
246 { |
269 { |
247 // If both first Name and last name are present |
270 setTitle(displayName); |
248 displayName.append(firstName); |
271 } |
249 displayName.append(" "); |
272 } |
250 displayName.append(lastName); |
|
251 } |
|
252 |
|
253 // set the display name |
|
254 setTitle(displayName); |
|
255 } |
|