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 |
#include <centralrepository.h>
|
|
35 |
#include <messaginginternalcrkeys.h>
|
|
36 |
|
|
37 |
|
|
38 |
#include <MTMStore.h>
|
|
39 |
#include <commonphoneparser.h>
|
|
40 |
|
|
41 |
#include <aknappui.h>
|
|
42 |
#include <akncontext.h>
|
|
43 |
#include <aknconsts.h>
|
|
44 |
#include <e32math.h>
|
|
45 |
|
|
46 |
#include <bldvariant.hrh>
|
|
47 |
#include <featmgr.h>
|
|
48 |
#include <NumberGrouping.h>
|
|
49 |
#include <mmsconst.h>
|
|
50 |
#include <mmsgenutils.h>
|
|
51 |
#include <mmsclient.h>
|
|
52 |
#include <mtclreg.h>
|
|
53 |
#include <muiu.mbg>
|
|
54 |
#include <mtudreg.h> // CMtmUiDataRegistry
|
|
55 |
|
|
56 |
// security data caging
|
|
57 |
#include <data_caging_path_literals.hrh>
|
|
58 |
#include <miutset.h>
|
|
59 |
#include <msvapi.h>
|
|
60 |
|
|
61 |
#include <ImumInternalApi.h> // CImumInternalApi
|
|
62 |
#include <ImumInSettingsData.h> // CImumInSettingsData
|
|
63 |
|
|
64 |
#include <muiuflags.h>
|
|
65 |
|
|
66 |
#include "MceMainViewListItemArrayIncludes.h"
|
|
67 |
#include <mceextraitems.rsg>
|
|
68 |
//FS Email stuff
|
|
69 |
#include <ImumInHealthServices.h>
|
|
70 |
#include <muiumsvuiserviceutilitiesinternal.h>
|
|
71 |
#include <MessagingDomainCRKeys.h>
|
|
72 |
#include <bautils.h>
|
|
73 |
|
|
74 |
// CONSTANTS
|
|
75 |
|
|
76 |
// LOCAL CONSTANTS AND MACROS
|
|
77 |
enum
|
|
78 |
{
|
|
79 |
KMceListArrayDocAmount = 0x0,
|
|
80 |
KMceListArrayDocAmountMany,
|
|
81 |
KMceListArrayDocAmountTemp,
|
|
82 |
KMceListArrayDocAmountTemps,
|
|
83 |
KMceListArrayDocNoMessages,
|
|
84 |
KMceListArrayNumberOneMessage,
|
|
85 |
KMceListArrayNumberOfMsgs,
|
|
86 |
KMceListArrayTimeFormatBuffer,
|
|
87 |
KMceListArrayDateFormatBuffer
|
|
88 |
};
|
|
89 |
|
|
90 |
//cmail update
|
|
91 |
#define KUidMsgTypeFsMtmVal 0x2001F406
|
|
92 |
#define KConversationUidVal 0x2002A540 //Conversation Application UID
|
|
93 |
|
|
94 |
//cmail update
|
|
95 |
|
|
96 |
// ================= MEMBER FUNCTIONS =======================
|
|
97 |
|
|
98 |
// C++ default constructor can NOT contain any code that
|
|
99 |
// might leave.
|
|
100 |
//
|
|
101 |
CMceMainViewListItemArray::CMceMainViewListItemArray(
|
|
102 |
CMsvSessionPtr aSession,
|
|
103 |
TMsvId /*aFolderId*/,
|
|
104 |
TMceListType /*aListType*/,
|
|
105 |
CMceBitmapResolver& aBitmapResolver ) :
|
|
106 |
CArrayFixFlat<TMceListItem>( KMceListGranuality ),
|
|
107 |
iSession( aSession ),
|
|
108 |
// KMsvRootIndexEntryId( aFolderId ),
|
|
109 |
// iListType( aListType ),
|
|
110 |
iBitmapResolver( aBitmapResolver )
|
|
111 |
{
|
|
112 |
iMailboxArray.Reset();
|
|
113 |
iDescriptionLength = iBitmapResolver.DescriptionLength();
|
|
114 |
}
|
|
115 |
|
|
116 |
// ----------------------------------------------------
|
|
117 |
// CMceMainViewListItemArray::ConstructL
|
|
118 |
// Symbian OS default constructor can leave.
|
|
119 |
// ----------------------------------------------------
|
|
120 |
void CMceMainViewListItemArray::ConstructL()
|
|
121 |
{
|
|
122 |
FeatureManager::InitializeLibL();
|
|
123 |
if ( FeatureManager::FeatureSupported( KFeatureIdSelectableEmail ) )
|
|
124 |
{
|
|
125 |
iSelectableEmail = ETrue;
|
|
126 |
}
|
|
127 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) )
|
|
128 |
{
|
|
129 |
iEmailFramework = ETrue;
|
|
130 |
}
|
|
131 |
FeatureManager::UnInitializeLib();
|
|
132 |
iCoeEnv = CEikonEnv::Static();
|
|
133 |
iUiRegistry = CMtmUiDataRegistry::NewL(*iSession);
|
|
134 |
ReadMainViewItemsFromRepositoryL();
|
|
135 |
ReadExtraItemsResourceL();
|
|
136 |
|
|
137 |
// read phone number grouping feature flag
|
|
138 |
// sort by details sorts remote mailboxes alphabetical order
|
|
139 |
iFolderEntry = CMsvEntry::NewL(
|
|
140 |
*iSession,
|
|
141 |
KMsvRootIndexEntryId,
|
|
142 |
TMsvSelectionOrdering(
|
|
143 |
KMsvGroupByStandardFolders, EMsvSortByDetails ));
|
|
144 |
|
|
145 |
iEmailApi = CreateEmailApiL( &*iSession );
|
|
146 |
Reset();
|
|
147 |
AddFoldersL();
|
|
148 |
iIdleLoader = CMceUtilsIdleClass::NewL( *this );
|
|
149 |
iIdleLoader->StartL();
|
|
150 |
iNumberOfMessagesStrings = new(ELeave)CDesCArrayFlat( KMceListGranuality );
|
|
151 |
TBuf<KMcePrintableTextLength> tempString;
|
|
152 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT, iCoeEnv );
|
|
153 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
154 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_MANY, iCoeEnv );
|
|
155 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
156 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_TEMP, iCoeEnv );
|
|
157 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
158 |
StringLoader::Load( tempString, R_MCE_DOC_AMOUNT_TEMPS, iCoeEnv );
|
|
159 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
160 |
StringLoader::Load( tempString, R_MCE_DOC_NO_MESSAGES, iCoeEnv);
|
|
161 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
162 |
StringLoader::Load( tempString, R_MCE_NUMBER_ONE_MESSAGE, iCoeEnv);
|
|
163 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
164 |
StringLoader::Load( tempString, R_MCE_NUMBER_OF_MSGS, iCoeEnv);
|
|
165 |
iNumberOfMessagesStrings->AppendL( tempString );
|
|
166 |
|
|
167 |
HBufC* timeFormat = iCoeEnv->
|
|
168 |
AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
|
|
169 |
iNumberOfMessagesStrings->AppendL( *timeFormat );
|
|
170 |
CleanupStack::PopAndDestroy();
|
|
171 |
|
|
172 |
HBufC* dateFormat = iCoeEnv->
|
|
173 |
AllocReadResourceLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO );
|
|
174 |
iNumberOfMessagesStrings->AppendL( *dateFormat );
|
|
175 |
CleanupStack::PopAndDestroy();
|
|
176 |
|
|
177 |
|
|
178 |
// todo
|
|
179 |
iListBoxText = HBufC::NewL( iDescriptionLength*3 );
|
|
180 |
iDefaultViewSettings = KMceConversationview;
|
|
181 |
}
|
|
182 |
|
|
183 |
// Two-phased constructor.
|
|
184 |
CMceMainViewListItemArray* CMceMainViewListItemArray::NewL(
|
|
185 |
CMsvSessionPtr aSession,
|
|
186 |
TMsvId aFolderId,
|
|
187 |
TMceListType aListType,
|
|
188 |
CMceBitmapResolver& aBitmapResolver )
|
|
189 |
{
|
|
190 |
CMceMainViewListItemArray* self = new (ELeave) CMceMainViewListItemArray(
|
|
191 |
aSession, aFolderId, aListType, aBitmapResolver );
|
|
192 |
CleanupStack::PushL(self);
|
|
193 |
self->ConstructL();
|
|
194 |
CleanupStack::Pop(); // self
|
|
195 |
return self;
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
// Destructor
|
|
200 |
CMceMainViewListItemArray::~CMceMainViewListItemArray( )
|
|
201 |
{
|
|
202 |
delete iExtraItemsArray;
|
|
203 |
delete iMainViewItems;
|
|
204 |
delete iFolderEntry;
|
|
205 |
delete iListBoxText;
|
|
206 |
delete iNumberOfMessagesStrings;
|
|
207 |
// delete iUiRegistry;
|
|
208 |
delete iEmailApi;
|
|
209 |
iMailboxArray.Reset();
|
|
210 |
delete iIdleLoader;
|
|
211 |
delete iUiRegistry;
|
|
212 |
// iSession deleted elsewhere
|
|
213 |
}
|
|
214 |
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
// CMceMainViewListItemArray::MakeItemL()
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CMceMainViewListItemArray::MakeItemL(
|
|
220 |
TMceListItem& aListItem,
|
|
221 |
const TMsvEntry& aEntry ) const
|
|
222 |
{
|
|
223 |
aListItem.iPrintableText.Zero();
|
|
224 |
|
|
225 |
const TMsvId id=aEntry.Id();
|
|
226 |
StripAndAppendString(
|
|
227 |
aListItem.iPrintableText,
|
|
228 |
aEntry.iDetails );
|
|
229 |
|
|
230 |
aListItem.iMsvId = id;
|
|
231 |
aListItem.iExtraItem = EFalse;
|
|
232 |
aListItem.iIconIndex = KErrNotFound;
|
|
233 |
aListItem.iText.Zero();
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
// CMceMainViewListItemArray::InsertItemL()
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
void CMceMainViewListItemArray::InsertItemL(
|
|
241 |
const TMsvEntry& aEntry,
|
|
242 |
const TInt aIndex )
|
|
243 |
{
|
|
244 |
TMceListItem tempItem;
|
|
245 |
MakeItemL( tempItem, aEntry );
|
|
246 |
InsertL( aIndex, tempItem );
|
|
247 |
}
|
|
248 |
|
|
249 |
|
|
250 |
// ----------------------------------------------------
|
|
251 |
// CMceMainViewListItemArray::AddItemL
|
|
252 |
// ----------------------------------------------------
|
|
253 |
void CMceMainViewListItemArray::AddItemL( const TMsvEntry& aEntry )
|
|
254 |
{
|
|
255 |
TMceListItem tempItem;
|
|
256 |
MakeItemL( tempItem, aEntry );
|
|
257 |
AppendL( tempItem );
|
|
258 |
}
|
|
259 |
|
|
260 |
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
// CMceListItemArray::AddFolderItemL()
|
|
263 |
// ---------------------------------------------------------------------------
|
|
264 |
//
|
|
265 |
void CMceMainViewListItemArray::AddFolderItemL( TMsvId aEntryId )
|
|
266 |
{
|
|
267 |
TMsvId service = KMsvLocalServiceIndexEntryId;
|
|
268 |
TMsvEntry entry;
|
|
269 |
if ( iSession->GetEntry(aEntryId,service,entry) == KErrNone )
|
|
270 |
{
|
|
271 |
AddItemL( entry );
|
|
272 |
}
|
|
273 |
}
|
|
274 |
|
|
275 |
// ----------------------------------------------------
|
|
276 |
// CMceMainViewListItemArray::ItemIndex
|
|
277 |
// ----------------------------------------------------
|
|
278 |
TInt CMceMainViewListItemArray::ItemIndex(TMsvId aItemId) const
|
|
279 |
{
|
|
280 |
TInt foundItem = KErrNotFound;
|
|
281 |
const TInt count = Count();
|
|
282 |
|
|
283 |
for( TInt loop = 0; loop < count && foundItem == KErrNotFound ; loop++)
|
|
284 |
{
|
|
285 |
if ( !At(loop).iExtraItem && At(loop).iMsvId == aItemId )
|
|
286 |
{
|
|
287 |
foundItem = loop;
|
|
288 |
}
|
|
289 |
}
|
|
290 |
return foundItem;
|
|
291 |
}
|
|
292 |
|
|
293 |
// ----------------------------------------------------
|
|
294 |
// CMceMainViewListItemArray::ExtraItemIndex
|
|
295 |
// ----------------------------------------------------
|
|
296 |
TInt CMceMainViewListItemArray::ExtraItemIndex( TInt aItemId ) const
|
|
297 |
{
|
|
298 |
TInt foundItem = KErrNotFound;
|
|
299 |
const TInt count = Count();
|
|
300 |
|
|
301 |
for( TInt loop = 0; loop < count && foundItem == KErrNotFound ; loop++)
|
|
302 |
{
|
|
303 |
if ( At(loop).iExtraItem && At(loop).iMsvId == aItemId )
|
|
304 |
{
|
|
305 |
foundItem = loop;
|
|
306 |
}
|
|
307 |
}
|
|
308 |
return foundItem;
|
|
309 |
}
|
|
310 |
|
|
311 |
// ----------------------------------------------------
|
|
312 |
// CMceListItemArray::ItemId
|
|
313 |
// ----------------------------------------------------
|
|
314 |
TMsvId CMceMainViewListItemArray::ItemId( TInt aIndex ) const
|
|
315 |
{
|
|
316 |
TMsvId id = KErrNotFound;
|
|
317 |
if ( aIndex >= 0 && aIndex < Count() )
|
|
318 |
{
|
|
319 |
if ( !At(aIndex).iExtraItem )
|
|
320 |
{
|
|
321 |
id = At(aIndex).iMsvId;
|
|
322 |
}
|
|
323 |
}
|
|
324 |
return id;
|
|
325 |
}
|
|
326 |
|
|
327 |
// ----------------------------------------------------
|
|
328 |
// CMceMainViewListItemArray::Item
|
|
329 |
// ----------------------------------------------------
|
|
330 |
const TMceListItem CMceMainViewListItemArray::Item( TInt aIndex ) const
|
|
331 |
{
|
|
332 |
TMceListItem tempItem;
|
|
333 |
tempItem.iMsvId = At(aIndex).iMsvId;
|
|
334 |
tempItem.iExtraItem = At(aIndex).iExtraItem;
|
|
335 |
return tempItem;
|
|
336 |
}
|
|
337 |
|
|
338 |
// ----------------------------------------------------
|
|
339 |
// CMceMainViewListItemArray::AddExtraItemL
|
|
340 |
// ----------------------------------------------------
|
|
341 |
void CMceMainViewListItemArray::AddExtraItemL( TMceListItem& aNewItem, TInt aIndex )
|
|
342 |
{
|
|
343 |
TMcePrintableText tempText = aNewItem.iPrintableText; // let's save string
|
|
344 |
|
|
345 |
aNewItem.iExtraItem = ETrue;
|
|
346 |
// make sure it will not be mixed with items in msgs
|
|
347 |
TMceBitmapListItem bitmapItem;
|
|
348 |
bitmapItem.iExtraItem = ETrue;
|
|
349 |
bitmapItem.iMtm.iUid = KUidMsvLocalServiceMtmValue;
|
|
350 |
bitmapItem.iType.iUid = KUidMsvFolderEntryValue;
|
|
351 |
bitmapItem.iId = aNewItem.iMsvId;
|
|
352 |
const TInt index = iBitmapResolver.BitmapIndex( bitmapItem );
|
|
353 |
aNewItem.iPrintableText.Zero();
|
|
354 |
aNewItem.iPrintableText.AppendNum( index );
|
|
355 |
aNewItem.iPrintableText.Append( KColumnListSeparator );
|
|
356 |
aNewItem.iPrintableText.Append( tempText );
|
|
357 |
aNewItem.iText.Zero();
|
|
358 |
InsertL( aIndex, aNewItem );
|
|
359 |
}
|
|
360 |
|
|
361 |
|
|
362 |
// ----------------------------------------------------
|
|
363 |
// CMceMainViewListItemArray::AddExtraItemWithIconL
|
|
364 |
// ----------------------------------------------------
|
|
365 |
void CMceMainViewListItemArray::AddExtraItemWithIconL(
|
|
366 |
TMceListItem& aNewItem,
|
|
367 |
TInt aIndex,
|
|
368 |
TInt aIconIndex,
|
|
369 |
TUid aApplicationUid )
|
|
370 |
{
|
|
371 |
TMcePrintableText tempText = aNewItem.iPrintableText; // let's save string
|
|
372 |
TMcePrintableText secondarytxt = aNewItem.iSecondaryText;
|
|
373 |
aNewItem.iExtraItem = ETrue;
|
|
374 |
// make sure it will not be mixed with items in msgs
|
|
375 |
TMceBitmapListItem bitmapItem;
|
|
376 |
bitmapItem.iExtraItem = ETrue;
|
|
377 |
bitmapItem.iMtm = aApplicationUid ; //KUidMsvLocalServiceMtmValue;
|
|
378 |
bitmapItem.iType = aApplicationUid; //KUidMsvFolderEntryValue;
|
|
379 |
bitmapItem.iId = aNewItem.iMsvId;
|
|
380 |
// here to add loading of the icon...
|
|
381 |
_LIT( KMceExtraIconsDirAndFile,"MceExtraIcons.mbm" );
|
|
382 |
TParse fp;
|
|
383 |
fp.Set( KMceExtraIconsDirAndFile, &KDC_APP_BITMAP_DIR , NULL );
|
|
384 |
// trap this and if fails, set index = Unknown.
|
|
385 |
TInt error = KErrNone;
|
|
386 |
|
|
387 |
// Add the bitmap
|
|
388 |
TRAP( error, iBitmapResolver.CreateAndAppendIconL( \
|
|
389 |
KAknsIIDDefault,\
|
|
390 |
fp.FullName(),\
|
|
391 |
aIconIndex,\
|
|
392 |
&bitmapItem ) );
|
|
393 |
|
|
394 |
// Handle the error
|
|
395 |
TInt index;
|
|
396 |
if ( error == KErrNone )
|
|
397 |
{
|
|
398 |
index = iBitmapResolver.BitmapIndex( bitmapItem );
|
|
399 |
}
|
|
400 |
else
|
|
401 |
{
|
|
402 |
index = EMceBitmapIndexUnknown;
|
|
403 |
}
|
|
404 |
|
|
405 |
aNewItem.iPrintableText.Zero();
|
|
406 |
aNewItem.iPrintableText.AppendNum( index );
|
|
407 |
aNewItem.iPrintableText.Append( KColumnListSeparator );
|
|
408 |
aNewItem.iPrintableText.Append( tempText );
|
|
409 |
aNewItem.iPrintableText.Append( KColumnListSeparator );
|
|
410 |
aNewItem.iPrintableText.Append( secondarytxt );
|
|
411 |
aNewItem.iText.Zero();
|
|
412 |
InsertL( aIndex, aNewItem );
|
|
413 |
}
|
|
414 |
|
|
415 |
// ----------------------------------------------------
|
|
416 |
// CMceMainViewListItemArray::MdcaCount
|
|
417 |
// ----------------------------------------------------
|
|
418 |
TInt CMceMainViewListItemArray::MdcaCount() const
|
|
419 |
{
|
|
420 |
return Count();
|
|
421 |
}
|
|
422 |
|
|
423 |
// ----------------------------------------------------
|
|
424 |
// CMceMainViewListItemArray::MdcaPoint
|
|
425 |
// ----------------------------------------------------
|
|
426 |
TPtrC CMceMainViewListItemArray::MdcaPoint( TInt aIndex ) const
|
|
427 |
{
|
|
428 |
const TMceListItem& item = At( aIndex );
|
|
429 |
if ( item.iExtraItem )
|
|
430 |
{
|
|
431 |
if ( item.iMsvId == KMceDeliveryReportsId )
|
|
432 |
{
|
|
433 |
TPtr tempText = iListBoxText->Des();
|
|
434 |
tempText.Copy( item.iPrintableText );
|
|
435 |
return tempText;
|
|
436 |
}
|
|
437 |
else if( item.iApplicationUid == KConversationUidVal )
|
|
438 |
{
|
|
439 |
return CreateConversationsListItem( aIndex );
|
|
440 |
}
|
|
441 |
else
|
|
442 |
{
|
|
443 |
return item.iPrintableText;
|
|
444 |
}
|
|
445 |
}
|
|
446 |
else
|
|
447 |
{
|
|
448 |
return MakeStringForMainView( aIndex );
|
|
449 |
}
|
|
450 |
}
|
|
451 |
|
|
452 |
// ----------------------------------------------------
|
|
453 |
// CMceMainViewListItemArray::MakeStringForMainView
|
|
454 |
// ----------------------------------------------------
|
|
455 |
TPtrC CMceMainViewListItemArray::MakeStringForMainView( TInt aIndex ) const
|
|
456 |
{
|
|
457 |
TPtr tempText = iListBoxText->Des();
|
|
458 |
tempText.Zero();
|
|
459 |
TMsvEntry entry;
|
|
460 |
TMsvId serviceId;
|
|
461 |
|
|
462 |
const TMceListItem& item = At( aIndex );
|
|
463 |
if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone )
|
|
464 |
{
|
|
465 |
if ( item.iIconIndex <= KErrNone || item.iIconIndex >= iBitmapResolver.MtmIconIndex() )
|
|
466 |
{
|
|
467 |
TInt messageCount = 0;
|
|
468 |
TMsvId id = entry.Id();
|
|
469 |
CONST_CAST( TMceListItem*, &item)->iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount );
|
|
470 |
if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId )
|
|
471 |
{
|
|
472 |
CONST_CAST( TMceListItem*, &item)->iIconIndex = EMceBitmapIndexInbox;
|
|
473 |
}
|
|
474 |
CONST_CAST( TMceListItem*, &item)->iMessageCount = messageCount;
|
|
475 |
}
|
|
476 |
else if(iListItemArrayObserver )
|
|
477 |
{
|
|
478 |
//if item iText is not cached then cache it first
|
|
479 |
if((item.iText.Length()!=0)&&(iListItemArrayObserver->MceListItemArrayFlickEvent()))
|
|
480 |
{
|
|
481 |
return item.iText;
|
|
482 |
}
|
|
483 |
}
|
|
484 |
|
|
485 |
tempText.AppendNum( item.iIconIndex );
|
|
486 |
tempText.Append( KColumnListSeparator );
|
|
487 |
tempText.Append( item.iPrintableText );
|
|
488 |
AppendMessageCountString( tempText, item.iMessageCount );
|
|
489 |
|
|
490 |
if ( entry.Connected() )
|
|
491 |
{
|
|
492 |
if ( iRoaming )
|
|
493 |
{
|
|
494 |
tempText.Append( KColumnListSeparator );
|
|
495 |
tempText.AppendNum( (TInt) EMceBitmapIndexAlwaysRoaming );
|
|
496 |
}
|
|
497 |
else
|
|
498 |
{
|
|
499 |
tempText.Append( KColumnListSeparator );
|
|
500 |
tempText.AppendNum( (TInt) EMceBitmapIndexMailboxConnectionOn );
|
|
501 |
}
|
|
502 |
}
|
|
503 |
else if ( iAlwaysOnline && ( entry.iMtm == KSenduiMtmImap4Uid ||
|
|
504 |
entry.iMtm == KSenduiMtmPop3Uid ) )
|
|
505 |
{
|
|
506 |
TBool dateTime = EFalse;
|
|
507 |
TBool aoAccount = EFalse;
|
|
508 |
TRAP_IGNORE( dateTime = AlwaysOnlineDateTimeValidL( serviceId, aoAccount ) );
|
|
509 |
if ( dateTime )
|
|
510 |
{
|
|
511 |
// within the update interval
|
|
512 |
tempText.Append( KColumnListSeparator );
|
|
513 |
if ( iRoaming )
|
|
514 |
{
|
|
515 |
tempText.AppendNum( (TInt) EMceBitmapIndexAlwaysRoaming );
|
|
516 |
}
|
|
517 |
else
|
|
518 |
{
|
|
519 |
tempText.AppendNum( (TInt) EMceBitmapIndexAlwaysAdd );
|
|
520 |
}
|
|
521 |
}
|
|
522 |
else if ( aoAccount )
|
|
523 |
{
|
|
524 |
// outside the interval
|
|
525 |
tempText.Append( KColumnListSeparator );
|
|
526 |
if ( iRoaming )
|
|
527 |
{
|
|
528 |
tempText.AppendNum( (TInt) EMceBitmapIndexAlwaysRoaming );
|
|
529 |
}
|
|
530 |
else
|
|
531 |
{
|
|
532 |
tempText.AppendNum( (TInt) EMceBitmapIndexInactiveAdd );
|
|
533 |
}
|
|
534 |
}
|
|
535 |
}
|
|
536 |
}
|
|
537 |
else
|
|
538 |
{
|
|
539 |
// this should never happend
|
|
540 |
__ASSERT_DEBUG( 0, Panic(EMceListItemArrayEntryNotFound ) );
|
|
541 |
tempText.AppendNum( (TInt)EMceBitmapIndexUnknown );
|
|
542 |
tempText.Append( KColumnListSeparator );
|
|
543 |
tempText.Append( item.iPrintableText );
|
|
544 |
}
|
|
545 |
//save the complete string as chache, will be used when flick will start
|
|
546 |
CONST_CAST( TMceListItem*, &item)->iText.Zero();
|
|
547 |
CONST_CAST( TMceListItem*, &item)->iText.Copy(tempText);
|
|
548 |
return tempText;
|
|
549 |
}
|
|
550 |
|
|
551 |
// ---------------------------------------------------------------------------
|
|
552 |
// CMceMainViewListItemArray::ShouldAddToListL()
|
|
553 |
// ---------------------------------------------------------------------------
|
|
554 |
//
|
|
555 |
TBool CMceMainViewListItemArray::ShouldAddToListL(
|
|
556 |
const TMsvEntry& aEntry,
|
|
557 |
const TMsvId aId )
|
|
558 |
{
|
|
559 |
TBool add =
|
|
560 |
// Is it a folder
|
|
561 |
( aEntry.iType == KUidMsvFolderEntry ) ||
|
|
562 |
// Is it a local service id
|
|
563 |
( aId == KMsvLocalServiceIndexEntryId ) ||
|
|
564 |
// Is it service but not local one?
|
|
565 |
( ( aEntry.iType == KUidMsvServiceEntry &&
|
|
566 |
aEntry.Id() != KMsvLocalServiceIndexEntryId ) );
|
|
567 |
|
|
568 |
// Mailboxes are added later, so ignore them here
|
|
569 |
return add ? !iEmailApi->MailboxUtilitiesL().IsMailMtm( aEntry.iMtm, ETrue ) : EFalse;
|
|
570 |
}
|
|
571 |
|
|
572 |
// ---------------------------------------------------------------------------
|
|
573 |
// CMceMainViewListItemArray::CollectServicesL()
|
|
574 |
// ---------------------------------------------------------------------------
|
|
575 |
//
|
|
576 |
TInt CMceMainViewListItemArray::CollectServicesL( const TMsvId aId )
|
|
577 |
{
|
|
578 |
const TMsvEntry* tEntry;
|
|
579 |
const TInt count = iFolderEntry->Count();
|
|
580 |
for (TInt cc = 0; cc < count; cc++)
|
|
581 |
{
|
|
582 |
tEntry = &( *iFolderEntry )[cc];
|
|
583 |
if ( ShouldAddToListL( *tEntry, aId ) )
|
|
584 |
{
|
|
585 |
AddItemL( *tEntry );
|
|
586 |
}
|
|
587 |
}
|
|
588 |
|
|
589 |
return Count();
|
|
590 |
}
|
|
591 |
|
|
592 |
// ---------------------------------------------------------------------------
|
|
593 |
// CMceMainViewListItemArray::AddMailboxesL()
|
|
594 |
// ---------------------------------------------------------------------------
|
|
595 |
void CMceMainViewListItemArray::AddMailboxesL( const TInt /*aMailboxIndex*/ )
|
|
596 |
{
|
|
597 |
// add mailboxes only if smtp mtm is installed
|
|
598 |
if ( iUiRegistry->IsPresent( KSenduiMtmSmtpUid ) )
|
|
599 |
{
|
|
600 |
// Get the list of valid IMAP4, POP3, and SyncML mailboxes
|
|
601 |
TInt err = MceUtils::GetHealthyMailboxListL(
|
|
602 |
iEmailApi->HealthServicesL(),
|
|
603 |
iMailboxArray,
|
|
604 |
ETrue,
|
|
605 |
ETrue,
|
|
606 |
ETrue,
|
|
607 |
ETrue );
|
|
608 |
|
|
609 |
// for use of CMceMainViewListView::AddExtraItemsL() so that
|
|
610 |
// MceUtils::GetHealthyMailboxListL won't be called twice
|
|
611 |
iErrGetHealthyMailBoxList = err;
|
|
612 |
iMaiboxArrayCount = iMailboxArray.Count();
|
|
613 |
// MCELOGGER_WRITE_FORMAT("AddMailboxesL: iMaiboxArrayCount: %d", iMaiboxArrayCount );
|
|
614 |
|
|
615 |
if ( iMaiboxArrayCount )
|
|
616 |
{
|
|
617 |
// Add the items to main view array in alphabetical order
|
|
618 |
for ( TInt mbox = 0; mbox < iMaiboxArrayCount; mbox++)
|
|
619 |
{
|
|
620 |
// cmail update
|
|
621 |
if(iEmailFramework)
|
|
622 |
{
|
|
623 |
//IF mtm UID matches with uidMsgTypeFsMtmVal, skip the entry
|
|
624 |
//cmail should not be visible in MCE main view
|
|
625 |
TMsvId service;
|
|
626 |
TMsvEntry entry;
|
|
627 |
User::LeaveIfError( iSession->GetEntry( iMailboxArray[mbox], service, entry ) );
|
|
628 |
if(entry.iMtm.iUid == KUidMsgTypeFsMtmVal)
|
|
629 |
{
|
|
630 |
continue;
|
|
631 |
}
|
|
632 |
}
|
|
633 |
//cmail update
|
|
634 |
AddItemL( iFolderEntry->ChildDataL( iMailboxArray[mbox] ) );
|
|
635 |
}
|
|
636 |
}
|
|
637 |
else
|
|
638 |
{
|
|
639 |
//Cmail update
|
|
640 |
// If iEmailFramework is true , donot show "MailBox"
|
|
641 |
// even if selectable email is true.
|
|
642 |
if(!iEmailFramework)
|
|
643 |
{
|
|
644 |
if ( !iSelectableEmail || ( iSelectableEmail &&
|
|
645 |
!MsvUiServiceUtilitiesInternal::OtherEmailMTMExistL( *iSession ) ) )
|
|
646 |
{
|
|
647 |
// add special mailbox entry
|
|
648 |
AddExtraItemFromResourceL( R_MCE_MAIN_VIEW_NO_MAILBOXES, KMceNoMailboxesListId );
|
|
649 |
}
|
|
650 |
}
|
|
651 |
}
|
|
652 |
}
|
|
653 |
|
|
654 |
}
|
|
655 |
|
|
656 |
// ---------------------------------------------------------------------------
|
|
657 |
// CMceMainViewListItemArray::AddExtraItemFromResourceL()
|
|
658 |
// ---------------------------------------------------------------------------
|
|
659 |
//
|
|
660 |
void CMceMainViewListItemArray::AddExtraItemFromResourceL( TInt aResourceId, TInt aCommandId )
|
|
661 |
{
|
|
662 |
TMceListItem tempItem;
|
|
663 |
tempItem.iExtraItem = ETrue;
|
|
664 |
tempItem.iMsvId = aCommandId;
|
|
665 |
StringLoader::Load( tempItem.iPrintableText, aResourceId, iCoeEnv );
|
|
666 |
|
|
667 |
HBufC* line2text = NULL;
|
|
668 |
switch ( aResourceId )
|
|
669 |
{
|
|
670 |
case R_MCE_MAIN_VIEW_DELIVERY_REPORTS:
|
|
671 |
line2text = StringLoader::LoadL( R_MCE_MAIN_VIEW_DELIVERY_INFORMATION, iEikonEnv );
|
|
672 |
break;
|
|
673 |
case R_MCE_MAIN_VIEW_NO_MAILBOXES:
|
|
674 |
line2text = StringLoader::LoadL( R_MCE_MAIN_VIEW_NO_MAILBOXES_DEFINED, iEikonEnv );
|
|
675 |
break;
|
|
676 |
default:
|
|
677 |
// others does not have line2...
|
|
678 |
break;
|
|
679 |
}
|
|
680 |
|
|
681 |
if ( line2text )
|
|
682 |
{
|
|
683 |
tempItem.iPrintableText.Append( KColumnListSeparator );
|
|
684 |
tempItem.iPrintableText.Append( *line2text );
|
|
685 |
delete line2text;
|
|
686 |
line2text = NULL;
|
|
687 |
}
|
|
688 |
|
|
689 |
// always add at the end
|
|
690 |
AddExtraItemL( tempItem, Count() );
|
|
691 |
}
|
|
692 |
|
|
693 |
// ----------------------------------------------------
|
|
694 |
// CMceMainViewListItemArray::AddFoldersL
|
|
695 |
// Adds the children of TMsvId aId to the listbox
|
|
696 |
// ----------------------------------------------------
|
|
697 |
void CMceMainViewListItemArray::AddFoldersL( )
|
|
698 |
{
|
|
699 |
Reset();
|
|
700 |
TInt count = iMainViewItems->Count();
|
|
701 |
TInt extraItemCommandCount = 0;
|
|
702 |
|
|
703 |
for ( TInt i=0; i<count; i++ )
|
|
704 |
{
|
|
705 |
TMsvId folderId = (*iMainViewItems)[i];
|
|
706 |
switch ( folderId )
|
|
707 |
{
|
|
708 |
case KMceWriteMessageListIdValue:
|
|
709 |
AddExtraItemFromResourceL( R_MCE_MAIN_VIEW_WRITE_MESSAGE, folderId );
|
|
710 |
break;
|
|
711 |
case KMceNoMailboxesListIdValue:
|
|
712 |
AddMailboxesL( KErrNotFound );
|
|
713 |
//AddExtraItemFromResourceL();
|
|
714 |
break;
|
|
715 |
case KMceDeliveryReportsListIdValue:
|
|
716 |
AddExtraItemFromResourceL( R_MCE_MAIN_VIEW_DELIVERY_REPORTS, folderId );
|
|
717 |
break;
|
|
718 |
default:
|
|
719 |
if ( folderId > KMsvRootIndexEntryIdValue )
|
|
720 |
{
|
|
721 |
AddFolderItemL( folderId );
|
|
722 |
}
|
|
723 |
else if ( folderId == KMceExtraItemPlaceHolderValue )
|
|
724 |
{
|
|
725 |
AddExtraItemCommandL( extraItemCommandCount );
|
|
726 |
extraItemCommandCount++;
|
|
727 |
}
|
|
728 |
break;
|
|
729 |
}
|
|
730 |
}
|
|
731 |
}
|
|
732 |
|
|
733 |
// ----------------------------------------------------
|
|
734 |
// CMceMainViewListItemArray::AddInboxDocumentsL
|
|
735 |
// ----------------------------------------------------
|
|
736 |
void CMceMainViewListItemArray::AddInboxDocumentsL( )
|
|
737 |
{
|
|
738 |
iFolderEntry->SetEntryL( KMsvLocalServiceIndexEntryId );
|
|
739 |
AddItemL( iFolderEntry->
|
|
740 |
ChildDataL( KMsvGlobalInBoxIndexEntryId ) );
|
|
741 |
AddItemL( iFolderEntry->ChildDataL( KMceDocumentsEntryId ) );
|
|
742 |
}
|
|
743 |
|
|
744 |
// ----------------------------------------------------
|
|
745 |
// CMceMainViewListItemArray::AddDraftSentOutboxL
|
|
746 |
// ----------------------------------------------------
|
|
747 |
void CMceMainViewListItemArray::AddDraftSentOutboxL( )
|
|
748 |
{
|
|
749 |
iFolderEntry->SetEntryL( KMsvLocalServiceIndexEntryId );
|
|
750 |
AddItemL( iFolderEntry->ChildDataL( KMsvDraftEntryId ) );
|
|
751 |
AddItemL( iFolderEntry->ChildDataL( KMsvSentEntryId ) );
|
|
752 |
AddItemL( iFolderEntry->
|
|
753 |
ChildDataL( KMsvGlobalOutBoxIndexEntryId ) );
|
|
754 |
}
|
|
755 |
|
|
756 |
// ----------------------------------------------------
|
|
757 |
// CMceMainViewListItemArray::HandleSessionEventL
|
|
758 |
// ----------------------------------------------------
|
|
759 |
void CMceMainViewListItemArray::HandleSessionEventL(
|
|
760 |
TMsvSessionEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
|
|
761 |
{
|
|
762 |
switch (aEvent)
|
|
763 |
{
|
|
764 |
case EMsvEntriesCreated:
|
|
765 |
case EMsvEntriesChanged:
|
|
766 |
case EMsvEntriesDeleted:
|
|
767 |
case EMsvMediaChanged:
|
|
768 |
case EMsvMediaUnavailable:
|
|
769 |
case EMsvMediaAvailable:
|
|
770 |
Reset();
|
|
771 |
AddFoldersL();
|
|
772 |
break;
|
|
773 |
|
|
774 |
case EMsvCloseSession:
|
|
775 |
break;
|
|
776 |
|
|
777 |
default:
|
|
778 |
break;
|
|
779 |
}
|
|
780 |
}
|
|
781 |
|
|
782 |
// ----------------------------------------------------
|
|
783 |
// CMceMainViewListItemArray::StripAndAppendString
|
|
784 |
// ----------------------------------------------------
|
|
785 |
void CMceMainViewListItemArray::StripAndAppendString(TDes& aTargetString, const TDesC& aSourceString) const
|
|
786 |
{
|
|
787 |
TRAP_IGNORE( MceUtils::StripAndAppendStringL(
|
|
788 |
aTargetString,
|
|
789 |
aSourceString,
|
|
790 |
iDescriptionLength ) );
|
|
791 |
}
|
|
792 |
|
|
793 |
// ----------------------------------------------------
|
|
794 |
// CMceMainViewListItemArray::IsFolderRemote
|
|
795 |
// return ETrue, if remote folder
|
|
796 |
//
|
|
797 |
// ----------------------------------------------------
|
|
798 |
TBool CMceMainViewListItemArray::IsFolderRemote() const
|
|
799 |
{
|
|
800 |
TMsvId service = KMsvLocalServiceIndexEntryId;
|
|
801 |
TMsvEntry entry;
|
|
802 |
if ( iSession->GetEntry(KMsvRootIndexEntryId,service,entry) == KErrNone )
|
|
803 |
{
|
|
804 |
return KMsvLocalServiceIndexEntryId != service;
|
|
805 |
}
|
|
806 |
else
|
|
807 |
{
|
|
808 |
return EFalse;
|
|
809 |
}
|
|
810 |
}
|
|
811 |
|
|
812 |
// ----------------------------------------------------
|
|
813 |
// CMceMainViewListItemArray::ConstructMainViewL
|
|
814 |
// add folders in main view
|
|
815 |
//
|
|
816 |
// ----------------------------------------------------
|
|
817 |
|
|
818 |
void CMceMainViewListItemArray::ConstructMainViewL()
|
|
819 |
{
|
|
820 |
delete iFolderEntry;
|
|
821 |
iFolderEntry = NULL;
|
|
822 |
iFolderEntry = CMsvEntry::NewL(
|
|
823 |
*iSession,
|
|
824 |
KMsvRootIndexEntryId,
|
|
825 |
TMsvSelectionOrdering(
|
|
826 |
KMsvGroupByStandardFolders, EMsvSortByDetails ) );
|
|
827 |
AddFoldersL();
|
|
828 |
}
|
|
829 |
|
|
830 |
// ----------------------------------------------------
|
|
831 |
// CMceMainViewListItemArray::FolderId
|
|
832 |
// return folder id
|
|
833 |
//
|
|
834 |
// ----------------------------------------------------
|
|
835 |
TMsvId CMceMainViewListItemArray::FolderId() const
|
|
836 |
{
|
|
837 |
return KMsvRootIndexEntryId;
|
|
838 |
}
|
|
839 |
|
|
840 |
|
|
841 |
// ----------------------------------------------------
|
|
842 |
// CMceMainViewListItemArray::IsConnected
|
|
843 |
// return ETrue, if account is connected
|
|
844 |
//
|
|
845 |
// ----------------------------------------------------
|
|
846 |
TBool CMceMainViewListItemArray::IsConnected() const
|
|
847 |
{
|
|
848 |
TMsvEntry entry;
|
|
849 |
entry = iFolderEntry->Entry();
|
|
850 |
|
|
851 |
TMsvEntry serviceEntry;
|
|
852 |
TMsvId serviceId;
|
|
853 |
if ( iSession->GetEntry(entry.iServiceId,serviceId,serviceEntry) == KErrNone )
|
|
854 |
{
|
|
855 |
return serviceEntry.Connected();
|
|
856 |
}
|
|
857 |
else
|
|
858 |
{
|
|
859 |
return EFalse;
|
|
860 |
}
|
|
861 |
}
|
|
862 |
|
|
863 |
|
|
864 |
// ----------------------------------------------------
|
|
865 |
// CMceMainViewListItemArray::AlwaysOnlineDateTimeValidL
|
|
866 |
//
|
|
867 |
//
|
|
868 |
// ----------------------------------------------------
|
|
869 |
TBool CMceMainViewListItemArray::AlwaysOnlineDateTimeValidL( const TMsvId aAccount, TBool &aoDefined ) const
|
|
870 |
{
|
|
871 |
// Check if the always online is turned on
|
|
872 |
TInt64 flags = 0;
|
|
873 |
iEmailApi->MailboxUtilitiesL().QueryAlwaysOnlineStateL(
|
|
874 |
aAccount, flags );
|
|
875 |
|
|
876 |
aoDefined =
|
|
877 |
( flags & MImumInMailboxUtilities::EFlagTurnedOn ) ? ETrue : EFalse;
|
|
878 |
return ( flags & MImumInMailboxUtilities::EFlagWaitingToConnect ) ?
|
|
879 |
ETrue : EFalse;
|
|
880 |
}
|
|
881 |
|
|
882 |
// ----------------------------------------------------
|
|
883 |
// CMceMainViewListItemArray::AlwaysOnlineAccountL
|
|
884 |
//
|
|
885 |
// ----------------------------------------------------
|
|
886 |
TBool CMceMainViewListItemArray::AlwaysOnlineAccountL(
|
|
887 |
const TMsvId /*aAccount*/,
|
|
888 |
const CImumInSettingsData& aSettingsData ) const
|
|
889 |
{
|
|
890 |
TInt online = 0;
|
|
891 |
aSettingsData.GetAttr( TImumDaSettings::EKeyAutoRetrieval, online );
|
|
892 |
return online != TImumDaSettings::EValueAutoOff;
|
|
893 |
}
|
|
894 |
|
|
895 |
// ----------------------------------------------------
|
|
896 |
// CMceMainViewListItemArray::SetRoaming
|
|
897 |
// sets roaming flag
|
|
898 |
//
|
|
899 |
// ----------------------------------------------------
|
|
900 |
void CMceMainViewListItemArray::SetRoaming( TBool aRoaming )
|
|
901 |
{
|
|
902 |
iRoaming = aRoaming;
|
|
903 |
}
|
|
904 |
|
|
905 |
// ----------------------------------------------------
|
|
906 |
// CMceMainViewListItemArray::Roaming
|
|
907 |
// gets roaming flag
|
|
908 |
//
|
|
909 |
// ----------------------------------------------------
|
|
910 |
TBool CMceMainViewListItemArray::Roaming() const
|
|
911 |
{
|
|
912 |
return iRoaming;
|
|
913 |
}
|
|
914 |
|
|
915 |
// ----------------------------------------------------
|
|
916 |
// CMceMainViewListItemArray::SetAlwaysOnline
|
|
917 |
// sets always online flag
|
|
918 |
//
|
|
919 |
// ----------------------------------------------------
|
|
920 |
void CMceMainViewListItemArray::SetAlwaysOnline( TBool aAlwaysOnline )
|
|
921 |
{
|
|
922 |
iAlwaysOnline = aAlwaysOnline;
|
|
923 |
}
|
|
924 |
|
|
925 |
// ----------------------------------------------------
|
|
926 |
// CMceMainViewListItemArray::GetEmailApi
|
|
927 |
// Returns the reference to the email API
|
|
928 |
// ----------------------------------------------------
|
|
929 |
CImumInternalApi* CMceMainViewListItemArray::GetEmailApi()
|
|
930 |
{
|
|
931 |
return iEmailApi;
|
|
932 |
}
|
|
933 |
|
|
934 |
// ----------------------------------------------------
|
|
935 |
// CMceMainViewListItemArray::
|
|
936 |
// ----------------------------------------------------
|
|
937 |
void CMceMainViewListItemArray::AppendMessageCountString( TDes& aBuffer, TInt aMessageCount ) const
|
|
938 |
{
|
|
939 |
aBuffer.Append( KColumnListSeparator );
|
|
940 |
if ( aMessageCount == 0)
|
|
941 |
{
|
|
942 |
aBuffer.Append( (*iNumberOfMessagesStrings)[
|
|
943 |
KMceListArrayDocNoMessages] );
|
|
944 |
}
|
|
945 |
else if ( aMessageCount == 1 )
|
|
946 |
{
|
|
947 |
TBuf<KMcePrintableTextLength> tempString;
|
|
948 |
tempString.Append((*iNumberOfMessagesStrings)[
|
|
949 |
KMceListArrayNumberOneMessage] );
|
|
950 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
951 |
aBuffer.Append( tempString );
|
|
952 |
}
|
|
953 |
else
|
|
954 |
{
|
|
955 |
TBuf<KMcePrintableTextLength> tempString;
|
|
956 |
StringLoader::Format( tempString,
|
|
957 |
(*iNumberOfMessagesStrings)[KMceListArrayNumberOfMsgs],
|
|
958 |
-1, // no index in the key string
|
|
959 |
aMessageCount );
|
|
960 |
AknTextUtils::LanguageSpecificNumberConversion( tempString );
|
|
961 |
aBuffer.Append( tempString );
|
|
962 |
}
|
|
963 |
}
|
|
964 |
|
|
965 |
|
|
966 |
// ----------------------------------------------------
|
|
967 |
// CMceMainViewListItemArray::GetHealthyMailboxListResult( TInt& aCount )
|
|
968 |
// ----------------------------------------------------
|
|
969 |
TInt CMceMainViewListItemArray::GetHealthyMailboxListResult( TInt& aCount )
|
|
970 |
{
|
|
971 |
aCount = iMaiboxArrayCount;
|
|
972 |
return iErrGetHealthyMailBoxList;
|
|
973 |
}
|
|
974 |
|
|
975 |
// ----------------------------------------------------
|
|
976 |
// CMceMainViewListItemArray::
|
|
977 |
// ----------------------------------------------------
|
|
978 |
void CMceMainViewListItemArray::StartListUpdateL()
|
|
979 |
{
|
|
980 |
const TInt count = Count();
|
|
981 |
TInt i = 0;
|
|
982 |
for ( i = 0; i < count; i++ )
|
|
983 |
{
|
|
984 |
At( i ).iIconIndex = KErrNotFound;
|
|
985 |
}
|
|
986 |
iIdleCounter = 0; // update only item which icon index is not valid
|
|
987 |
if ( iIdleLoader )
|
|
988 |
{
|
|
989 |
iIdleLoader->StartL();
|
|
990 |
}
|
|
991 |
}
|
|
992 |
|
|
993 |
// ----------------------------------------------------
|
|
994 |
// CMceMainViewListItemArray::
|
|
995 |
// ----------------------------------------------------
|
|
996 |
void CMceMainViewListItemArray::ResetIconIndexL( TInt aIndex )
|
|
997 |
{
|
|
998 |
iIdleCounter = 0;
|
|
999 |
At( aIndex ).iIconIndex = KErrNotFound;
|
|
1000 |
if ( iIdleLoader )
|
|
1001 |
{
|
|
1002 |
iIdleLoader->StartL();
|
|
1003 |
}
|
|
1004 |
}
|
|
1005 |
|
|
1006 |
// ----------------------------------------------------
|
|
1007 |
// CMceMainViewListItemArray::
|
|
1008 |
// ----------------------------------------------------
|
|
1009 |
TBool CMceMainViewListItemArray::MMceUtilsIdleClassStepL( )
|
|
1010 |
{
|
|
1011 |
const TInt count = Count();
|
|
1012 |
// iIdleCounter set to 0 in functions StartListUpdateL and ResetIconIndexL
|
|
1013 |
for ( ; iIdleCounter < count; iIdleCounter++ )
|
|
1014 |
{
|
|
1015 |
TMceListItem& item = At( iIdleCounter );
|
|
1016 |
if ( !item.iExtraItem && ( item.iIconIndex <= KErrNone || item.iIconIndex > iBitmapResolver.MtmIconIndex() ) )
|
|
1017 |
{
|
|
1018 |
TMsvEntry entry;
|
|
1019 |
TMsvId serviceId;
|
|
1020 |
if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone )
|
|
1021 |
{
|
|
1022 |
TInt messageCount = 0;
|
|
1023 |
TMsvId id = entry.Id();
|
|
1024 |
item.iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount );
|
|
1025 |
if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId )
|
|
1026 |
{
|
|
1027 |
item.iIconIndex = EMceBitmapIndexInbox;
|
|
1028 |
}
|
|
1029 |
item.iMessageCount = messageCount;
|
|
1030 |
// item.iUnreadMessageCount = unreadMessageCount;
|
|
1031 |
if ( iListItemArrayObserver )
|
|
1032 |
{
|
|
1033 |
iListItemArrayObserver->MceListItemArrayChangedL();
|
|
1034 |
}
|
|
1035 |
// iIdleCounter++;
|
|
1036 |
break;
|
|
1037 |
}
|
|
1038 |
}
|
|
1039 |
}
|
|
1040 |
return iIdleCounter < count;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
// ----------------------------------------------------
|
|
1044 |
// CMceMainViewListItemArray::
|
|
1045 |
// ----------------------------------------------------
|
|
1046 |
void CMceMainViewListItemArray::SetListItemArrayObserver( MMceMainViewListItemArrayObserver* aObserver )
|
|
1047 |
{
|
|
1048 |
iListItemArrayObserver = aObserver;
|
|
1049 |
}
|
|
1050 |
|
|
1051 |
// ----------------------------------------------------
|
|
1052 |
// CMceMainViewListView::ReadExtraItemsResourceL
|
|
1053 |
// ----------------------------------------------------
|
|
1054 |
void CMceMainViewListItemArray::ReadExtraItemsResourceL()
|
|
1055 |
{
|
|
1056 |
if ( !iExtraItemsArray )
|
|
1057 |
{
|
|
1058 |
iExtraItemsArray = new( ELeave ) CMceMainViewExtraItemArray( KMceListGranuality );
|
|
1059 |
}
|
|
1060 |
else
|
|
1061 |
{
|
|
1062 |
iExtraItemsArray->Reset();
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
_LIT(KDirAndMceExtraItemsResFileName,"mceextraitems.rsc");
|
|
1066 |
TFileName fileName;
|
|
1067 |
fileName.Insert( 0,KDC_APP_RESOURCE_DIR );
|
|
1068 |
fileName.Append( KDirAndMceExtraItemsResFileName );
|
|
1069 |
TFindFile finder( iCoeEnv->FsSession() );
|
|
1070 |
//Search Y->A then Z:
|
|
1071 |
BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(),fileName);
|
|
1072 |
TInt err = finder.FindByDir(fileName , KDC_APP_RESOURCE_DIR );
|
|
1073 |
if(err == KErrNone)
|
|
1074 |
{
|
|
1075 |
RConeResourceLoader resources( *iCoeEnv );
|
|
1076 |
|
|
1077 |
TInt err = KErrNone;
|
|
1078 |
TRAP( err, resources.OpenL(fileName) );
|
|
1079 |
|
|
1080 |
if ( err == KErrNone )
|
|
1081 |
{
|
|
1082 |
TResourceReader reader;
|
|
1083 |
iEikonEnv->CreateResourceReaderLC( reader, R_MCE_EXTRA_ITEMS );
|
|
1084 |
|
|
1085 |
const TInt count = reader.ReadInt16();
|
|
1086 |
TMceMainViewExtraItem extraItem;
|
|
1087 |
extraItem.iCommandId = KMceFirstExtraItemId;
|
|
1088 |
for ( TInt loop = 0; loop < count; loop++ )
|
|
1089 |
{
|
|
1090 |
HBufC* txt = reader.ReadHBufCL(); // message text
|
|
1091 |
extraItem.iPrintableText.Copy( *txt );
|
|
1092 |
delete txt;
|
|
1093 |
txt = NULL;
|
|
1094 |
txt = reader.ReadHBufCL(); // message text
|
|
1095 |
extraItem.iCommandText.Copy( *txt );
|
|
1096 |
delete txt;
|
|
1097 |
|
|
1098 |
TInt depricatedResource = reader.ReadInt16(); // this is not used anymore, but left in resource so no DC break.
|
|
1099 |
extraItem.iIconIndex = reader.ReadInt16();
|
|
1100 |
TUid applicationUid;
|
|
1101 |
applicationUid.iUid = reader.ReadUint32();
|
|
1102 |
extraItem.iApplicationUid = applicationUid.iUid;
|
|
1103 |
// secondary text
|
|
1104 |
txt = reader.ReadHBufCL(); //secondary text
|
|
1105 |
if(txt)
|
|
1106 |
{
|
|
1107 |
extraItem.iSecondaryText.Copy( *txt );
|
|
1108 |
delete txt;
|
|
1109 |
txt = NULL;
|
|
1110 |
}
|
|
1111 |
else
|
|
1112 |
{
|
|
1113 |
extraItem.iSecondaryText.Copy(KNullDesC());
|
|
1114 |
}
|
|
1115 |
iExtraItemsArray->AppendL( extraItem );
|
|
1116 |
extraItem.iCommandId++;
|
|
1117 |
}
|
|
1118 |
CleanupStack::PopAndDestroy(); // reader
|
|
1119 |
resources.Close();
|
|
1120 |
}
|
|
1121 |
}
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
|
|
1125 |
// ----------------------------------------------------
|
|
1126 |
// CMceMainViewListView::ExtraItemCommandLC
|
|
1127 |
// ----------------------------------------------------
|
|
1128 |
HBufC* CMceMainViewListItemArray::ExtraItemCommandLC( TInt aCommandId )
|
|
1129 |
{
|
|
1130 |
HBufC* commandText = HBufC::NewLC( KMcePrintableTextLength );
|
|
1131 |
TPtr tempText = commandText->Des();
|
|
1132 |
|
|
1133 |
const TInt count = iExtraItemsArray->Count();
|
|
1134 |
for (TInt i=0; i<count; i++ )
|
|
1135 |
{
|
|
1136 |
if ( aCommandId == (*iExtraItemsArray)[i].iCommandId )
|
|
1137 |
{
|
|
1138 |
tempText.Copy( (*iExtraItemsArray)[i].iCommandText );
|
|
1139 |
i=count;
|
|
1140 |
}
|
|
1141 |
}
|
|
1142 |
|
|
1143 |
return commandText;
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
// ----------------------------------------------------
|
|
1147 |
// CMceMainViewListView::AddExtraItemCommandL
|
|
1148 |
// ----------------------------------------------------
|
|
1149 |
void CMceMainViewListItemArray::AddExtraItemCommandL( TInt aIndex )
|
|
1150 |
{
|
|
1151 |
if ( aIndex < iExtraItemsArray->Count() )
|
|
1152 |
{
|
|
1153 |
const TMceMainViewExtraItem& extraItem = (*iExtraItemsArray)[aIndex];
|
|
1154 |
TMceListItem tempItem;
|
|
1155 |
tempItem.iExtraItem = ETrue;
|
|
1156 |
tempItem.iMsvId = extraItem.iCommandId;
|
|
1157 |
tempItem.iPrintableText.Copy( extraItem.iPrintableText );
|
|
1158 |
tempItem.iSecondaryText.Copy(extraItem.iSecondaryText);
|
|
1159 |
tempItem.iApplicationUid = extraItem.iApplicationUid;
|
|
1160 |
TUid appUid;
|
|
1161 |
appUid.iUid = extraItem.iApplicationUid;
|
|
1162 |
AddExtraItemWithIconL( tempItem, Count(), extraItem.iIconIndex, appUid );
|
|
1163 |
}
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// ----------------------------------------------------
|
|
1167 |
// CMceMainViewListView::ReadMainViewItemsFromRepositoryL
|
|
1168 |
// ----------------------------------------------------
|
|
1169 |
void CMceMainViewListItemArray::ReadMainViewItemsFromRepositoryL()
|
|
1170 |
{
|
|
1171 |
if ( !iMainViewItems )
|
|
1172 |
{
|
|
1173 |
iMainViewItems = new( ELeave ) CMsvEntrySelection();
|
|
1174 |
}
|
|
1175 |
else
|
|
1176 |
{
|
|
1177 |
iMainViewItems->Reset();
|
|
1178 |
}
|
|
1179 |
CRepository* repository = CRepository::NewLC(KCRUidMuiuSettings);
|
|
1180 |
for ( TInt i = KMuiuMceMainViewRow1; i<=KMuiuMceMainViewRow16; i++ )
|
|
1181 |
{
|
|
1182 |
TInt value = 0;
|
|
1183 |
if ( repository->Get( i, value ) == KErrNone && value > KErrNotFound )
|
|
1184 |
{
|
|
1185 |
iMainViewItems->AppendL( value );
|
|
1186 |
}
|
|
1187 |
}
|
|
1188 |
CleanupStack::PopAndDestroy( repository );
|
|
1189 |
}
|
|
1190 |
|
|
1191 |
// ----------------------------------------------------
|
|
1192 |
// CMceMainViewListItemArray::CreateConversationsListItem()
|
|
1193 |
// ----------------------------------------------------
|
|
1194 |
TPtrC CMceMainViewListItemArray::CreateConversationsListItem( TInt aIndex ) const
|
|
1195 |
{
|
|
1196 |
const TMceListItem& item = At( aIndex );
|
|
1197 |
//if item iText is not cached then cache it first
|
|
1198 |
if((item.iText.Length()==0)||(!iListItemArrayObserver->MceListItemArrayFlickEvent()))
|
|
1199 |
{
|
|
1200 |
TPtr tempText = iListBoxText->Des();
|
|
1201 |
tempText.Zero();
|
|
1202 |
TInt bitmapidx = EMceBitmapIndexConversation;
|
|
1203 |
if(iDefaultViewSettings == KMceConversationview )
|
|
1204 |
{
|
|
1205 |
TInt unreadMessages = 0;
|
|
1206 |
//To check whether unread message presents in inbox
|
|
1207 |
TRAPD( err, iBitmapResolver.FindVisibleCountWithUnreadMessageL( KMsvGlobalInBoxIndexEntryId, unreadMessages ));
|
|
1208 |
if ( err == KErrNone && unreadMessages )
|
|
1209 |
{
|
|
1210 |
bitmapidx = EMceBitmapIndexConversationNew ;
|
|
1211 |
}
|
|
1212 |
}
|
|
1213 |
tempText.AppendNum(bitmapidx);
|
|
1214 |
TPtrC Ptr(item.iPrintableText);
|
|
1215 |
TInt pos = Ptr.Locate(KColumnListSeparator);
|
|
1216 |
TPtrC Ptr1(Ptr.Mid(pos));
|
|
1217 |
tempText.Append(Ptr1);
|
|
1218 |
CONST_CAST( TMceListItem*, &item)->iText.Zero();
|
|
1219 |
CONST_CAST( TMceListItem*, &item)->iText.Copy(tempText);
|
|
1220 |
return tempText;
|
|
1221 |
}
|
|
1222 |
else
|
|
1223 |
{
|
|
1224 |
return item.iText;
|
|
1225 |
}
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
// ----------------------------------------------------
|
|
1229 |
// CMceMainViewListItemArray::SetDefaultViewSettings()
|
|
1230 |
// ----------------------------------------------------
|
|
1231 |
void CMceMainViewListItemArray::SetDefaultViewSettings(TBool aVal)
|
|
1232 |
{
|
|
1233 |
iDefaultViewSettings = aVal;
|
|
1234 |
Reset();
|
|
1235 |
TRAP_IGNORE(AddFoldersL());
|
|
1236 |
}
|
|
1237 |
// End of File
|