author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:45:25 +0300 | |
changeset 52 | 12db4185673b |
parent 44 | 36f374c67aa8 |
child 70 | a15d9966050f |
permissions | -rw-r--r-- |
31 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Listen to conversation server events and parse the |
|
15 |
* events. These parse infomation passed to notifications and indications. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
// SYSTEM INCLUDES |
|
20 |
#include <msvapi.h> |
|
21 |
#include <ccsclientconversation.h> |
|
22 |
#include <ccsrequesthandler.h> |
|
23 |
#include <ccsconversationentry.h> |
|
24 |
#include <xqservicerequest.h> |
|
25 |
#include <QString> |
|
26 |
#include <w32std.h> |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
27 |
#include <apgtask.h> |
31 | 28 |
#include <XQSettingsManager> |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
29 |
#include <xqaiwrequest.h> |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
30 |
#include <xqappmgr.h> |
31 | 31 |
#include <xqpublishandsubscribeutils.h> |
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
32 |
#include <xqsystemtoneservice.h> |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
33 |
#include <xqconversions.h> |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
34 |
#include <QThreadPool> |
31 | 35 |
|
36 |
//USER INCLUDES |
|
37 |
#include "msgnotifier.h" |
|
38 |
#include "msgnotifier_p.h" |
|
39 |
#include "msgstorehandler.h" |
|
40 |
#include "msginfodefs.h" |
|
41 |
#include "conversationidpsconsts.h" |
|
42 |
#include "debugtraces.h" |
|
43 |
||
44 |
// ---------------------------------------------------------------------------- |
|
45 |
// MsgNotifierPrivate::MsgNotifierPrivate |
|
46 |
// @see MsgNotifierPrivate.h |
|
47 |
// ---------------------------------------------------------------------------- |
|
48 |
MsgNotifierPrivate::MsgNotifierPrivate(MsgNotifier* MsgNotifier) : |
|
49 |
q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL), |
|
50 |
mSettingsManager(NULL),mPSUtils(NULL) |
|
51 |
{ |
|
52 |
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter") |
|
53 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
54 |
initL(); |
31 | 55 |
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit") |
56 |
} |
|
57 |
||
58 |
// ---------------------------------------------------------------------------- |
|
59 |
// MsgNotifierPrivate::~MsgNotifierPrivate |
|
60 |
// @see MsgNotifierPrivate.h |
|
61 |
// ---------------------------------------------------------------------------- |
|
62 |
MsgNotifierPrivate::~MsgNotifierPrivate() |
|
63 |
{ |
|
64 |
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Enter") |
|
65 |
if (mCvServer) { |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
66 |
TRAP_IGNORE(mCvServer->RemoveConversationListChangeEventL(this)); |
31 | 67 |
delete mCvServer; |
68 |
mCvServer = NULL; |
|
69 |
} |
|
70 |
||
71 |
if (iMsgStoreHandler) { |
|
72 |
delete iMsgStoreHandler; |
|
73 |
iMsgStoreHandler = NULL; |
|
74 |
} |
|
75 |
||
76 |
if(mPSUtils) |
|
77 |
{ |
|
78 |
delete mPSUtils; |
|
79 |
} |
|
80 |
||
81 |
if(mSettingsManager) |
|
82 |
{ |
|
83 |
delete mSettingsManager; |
|
84 |
} |
|
85 |
||
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
86 |
if(mSts) |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
87 |
{ |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
88 |
delete mSts; |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
89 |
mSts = NULL; |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
90 |
} |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
91 |
|
31 | 92 |
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit") |
93 |
} |
|
94 |
||
95 |
// ---------------------------------------------------------------------------- |
|
96 |
// MsgNotifierPrivate::initL |
|
97 |
// @see MsgNotifierPrivate.h |
|
98 |
// ---------------------------------------------------------------------------- |
|
99 |
void MsgNotifierPrivate::initL() |
|
100 |
{ |
|
101 |
QDEBUG_WRITE("MsgNotifierPrivate::initL : Enter") |
|
102 |
||
103 |
mCvServer = CCSRequestHandler::NewL(); |
|
104 |
mCvServer->RequestConversationListChangeEventL(this); |
|
105 |
iMsgStoreHandler = new MsgStoreHandler(this, mCvServer); |
|
106 |
updateUnreadIndications(true); |
|
107 |
updateOutboxIndications(); |
|
108 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
109 |
QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager()); |
31 | 110 |
|
111 |
// define property |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
112 |
QT_TRYCATCH_LEAVING(mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager)); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
113 |
|
31 | 114 |
XQPublishAndSubscribeSettingsKey convIdKey( |
115 |
KMsgCVIdProperty, KMsgCVIdKey); |
|
116 |
bool success = mPSUtils->defineProperty(convIdKey, |
|
117 |
XQSettingsManager::TypeInt); |
|
118 |
||
119 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
|
120 |
"property creation ret value",success) |
|
121 |
||
122 |
// write -1 initially |
|
123 |
success = mSettingsManager->writeItemValue(convIdKey,-1); |
|
124 |
||
125 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL " |
|
126 |
"writing ret value",success) |
|
127 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
128 |
QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService()); |
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
129 |
|
31 | 130 |
QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit") |
131 |
} |
|
132 |
||
133 |
// ---------------------------------------------------------------------------- |
|
134 |
// MsgNotifierPrivate::AddConversationList |
|
135 |
// @see MsgNotifierPrivate.h |
|
136 |
// ---------------------------------------------------------------------------- |
|
137 |
void MsgNotifierPrivate::AddConversationList( |
|
138 |
const CCsClientConversation& aClientConversation) |
|
139 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
140 |
QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Enter") |
31 | 141 |
|
142 |
processListEntry(aClientConversation); |
|
143 |
updateUnreadIndications(); |
|
144 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
145 |
QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Exit") |
31 | 146 |
} |
147 |
||
148 |
// ---------------------------------------------------------------------------- |
|
149 |
// MsgNotifierPrivate::DeleteConversationList |
|
150 |
// @see MsgNotifierPrivate.h |
|
151 |
// ---------------------------------------------------------------------------- |
|
152 |
void MsgNotifierPrivate::DeleteConversationList( |
|
153 |
const CCsClientConversation& /*aClientConversation*/) |
|
154 |
{ |
|
155 |
QDEBUG_WRITE("MsgNotifierPrivate::DeleteConversationList : Enter") |
|
156 |
updateUnreadIndications(); |
|
157 |
QDEBUG_WRITE("MsgNotifierPrivate::DeleteConversationList : Exit") |
|
158 |
} |
|
159 |
||
160 |
// ---------------------------------------------------------------------------- |
|
161 |
// MsgNotifierPrivate::ModifyConversationList |
|
162 |
// @see MsgNotifierPrivate.h |
|
163 |
// ---------------------------------------------------------------------------- |
|
164 |
void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation) |
|
165 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
166 |
QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter") |
31 | 167 |
|
168 |
processListEntry(aClientConversation); |
|
169 |
updateUnreadIndications(); |
|
170 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
171 |
QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit") |
31 | 172 |
} |
173 |
||
174 |
// ---------------------------------------------------------------------------- |
|
175 |
// MsgNotifierPrivate::RefreshConversationList |
|
176 |
// @see MsgNotifierPrivate.h |
|
177 |
// ---------------------------------------------------------------------------- |
|
178 |
void MsgNotifierPrivate::RefreshConversationList() |
|
179 |
{ |
|
180 |
||
181 |
} |
|
182 |
||
183 |
// ---------------------------------------------------------------------------- |
|
184 |
// MsgNotifierPrivate::processListEntry |
|
185 |
// @see MsgNotifierPrivate.h |
|
186 |
// ---------------------------------------------------------------------------- |
|
187 |
void MsgNotifierPrivate::processListEntry( |
|
188 |
const CCsClientConversation& aClientConversation) |
|
189 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
190 |
QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Enter") |
31 | 191 |
|
192 |
CCsConversationEntry* convEntry = |
|
193 |
aClientConversation.GetConversationEntry(); |
|
194 |
||
195 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction", |
|
196 |
convEntry->ConversationDir()) |
|
197 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry New Entry Attribute", |
|
198 |
convEntry->IsAttributeSet(ECsAttributeNewEntryAdded)) |
|
199 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Unread Attribute", |
|
200 |
convEntry->IsAttributeSet(ECsAttributeUnread)) |
|
201 |
||
202 |
if((convEntry->ConversationDir() == ECsDirectionIncoming) |
|
203 |
&& convEntry->IsAttributeSet(ECsAttributeNewEntryAdded) |
|
204 |
&& convEntry->IsAttributeSet(ECsAttributeUnread)) |
|
205 |
{ |
|
206 |
QDEBUG_WRITE("processListEntry : Processing data for Notification") |
|
207 |
||
208 |
NotificationData notifData; |
|
209 |
notifData.msvEntryId = convEntry->EntryId(); |
|
210 |
notifData.mConversationId = aClientConversation.GetConversationEntryId(); |
|
211 |
notifData.mMsgType = static_cast<int>(convEntry->GetType()); |
|
212 |
||
213 |
HBufC* displayName = aClientConversation.GetDisplayName(); |
|
214 |
HBufC* number = convEntry->Contact(); |
|
215 |
HBufC* descrp = convEntry->Description(); |
|
216 |
||
217 |
if(displayName) |
|
218 |
{ |
|
219 |
notifData.mDisplayName = |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
220 |
XQConversions::s60DescToQString(*displayName); |
31 | 221 |
} |
222 |
if(number) |
|
223 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
224 |
notifData.mContactNum = XQConversions::s60DescToQString(*number); |
31 | 225 |
} |
226 |
if(descrp) |
|
227 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
228 |
notifData.mDescription = XQConversions::s60DescToQString(*descrp); |
31 | 229 |
} |
230 |
||
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
231 |
//Play new message alert tone. |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
232 |
mSts->playTone(XQSystemToneService::SmsAlertTone); |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
233 |
|
31 | 234 |
// check whether opened cv id and received |
235 |
// cv id are same and show notification |
|
236 |
if( showNotification(notifData.mConversationId )) |
|
237 |
{ |
|
238 |
q_ptr->displayNewMessageNotification(notifData); |
|
239 |
QDEBUG_WRITE("processListEntry : Notification display called") |
|
240 |
} |
|
241 |
||
242 |
} |
|
243 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
244 |
QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Exit") |
31 | 245 |
} |
246 |
||
247 |
// ---------------------------------------------------------------------------- |
|
248 |
// MsgNotifierPrivate::updateUnreadIndications |
|
249 |
// @see MsgNotifierPrivate.h |
|
250 |
// ---------------------------------------------------------------------------- |
|
251 |
void MsgNotifierPrivate::updateUnreadIndications(bool bootup) |
|
252 |
{ |
|
253 |
QDEBUG_WRITE("MsgNotifierPrivate::updateIndicationsL : Enter") |
|
254 |
||
255 |
int unreadCount(0); |
|
256 |
if(bootup) |
|
257 |
{ |
|
258 |
TRAP_IGNORE(unreadCount = iMsgStoreHandler->GetUnreadMessageCountL()); |
|
259 |
} |
|
260 |
else |
|
261 |
{ |
|
262 |
TRAP_IGNORE(unreadCount = mCvServer->GetTotalUnreadCountL()); |
|
263 |
} |
|
264 |
||
265 |
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::" |
|
266 |
"updateIndications unreadCount = ",unreadCount ); |
|
267 |
||
268 |
//activate or deactivate indications based on unread count |
|
269 |
q_ptr->updateUnreadIndications(unreadCount); |
|
270 |
||
271 |
QDEBUG_WRITE("MsgNotifierPrivate::updateIndicationsL : Exit") |
|
272 |
} |
|
273 |
||
274 |
// ---------------------------------------------------------------------------- |
|
275 |
// MsgNotifierPrivate::updateOutboxIndications |
|
276 |
// @see MsgNotifierPrivate.h |
|
277 |
// ---------------------------------------------------------------------------- |
|
278 |
void MsgNotifierPrivate::updateOutboxIndications() |
|
279 |
{ |
|
280 |
||
281 |
MsgInfo failedIndicatorData; |
|
282 |
MsgInfo pendingIndicatorData; |
|
283 |
TInt err = KErrNone; |
|
284 |
||
285 |
TRAP(err, iMsgStoreHandler->GetOutboxEntriesL(failedIndicatorData,pendingIndicatorData)); |
|
286 |
||
287 |
q_ptr->updateOutboxIndications(failedIndicatorData); |
|
288 |
q_ptr->updateOutboxIndications(pendingIndicatorData); |
|
289 |
} |
|
290 |
||
291 |
||
292 |
// ---------------------------------------------------------------------------- |
|
293 |
// MsgNotifierPrivate::displayOutboxIndications |
|
294 |
// @see MsgNotifierPrivate.h |
|
295 |
// ---------------------------------------------------------------------------- |
|
296 |
||
297 |
void MsgNotifierPrivate::displayOutboxIndications(MsgInfo data) |
|
298 |
{ |
|
299 |
q_ptr->updateOutboxIndications(data); |
|
300 |
} |
|
301 |
||
302 |
// ---------------------------------------------------------------------------- |
|
303 |
// MsgNotifierPrivate::displayFailedNote |
|
304 |
// @see MsgNotifierPrivate.h |
|
305 |
// ---------------------------------------------------------------------------- |
|
306 |
void MsgNotifierPrivate::displayFailedNote(MsgInfo info) |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
307 |
{ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
308 |
QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote start.") |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
309 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
310 |
// check whether opened cv id and received |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
311 |
// cv id are same then dont show failed note |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
312 |
if (!showNotification(info.mConversationId)) |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
313 |
{ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
314 |
return; |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
315 |
} |
31 | 316 |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
317 |
//Even if name string is empty we shall add name into args |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
318 |
QString nameString; |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
319 |
|
31 | 320 |
info.mDisplayName.removeDuplicates(); |
321 |
info.mDisplayName.sort(); |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
322 |
|
31 | 323 |
nameString.append(info.mDisplayName.at(0)); |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
324 |
for (int i = 1; i < info.mDisplayName.count(); ++i) |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
325 |
{ |
31 | 326 |
nameString.append(", "); |
327 |
nameString.append(info.mDisplayName.at(i)); |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
328 |
} |
31 | 329 |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
330 |
// create request arguments |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
331 |
QVariantList args; |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
332 |
args << QVariant(nameString); |
31 | 333 |
args << info.mConversationId; |
334 |
args << info.mMessageType; |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
335 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
336 |
// TODO: use XQAiwRequest |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
337 |
XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier", |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
338 |
"displayErrorNote(QVariantList)", false); |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
339 |
|
31 | 340 |
snd << args; |
341 |
snd.send(); |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
342 |
|
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
343 |
QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote end.") |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
344 |
} |
31 | 345 |
|
346 |
// ---------------------------------------------------------------------------- |
|
347 |
// MsgNotifierPrivate::showNotification |
|
348 |
// @see MsgNotifierPrivate.h |
|
349 |
// ---------------------------------------------------------------------------- |
|
350 |
bool MsgNotifierPrivate::showNotification(int receivedMsgConvId) |
|
351 |
{ |
|
352 |
bool showNotification = true; |
|
353 |
||
354 |
RWsSession wsSession ; |
|
355 |
wsSession.Connect(); |
|
356 |
||
357 |
TApaTaskList taskList( wsSession ); |
|
358 |
TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running |
|
359 |
||
360 |
if(task.Exists()) |
|
361 |
{ |
|
362 |
TApaTask foregndtask = taskList.FindByPos(0) ; // foreground app |
|
363 |
// compare window group id |
|
364 |
// if application is in foregorund, then check the currently |
|
365 |
// opened conversation is same as received one. |
|
366 |
if(task.WgId() == foregndtask.WgId() ) |
|
367 |
{ |
|
368 |
// get the current conversation ID |
|
369 |
XQPublishAndSubscribeSettingsKey convIdKey( KMsgCVIdProperty, |
|
370 |
KMsgCVIdKey); |
|
371 |
QVariant value = mSettingsManager->readItemValue(convIdKey, |
|
372 |
XQSettingsManager::TypeInt); |
|
373 |
||
374 |
int openedConvId = value.toInt(); |
|
375 |
if( openedConvId == receivedMsgConvId) |
|
376 |
{ |
|
377 |
showNotification = false; |
|
378 |
QDEBUG_WRITE("processListEntry : Notification not shown") |
|
379 |
} |
|
380 |
} |
|
381 |
} |
|
382 |
||
383 |
wsSession.Close(); |
|
384 |
return showNotification; |
|
385 |
} |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
386 |
// ---------------------------------------------------------------------------- |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
387 |
// MsgNotifierPrivate::PartialDeleteConversationList |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
388 |
// @see mcsconversationclientchangeobserver.h |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
389 |
// ---------------------------------------------------------------------------- |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
390 |
void MsgNotifierPrivate::PartialDeleteConversationList( |
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
391 |
const CCsClientConversation& /*aClientConversation*/){/*empty implementation*/} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
392 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
393 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
394 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
395 |
// MsgNotifierPrivate::ShowClass0Message |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
396 |
// @see msgnotifier_p.h |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
397 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
398 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
399 |
void MsgNotifierPrivate::ShowClass0Message(Class0Info& class0Info) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
400 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
401 |
QCRITICAL_WRITE("flashmsgnotifier BEGIN"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
402 |
QThreadPool::globalInstance()->start(new Class0SmsServiceTask(class0Info)); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
403 |
QCRITICAL_WRITE("flashmsgnotifier END"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
404 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
405 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
406 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
407 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
408 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
409 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
410 |
// Class0SmsServiceTask::Class0SmsServiceTask |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
411 |
// @see msgnotifier_p.h |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
412 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
413 |
Class0SmsServiceTask::Class0SmsServiceTask(Class0Info& class0Info): |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
414 |
mClass0info(class0Info) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
415 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
416 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
417 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
418 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
419 |
// Class0SmsServiceTask::~Class0SmsServiceTask |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
420 |
// @see msgnotifier_p.h |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
421 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
422 |
Class0SmsServiceTask::~Class0SmsServiceTask() |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
423 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
424 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
425 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
426 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
427 |
// Class0SmsServiceTask::run |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
428 |
// @see msgnotifier_p.h |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
429 |
// ---------------------------------------------------------------------------- |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
430 |
void Class0SmsServiceTask::run() |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
431 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
432 |
QList<QVariant> args; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
433 |
QString serviceName("flashmsgnotifier"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
434 |
QString interfaceName("com.nokia.symbian.IFlashMsgNotifier"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
435 |
QString operation("displayFlashMsg(QByteArray)"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
436 |
XQAiwRequest* request; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
437 |
XQApplicationManager appManager; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
438 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
439 |
request = appManager.create(interfaceName, operation, false); //non-embedded |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
440 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
441 |
if ( request == NULL ) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
442 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
443 |
QCRITICAL_WRITE("flashmsgnotifier request == NULL"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
444 |
return; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
445 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
446 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
447 |
QByteArray ba; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
448 |
QDataStream stream(&ba, QIODevice::ReadWrite); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
449 |
stream << mClass0info.body; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
450 |
stream << mClass0info.address; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
451 |
stream << mClass0info.alias; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
452 |
stream << mClass0info.time; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
453 |
stream << mClass0info.messageId; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
454 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
455 |
args << ba; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
456 |
request->setArguments(args); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
457 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
458 |
if(!request->send()) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
459 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
460 |
QString lastErr; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
461 |
lastErr = request->lastErrorMessage(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
462 |
QDEBUG_WRITE_FORMAT("flashmsgnotifier launch failed", lastErr); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
463 |
} |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
464 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
465 |
QCRITICAL_WRITE("flashmsgnotifier END"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
466 |
delete request; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
467 |
} |
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
43
diff
changeset
|
468 |
|
31 | 469 |
//EOF |