37
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Reads message information from message store.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <msvids.h>
|
67
|
19 |
#include <msvstd.h>
|
37
|
20 |
#include <mmsconst.h>
|
|
21 |
#include <SendUiConsts.h>
|
67
|
22 |
#include <mtclreg.h> // for CClientMtmRegistry
|
|
23 |
#include <mmsnotificationclient.h>
|
|
24 |
#include <mmssettings.h>
|
|
25 |
#include <xqconversions.h> // from xqutils
|
|
26 |
#include <mmsconst.h>
|
|
27 |
#include <QDateTime>
|
|
28 |
#include <hbglobal.h>
|
37
|
29 |
|
|
30 |
#include "msgstorehandler.h"
|
|
31 |
#include "msgbiouids.h"
|
|
32 |
#include "convergedmessage.h"
|
|
33 |
|
67
|
34 |
// CONSTANTS
|
|
35 |
_LIT(KUnixEpoch, "19700000:000000.000000");
|
|
36 |
#define BYTES_TO_KBYTES_FACTOR 1024
|
|
37 |
|
|
38 |
// LOCALIZATION
|
|
39 |
// TODO : use dialog localizations
|
|
40 |
#define LOC_MESSAGE_SIZE hbTrId("txt_messaging_list_size")
|
|
41 |
#define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messaging_list_advertisement")
|
|
42 |
#define LOC_CLASS_INFORMATIONAL hbTrId("txt_messaging_list_informational")
|
|
43 |
#define LOC_CLASS_PERSONAL hbTrId("txt_messaging_list_personal")
|
|
44 |
#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
|
|
45 |
#define LOC_MMS_NOTIF_EXPIRED hbTrId("txt_messaging_list_message_expired")
|
|
46 |
#define LOC_MMS_WAITING hbTrId("txt_wireframe_list_multimedia_message_waiting")
|
|
47 |
#define LOC_MMS_RETRIEVING hbTrId("txt_messaging_list_retrieving_message")
|
|
48 |
#define LOC_MMS_EXPIRY_DATE hbTrId("txt_messaging_list_expiry_date")
|
|
49 |
|
37
|
50 |
//----------------------------------------------------------------------------
|
|
51 |
// MsgStoreHandler::MsgStoreHandler
|
|
52 |
// @see header
|
|
53 |
//----------------------------------------------------------------------------
|
|
54 |
MsgStoreHandler::MsgStoreHandler():
|
67
|
55 |
iMsvSession(NULL), iNotificationClient(NULL), iMtmReg(NULL)
|
|
56 |
{
|
|
57 |
InitL();
|
|
58 |
}
|
37
|
59 |
|
|
60 |
//----------------------------------------------------------------------------
|
|
61 |
// MsgStoreHandler::~MsgStoreHandler
|
|
62 |
// @see header
|
|
63 |
//----------------------------------------------------------------------------
|
|
64 |
MsgStoreHandler::~MsgStoreHandler()
|
67
|
65 |
{
|
|
66 |
if(iNotificationClient)
|
37
|
67 |
{
|
67
|
68 |
delete iNotificationClient;
|
|
69 |
iNotificationClient = NULL;
|
37
|
70 |
}
|
|
71 |
|
67
|
72 |
if(iMtmReg)
|
37
|
73 |
{
|
67
|
74 |
delete iMtmReg;
|
|
75 |
iMtmReg = NULL;
|
37
|
76 |
}
|
|
77 |
|
67
|
78 |
if(iMsvSession)
|
|
79 |
{
|
|
80 |
delete iMsvSession;
|
|
81 |
iMsvSession = NULL;
|
|
82 |
}
|
|
83 |
}
|
|
84 |
|
37
|
85 |
//----------------------------------------------------------------------------
|
|
86 |
// MsgStoreHandler::HandleSessionEventL
|
|
87 |
// @see header
|
|
88 |
//----------------------------------------------------------------------------
|
|
89 |
void MsgStoreHandler::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
|
|
90 |
TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
|
67
|
91 |
{
|
37
|
92 |
// Nothing to do
|
67
|
93 |
}
|
|
94 |
|
|
95 |
//----------------------------------------------------------------------------
|
|
96 |
// MsgStoreHandler::InitL
|
|
97 |
// @see header
|
|
98 |
//----------------------------------------------------------------------------
|
|
99 |
void MsgStoreHandler::InitL()
|
|
100 |
{
|
|
101 |
TInt err = KErrNone;
|
|
102 |
TRAP(err,iMsvSession = CMsvSession::OpenSyncL(*this));
|
|
103 |
if(err != KErrNone)
|
|
104 |
{
|
|
105 |
iMsvSession = NULL;
|
|
106 |
return;
|
37
|
107 |
}
|
|
108 |
|
67
|
109 |
TRAP(err,iMtmReg = CClientMtmRegistry::NewL(*iMsvSession));
|
|
110 |
if(err != KErrNone)
|
|
111 |
{
|
|
112 |
iMtmReg = NULL;
|
|
113 |
return;
|
|
114 |
}
|
|
115 |
}
|
|
116 |
|
37
|
117 |
//----------------------------------------------------------------------------
|
67
|
118 |
// MsgStoreHandler::MessageLocation
|
|
119 |
// @see header
|
|
120 |
//----------------------------------------------------------------------------
|
|
121 |
TMsvId MsgStoreHandler::MessageLocation( TMsvId aMsgId ) const
|
|
122 |
{
|
|
123 |
TMsvId parent = NULL;
|
|
124 |
CMsvEntry* cEntry = NULL;
|
|
125 |
TRAPD(err, cEntry = iMsvSession->GetEntryL(aMsgId));
|
|
126 |
if(err == KErrNone)
|
|
127 |
{
|
|
128 |
TMsvEntry msvEntry = cEntry->Entry();
|
|
129 |
parent = msvEntry.Parent();
|
|
130 |
}
|
|
131 |
delete cEntry;
|
|
132 |
return parent;
|
|
133 |
}
|
|
134 |
|
|
135 |
//----------------------------------------------------------------------------
|
|
136 |
// MsgStoreHandler::markAsRead
|
37
|
137 |
// @see header
|
|
138 |
//----------------------------------------------------------------------------
|
67
|
139 |
void MsgStoreHandler::markAsRead(int msgId)
|
|
140 |
{
|
|
141 |
CMsvEntry* cEntry = NULL;
|
|
142 |
TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
|
|
143 |
if(err == KErrNone)
|
37
|
144 |
{
|
67
|
145 |
TMsvEntry entry = cEntry->Entry();
|
|
146 |
if ( entry.Unread() )
|
|
147 |
{
|
|
148 |
// Mark the entry as read
|
|
149 |
entry.SetUnread( EFalse );
|
|
150 |
cEntry->ChangeL( entry );
|
|
151 |
}
|
|
152 |
}
|
|
153 |
delete cEntry;
|
|
154 |
}
|
|
155 |
|
|
156 |
//----------------------------------------------------------------------------
|
|
157 |
// MsgStoreHandler::getMsgTypeInfo
|
|
158 |
// @see header
|
|
159 |
//----------------------------------------------------------------------------
|
|
160 |
void MsgStoreHandler::getMsgTypeInfo(int msgId,
|
|
161 |
int& msgType,
|
|
162 |
int& msgSubType)
|
|
163 |
{
|
37
|
164 |
msgType = ConvergedMessage::None;
|
|
165 |
msgSubType = ConvergedMessage::None;
|
|
166 |
|
67
|
167 |
CMsvEntry* cEntry = NULL;
|
|
168 |
TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
|
|
169 |
if(err != KErrNone)
|
|
170 |
{
|
|
171 |
// error in getting the entry, return back
|
|
172 |
delete cEntry;
|
|
173 |
return;
|
|
174 |
}
|
|
175 |
|
|
176 |
TMsvEntry entry = cEntry->Entry();
|
37
|
177 |
switch(entry.iMtm.iUid)
|
67
|
178 |
{
|
|
179 |
case KSenduiMtmSmsUidValue:
|
37
|
180 |
{
|
|
181 |
msgType = ConvergedMessage::Sms;
|
67
|
182 |
if (entry.iBioType == KMsgBioUidVCard.iUid)
|
|
183 |
{
|
|
184 |
msgSubType = ConvergedMessage::VCard;
|
|
185 |
}
|
37
|
186 |
break;
|
67
|
187 |
}
|
37
|
188 |
case KSenduiMtmBtUidValue:
|
|
189 |
msgType = ConvergedMessage::BT;
|
|
190 |
break;
|
|
191 |
case KSenduiMtmMmsUidValue:
|
|
192 |
msgType = ConvergedMessage::Mms;
|
|
193 |
break;
|
|
194 |
case KSenduiMMSNotificationUidValue:
|
|
195 |
msgType = ConvergedMessage::MmsNotification;
|
|
196 |
break;
|
|
197 |
case KSenduiMtmBioUidValue:
|
67
|
198 |
{
|
|
199 |
if (entry.iMtmData1 == KSenduiMtmBtUidValue)
|
|
200 |
{
|
|
201 |
msgType = ConvergedMessage::BT;
|
|
202 |
if (entry.iBioType == KMsgBioUidVCard.iUid)
|
|
203 |
{
|
|
204 |
msgSubType = ConvergedMessage::VCard;
|
|
205 |
}
|
|
206 |
else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
|
|
207 |
{
|
|
208 |
msgSubType = ConvergedMessage::VCal;
|
|
209 |
}
|
|
210 |
break;
|
|
211 |
}
|
41
|
212 |
|
67
|
213 |
msgType = ConvergedMessage::BioMsg;
|
|
214 |
// based on the biotype uid set message type
|
|
215 |
if(entry.iBioType == KMsgBioUidRingingTone.iUid)
|
|
216 |
{
|
|
217 |
msgSubType = ConvergedMessage::RingingTone;
|
|
218 |
}
|
|
219 |
else if(entry.iBioType == KMsgBioProvisioningMessage.iUid)
|
|
220 |
{
|
|
221 |
msgSubType = ConvergedMessage::Provisioning;
|
|
222 |
}
|
|
223 |
else if (entry.iBioType == KMsgBioUidVCard.iUid)
|
|
224 |
{
|
41
|
225 |
msgSubType = ConvergedMessage::VCard;
|
|
226 |
}
|
67
|
227 |
else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
|
|
228 |
{
|
41
|
229 |
msgSubType = ConvergedMessage::VCal;
|
67
|
230 |
}
|
41
|
231 |
break;
|
|
232 |
}
|
37
|
233 |
default:
|
|
234 |
msgType = ConvergedMessage::None;
|
|
235 |
break;
|
|
236 |
}
|
67
|
237 |
delete cEntry;
|
|
238 |
}
|
37
|
239 |
|
|
240 |
//----------------------------------------------------------------------------
|
|
241 |
// MsgStoreHandler::deleteMessage
|
|
242 |
// @see header
|
|
243 |
//----------------------------------------------------------------------------
|
|
244 |
void MsgStoreHandler::deleteMessage(int msgId)
|
67
|
245 |
{
|
37
|
246 |
iMsvSession->RemoveEntry(msgId);
|
67
|
247 |
}
|
38
|
248 |
|
|
249 |
//----------------------------------------------------------------------------
|
|
250 |
// MsgStoreHandler::isDraftMessage
|
|
251 |
// @see header
|
|
252 |
//----------------------------------------------------------------------------
|
|
253 |
bool MsgStoreHandler::isDraftMessage(int msgId)
|
67
|
254 |
{
|
|
255 |
return (KMsvDraftEntryIdValue == MessageLocation(msgId));
|
|
256 |
}
|
|
257 |
|
|
258 |
//----------------------------------------------------------------------------
|
|
259 |
// MsgStoreHandler::locked
|
|
260 |
// @see header
|
|
261 |
//----------------------------------------------------------------------------
|
|
262 |
bool MsgStoreHandler::locked(int msgId)
|
|
263 |
{
|
|
264 |
bool msglocked = false;
|
|
265 |
CMsvEntry* cEntry = NULL;
|
|
266 |
TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
|
|
267 |
if(err != KErrNone)
|
|
268 |
{
|
|
269 |
// error in getting the entry e.g. already deleted message
|
|
270 |
msglocked = true;
|
|
271 |
}
|
|
272 |
else
|
|
273 |
{
|
|
274 |
// Outbox messages are locked and hence cann't be viewed.
|
|
275 |
// However, make an exception for failed messages.
|
|
276 |
TMsvEntry entry = cEntry->Entry();
|
|
277 |
if( (KMsvGlobalOutBoxIndexEntryIdValue == entry.Parent()) &&
|
|
278 |
(KMsvSendStateFailed != entry.SendingState()) )
|
|
279 |
{
|
|
280 |
msglocked = true;
|
|
281 |
}
|
|
282 |
}
|
|
283 |
delete cEntry;
|
|
284 |
return msglocked;
|
|
285 |
}
|
|
286 |
|
|
287 |
//----------------------------------------------------------------------------
|
|
288 |
// MsgStoreHandler::exists
|
|
289 |
// @see header
|
|
290 |
//----------------------------------------------------------------------------
|
|
291 |
bool MsgStoreHandler::exists(int msgId)
|
|
292 |
{
|
|
293 |
bool msgexists = true;
|
38
|
294 |
CMsvEntry* cEntry = NULL;
|
|
295 |
TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
|
67
|
296 |
if(err != KErrNone)
|
|
297 |
{
|
|
298 |
// error in getting the entry e.g. already deleted message
|
|
299 |
msgexists = false;
|
|
300 |
}
|
|
301 |
delete cEntry;
|
|
302 |
return msgexists;
|
|
303 |
}
|
|
304 |
|
|
305 |
//----------------------------------------------------------------------------
|
|
306 |
// MsgStoreHandler::setNotificationMessageId
|
|
307 |
// @see header
|
|
308 |
//----------------------------------------------------------------------------
|
|
309 |
int MsgStoreHandler::setNotificationMessageId(int msgId)
|
|
310 |
{
|
|
311 |
TRAPD(err, SetNotificationMessageIdL(msgId));
|
|
312 |
return err;
|
|
313 |
}
|
|
314 |
|
|
315 |
//----------------------------------------------------------------------------
|
|
316 |
// MsgStoreHandler::SetNotificationMessageIdL
|
|
317 |
// @see header
|
|
318 |
//----------------------------------------------------------------------------
|
|
319 |
void MsgStoreHandler::SetNotificationMessageIdL( TMsvId aMsgId )
|
|
320 |
{
|
|
321 |
// get MMS Notification client mtm & set the content to current entry
|
|
322 |
if(iNotificationClient)
|
|
323 |
{
|
|
324 |
delete iNotificationClient;
|
|
325 |
iNotificationClient = NULL;
|
|
326 |
}
|
|
327 |
iNotificationClient = static_cast<CMmsNotificationClientMtm*>(
|
|
328 |
iMtmReg->NewMtmL( KUidMsgMMSNotification ));
|
|
329 |
iNotificationClient->SwitchCurrentEntryL(aMsgId);
|
|
330 |
iNotificationClient->LoadMessageL();
|
|
331 |
}
|
|
332 |
|
|
333 |
//----------------------------------------------------------------------------
|
|
334 |
// MsgStoreHandler::MaxReceiveSizeLimitL
|
|
335 |
// @see header
|
|
336 |
//----------------------------------------------------------------------------
|
|
337 |
TInt MsgStoreHandler::MaxReceiveSizeLimitL()
|
|
338 |
{
|
|
339 |
CMmsSettings* settings = CMmsSettings::NewL();
|
|
340 |
CleanupStack::PushL( settings );
|
|
341 |
iNotificationClient->RestoreSettingsL();
|
|
342 |
settings->CopyL( iNotificationClient->MmsSettings() );
|
|
343 |
TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() );
|
|
344 |
CleanupStack::PopAndDestroy( settings );
|
|
345 |
return maxSize;
|
|
346 |
}
|
|
347 |
|
|
348 |
// ---------------------------------------------------------
|
|
349 |
// MsgStoreHandler::MmsNotificationStatus
|
|
350 |
// @see header
|
|
351 |
// ---------------------------------------------------------
|
|
352 |
TCsMmsNotificationMsgState
|
|
353 |
MsgStoreHandler::MmsNotificationStatus( TInt aMsvId )
|
|
354 |
{
|
|
355 |
TMsvId dummy = 0x0;
|
|
356 |
|
|
357 |
TMsvEntry entry;
|
|
358 |
iMsvSession->GetEntry(aMsvId, dummy, entry);
|
|
359 |
|
|
360 |
TCsMmsNotificationMsgState status = EMsgStatusNull;
|
|
361 |
|
|
362 |
TTime currentTime;
|
|
363 |
currentTime.HomeTime( );
|
|
364 |
TTime expiryTime = iNotificationClient->ExpiryDate( );
|
|
365 |
TLocale locale;
|
|
366 |
expiryTime += locale.UniversalTimeOffset();
|
|
367 |
if (locale.QueryHomeHasDaylightSavingOn())
|
38
|
368 |
{
|
67
|
369 |
TTimeIntervalHours daylightSaving(1);
|
|
370 |
expiryTime += daylightSaving;
|
|
371 |
}
|
|
372 |
|
|
373 |
// operationMask includes operation type. It is not bitmap but ordinal number.
|
|
374 |
// It does not include operation status and result
|
|
375 |
TInt operationMask = (entry.iMtmData2 & KMmsOperationIdentifier) ;
|
|
376 |
|
|
377 |
// Note! Ongoing operation resets every bit of operation type, operation status
|
|
378 |
// and result. E.g. If message has been forwarded and then fetching starts,
|
|
379 |
// information about forwarding is lost
|
|
380 |
|
|
381 |
if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageMNotificationInd )
|
38
|
382 |
{
|
67
|
383 |
if( operationMask == KMmsOperationFetch
|
|
384 |
&& OperationOngoing( entry ) )
|
|
385 |
{
|
|
386 |
// It's in retrieving state
|
|
387 |
status = EMsgStatusRetrieving;
|
|
388 |
}
|
|
389 |
else if( operationMask == KMmsOperationForward
|
|
390 |
&& OperationOngoing( entry ) )
|
|
391 |
{
|
|
392 |
// It's in forwarding state
|
|
393 |
status = EMsgStatusForwarding;
|
|
394 |
}
|
|
395 |
else if( operationMask == KMmsOperationForward
|
|
396 |
&& OperationFinished( entry )
|
|
397 |
&& !( entry.iMtmData2 & KMmsOperationResult ) )
|
|
398 |
{
|
|
399 |
// It's been forwarded succesfully
|
|
400 |
status = EMsgStatusForwarded;
|
|
401 |
}
|
|
402 |
else if( operationMask == KMmsOperationFetch
|
|
403 |
&& OperationFinished( entry )
|
|
404 |
&& ( entry.iMtmData2 & KMmsOperationResult
|
|
405 |
|| entry.iError ) )
|
|
406 |
{
|
|
407 |
// Fetch has been failed
|
|
408 |
status = EMsgStatusFailed;
|
|
409 |
}
|
|
410 |
else if( operationMask == KMmsOperationDelete
|
|
411 |
&& OperationFinished( entry )
|
|
412 |
&& !( entry.iMtmData2 & KMmsOperationResult ) )
|
|
413 |
{
|
|
414 |
// It's been deleted succesfully
|
|
415 |
status = EMsgStatusDeleted;
|
|
416 |
}
|
|
417 |
else if( currentTime > expiryTime )
|
|
418 |
{
|
|
419 |
status = EMsgStatusExpired;
|
|
420 |
}
|
|
421 |
else
|
|
422 |
{ // Normal waiting state
|
|
423 |
status = EMsgStatusReadyForFetching;
|
|
424 |
}
|
|
425 |
}
|
|
426 |
|
|
427 |
return status;
|
|
428 |
}
|
|
429 |
|
|
430 |
// ---------------------------------------------------------
|
|
431 |
// MsgStoreHandler::OperationOngoing
|
|
432 |
// @see header
|
|
433 |
// ---------------------------------------------------------
|
|
434 |
TBool MsgStoreHandler::OperationOngoing(
|
|
435 |
const TMsvEntry& aEntry ) const
|
|
436 |
{
|
|
437 |
return ( aEntry.iMtmData2 & KMmsOperationOngoing
|
|
438 |
&& !( aEntry.iMtmData2 & KMmsOperationFinished ) );
|
|
439 |
}
|
|
440 |
|
|
441 |
// ---------------------------------------------------------
|
|
442 |
// MsgStoreHandler::OperationFinished
|
|
443 |
// @see header
|
|
444 |
// ---------------------------------------------------------
|
|
445 |
TBool MsgStoreHandler::OperationFinished(
|
|
446 |
const TMsvEntry& aEntry ) const
|
|
447 |
{
|
|
448 |
return ( aEntry.iMtmData2 & KMmsOperationFinished
|
|
449 |
&& !( aEntry.iMtmData2 & KMmsOperationOngoing ) );
|
|
450 |
}
|
|
451 |
|
|
452 |
//---------------------------------------------------------------
|
|
453 |
// MsgStoreHandler::notificationSubject
|
|
454 |
// @see header
|
|
455 |
//---------------------------------------------------------------
|
|
456 |
QString MsgStoreHandler::notificationSubject()
|
|
457 |
{
|
|
458 |
QString subject;
|
|
459 |
if(iNotificationClient)
|
|
460 |
{
|
|
461 |
TPtrC sub = iNotificationClient->SubjectL();
|
|
462 |
subject = XQConversions::s60DescToQString(sub);
|
|
463 |
}
|
|
464 |
return subject;
|
|
465 |
}
|
|
466 |
//---------------------------------------------------------------
|
|
467 |
// MsgStoreHandler::notificationMsgSize
|
|
468 |
// @see header
|
|
469 |
//---------------------------------------------------------------
|
|
470 |
QString MsgStoreHandler::notificationMsgSize()
|
|
471 |
{
|
|
472 |
// Null check
|
|
473 |
if(!iNotificationClient)
|
|
474 |
{
|
|
475 |
return LOC_MESSAGE_SIZE.arg(0);
|
|
476 |
}
|
|
477 |
|
|
478 |
// Size of message.
|
|
479 |
TInt size = iNotificationClient->MessageTransferSize();
|
|
480 |
|
|
481 |
// read max receive size limit from settings
|
|
482 |
TInt maxSize = 0;
|
|
483 |
TRAP_IGNORE(maxSize = MaxReceiveSizeLimitL());
|
|
484 |
|
|
485 |
// apply max size limit rule
|
|
486 |
if( maxSize > 0 )
|
|
487 |
{
|
|
488 |
if( size > maxSize )
|
|
489 |
{
|
|
490 |
size = maxSize;
|
38
|
491 |
}
|
|
492 |
}
|
|
493 |
|
67
|
494 |
TInt fileSize = size / BYTES_TO_KBYTES_FACTOR;
|
|
495 |
if ( size % BYTES_TO_KBYTES_FACTOR )
|
|
496 |
{
|
|
497 |
fileSize++;
|
|
498 |
}
|
|
499 |
|
|
500 |
return LOC_MESSAGE_SIZE.arg(fileSize);
|
|
501 |
}
|
|
502 |
|
|
503 |
//---------------------------------------------------------------
|
|
504 |
// MsgStoreHandler::notificationClass
|
|
505 |
// @see header
|
|
506 |
//---------------------------------------------------------------
|
|
507 |
QString MsgStoreHandler::notificationClass()
|
|
508 |
{
|
|
509 |
QString notificationClass;
|
|
510 |
// Null Check
|
|
511 |
if(!iNotificationClient)
|
|
512 |
{
|
|
513 |
return notificationClass;
|
|
514 |
}
|
|
515 |
|
|
516 |
TInt msgClass = iNotificationClient->MessageClass( );
|
|
517 |
switch( msgClass )
|
|
518 |
{
|
|
519 |
case EMmsClassPersonal:
|
|
520 |
{
|
|
521 |
notificationClass = LOC_CLASS_PERSONAL;
|
|
522 |
break;
|
|
523 |
}
|
|
524 |
case EMmsClassAdvertisement:
|
|
525 |
{
|
|
526 |
notificationClass = LOC_CLASS_ADVERTISEMENT;
|
|
527 |
break;
|
|
528 |
}
|
|
529 |
case EMmsClassInformational:
|
|
530 |
{
|
|
531 |
notificationClass = LOC_CLASS_INFORMATIONAL;
|
|
532 |
break;
|
|
533 |
}
|
|
534 |
default:
|
|
535 |
{ // In case no class is returned (0), don't add the field
|
|
536 |
break;
|
|
537 |
}
|
|
538 |
}
|
|
539 |
return notificationClass;
|
38
|
540 |
}
|
67
|
541 |
|
|
542 |
//---------------------------------------------------------------
|
|
543 |
// MsgStoreHandler::notificationStatus
|
|
544 |
// @see header
|
|
545 |
//---------------------------------------------------------------
|
|
546 |
void MsgStoreHandler::notificationStatus(
|
|
547 |
int& status,
|
|
548 |
QString& statusStr)
|
|
549 |
{
|
|
550 |
// Null Check
|
|
551 |
if(!iNotificationClient)
|
|
552 |
{
|
|
553 |
return;
|
|
554 |
}
|
|
555 |
|
|
556 |
// fetch mms notification status from store handler
|
|
557 |
// and map as per our UI requirements
|
|
558 |
TMsvEntry entry = iNotificationClient->Entry().Entry();
|
|
559 |
status = MmsNotificationStatus(entry.Id());
|
|
560 |
switch(status)
|
|
561 |
{
|
|
562 |
case ConvergedMessage::NotifFailed:
|
|
563 |
{
|
|
564 |
statusStr = LOC_MMS_RETRIEVAL_FAILED;
|
|
565 |
break;
|
|
566 |
}
|
|
567 |
case ConvergedMessage::NotifExpired:
|
|
568 |
{
|
|
569 |
statusStr = LOC_MMS_NOTIF_EXPIRED;
|
|
570 |
break;
|
|
571 |
}
|
|
572 |
case ConvergedMessage::NotifReadyForFetching:
|
|
573 |
{
|
|
574 |
statusStr = LOC_MMS_WAITING;
|
|
575 |
break;
|
|
576 |
}
|
|
577 |
case ConvergedMessage::NotifWaiting:
|
|
578 |
case ConvergedMessage::NotifRetrieving:
|
|
579 |
{
|
|
580 |
statusStr = LOC_MMS_RETRIEVING;
|
|
581 |
break;
|
|
582 |
}
|
|
583 |
default:
|
|
584 |
{
|
|
585 |
// not handled, do nothing
|
|
586 |
break;
|
|
587 |
}
|
|
588 |
}
|
|
589 |
}
|
|
590 |
|
|
591 |
//---------------------------------------------------------------
|
|
592 |
// MsgStoreHandler::notificationExpiryDate
|
|
593 |
// @see header
|
|
594 |
//---------------------------------------------------------------
|
|
595 |
QString MsgStoreHandler::notificationExpiryDate()
|
|
596 |
{
|
|
597 |
// Null Check
|
|
598 |
if(!iNotificationClient)
|
|
599 |
{
|
|
600 |
return QString();
|
|
601 |
}
|
|
602 |
|
|
603 |
// get expiry time from entry
|
|
604 |
TTime expiryTime = iNotificationClient->ExpiryDate( );
|
|
605 |
TLocale locale;
|
|
606 |
expiryTime += locale.UniversalTimeOffset();
|
|
607 |
if (locale.QueryHomeHasDaylightSavingOn())
|
|
608 |
{
|
|
609 |
TTimeIntervalHours daylightSaving(1);
|
|
610 |
expiryTime += daylightSaving;
|
|
611 |
}
|
|
612 |
|
|
613 |
// create formatted string for the expiry time
|
|
614 |
TTime unixEpoch(KUnixEpoch);
|
|
615 |
TTimeIntervalSeconds seconds;
|
|
616 |
expiryTime.SecondsFrom(unixEpoch, seconds);
|
|
617 |
return LOC_MMS_EXPIRY_DATE.arg(seconds.Int());
|
|
618 |
}
|
|
619 |
|
37
|
620 |
// End of file
|