79
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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:
|
|
15 |
* Item array for the message items to be displayed by mce.
|
|
16 |
* Main view items are kept in memory (CArrayFixFlat<TMceListItem>) when created but
|
|
17 |
* Message view list items are fetched from the msgs when needed in MdcaPoint function
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
// INCLUDE FILES
|
|
24 |
|
|
25 |
#include <AknUtils.h> // AknTextUtils
|
|
26 |
#include <mtudcbas.h>
|
|
27 |
#include <msvids.h>
|
|
28 |
#include <NpdApi.h> // CNotepadApi
|
|
29 |
#include "MtmRegistryObserver.h" // MMtmUiDataRegistryObserver
|
|
30 |
#include <StringLoader.h> // StringLoader
|
|
31 |
#include <mce.rsg>
|
|
32 |
#include <SenduiMtmUids.h> // mtm uids
|
|
33 |
#include <eikenv.h>
|
|
34 |
|
|
35 |
#include "MceMessageListItemArray.h"
|
|
36 |
#include "MceBitmapResolver.h"
|
|
37 |
#include "MceIds.h" // KMceDocumentsEntryIdValue
|
|
38 |
#include "McePanic.h"
|
|
39 |
#include "MceCommands.hrh"
|
|
40 |
#include "MceLogText.h"
|
|
41 |
|
|
42 |
#include <MTMStore.h>
|
|
43 |
#include <commonphoneparser.h>
|
|
44 |
|
|
45 |
#include <aknappui.h>
|
|
46 |
#include <akncontext.h>
|
|
47 |
#include <aknconsts.h>
|
|
48 |
#include <e32math.h>
|
|
49 |
|
|
50 |
#include <bldvariant.hrh>
|
|
51 |
#include <featmgr.h>
|
|
52 |
#include <NumberGrouping.h>
|
|
53 |
#include <mmsconst.h>
|
|
54 |
#include <mmsgenutils.h>
|
|
55 |
#include <mmsclient.h>
|
|
56 |
#include <mtclreg.h>
|
|
57 |
#include <muiu.mbg>
|
|
58 |
#include <mtudreg.h> // CMtmUiDataRegistry
|
|
59 |
|
|
60 |
// security data caging
|
|
61 |
#include <data_caging_path_literals.hrh>
|
|
62 |
#include <miutset.h>
|
|
63 |
#include <msvapi.h>
|
|
64 |
#include <ImumInternalApi.h> // CImumInternalApi
|
|
65 |
#include <ImumInSettingsData.h> // CImumInSettingsData
|
|
66 |
|
|
67 |
#include <muiuflags.h>
|
|
68 |
|
|
69 |
//FS email stuff
|
|
70 |
#include <centralrepository.h>
|
|
71 |
#include <MessagingDomainCRKeys.h>
|
|
72 |
const TInt KMceListArrayGranuality = 4;
|
|
73 |
|
|
74 |
// CONSTANTS
|
|
75 |
|
|
76 |
const TInt KMceArabicSemiColon = {0x061B};
|
|
77 |
const TInt KMceSemiColon = {0x003B};
|
|
78 |
const TInt KMceMaxFormatFactor = 2;
|
|
79 |
const TText KMceRLM = 0x200F;
|
|
80 |
const TText KMcePDF = 0x202C;
|
|
81 |
|
|
82 |
const TUid KUidMsvMessageListSortOrder={0x10005359};
|
|
83 |
|
|
84 |
_LIT( KSortSubjectSkipString, "*:*" );
|
|
85 |
const TChar KWhiteSpaceCharacter(' ');
|
|
86 |
const TInt KSortSubjectStringLength = 100;
|
|
87 |
|
|
88 |
// LOCAL CONSTANTS AND MACROS
|
|
89 |
enum
|
|
90 |
{
|
|
91 |
KMceListArrayDocAmount = 0x0,
|
|
92 |
KMceListArrayDocAmountMany,
|
|
93 |
KMceListArrayDocAmountTemp,
|
|
94 |
KMceListArrayDocAmountTemps,
|
|
95 |
KMceListArrayTimeFormatBuffer,
|
|
96 |
KMceListArrayDateFormatBuffer
|
|
97 |
};
|
|
98 |
|
|
99 |
//cmail update
|
|
100 |
#define KUidMsgTypeFsMtmVal 0x2001F406
|
|
101 |
|
|
102 |
const TUid KMailTechnologyTypeUid = { 0x10001671 };
|
|
103 |
|
|
104 |
// ================= MEMBER FUNCTIONS =======================
|
|
105 |
|
|
106 |
// C++ default constructor can NOT contain any code that
|
|
107 |
// might leave.
|
|
108 |
//
|
|
109 |
CMceMessageListItemArray::CMceMessageListItemArray(
|
|
110 |
CMsvSessionPtr aSession,
|
|
111 |
TMsvId aFolderId,
|
|
112 |
TMceListType aListType,
|
|
113 |
CMceBitmapResolver& aBitmapResolver ) :
|
|
114 |
// CArrayFixFlat<TMceListItem>( KMceListGranuality ),
|
|
115 |
iSession( aSession ),
|
|
116 |
iFolderId( aFolderId ),
|
|
117 |
iListType( aListType ),
|
|
118 |
iBitmapResolver( aBitmapResolver ),
|
|
119 |
iEmailClientIntegration(EFalse),
|
|
120 |
iIntegratedEmailAppExcist(EFalse),
|
|
121 |
iEmailFramework(EFalse)
|
|
122 |
{
|
|
123 |
iDescriptionLength = iBitmapResolver.DescriptionLength();
|
|
124 |
}
|
|
125 |
|
|
126 |
// ----------------------------------------------------
|
|
127 |
// CMceMessageListItemArray::ConstructL
|
|
128 |
// Symbian OS default constructor can leave.
|
|
129 |
// ----------------------------------------------------
|
|
130 |
void CMceMessageListItemArray::ConstructL()
|
|
131 |
{
|
|
132 |
CRepository* repository = NULL;
|
|
133 |
// read phone number grouping feature flag
|
|
134 |
iNumberGroupingEnabledFlag = MceUtils::NumberGroupingEnabled();
|
|
135 |
|
|
136 |
iPreviousSelectionOrdering = TMsvSelectionOrdering(
|
|
137 |
KMsvGroupByStandardFolders, EMsvSortByDateReverse);
|
|
138 |
// Added for FS Email stuff
|
|
139 |
FeatureManager::InitializeLibL();
|
|
140 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) )
|
|
141 |
{
|
|
142 |
iEmailFramework = ETrue;
|
|
143 |
}
|
|
144 |
if ( FeatureManager::FeatureSupported( KFeatureIdEmailMceIntegration) )
|
|
145 |
{
|
|
146 |
iEmailClientIntegration = ETrue;
|
|
147 |
|
|
148 |
// Check if there is other than platform email application registered to handle S60 mailboxes
|
|
149 |
repository = NULL;
|
|
150 |
TInt mtmPluginID = 0;
|
|
151 |
TRAPD( ret, repository = CRepository::NewL(
|
|
152 |
KCRUidSelectableDefaultEmailSettings ) );
|
|
153 |
|
|
154 |
if ( ret == KErrNone )
|
|
155 |
{
|
|
156 |
TInt err = repository->Get( KIntegratedEmailAppMtmPluginId ,
|
|
157 |
mtmPluginID );
|
|
158 |
if ( err != KErrNone )
|
|
159 |
{
|
|
160 |
mtmPluginID = 0;
|
|
161 |
}
|
|
162 |
}
|
|
163 |
delete repository;
|
|
164 |
|
|
165 |
if ( mtmPluginID != 0 )
|
|
166 |
{
|
|
167 |
iIntegratedEmailAppExcist = ETrue;
|
|
168 |
}
|
|
169 |
}
|
|
170 |
|
|
171 |
|
|
172 |
FeatureManager::UnInitializeLib();
|
|
173 |
iFolderEntry = CMsvEntry::NewL(
|
|
174 |
*iSession,
|
|
175 |
iFolderId,
|
|
176 |
iPreviousSelectionOrdering );
|
|
177 |
|
|
178 |
iNumberOfMessagesStrings = new(ELeave)CDesCArrayFlat( KMceListGranuality );
|
|
179 |
TBuf<KMcePrintableTextLength> tempString;
|
|
180 |
CCoeEnv* eikonEnv = CEikonEnv::Static();
|
|
181 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT, eikonEnv );
|
|
182 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
183 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_MANY, eikonEnv );
|
|
184 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
185 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_TEMP, eikonEnv );
|
|
186 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
187 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_TEMPS, eikonEnv );
|
|
188 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
189 |
|
|
190 |
|
|
191 |
HBufC* timeFormat = eikonEnv->
|
|
192 |
AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
|
|
193 |
iNumberOfMessagesStrings->AppendL( *timeFormat );
|
|
194 |
CleanupStack::PopAndDestroy();
|
|
195 |
|
|
196 |
HBufC* dateFormat = eikonEnv->
|
|
197 |
AllocReadResourceLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO );
|
|
198 |
iNumberOfMessagesStrings->AppendL( *dateFormat );
|
|
199 |
CleanupStack::PopAndDestroy();
|
|
200 |
|
|
201 |
// TODO
|
|
202 |
iListBoxText = HBufC::NewL( iDescriptionLength*3 );
|
|
203 |
iUiRegistry = CMtmUiDataRegistry::NewL(*iSession);
|
|
204 |
//FS Email stuff
|
|
205 |
iMsgIndex = new ( ELeave )CArrayFixFlat<TInt>( KMceListArrayGranuality );
|
|
206 |
}
|
|
207 |
|
|
208 |
// Two-phased constructor.
|
|
209 |
CMceMessageListItemArray* CMceMessageListItemArray::NewL(
|
|
210 |
CMsvSessionPtr aSession,
|
|
211 |
TMsvId aFolderId,
|
|
212 |
TMceListType aListType,
|
|
213 |
CMceBitmapResolver& aBitmapResolver )
|
|
214 |
{
|
|
215 |
CMceMessageListItemArray* self = new (ELeave) CMceMessageListItemArray(
|
|
216 |
aSession, aFolderId, aListType, aBitmapResolver );
|
|
217 |
CleanupStack::PushL(self);
|
|
218 |
self->ConstructL();
|
|
219 |
CleanupStack::Pop(); // self
|
|
220 |
return self;
|
|
221 |
}
|
|
222 |
|
|
223 |
|
|
224 |
// Destructor
|
|
225 |
CMceMessageListItemArray::~CMceMessageListItemArray( )
|
|
226 |
{
|
|
227 |
delete iFolderEntry;
|
|
228 |
delete iListBoxText;
|
|
229 |
delete iNumberOfMessagesStrings;
|
|
230 |
delete iUiRegistry;
|
|
231 |
if(iMsgIndex)
|
|
232 |
{
|
|
233 |
delete iMsgIndex;
|
|
234 |
iMsgIndex = NULL;
|
|
235 |
}
|
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
// ----------------------------------------------------
|
|
240 |
// CMceMessageListItemArray::ItemIndex
|
|
241 |
// ----------------------------------------------------
|
|
242 |
TInt CMceMessageListItemArray::ItemIndex(TMsvId aItemId) const
|
|
243 |
{
|
|
244 |
TInt foundItem = KErrNotFound;
|
|
245 |
TInt count = iFolderEntry->Count();
|
|
246 |
if ( (iEmailClientIntegration && iIntegratedEmailAppExcist) || iEmailFramework )
|
|
247 |
{
|
|
248 |
TRAP_IGNORE( count = CreateEntryIndexL() );
|
|
249 |
}
|
|
250 |
for( TInt loop = 0; loop < count && foundItem == KErrNotFound ; loop++)
|
|
251 |
{
|
|
252 |
if ( (*iFolderEntry)[ GetEntryIndex( loop ) ].Id() == aItemId )
|
|
253 |
{
|
|
254 |
foundItem = loop;
|
|
255 |
}
|
|
256 |
}
|
|
257 |
return foundItem;
|
|
258 |
}
|
|
259 |
|
|
260 |
// ----------------------------------------------------
|
|
261 |
// CMceMessageListItemArray::ItemId
|
|
262 |
// ----------------------------------------------------
|
|
263 |
TMsvId CMceMessageListItemArray::ItemId( TInt aIndex ) const
|
|
264 |
{
|
|
265 |
TMsvId id = KErrNotFound;
|
|
266 |
if ( aIndex >= 0 && iFolderEntry->Count() > aIndex )
|
|
267 |
{
|
|
268 |
id = (*iFolderEntry)[ GetEntryIndex( aIndex ) ].Id();
|
|
269 |
}
|
|
270 |
return id;
|
|
271 |
}
|
|
272 |
|
|
273 |
// ----------------------------------------------------
|
|
274 |
// CMceMessageListItemArray::Item
|
|
275 |
// ----------------------------------------------------
|
|
276 |
const TMceListItem CMceMessageListItemArray::Item( TInt aIndex ) const
|
|
277 |
{
|
|
278 |
TMceListItem tempItem;
|
|
279 |
tempItem.iMsvId = (*iFolderEntry)[ aIndex ].Id();
|
|
280 |
tempItem.iExtraItem = EFalse;
|
|
281 |
return tempItem;
|
|
282 |
}
|
|
283 |
|
|
284 |
|
|
285 |
// ----------------------------------------------------
|
|
286 |
// CMceMessageListItemArray::GetEntry
|
|
287 |
// ----------------------------------------------------
|
|
288 |
TInt CMceMessageListItemArray::GetEntry( TMsvId aEntryId, TMsvEntry& aEntry )
|
|
289 |
{
|
|
290 |
TMsvId serviceId;
|
|
291 |
return iSession->GetEntry( aEntryId, serviceId, aEntry );
|
|
292 |
}
|
|
293 |
|
|
294 |
|
|
295 |
// ----------------------------------------------------
|
|
296 |
// CMceMessageListItemArray::SetFolderL
|
|
297 |
// ----------------------------------------------------
|
|
298 |
void CMceMessageListItemArray::SetFolderL( TMsvId aFolderId )
|
|
299 |
{
|
|
300 |
// this can only happen when iListType == EMceListTypeMessage
|
|
301 |
iFolderEntry->SetEntryL( aFolderId );
|
|
302 |
iFolderId = aFolderId;
|
|
303 |
}
|
|
304 |
|
|
305 |
// ----------------------------------------------------
|
|
306 |
// CMceMessageListItemArray::IsItemFolder
|
|
307 |
// ----------------------------------------------------
|
|
308 |
TBool CMceMessageListItemArray::IsItemFolder( TMsvId aItemId ) const
|
|
309 |
{
|
|
310 |
TBool isFolder = EFalse;
|
|
311 |
TMsvId serviceId;
|
|
312 |
TMsvEntry entry;
|
|
313 |
if ( iSession->GetEntry( aItemId, serviceId, entry ) == KErrNone &&
|
|
314 |
entry.iType == KUidMsvFolderEntry )
|
|
315 |
{
|
|
316 |
isFolder = ETrue;
|
|
317 |
}
|
|
318 |
return isFolder;
|
|
319 |
}
|
|
320 |
|
|
321 |
// ----------------------------------------------------
|
|
322 |
// CMceMessageListItemArray::MdcaCount
|
|
323 |
// ----------------------------------------------------
|
|
324 |
TInt CMceMessageListItemArray::MdcaCount() const
|
|
325 |
{
|
|
326 |
TInt retval=iFolderEntry->Count();
|
|
327 |
if (( iEmailClientIntegration && iIntegratedEmailAppExcist )||(iEmailFramework))
|
|
328 |
{
|
|
329 |
if( iFolderId == KMsvDraftEntryId ||
|
|
330 |
iFolderId == KMsvSentEntryId ||
|
|
331 |
iFolderId == KMsvDeletedEntryFolderEntryId ||
|
|
332 |
iFolderId == KMsvGlobalInBoxIndexEntryId || iFolderId == KMsvGlobalOutBoxIndexEntryId)
|
|
333 |
{
|
|
334 |
|
|
335 |
TRAP_IGNORE( retval = CreateEntryIndexL() );
|
|
336 |
}
|
|
337 |
}
|
|
338 |
return ( retval );
|
|
339 |
}
|
|
340 |
|
|
341 |
// ----------------------------------------------------
|
|
342 |
// CMceMessageListItemArray::MdcaPoint
|
|
343 |
// ----------------------------------------------------
|
|
344 |
TPtrC CMceMessageListItemArray::MdcaPoint( TInt aIndex ) const
|
|
345 |
{
|
|
346 |
return MakeStringForMessageView( aIndex );
|
|
347 |
}
|
|
348 |
|
|
349 |
// ----------------------------------------------------
|
|
350 |
// CMceMessageListItemArray::MakeStringForMessageView
|
|
351 |
// ----------------------------------------------------
|
|
352 |
TPtrC CMceMessageListItemArray::MakeStringForMessageView( TInt aIndex ) const
|
|
353 |
{
|
|
354 |
__ASSERT_DEBUG( iListType == EMceListTypeMessage, Panic(EMceListItemArrayNotMessageViewList ) );
|
|
355 |
const TMsvEntry* child;
|
|
356 |
child = &(*iFolderEntry)[ GetEntryIndex( aIndex ) ];
|
|
357 |
TPtr tempText = iListBoxText->Des();
|
|
358 |
|
|
359 |
tempText.Zero();
|
|
360 |
const TInt index = iBitmapResolver.BitmapIndex( *child );
|
|
361 |
tempText.AppendNum( index );
|
|
362 |
tempText.Append( KColumnListSeparator );
|
|
363 |
|
|
364 |
if ( child->iType == KUidMsvFolderEntry )
|
|
365 |
{
|
|
366 |
AppendFolderString( tempText, *child );
|
|
367 |
}
|
|
368 |
else // should be KUidMsvMessageEntryValue
|
|
369 |
{
|
|
370 |
AppendMessageString( tempText, *child );
|
|
371 |
}
|
|
372 |
return tempText;
|
|
373 |
|
|
374 |
}
|
|
375 |
|
|
376 |
// ----------------------------------------------------
|
|
377 |
// CMceMessageListItemArray::AppendMessageString
|
|
378 |
// ----------------------------------------------------
|
|
379 |
void CMceMessageListItemArray::AppendMessageString( TDes& aBuffer, const TMsvEntry& aEntry ) const
|
|
380 |
{
|
|
381 |
__ASSERT_DEBUG( aEntry.iType == KUidMsvMessageEntry, Panic(EMceListItemArrayEntryNotMessage ) );
|
|
382 |
|
|
383 |
if ( aEntry.iMtm == KSenduiMtmImap4Uid || aEntry.iMtm == KSenduiMtmPop3Uid
|
|
384 |
|| aEntry.iMtm == KSenduiMtmSmtpUid )
|
|
385 |
{
|
|
386 |
StripAndAppendString( aBuffer, aEntry.iDetails );
|
|
387 |
}
|
|
388 |
else
|
|
389 |
{
|
|
390 |
TRAPD( error, AppendRecipientStringL( aBuffer, aEntry ) );
|
|
391 |
if ( error != KErrNone )
|
|
392 |
{
|
|
393 |
// leave is not needed to handle; if leaves, nothing is shown
|
|
394 |
}
|
|
395 |
}
|
|
396 |
|
|
397 |
aBuffer.Append( KColumnListSeparator );
|
|
398 |
|
|
399 |
if ( ( iFolderEntry->Entry().Id() == KMsvGlobalInBoxIndexEntryId ) &&
|
|
400 |
( aEntry.iMtm == KUidMsgMMSNotification ) )
|
|
401 |
{
|
|
402 |
TRAP_IGNORE( MakeInboxStatusStringL( aBuffer, aEntry ) );
|
|
403 |
}
|
|
404 |
|
|
405 |
else if ( iFolderEntry->Entry().Id() == KMsvGlobalOutBoxIndexEntryId )
|
|
406 |
{
|
|
407 |
// in outbox show status of the message
|
|
408 |
TRAP_IGNORE(MakeSendStatusStringL(aBuffer, aEntry));
|
|
409 |
}
|
|
410 |
else
|
|
411 |
{
|
|
412 |
TRAP_IGNORE( AppendTimeStringL( aBuffer, aEntry ) );
|
|
413 |
|
|
414 |
if ( aEntry.iMtm==KSenduiMtmIrUid || aEntry.iMtm==KSenduiMtmBtUid )
|
|
415 |
{
|
|
416 |
TRAP_IGNORE( AppendBtIrMessageStringL( aBuffer, aEntry ) );
|
|
417 |
}
|
|
418 |
else
|
|
419 |
{
|
|
420 |
StripAndAppendString( aBuffer, aEntry.iDescription );
|
|
421 |
}
|
|
422 |
}
|
|
423 |
|
|
424 |
aBuffer.Append( KColumnListSeparator );
|
|
425 |
|
|
426 |
|
|
427 |
if ( aEntry.Attachment()&& aEntry.iMtm != KSenduiMtmMmsUid
|
|
428 |
&& IsMailMtmTechnology(aEntry.iMtm))
|
|
429 |
{
|
|
430 |
aBuffer.AppendNum( (TInt) EMceBitmapIndexAttachment );
|
|
431 |
aBuffer.Append( KColumnListSeparator );
|
|
432 |
}
|
|
433 |
|
|
434 |
TMsvPriority priority = aEntry.Priority();
|
|
435 |
if ( priority == EMsvHighPriority )
|
|
436 |
{
|
|
437 |
aBuffer.AppendNum( EMceBitmapIndexPriorityHigh );
|
|
438 |
aBuffer.Append( KColumnListSeparator );
|
|
439 |
}
|
|
440 |
else if ( priority == EMsvLowPriority )
|
|
441 |
{
|
|
442 |
aBuffer.AppendNum( EMceBitmapIndexPriorityLow );
|
|
443 |
aBuffer.Append( KColumnListSeparator );
|
|
444 |
}
|
|
445 |
|
|
446 |
}
|
|
447 |
|
|
448 |
// ----------------------------------------------------
|
|
449 |
// CMceMessageListItemArray::AppendFolderString
|
|
450 |
// ----------------------------------------------------
|
|
451 |
void CMceMessageListItemArray::AppendFolderString( TDes& aBuffer, const TMsvEntry& aEntry ) const
|
|
452 |
{
|
|
453 |
__ASSERT_DEBUG( aEntry.iType == KUidMsvFolderEntry, Panic(EMceListItemArrayEntryNotFolder ) );
|
|
454 |
|
|
455 |
StripAndAppendString( aBuffer, aEntry.iDetails );
|
|
456 |
aBuffer.Append( KColumnListSeparator );
|
|
457 |
if ( aEntry.Id() == KMceTemplatesEntryId )
|
|
458 |
{
|
|
459 |
TInt templatesCount = CNotepadApi::NumberOfTemplates();
|
|
460 |
templatesCount = templatesCount < 0 ? 0 : templatesCount;
|
|
461 |
if ( templatesCount == 1 )
|
|
462 |
{
|
|
463 |
TBuf<KMcePrintableTextLength> tempString;
|
|
464 |
tempString.Append( (*iNumberOfMessagesStrings)[
|
|
465 |
KMceListArrayDocAmountTemp] );
|
|
466 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
467 |
aBuffer.Append( tempString );
|
|
468 |
}
|
|
469 |
else
|
|
470 |
{
|
|
471 |
TBuf<KMcePrintableTextLength> tempString;
|
|
472 |
StringLoader::Format( tempString,
|
|
473 |
(*iNumberOfMessagesStrings)[KMceListArrayDocAmountTemps],
|
|
474 |
-1, // no index in the key string
|
|
475 |
templatesCount );
|
|
476 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
477 |
aBuffer.Append( tempString );
|
|
478 |
}
|
|
479 |
}
|
|
480 |
else
|
|
481 |
{
|
|
482 |
TRAP_IGNORE( HandleFolderMessagesStringL( aBuffer, aEntry ) );
|
|
483 |
}
|
|
484 |
aBuffer.Append( KColumnListSeparator );
|
|
485 |
}
|
|
486 |
|
|
487 |
|
|
488 |
// ----------------------------------------------------
|
|
489 |
// CMceMessageListItemArray::HandleSessionEventL
|
|
490 |
// ----------------------------------------------------
|
|
491 |
void CMceMessageListItemArray::HandleSessionEventL(
|
|
492 |
TMsvSessionEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
|
|
493 |
{
|
|
494 |
// TODO: why?
|
|
495 |
switch (aEvent)
|
|
496 |
{
|
|
497 |
case EMsvEntriesCreated:
|
|
498 |
case EMsvEntriesChanged:
|
|
499 |
case EMsvEntriesDeleted:
|
|
500 |
case EMsvMediaChanged:
|
|
501 |
case EMsvMediaUnavailable:
|
|
502 |
case EMsvMediaAvailable:
|
|
503 |
case EMsvCloseSession:
|
|
504 |
break;
|
|
505 |
|
|
506 |
default:
|
|
507 |
break;
|
|
508 |
}
|
|
509 |
}
|
|
510 |
|
|
511 |
// ----------------------------------------------------
|
|
512 |
// CMceMessageListItemArray::SetRegistryObserver
|
|
513 |
// ----------------------------------------------------
|
|
514 |
void CMceMessageListItemArray::SetRegistryObserver( MMtmUiDataRegistryObserver* aRegistryObserver )
|
|
515 |
{
|
|
516 |
iRegistryObserver = aRegistryObserver;
|
|
517 |
}
|
|
518 |
|
|
519 |
// ----------------------------------------------------
|
|
520 |
// CMceMessageListItemArray::MakeSendStatusStringL
|
|
521 |
// ----------------------------------------------------
|
|
522 |
void CMceMessageListItemArray::MakeSendStatusStringL(TDes& aText, const TMsvEntry& aEntry) const
|
|
523 |
{
|
|
524 |
if ( iRegistryObserver )
|
|
525 |
{
|
|
526 |
CBaseMtmUiData* data=iRegistryObserver->GetMtmUiDataL(aEntry.iMtm);
|
|
527 |
if ( data )
|
|
528 |
{
|
|
529 |
HBufC* statusText=data->StatusTextL(aEntry);
|
|
530 |
if ( statusText->Length() )
|
|
531 |
{
|
|
532 |
aText.Append( statusText->Des() );
|
|
533 |
}
|
|
534 |
else
|
|
535 |
{
|
|
536 |
aText.Append( CEditableText::ESpace );
|
|
537 |
}
|
|
538 |
delete statusText;
|
|
539 |
}
|
|
540 |
}
|
|
541 |
}
|
|
542 |
|
|
543 |
|
|
544 |
// ----------------------------------------------------
|
|
545 |
// CMceMessageListItemArray::StripAndAppendString
|
|
546 |
// ----------------------------------------------------
|
|
547 |
void CMceMessageListItemArray::StripAndAppendString(TDes& aTargetString, const TDesC& aSourceString) const
|
|
548 |
{
|
|
549 |
TRAP_IGNORE( MceUtils::StripAndAppendStringL(
|
|
550 |
aTargetString,
|
|
551 |
aSourceString,
|
|
552 |
iDescriptionLength ) );
|
|
553 |
}
|
|
554 |
|
|
555 |
// ----------------------------------------------------
|
|
556 |
// CMceMessageListItemArray::IsFolderRemote
|
|
557 |
// return ETrue, if remote folder
|
|
558 |
//
|
|
559 |
// ----------------------------------------------------
|
|
560 |
TBool CMceMessageListItemArray::IsFolderRemote() const
|
|
561 |
{
|
|
562 |
return IsItemRemote( iFolderId );
|
|
563 |
}
|
|
564 |
|
|
565 |
// ----------------------------------------------------
|
|
566 |
// CMceMessageListItemArray::
|
|
567 |
// ----------------------------------------------------
|
|
568 |
TBool CMceMessageListItemArray::IsItemRemote( TMsvId aItemId ) const
|
|
569 |
{
|
|
570 |
TMsvId service = KMsvLocalServiceIndexEntryId;
|
|
571 |
TMsvEntry entry;
|
|
572 |
if ( iSession->GetEntry(aItemId,service,entry) == KErrNone )
|
|
573 |
{
|
|
574 |
return KMsvLocalServiceIndexEntryId != service;
|
|
575 |
}
|
|
576 |
else
|
|
577 |
{
|
|
578 |
return EFalse;
|
|
579 |
}
|
|
580 |
}
|
|
581 |
|
|
582 |
// ----------------------------------------------------
|
|
583 |
// CMceMessageListItemArray::FolderId
|
|
584 |
// return folder id
|
|
585 |
//
|
|
586 |
// ----------------------------------------------------
|
|
587 |
TMsvId CMceMessageListItemArray::FolderId() const
|
|
588 |
{
|
|
589 |
return iFolderId;
|
|
590 |
}
|
|
591 |
|
|
592 |
// ----------------------------------------------------
|
|
593 |
// CMceMessageListItemArray::
|
|
594 |
// ----------------------------------------------------
|
|
595 |
const TMsvEntry& CMceMessageListItemArray::FolderEntry() const
|
|
596 |
{
|
|
597 |
return iFolderEntry->Entry();
|
|
598 |
}
|
|
599 |
|
|
600 |
|
|
601 |
|
|
602 |
// ----------------------------------------------------
|
|
603 |
// CMceMessageListItemArray::IsConnected
|
|
604 |
// return ETrue, if account is connected
|
|
605 |
//
|
|
606 |
// ----------------------------------------------------
|
|
607 |
TBool CMceMessageListItemArray::IsConnected() const
|
|
608 |
{
|
|
609 |
TMsvEntry entry;
|
|
610 |
entry = iFolderEntry->Entry();
|
|
611 |
|
|
612 |
TMsvEntry serviceEntry;
|
|
613 |
TMsvId serviceId;
|
|
614 |
if ( iSession->GetEntry(entry.iServiceId,serviceId,serviceEntry) == KErrNone )
|
|
615 |
{
|
|
616 |
return serviceEntry.Connected();
|
|
617 |
}
|
|
618 |
else
|
|
619 |
{
|
|
620 |
return EFalse;
|
|
621 |
}
|
|
622 |
}
|
|
623 |
|
|
624 |
|
|
625 |
// ----------------------------------------------------
|
|
626 |
// CMceMessageListItemArray::FindEntryIndex
|
|
627 |
// Finds entry index in message list
|
|
628 |
//
|
|
629 |
// ----------------------------------------------------
|
|
630 |
TInt CMceMessageListItemArray::FindEntryIndex( const TDesC& aMatchString ) const
|
|
631 |
{
|
|
632 |
TInt foundIndex = KErrNotFound;
|
|
633 |
TMsvSelectionOrdering ordering( KMsvNoGrouping, EMsvSortByDateReverse, EFalse );
|
|
634 |
ordering = iFolderEntry->SortType();
|
|
635 |
|
|
636 |
const TInt count = iFolderEntry->Count();
|
|
637 |
const TInt length = aMatchString.Length();
|
|
638 |
|
|
639 |
if ( (ordering.Sorting()==EMsvSortByDetails) ||
|
|
640 |
(ordering.Sorting()==EMsvSortByDetailsReverse) )
|
|
641 |
{
|
|
642 |
for( TInt loop = 0; loop < count && foundIndex == KErrNotFound ; loop++ )
|
|
643 |
{
|
|
644 |
if ( aMatchString.CompareF((*iFolderEntry)[loop].iDetails.Left( length ) ) == 0 )
|
|
645 |
{
|
|
646 |
foundIndex = loop;
|
|
647 |
}
|
|
648 |
}
|
|
649 |
}
|
|
650 |
|
|
651 |
else if ( (ordering.Sorting()==EMsvSortByDescription) ||
|
|
652 |
(ordering.Sorting()==EMsvSortByDescriptionReverse) )
|
|
653 |
{
|
|
654 |
for( TInt loop = 0; loop < count && foundIndex == KErrNotFound ; loop++)
|
|
655 |
{
|
|
656 |
TBufC<100> tmpString( (*iFolderEntry)[loop].iDescription.Left(KSortSubjectStringLength) );
|
|
657 |
TInt start = SkipPrefix( tmpString.Des() );
|
|
658 |
if ( start < tmpString.Length() && tmpString.Length() >= (start + length) )
|
|
659 |
{
|
|
660 |
TPtrC mid = (*iFolderEntry)[loop].iDescription.Mid( start, length );
|
|
661 |
if ( aMatchString.CompareF( mid ) == 0 )
|
|
662 |
{
|
|
663 |
foundIndex = loop;
|
|
664 |
}
|
|
665 |
}
|
|
666 |
}
|
|
667 |
}
|
|
668 |
else
|
|
669 |
{
|
|
670 |
//EMsvSortByReverse, nothing cannot be searched
|
|
671 |
}
|
|
672 |
|
|
673 |
return foundIndex;
|
|
674 |
}
|
|
675 |
|
|
676 |
// ----------------------------------------------------
|
|
677 |
// CMceMessageListItemArray::SetOrderingL
|
|
678 |
// Sets sort order in folder entry
|
|
679 |
//
|
|
680 |
// ----------------------------------------------------
|
|
681 |
void CMceMessageListItemArray::SetOrderingL( TInt aOrdering )
|
|
682 |
{
|
|
683 |
TMsvSorting sorting = EMsvSortByDateReverse;
|
|
684 |
TInt grouping = KMsvGroupByStandardFolders;
|
|
685 |
switch ( aOrdering )
|
|
686 |
{
|
|
687 |
case EMceCmdSortByRecipient:
|
|
688 |
case EMceCmdSortBySender:
|
|
689 |
sorting=EMsvSortByDetails;
|
|
690 |
break;
|
|
691 |
case EMceCmdSortBySubject:
|
|
692 |
sorting=EMsvSortByDescription;
|
|
693 |
break;
|
|
694 |
case EMceCmdSortByDate:
|
|
695 |
default:
|
|
696 |
sorting=EMsvSortByDateReverse;
|
|
697 |
break;
|
|
698 |
|
|
699 |
}
|
|
700 |
|
|
701 |
const TMsvSelectionOrdering newOrdering( grouping, sorting, EFalse );
|
|
702 |
iFolderEntry->SetSortTypeL( newOrdering );
|
|
703 |
}
|
|
704 |
|
|
705 |
|
|
706 |
|
|
707 |
// ----------------------------------------------------
|
|
708 |
// CMceMessageListItemArray::DeleteDiscard
|
|
709 |
// return ETrue, if delete command should be discarded
|
|
710 |
//
|
|
711 |
// ----------------------------------------------------
|
|
712 |
TBool CMceMessageListItemArray::DeleteDiscard( TMsvId aItemId ) const
|
|
713 |
{
|
|
714 |
TMsvEntry entry;
|
|
715 |
TMsvId serviceId;
|
|
716 |
if ( iSession->GetEntry(aItemId,serviceId,entry) != KErrNone )
|
|
717 |
{
|
|
718 |
return ETrue;
|
|
719 |
}
|
|
720 |
|
|
721 |
//mail or syncml folder cannot be deleted
|
|
722 |
if ( ( entry.iType == KUidMsvFolderEntry ) &&
|
|
723 |
( entry.iMtm == KSenduiMtmImap4Uid ||
|
|
724 |
entry.iMtm == KSenduiMtmSyncMLEmailUid ) )
|
|
725 |
{
|
|
726 |
return ETrue;
|
|
727 |
}
|
|
728 |
|
|
729 |
if ( iFolderEntry->Entry().Id() == KMsvGlobalOutBoxIndexEntryId )
|
|
730 |
{
|
|
731 |
if ( entry.SendingState() == KMsvSendStateSending )
|
|
732 |
{
|
|
733 |
return ETrue;
|
|
734 |
}
|
|
735 |
|
|
736 |
// Message in waiting state cannot be deleted except e-mail.
|
|
737 |
// For e-mail, waiting, resend and scheduled states are presented
|
|
738 |
// to user as queued state (by CSmtpMtmUiData). Delete is allowed
|
|
739 |
// from the queued state.
|
|
740 |
if ( ( entry.SendingState() == KMsvSendStateWaiting ) &&
|
|
741 |
( entry.iMtm != KSenduiMtmSmtpUid ) )
|
|
742 |
{
|
|
743 |
return ETrue;
|
|
744 |
}
|
|
745 |
|
|
746 |
if ( entry.iMtm == KSenduiMtmSmsUid ||
|
|
747 |
entry.iMtm == KSenduiMtmMmsUid )
|
|
748 |
{
|
|
749 |
if ( entry.Connected() || ( entry.SendingState() == KMsvSendStateUnknown )
|
|
750 |
|| ( entry.SendingState() == KMsvSendStateNotApplicable ) )
|
|
751 |
{
|
|
752 |
return ETrue;
|
|
753 |
}
|
|
754 |
}
|
|
755 |
}
|
|
756 |
return EFalse;
|
|
757 |
}
|
|
758 |
|
|
759 |
// ----------------------------------------------------
|
|
760 |
// CMceMessageListItemArray::AppendRecipientStringL
|
|
761 |
// handles recipient string
|
|
762 |
//
|
|
763 |
// ----------------------------------------------------
|
|
764 |
void CMceMessageListItemArray::AppendRecipientStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const
|
|
765 |
{
|
|
766 |
|
|
767 |
//
|
|
768 |
// The following processes the recipient(s) for languages which require number
|
|
769 |
// conversion and/or number grouping
|
|
770 |
//
|
|
771 |
if ( AknLayoutUtils::LayoutMirrored() || iNumberGroupingEnabledFlag ||
|
|
772 |
EDigitTypeWestern != AknTextUtils::NumericEditorDigitType() )
|
|
773 |
{
|
|
774 |
|
|
775 |
//
|
|
776 |
// semicolon separator
|
|
777 |
//
|
|
778 |
TBuf<1> semiColon;
|
|
779 |
semiColon.Append( KMceSemiColon );
|
|
780 |
TInt posForSemiColon = KErrNotFound;
|
|
781 |
|
|
782 |
//
|
|
783 |
// arabic semicolon separator
|
|
784 |
//
|
|
785 |
TBuf<1> arabicSemiColon;
|
|
786 |
arabicSemiColon.Append( KMceArabicSemiColon );
|
|
787 |
TInt posForArabicSemiColon = KErrNotFound;
|
|
788 |
|
|
789 |
//
|
|
790 |
// The following are used for keeping track of which type of separator we're
|
|
791 |
// currently processing
|
|
792 |
//
|
|
793 |
TBuf<1> separator;
|
|
794 |
TInt posForSeparator = KErrNotFound;
|
|
795 |
|
|
796 |
TInt len = aEntry.iDetails.Length();
|
|
797 |
|
|
798 |
//
|
|
799 |
// recipient buffer is made to be larger than the length of the entry details
|
|
800 |
// to allow additional room needed for number grouping
|
|
801 |
//
|
|
802 |
HBufC* recipientBuf = HBufC::NewLC( KMceMaxFormatFactor*len );
|
|
803 |
TPtr recipientPtr = recipientBuf->Des();
|
|
804 |
|
|
805 |
//
|
|
806 |
// remaining details buffer is initialized to the same as the entry details
|
|
807 |
// and we will remove processed info until this buffer becomes empty
|
|
808 |
//
|
|
809 |
HBufC* remainingDetailsBuf = HBufC::NewLC( len );
|
|
810 |
TPtr remainingDetailsPtr = remainingDetailsBuf->Des();
|
|
811 |
remainingDetailsPtr.Copy( aEntry.iDetails );
|
|
812 |
|
|
813 |
//
|
|
814 |
// result buffer is made to be larger than the length of the entry details
|
|
815 |
// to allow additional room needed for number grouping
|
|
816 |
//
|
|
817 |
HBufC* resultBuf = HBufC::NewLC( KMceMaxFormatFactor*len );
|
|
818 |
TPtr resultPtr = resultBuf->Des();
|
|
819 |
|
|
820 |
//
|
|
821 |
// Construct the result buffer from the entry details. Each recipient is
|
|
822 |
// extracted from the entry details and valid phone numbers are number
|
|
823 |
// grouped and converted as needed before they are concatenated into a
|
|
824 |
// string separated by semicolon/arabic semicolon
|
|
825 |
//
|
|
826 |
do
|
|
827 |
{
|
|
828 |
|
|
829 |
// find the first occurrence of semi colon in the remaining details buffer
|
|
830 |
posForSemiColon = remainingDetailsPtr.Find( semiColon );
|
|
831 |
|
|
832 |
// find the first occurrence of arabic semicolon in the remaining details
|
|
833 |
// buffer
|
|
834 |
posForArabicSemiColon = remainingDetailsPtr.Find( arabicSemiColon );
|
|
835 |
|
|
836 |
//
|
|
837 |
// 5 possible cases:
|
|
838 |
//
|
|
839 |
// 1) Neither semicolon nor arabic semicolon is found in the remaining
|
|
840 |
// details buffer:
|
|
841 |
//
|
|
842 |
// we will take the first KPhCltNameBufferLength to the recipient buffer
|
|
843 |
// to proceed with our number grouping and/or conversion. At the end of
|
|
844 |
// this iteration, there will not be any in the remaining details buffer
|
|
845 |
// to be processed. This is either the single recipient case or we are
|
|
846 |
// processing the last of the recipients
|
|
847 |
//
|
|
848 |
if ( posForSemiColon == KErrNotFound && posForArabicSemiColon == KErrNotFound )
|
|
849 |
{
|
|
850 |
posForSeparator = KErrNotFound;
|
|
851 |
}
|
|
852 |
|
|
853 |
// 2) found arabic semicolon in the remaining details buffer:
|
|
854 |
//
|
|
855 |
// we will take everything upto where we find the arabic semicolon to the
|
|
856 |
// recipient buffer and we strip this recipient from our remaining details
|
|
857 |
// buffer for the next round of processing. (this is the multiple
|
|
858 |
// recipients case where each recipient is separated by arabic semicolon)
|
|
859 |
//
|
|
860 |
else if ( posForSemiColon == KErrNotFound )
|
|
861 |
{
|
|
862 |
posForSeparator = posForArabicSemiColon;
|
|
863 |
separator.Copy( arabicSemiColon );
|
|
864 |
}
|
|
865 |
|
|
866 |
// 3) found semicolon in the remaining details buffer:
|
|
867 |
//
|
|
868 |
// similar to the above. We will take everything upto where we find the
|
|
869 |
// semicolon to the recipient buffer and we strip this recipient from our
|
|
870 |
// remaining details buffer. (this is also the multiple recipients case
|
|
871 |
// where each recipient is separated by semicolon)
|
|
872 |
//
|
|
873 |
else if ( posForArabicSemiColon == KErrNotFound )
|
|
874 |
{
|
|
875 |
posForSeparator = posForSemiColon;
|
|
876 |
separator.Copy( semiColon );
|
|
877 |
}
|
|
878 |
|
|
879 |
// The following 2 blocks are categorized under case 4).
|
|
880 |
//
|
|
881 |
// 4) found both semicolon and arabic semicolon: (This is the multiple
|
|
882 |
// recipients case where each recipient is separated by mix of semicolon
|
|
883 |
// and arabic semicolon).
|
|
884 |
// This is further broken down into 2 cases:
|
|
885 |
//
|
|
886 |
// a) semicolon found is before arabic semicolon: treat it the same way
|
|
887 |
// as 3)
|
|
888 |
//
|
|
889 |
else if ( posForSemiColon < posForArabicSemiColon )
|
|
890 |
{
|
|
891 |
posForSeparator = posForSemiColon;
|
|
892 |
separator.Copy( semiColon );
|
|
893 |
}
|
|
894 |
|
|
895 |
// b) semicolon found is after arabic semicolon: treat it the same way
|
|
896 |
// as 2)
|
|
897 |
//
|
|
898 |
else
|
|
899 |
{
|
|
900 |
posForSeparator = posForArabicSemiColon;
|
|
901 |
separator.Copy( arabicSemiColon );
|
|
902 |
}
|
|
903 |
|
|
904 |
//
|
|
905 |
// take the first KPhCltNameBufferLength to the recipient buffer or take
|
|
906 |
// everything upto where we find the separator
|
|
907 |
//
|
|
908 |
recipientPtr.Copy(
|
|
909 |
remainingDetailsPtr.Left(
|
|
910 |
( posForSeparator == KErrNotFound ) ? KPhCltNameBufferLength : posForSeparator ) );
|
|
911 |
|
|
912 |
//
|
|
913 |
// remove the recipient we're processing from the remaining details buffer.
|
|
914 |
// remove the separator as well (this is accomplished by advancing the position
|
|
915 |
// by 1)
|
|
916 |
//
|
|
917 |
remainingDetailsPtr.Copy(
|
|
918 |
remainingDetailsPtr.Mid(
|
|
919 |
( posForSeparator == KErrNotFound ) ? remainingDetailsPtr.Length() : posForSeparator + 1 ) );
|
|
920 |
|
|
921 |
//
|
|
922 |
// process the recipient buffer
|
|
923 |
//
|
|
924 |
if ( recipientPtr.Length() > 0 )
|
|
925 |
{
|
|
926 |
|
|
927 |
TBool validNumber = CommonPhoneParser::IsValidPhoneNumber(
|
|
928 |
recipientPtr, CommonPhoneParser::ESMSNumber );
|
|
929 |
|
|
930 |
//
|
|
931 |
// if the recipient is specified as a valid number, we will
|
|
932 |
// perform number grouping and/or conversion as needed
|
|
933 |
//
|
|
934 |
if ( validNumber )
|
|
935 |
{
|
|
936 |
|
|
937 |
// perform number grouping as needed
|
|
938 |
DoNumberGroupingL( recipientPtr );
|
|
939 |
|
|
940 |
// perform Arabic & Hebrew conversion as needed
|
|
941 |
AknTextUtils::LanguageSpecificNumberConversion( recipientPtr );
|
|
942 |
|
|
943 |
}
|
|
944 |
|
|
945 |
//
|
|
946 |
// for Arabic/Hebrew, if the recipient isn't the last in the list, we need to
|
|
947 |
// put KMceRLM marker before the recipient name and McePDF marker before the
|
|
948 |
// arabic semicolon, e.g.
|
|
949 |
//
|
|
950 |
// <KMceRLM><recipient name><KMcePDF><arabic semicolon>
|
|
951 |
//
|
|
952 |
if ( !validNumber &&
|
|
953 |
( posForSeparator != KErrNotFound ) &&
|
|
954 |
( separator.Compare( arabicSemiColon ) == 0 ) )
|
|
955 |
{
|
|
956 |
resultPtr.Append( KMceRLM );
|
|
957 |
}
|
|
958 |
|
|
959 |
//
|
|
960 |
// we've finished processing this recipient, append it to the result buffer
|
|
961 |
//
|
|
962 |
resultPtr.Append( recipientPtr );
|
|
963 |
|
|
964 |
//
|
|
965 |
// append separator if there are subsequent recipients
|
|
966 |
//
|
|
967 |
if ( posForSeparator != KErrNotFound )
|
|
968 |
{
|
|
969 |
|
|
970 |
//
|
|
971 |
// for Arabic/Hebrew, if the recipient isn't the last in the list, we need to
|
|
972 |
// put KMceRLM marker before the recipient name and McePDF marker before the
|
|
973 |
// arabic semicolon, e.g.
|
|
974 |
//
|
|
975 |
// <KMceRLM><recipient name><KMcePDF><arabic semicolon>
|
|
976 |
//
|
|
977 |
if ( !validNumber &&
|
|
978 |
( separator.Compare( arabicSemiColon ) == 0 ) )
|
|
979 |
{
|
|
980 |
resultPtr.Append( KMcePDF );
|
|
981 |
}
|
|
982 |
|
|
983 |
resultPtr.Append( separator );
|
|
984 |
}
|
|
985 |
|
|
986 |
}
|
|
987 |
|
|
988 |
} while ( remainingDetailsPtr.Length() > 0 );
|
|
989 |
|
|
990 |
//
|
|
991 |
// we've processed the entire entry details, append our result to aBuffer
|
|
992 |
//
|
|
993 |
if ( len )
|
|
994 |
{
|
|
995 |
StripAndAppendString( aBuffer, resultPtr );
|
|
996 |
}
|
|
997 |
else
|
|
998 |
{
|
|
999 |
HBufC* text = StringLoader::LoadLC( R_MCE_PUSH_INBOX_SENDER_UNKW );
|
|
1000 |
aBuffer.Append( *text );
|
|
1001 |
CleanupStack::PopAndDestroy(); // text
|
|
1002 |
}
|
|
1003 |
|
|
1004 |
CleanupStack::PopAndDestroy( 3 ); // recipientBuf, remainingDetailsBuf, resultBuf
|
|
1005 |
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
//
|
|
1009 |
// The following processes the recipient(s) for languages which do not require number
|
|
1010 |
// conversion or number grouping for performance consideration
|
|
1011 |
//
|
|
1012 |
else
|
|
1013 |
{
|
|
1014 |
if ( aEntry.iDetails.Length() )
|
|
1015 |
{
|
|
1016 |
StripAndAppendString( aBuffer, aEntry.iDetails );
|
|
1017 |
}
|
|
1018 |
else
|
|
1019 |
{
|
|
1020 |
HBufC* text = StringLoader::LoadLC( R_MCE_PUSH_INBOX_SENDER_UNKW );
|
|
1021 |
aBuffer.Append( *text );
|
|
1022 |
CleanupStack::PopAndDestroy(); // text
|
|
1023 |
}
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
}
|
|
1027 |
|
|
1028 |
// ----------------------------------------------------
|
|
1029 |
// CMceMessageListItemArray::DoNumberGroupingL
|
|
1030 |
//
|
|
1031 |
// This method uses CPNGNumberGrouping to reformat the given
|
|
1032 |
// valid phone number if all of the following are true:
|
|
1033 |
//
|
|
1034 |
// 1) number grouping feature is turned on
|
|
1035 |
//
|
|
1036 |
// 2) the given number does not already exceed the maximum
|
|
1037 |
// displayable length for number grouping
|
|
1038 |
//
|
|
1039 |
// If not all of the above are true, the given phone number
|
|
1040 |
// remains unchanged.
|
|
1041 |
//
|
|
1042 |
// This method leaves if unable to instantiate a CPNGNumberGrouping
|
|
1043 |
// object.
|
|
1044 |
// ----------------------------------------------------
|
|
1045 |
void CMceMessageListItemArray::DoNumberGroupingL( TDes& aPhoneNumber ) const
|
|
1046 |
{
|
|
1047 |
|
|
1048 |
if ( iNumberGroupingEnabledFlag )
|
|
1049 |
{
|
|
1050 |
|
|
1051 |
CPNGNumberGrouping* numberGrouping =
|
|
1052 |
CPNGNumberGrouping::NewL( KPhCltTelephoneNumberLength );
|
|
1053 |
CleanupStack::PushL( numberGrouping );
|
|
1054 |
|
|
1055 |
if ( aPhoneNumber.Length() <= numberGrouping->MaxDisplayLength() )
|
|
1056 |
{
|
|
1057 |
|
|
1058 |
//
|
|
1059 |
// Remove extra space for multiple recipients
|
|
1060 |
//
|
|
1061 |
TInt lengthBeforeTrimming = aPhoneNumber.Length();
|
|
1062 |
aPhoneNumber.Trim();
|
|
1063 |
TInt lengthAfterTrimming = aPhoneNumber.Length();
|
|
1064 |
|
|
1065 |
numberGrouping->Set( aPhoneNumber );
|
|
1066 |
|
|
1067 |
// reset aPhoneNumber
|
|
1068 |
aPhoneNumber.Zero();
|
|
1069 |
|
|
1070 |
//
|
|
1071 |
// put the space prefix back if one was stripped before
|
|
1072 |
//
|
|
1073 |
if ( lengthBeforeTrimming != lengthAfterTrimming )
|
|
1074 |
{
|
|
1075 |
aPhoneNumber.Append( CEditableText::ESpace );
|
|
1076 |
}
|
|
1077 |
|
|
1078 |
aPhoneNumber.Append( numberGrouping->FormattedNumber() );
|
|
1079 |
|
|
1080 |
} // end if aPhoneNumber
|
|
1081 |
|
|
1082 |
CleanupStack::PopAndDestroy(); // numberGrouping
|
|
1083 |
|
|
1084 |
} // end if iNumberGroupingEnabledFlag
|
|
1085 |
|
|
1086 |
}
|
|
1087 |
|
|
1088 |
// ----------------------------------------------------
|
|
1089 |
// CMceMessageListItemArray::MakeInboxStatusStringL
|
|
1090 |
// ----------------------------------------------------
|
|
1091 |
void CMceMessageListItemArray::MakeInboxStatusStringL( TDes& aText, const TMsvEntry& aEntry ) const
|
|
1092 |
{
|
|
1093 |
AppendTimeStringL( aText, aEntry );
|
|
1094 |
if ( iRegistryObserver )
|
|
1095 |
{
|
|
1096 |
CBaseMtmUiData* data=iRegistryObserver->GetMtmUiDataL( aEntry.iMtm );
|
|
1097 |
if ( data )
|
|
1098 |
{
|
|
1099 |
HBufC* statusText=data->StatusTextL( aEntry );
|
|
1100 |
StripAndAppendString( aText, statusText->Des() );
|
|
1101 |
delete statusText;
|
|
1102 |
}
|
|
1103 |
}
|
|
1104 |
}
|
|
1105 |
|
|
1106 |
// ----------------------------------------------------
|
|
1107 |
// CMceMessageListItemArray::HandleFolderMessagesStringL
|
|
1108 |
// ----------------------------------------------------
|
|
1109 |
void CMceMessageListItemArray::HandleFolderMessagesStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const
|
|
1110 |
{
|
|
1111 |
CMsvEntry* folderCEntry = NULL;
|
|
1112 |
folderCEntry = iFolderEntry->ChildEntryL( aEntry.Id() );
|
|
1113 |
|
|
1114 |
TUid technologyType = KNullUid;
|
|
1115 |
|
|
1116 |
if ( aEntry.iMtm.iUid != 0 && aEntry.iMtm != KUidMsvLocalServiceMtm &&
|
|
1117 |
iUiRegistry->IsPresent( aEntry.iMtm ) )
|
|
1118 |
{
|
|
1119 |
technologyType = iUiRegistry->TechnologyTypeUid( aEntry.iMtm );
|
|
1120 |
}
|
|
1121 |
|
|
1122 |
// Is Mail MTM
|
|
1123 |
if ( KSenduiTechnologyMailUid == technologyType )
|
|
1124 |
{
|
|
1125 |
// Count subfolders
|
|
1126 |
CMsvEntrySelection* sel=folderCEntry->ChildrenWithTypeL( KUidMsvFolderEntry );
|
|
1127 |
CleanupStack::PushL(sel);
|
|
1128 |
TInt folderCount = sel->Count();
|
|
1129 |
|
|
1130 |
// Count mail messages
|
|
1131 |
CMsvEntrySelection* mesSel=folderCEntry->ChildrenWithTypeL( KUidMsvMessageEntry );
|
|
1132 |
CleanupStack::PushL( mesSel );
|
|
1133 |
TInt messagesCount = mesSel->Count();
|
|
1134 |
CleanupStack::PopAndDestroy(); // mesSel
|
|
1135 |
|
|
1136 |
CArrayFix<TInt>* indexArray =
|
|
1137 |
new( ELeave ) CArrayFixFlat<TInt>( KMceListArrayGranuality );
|
|
1138 |
|
|
1139 |
CleanupStack::PushL( indexArray );
|
|
1140 |
|
|
1141 |
if (folderCount > 0)
|
|
1142 |
{
|
|
1143 |
TInt cnt;
|
|
1144 |
for(cnt=0;cnt<folderCount;cnt++)
|
|
1145 |
{
|
|
1146 |
CMsvEntry* folderSubEntry = iSession->GetEntryL( sel->At( cnt ) );
|
|
1147 |
CleanupStack::PushL( folderSubEntry );
|
|
1148 |
CMsvEntrySelection* mesSel = folderSubEntry->ChildrenWithTypeL( KUidMsvMessageEntry );
|
|
1149 |
CleanupStack::PushL( mesSel );
|
|
1150 |
messagesCount+=mesSel->Count();
|
|
1151 |
CleanupStack::PopAndDestroy( mesSel );
|
|
1152 |
CleanupStack::PopAndDestroy( folderSubEntry );
|
|
1153 |
}
|
|
1154 |
}
|
|
1155 |
indexArray->AppendL( folderCount );
|
|
1156 |
indexArray->AppendL( messagesCount );
|
|
1157 |
|
|
1158 |
HBufC* tempString = NULL;
|
|
1159 |
|
|
1160 |
if ( folderCount == 1 )
|
|
1161 |
{
|
|
1162 |
if ( messagesCount == 1 )
|
|
1163 |
{
|
|
1164 |
tempString = StringLoader::LoadLC(
|
|
1165 |
R_MCE_MAILBOX_AMOUNT_FOLDER_MAIL, *indexArray );
|
|
1166 |
}
|
|
1167 |
else
|
|
1168 |
{
|
|
1169 |
tempString = StringLoader::LoadLC(
|
|
1170 |
R_MCE_MAILBOX_AMOUNT_FOLDER_MAILS, *indexArray );
|
|
1171 |
}
|
|
1172 |
}
|
|
1173 |
else
|
|
1174 |
{
|
|
1175 |
if ( messagesCount == 1 )
|
|
1176 |
{
|
|
1177 |
tempString = StringLoader::LoadLC(
|
|
1178 |
R_MCE_MAILBOX_AMOUNT_FOLDERS_MAIL, *indexArray );
|
|
1179 |
}
|
|
1180 |
else
|
|
1181 |
{
|
|
1182 |
tempString = StringLoader::LoadLC(
|
|
1183 |
R_MCE_MAILBOX_AMOUNT_FOLDERS_MAILS, *indexArray );
|
|
1184 |
}
|
|
1185 |
}
|
|
1186 |
|
|
1187 |
aBuffer.Append( tempString->Des() );
|
|
1188 |
CleanupStack::PopAndDestroy( 2 ); // indexArray, tempString
|
|
1189 |
CleanupStack::PopAndDestroy(); //sel
|
|
1190 |
}
|
|
1191 |
else
|
|
1192 |
{
|
|
1193 |
CMsvEntrySelection* mesSel=folderCEntry->ChildrenWithTypeL( KUidMsvMessageEntry );
|
|
1194 |
CleanupStack::PushL( mesSel );
|
|
1195 |
TInt messagesCount = mesSel->Count();
|
|
1196 |
CleanupStack::PopAndDestroy(); // mesSel
|
|
1197 |
|
|
1198 |
// Append Message count
|
|
1199 |
if ( messagesCount == 1 )
|
|
1200 |
{
|
|
1201 |
TBuf<KMcePrintableTextLength> tempString;
|
|
1202 |
tempString.Append( (*iNumberOfMessagesStrings)[
|
|
1203 |
KMceListArrayDocAmount] );
|
|
1204 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
1205 |
aBuffer.Append( tempString );
|
|
1206 |
}
|
|
1207 |
else
|
|
1208 |
{
|
|
1209 |
TBuf<KMcePrintableTextLength> tempString;
|
|
1210 |
StringLoader::Format( tempString,
|
|
1211 |
(*iNumberOfMessagesStrings)[KMceListArrayDocAmountMany],
|
|
1212 |
-1, // no index in the key string
|
|
1213 |
messagesCount );
|
|
1214 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
1215 |
aBuffer.Append( tempString );
|
|
1216 |
}
|
|
1217 |
}
|
|
1218 |
delete folderCEntry;
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
// ----------------------------------------------------
|
|
1222 |
// CMceMessageListItemArray::SetOrderingL
|
|
1223 |
// Sets sort order in folder entry, overloaded version
|
|
1224 |
// ----------------------------------------------------
|
|
1225 |
void CMceMessageListItemArray::SetOrderingL( TInt aSortType, TBool aOrdering )
|
|
1226 |
{
|
|
1227 |
TMsvSorting sorting = EMsvSortByDateReverse;
|
|
1228 |
TInt grouping = KMsvGroupByStandardFolders;
|
|
1229 |
switch ( aSortType )
|
|
1230 |
{
|
|
1231 |
case EMceCmdSortByType:
|
|
1232 |
grouping=KMsvGroupByStandardFolders|KMsvGroupByMtm;
|
|
1233 |
sorting = aOrdering ? EMsvSortByIdReverse: EMsvSortById;
|
|
1234 |
break;
|
|
1235 |
case EMceCmdSortByRecipient:
|
|
1236 |
case EMceCmdSortBySender:
|
|
1237 |
sorting= aOrdering ? EMsvSortByDetailsReverse: EMsvSortByDetails;
|
|
1238 |
break;
|
|
1239 |
case EMceCmdSortBySubject:
|
|
1240 |
sorting= aOrdering ? EMsvSortByDescriptionReverse: EMsvSortByDescription;
|
|
1241 |
break;
|
|
1242 |
case EMceCmdSortByDate:
|
|
1243 |
default:
|
|
1244 |
sorting= aOrdering ? EMsvSortByDate: EMsvSortByDateReverse;
|
|
1245 |
break;
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
const TMsvSelectionOrdering newOrdering( grouping, sorting, EFalse );
|
|
1249 |
iFolderEntry->SetSortTypeL( newOrdering );
|
|
1250 |
// Ignore possible error. If this leaves worst thing is that ordering is not saved to root for message iterator.
|
|
1251 |
TRAP_IGNORE( SaveOrderingL( newOrdering ) );
|
|
1252 |
iPreviousSelectionOrdering = newOrdering;
|
|
1253 |
}
|
|
1254 |
|
|
1255 |
// ----------------------------------------------------
|
|
1256 |
// CMceMessageListItemArray::SaveOrderingL
|
|
1257 |
// Write the sorting order into the message store, MUIU accesses and
|
|
1258 |
// uses this for CMessageIterator
|
|
1259 |
// ----------------------------------------------------
|
|
1260 |
void CMceMessageListItemArray::SaveOrderingL( const TMsvSelectionOrdering& aNewOrdering ) const
|
|
1261 |
{
|
|
1262 |
// TMsvSelectionOrdering class does not have != operator
|
|
1263 |
if ( !(iPreviousSelectionOrdering == aNewOrdering ) )
|
|
1264 |
{
|
|
1265 |
CMsvEntry* entry=iSession->GetEntryL( KMsvRootIndexEntryId ); // Access the entry
|
|
1266 |
CleanupStack::PushL( entry );
|
|
1267 |
CMsvStore* store = entry->EditStoreL();
|
|
1268 |
CleanupStack::PushL( store );
|
|
1269 |
RMsvWriteStream writeStream;
|
|
1270 |
writeStream.AssignLC( *store, KUidMsvMessageListSortOrder );
|
|
1271 |
aNewOrdering.ExternalizeL( writeStream );
|
|
1272 |
writeStream.CommitL();
|
|
1273 |
store->CommitL();
|
|
1274 |
CleanupStack::PopAndDestroy( 3 );
|
|
1275 |
}
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
// ----------------------------------------------------
|
|
1279 |
// CMceMessageListItemArray::SortType
|
|
1280 |
// returns folder's sort type
|
|
1281 |
//
|
|
1282 |
// ----------------------------------------------------
|
|
1283 |
TMsvSelectionOrdering CMceMessageListItemArray::SortType( )
|
|
1284 |
{
|
|
1285 |
return iFolderEntry->SortType();
|
|
1286 |
}
|
|
1287 |
|
|
1288 |
// ----------------------------------------------------
|
|
1289 |
// CMceMessageListItemArray::StripPrefix
|
|
1290 |
// Removes the "Re:" or "Fw:" prefixes from the given
|
|
1291 |
// text string
|
|
1292 |
// ----------------------------------------------------
|
|
1293 |
TInt CMceMessageListItemArray::SkipPrefix( TPtrC aTextString ) const
|
|
1294 |
{
|
|
1295 |
TPtrC searchString( aTextString );
|
|
1296 |
TPtrC searchStringOrig( aTextString );
|
|
1297 |
TInt matchInd = searchString.Match( KSortSubjectSkipString );
|
|
1298 |
TInt matchStart = 0;
|
|
1299 |
TInt lenRight = searchString.Length() - matchInd - 1;
|
|
1300 |
|
|
1301 |
// Find the last prefix character
|
|
1302 |
while ( matchInd != KErrNotFound && lenRight > 0 )
|
|
1303 |
{
|
|
1304 |
TPtrC searchString2 = searchString.Right( lenRight );
|
|
1305 |
matchStart += matchInd + 1;
|
|
1306 |
matchInd = searchString2.Match( KSortSubjectSkipString );
|
|
1307 |
lenRight = searchString2.Length() - matchInd - 1;
|
|
1308 |
searchString.Set( searchString2 );
|
|
1309 |
}
|
|
1310 |
|
|
1311 |
// Skip the white space after the prefix character
|
|
1312 |
matchInd = searchStringOrig.Locate(KWhiteSpaceCharacter);
|
|
1313 |
if ( matchInd!=KErrNotFound && matchStart==matchInd )
|
|
1314 |
{
|
|
1315 |
++matchStart;
|
|
1316 |
}
|
|
1317 |
|
|
1318 |
return matchStart;
|
|
1319 |
}
|
|
1320 |
|
|
1321 |
// ----------------------------------------------------
|
|
1322 |
// CMceMessageListItemArray::AppendBtIrMessageStringL
|
|
1323 |
// ----------------------------------------------------
|
|
1324 |
void CMceMessageListItemArray::AppendBtIrMessageStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const
|
|
1325 |
{
|
|
1326 |
HBufC *fileName = AknTextUtils::ConvertFileNameL( aEntry.iDescription );
|
|
1327 |
StripAndAppendString( aBuffer, *fileName ); // does not leave
|
|
1328 |
delete fileName;
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
#ifdef RD_READ_MESSAGE_DELETION
|
|
1332 |
// ----------------------------------------------------
|
|
1333 |
// CMceMessageListItemArray::GetParentFolder
|
|
1334 |
// ----------------------------------------------------
|
|
1335 |
TMsvId CMceMessageListItemArray::GetParentFolderId() const
|
|
1336 |
{
|
|
1337 |
return iFolderEntry->Entry().Parent();
|
|
1338 |
}
|
|
1339 |
#endif // RD_READ_MESSAGE_DELETION
|
|
1340 |
|
|
1341 |
|
|
1342 |
// ----------------------------------------------------
|
|
1343 |
// CMceMessageListItemArray::
|
|
1344 |
// ----------------------------------------------------
|
|
1345 |
void CMceMessageListItemArray::AppendMessageCountString( TDes& aBuffer, TInt aMessageCount ) const
|
|
1346 |
{
|
|
1347 |
aBuffer.Append( KColumnListSeparator );
|
|
1348 |
if ( aMessageCount == 1 )
|
|
1349 |
{
|
|
1350 |
aBuffer.Append( (*iNumberOfMessagesStrings)[
|
|
1351 |
KMceListArrayDocAmount] );
|
|
1352 |
}
|
|
1353 |
else
|
|
1354 |
{
|
|
1355 |
TBuf<KMcePrintableTextLength> tempString;
|
|
1356 |
StringLoader::Format( tempString,
|
|
1357 |
(*iNumberOfMessagesStrings)[KMceListArrayDocAmountMany],
|
|
1358 |
-1, // no index in the key string
|
|
1359 |
aMessageCount );
|
|
1360 |
aBuffer.Append( tempString );
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
}
|
|
1364 |
|
|
1365 |
// ----------------------------------------------------
|
|
1366 |
// CMceMessageListItemArray::
|
|
1367 |
// ----------------------------------------------------
|
|
1368 |
void CMceMessageListItemArray::AppendTimeStringL( TDes& aText, const TMsvEntry& aEntry ) const
|
|
1369 |
{
|
|
1370 |
// TBuf<KMceMaxDateString> timeBuffer;
|
|
1371 |
TBuf<30> dateBuffer;
|
|
1372 |
TTime timeNow;
|
|
1373 |
timeNow.UniversalTime();
|
|
1374 |
|
|
1375 |
TTime home;
|
|
1376 |
home.HomeTime();
|
|
1377 |
TTimeIntervalMinutes timeZoneDifference;
|
|
1378 |
TInt err = home.MinutesFrom( timeNow, timeZoneDifference );
|
|
1379 |
if ( err )
|
|
1380 |
{
|
|
1381 |
timeZoneDifference = 0;
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
timeNow = timeNow + timeZoneDifference;
|
|
1385 |
TDateTime dateTime = timeNow.DateTime();
|
|
1386 |
dateTime.SetHour( 0 );
|
|
1387 |
dateTime.SetMinute( 0 );
|
|
1388 |
dateTime.SetSecond( 0 );
|
|
1389 |
dateTime.SetMicroSecond( 0 );
|
|
1390 |
timeNow = dateTime;
|
|
1391 |
|
|
1392 |
TTime entryTime = aEntry.iDate + timeZoneDifference;
|
|
1393 |
|
|
1394 |
TTimeIntervalMinutes oneDay( 1440 );
|
|
1395 |
TInt bufferInt = KMceListArrayDateFormatBuffer;
|
|
1396 |
TTimeIntervalMinutes minutesfrom;
|
|
1397 |
err = entryTime.MinutesFrom( timeNow, minutesfrom );
|
|
1398 |
if ( err == KErrNone && minutesfrom <= oneDay && minutesfrom.Int() >= 0 )
|
|
1399 |
{
|
|
1400 |
// show time
|
|
1401 |
bufferInt = KMceListArrayTimeFormatBuffer;
|
|
1402 |
}
|
|
1403 |
entryTime.FormatL( dateBuffer, (*iNumberOfMessagesStrings)[bufferInt] );
|
|
1404 |
AknTextUtils::LanguageSpecificNumberConversion( dateBuffer );
|
|
1405 |
aText.Append( dateBuffer );
|
|
1406 |
aText.Append( CEditableText::ESpace );
|
|
1407 |
aText.Append( CEditableText::ESpace );
|
|
1408 |
}
|
|
1409 |
|
|
1410 |
// ----------------------------------------------------
|
|
1411 |
// CMceMessageListItemArray::
|
|
1412 |
// ----------------------------------------------------
|
|
1413 |
TBool CMceMessageListItemArray::FindFirstUnreadMessageL( TMsvId& aEntryId ) const
|
|
1414 |
{
|
|
1415 |
aEntryId = KErrNotFound;
|
|
1416 |
TInt numberOfUnreadMessages = 0;
|
|
1417 |
const TInt itemCount = iFolderEntry->Count();
|
|
1418 |
for ( TInt loop = 0; loop < itemCount; loop++ )
|
|
1419 |
{
|
|
1420 |
if ( (*iFolderEntry)[loop].iType == KUidMsvMessageEntry &&
|
|
1421 |
(*iFolderEntry)[loop].Unread() )
|
|
1422 |
{
|
|
1423 |
if ( aEntryId == KErrNotFound )
|
|
1424 |
{
|
|
1425 |
aEntryId = (*iFolderEntry)[loop].Id();
|
|
1426 |
}
|
|
1427 |
numberOfUnreadMessages++;
|
|
1428 |
if ( numberOfUnreadMessages > 1 )
|
|
1429 |
{
|
|
1430 |
// we are only interested of first unread message and info that if
|
|
1431 |
// there are more than one unread messages.
|
|
1432 |
// So we can stop if there are more than one.
|
|
1433 |
break;
|
|
1434 |
}
|
|
1435 |
}
|
|
1436 |
}
|
|
1437 |
return (numberOfUnreadMessages == 1);
|
|
1438 |
}
|
|
1439 |
|
|
1440 |
// ----------------------------------------------------
|
|
1441 |
// CMceMessageListItemArray::
|
|
1442 |
// ----------------------------------------------------
|
|
1443 |
TInt CMceMessageListItemArray::MessageCount()
|
|
1444 |
{
|
|
1445 |
TInt numberOfMessages = 0;
|
|
1446 |
const TInt itemCount = iFolderEntry->Count();
|
|
1447 |
for ( TInt loop = 0; loop < itemCount; loop++ )
|
|
1448 |
{
|
|
1449 |
if ( (*iFolderEntry)[loop].iType == KUidMsvMessageEntry )
|
|
1450 |
{
|
|
1451 |
numberOfMessages++;
|
|
1452 |
}
|
|
1453 |
}
|
|
1454 |
return numberOfMessages;
|
|
1455 |
}
|
|
1456 |
|
|
1457 |
// ----------------------------------------------------
|
|
1458 |
// CMceMessageListItemArray::
|
|
1459 |
// ----------------------------------------------------
|
|
1460 |
TInt CMceMessageListItemArray::FolderCount()
|
|
1461 |
{
|
|
1462 |
TInt numberOfFolders = 0;
|
|
1463 |
const TInt itemCount = iFolderEntry->Count();
|
|
1464 |
for ( TInt loop = 0; loop < itemCount; loop++ )
|
|
1465 |
{
|
|
1466 |
if ( (*iFolderEntry)[loop].iType == KUidMsvFolderEntry )
|
|
1467 |
{
|
|
1468 |
numberOfFolders++;
|
|
1469 |
}
|
|
1470 |
else if ( (*iFolderEntry)[loop].iType == KUidMsvMessageEntry )
|
|
1471 |
{
|
|
1472 |
// folders are grouped first, so we can stop when first message is reached.
|
|
1473 |
break; //loop = itemCount;
|
|
1474 |
}
|
|
1475 |
}
|
|
1476 |
return numberOfFolders;
|
|
1477 |
}
|
|
1478 |
|
|
1479 |
|
|
1480 |
// ----------------------------------------------------
|
|
1481 |
// CMceMessageListItemArray::CreateEntryIndex()
|
|
1482 |
// ----------------------------------------------------
|
|
1483 |
TInt CMceMessageListItemArray::CreateEntryIndexL() const
|
|
1484 |
{
|
|
1485 |
TInt visiblecount;
|
|
1486 |
TInt itemcount = iFolderEntry->Count();
|
|
1487 |
|
|
1488 |
CMsvEntrySelection *sel = new(ELeave) CMsvEntrySelection;
|
|
1489 |
CleanupStack::PushL( sel );
|
|
1490 |
|
|
1491 |
//Find email messages
|
|
1492 |
CMsvEntrySelection *smtpselection = iFolderEntry->ChildrenWithMtmL( KUidMsgTypeSMTP );
|
|
1493 |
CleanupStack::PushL( smtpselection );
|
|
1494 |
|
|
1495 |
CMsvEntrySelection *pop3selection = NULL;
|
|
1496 |
CMsvEntrySelection *imapselection = NULL ;
|
|
1497 |
CMsvEntrySelection *cmailselection = NULL ;
|
|
1498 |
|
|
1499 |
if(!iEmailFramework)
|
|
1500 |
{
|
|
1501 |
pop3selection = iFolderEntry->ChildrenWithMtmL( KUidMsgTypePOP3 );
|
|
1502 |
CleanupStack::PushL( pop3selection );
|
|
1503 |
imapselection = iFolderEntry->ChildrenWithMtmL( KUidMsgTypeIMAP4 );
|
|
1504 |
CleanupStack::PushL( imapselection );
|
|
1505 |
}
|
|
1506 |
else
|
|
1507 |
{
|
|
1508 |
cmailselection = iFolderEntry->ChildrenWithMtmL(
|
|
1509 |
TUid::Uid(KUidMsgTypeFsMtmVal));
|
|
1510 |
CleanupStack::PushL( cmailselection );
|
|
1511 |
}
|
|
1512 |
|
|
1513 |
sel->Reset();
|
|
1514 |
iMsgIndex->Reset();
|
|
1515 |
|
|
1516 |
//store all email id's to sel array
|
|
1517 |
if ( smtpselection!=0 && smtpselection->Count()>0 )
|
|
1518 |
{
|
|
1519 |
for( TInt i=0 ; i < smtpselection->Count() ; i++ )
|
|
1520 |
{
|
|
1521 |
sel->AppendL( smtpselection->At(i) );
|
|
1522 |
}
|
|
1523 |
}
|
|
1524 |
if(!iEmailFramework)
|
|
1525 |
{
|
|
1526 |
if ( pop3selection!=0 && pop3selection->Count()>0 )
|
|
1527 |
{
|
|
1528 |
for( TInt i=0 ; i < pop3selection->Count() ; i++ )
|
|
1529 |
{
|
|
1530 |
sel->AppendL( pop3selection->At(i) );
|
|
1531 |
}
|
|
1532 |
}
|
|
1533 |
if ( imapselection!=0 && imapselection->Count()>0 )
|
|
1534 |
{
|
|
1535 |
for( TInt i=0 ; i < imapselection->Count() ; i++ )
|
|
1536 |
{
|
|
1537 |
sel->AppendL( imapselection->At(i) );
|
|
1538 |
}
|
|
1539 |
}
|
|
1540 |
}
|
|
1541 |
else
|
|
1542 |
{
|
|
1543 |
if ( cmailselection!=0 && cmailselection->Count()>0 )
|
|
1544 |
{
|
|
1545 |
for( TInt i=0 ; i < cmailselection->Count() ; i++ )
|
|
1546 |
{
|
|
1547 |
sel->AppendL( cmailselection->At(i) );
|
|
1548 |
}
|
|
1549 |
}
|
|
1550 |
}
|
|
1551 |
visiblecount = itemcount - sel->Count();
|
|
1552 |
|
|
1553 |
TInt i = 0;
|
|
1554 |
TInt j = visiblecount;
|
|
1555 |
|
|
1556 |
if ( visiblecount < itemcount )
|
|
1557 |
{
|
|
1558 |
do
|
|
1559 |
{
|
|
1560 |
if ( sel->Find( (*iFolderEntry)[i].Id() ) == KErrNotFound )
|
|
1561 |
{
|
|
1562 |
//add everything else but emails to msg index
|
|
1563 |
iMsgIndex->AppendL( i );
|
|
1564 |
j--;
|
|
1565 |
}
|
|
1566 |
i++;
|
|
1567 |
|
|
1568 |
} while ( j > 0 && i < itemcount);
|
|
1569 |
}
|
|
1570 |
|
|
1571 |
if(iEmailFramework)
|
|
1572 |
{
|
|
1573 |
CleanupStack::PopAndDestroy( cmailselection );
|
|
1574 |
}
|
|
1575 |
else
|
|
1576 |
{
|
|
1577 |
CleanupStack::PopAndDestroy(imapselection);
|
|
1578 |
CleanupStack::PopAndDestroy( pop3selection );
|
|
1579 |
}
|
|
1580 |
CleanupStack::PopAndDestroy( smtpselection );
|
|
1581 |
CleanupStack::PopAndDestroy( sel );
|
|
1582 |
|
|
1583 |
return visiblecount;
|
|
1584 |
}
|
|
1585 |
|
|
1586 |
// ----------------------------------------------------
|
|
1587 |
// CMceListItemArray::GetEntryIndex()
|
|
1588 |
// ----------------------------------------------------
|
|
1589 |
TInt CMceMessageListItemArray::GetEntryIndex( TInt aIndex ) const
|
|
1590 |
{
|
|
1591 |
TInt tmpindex = aIndex;
|
|
1592 |
|
|
1593 |
if ( (iEmailClientIntegration && iIntegratedEmailAppExcist) || iEmailFramework )
|
|
1594 |
{
|
|
1595 |
if( ( iFolderId == KMsvDraftEntryId ||
|
|
1596 |
iFolderId == KMsvSentEntryId ||
|
|
1597 |
iFolderId == KMsvDeletedEntryFolderEntryId ||
|
|
1598 |
iFolderId == KMsvGlobalInBoxIndexEntryId || iFolderId == KMsvGlobalOutBoxIndexEntryId ) &&
|
|
1599 |
iMsgIndex->Count() > 0 )
|
|
1600 |
{
|
|
1601 |
tmpindex = iMsgIndex->At( aIndex );
|
|
1602 |
}
|
|
1603 |
}
|
|
1604 |
|
|
1605 |
return tmpindex;
|
|
1606 |
}
|
|
1607 |
// ----------------------------------------------------
|
|
1608 |
// CMceMessageListItemArray::IsMailMtmTechnology
|
|
1609 |
// ----------------------------------------------------
|
|
1610 |
TBool CMceMessageListItemArray::IsMailMtmTechnology(TUid aMtm )const
|
|
1611 |
{
|
|
1612 |
TBool isMailMtm = EFalse;
|
|
1613 |
if ( aMtm.iUid != 0 && aMtm != KUidMsvLocalServiceMtm &&
|
|
1614 |
iUiRegistry->IsPresent( aMtm) )
|
|
1615 |
{
|
|
1616 |
// get MTM technology type
|
|
1617 |
TUid technologyType = iUiRegistry->TechnologyTypeUid( aMtm);
|
|
1618 |
isMailMtm = ( KMailTechnologyTypeUid == technologyType );
|
|
1619 |
}
|
|
1620 |
return isMailMtm;
|
|
1621 |
}
|
|
1622 |
// End of File
|