|
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 * Handles different mce bitmaps. |
|
16 * First collects all the bitmaps from different mtm's and also local |
|
17 * folder's bitmaps to icon array. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <mtudcbas.h> // cbasemtmuidata |
|
25 #include "MtmRegistryObserver.h" // mmtmuidataregistryobserver |
|
26 #include <msvuids.h> |
|
27 #include <msvids.h> // fixed entry ids |
|
28 #include <gulicon.h> // CGulIcon |
|
29 #include <AknIconArray.h> // cakniconarray |
|
30 #include <fbs.h> // CFbsFont |
|
31 #include <muiu.mbg> // bitmap enums |
|
32 #include <avkon.mbg> // bitmap enums |
|
33 #include <mtud.hrh> // EMtudEntryStateOpen |
|
34 #include <SenduiMtmUids.h> // mtm uids |
|
35 #include "MceUtils.h" |
|
36 #include "MceListItem.h" |
|
37 #include "MceBitmapResolver.h" |
|
38 #include "MceIds.h" //kmcedocumentsentryid |
|
39 |
|
40 // security data caging |
|
41 #include <data_caging_path_literals.hrh> |
|
42 #include <bldvariant.hrh> |
|
43 #include <AknIconUtils.h> |
|
44 |
|
45 |
|
46 // LOCAL CONSTANTS AND MACROS |
|
47 |
|
48 _LIT( KMceDirAndFileMuiu,"muiu.mbm" ); |
|
49 |
|
50 const TInt KMceIconArrayGranularity = 10; |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ======================= |
|
53 |
|
54 CMceBitmapResolver* CMceBitmapResolver::NewL( |
|
55 CMsvSessionPtr aSession, |
|
56 MMtmUiDataRegistryObserver& aRegObserver, |
|
57 TBool aLargeIcons ) |
|
58 { // static |
|
59 CMceBitmapResolver* self=new(ELeave) CMceBitmapResolver( |
|
60 aSession, aRegObserver, aLargeIcons ); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 CMceBitmapResolver::CMceBitmapResolver( |
|
68 CMsvSessionPtr aSession, |
|
69 MMtmUiDataRegistryObserver& aRegObserver, |
|
70 TBool aLargeIcons) : |
|
71 iRegObserver(aRegObserver), |
|
72 iSession( aSession), |
|
73 iLargeIcons( aLargeIcons ), |
|
74 iBitmapsLoaded( 0 ), |
|
75 iDescriptionLength( KMceVisibleTextLength ) |
|
76 { |
|
77 } |
|
78 |
|
79 CMceBitmapResolver::~CMceBitmapResolver() |
|
80 { |
|
81 if ( iIcons ) |
|
82 { |
|
83 iIcons->ResetAndDestroy(); |
|
84 } |
|
85 delete iIcons; |
|
86 delete iIconIndexes; |
|
87 // iSession deleted by Ui class. |
|
88 } |
|
89 |
|
90 |
|
91 // ---------------------------------------------------- |
|
92 // CMceBitmapResolver::ConstructL |
|
93 // ---------------------------------------------------- |
|
94 void CMceBitmapResolver::ConstructL() |
|
95 { |
|
96 // security data caging |
|
97 TParse fp; |
|
98 fp.Set( AknIconUtils::AvkonIconFileName(), &KDC_RESOURCE_FILES_DIR , NULL ); |
|
99 iFilenameAvkon = fp.FullName(); |
|
100 |
|
101 fp.Set( KMceDirAndFileMuiu, &KDC_APP_BITMAP_DIR , NULL ); |
|
102 iFilenameMuiu = fp.FullName(); |
|
103 |
|
104 iIcons = new(ELeave) CAknIconArray( KMceIconArrayGranularity ); |
|
105 iIconIndexes = new(ELeave) CArrayFixFlat<TMceBitmapListItem>( |
|
106 KMceIconArrayGranularity ); |
|
107 |
|
108 TMceBitmapListItem listItem; |
|
109 listItem.iExtraItem = EFalse; |
|
110 listItem.iMtm.iUid = KUidMsvLocalServiceMtmValue; |
|
111 listItem.iType.iUid = KUidMsvFolderEntryValue; |
|
112 |
|
113 listItem.iId = KErrNone; |
|
114 listItem.iExtraItem = ETrue; |
|
115 |
|
116 CreateAndAppendIconL( KAknsIIDQgnIndiMarkedAdd, iFilenameAvkon, EMbmAvkonQgn_indi_marked_add, &listItem ); |
|
117 |
|
118 CreateAndAppendIconL( KAknsIIDQgnPropMceWriteSub, EMbmMuiuQgn_prop_mce_write_sub, &listItem ); |
|
119 CreateAndAppendIconL( KAknsIIDQgnPropMceRemoteSub, EMbmMuiuQgn_prop_mce_remote_sub, &listItem ); |
|
120 CreateAndAppendIconL( KAknsIIDQgnPropMceRemoteNewSub, EMbmMuiuQgn_prop_mce_remote_new_sub, &listItem ); |
|
121 CreateAndAppendIconL( KAknsIIDQgnPropMceDrSub, EMbmMuiuQgn_prop_mce_dr_sub, &listItem ); |
|
122 |
|
123 listItem.iExtraItem = EFalse; |
|
124 listItem.iId = KMsvGlobalInBoxIndexEntryId; |
|
125 CreateAndAppendIconL( KAknsIIDQgnPropMceInboxSub, EMbmMuiuQgn_prop_mce_inbox_sub, &listItem ); |
|
126 CreateAndAppendIconL( KAknsIIDQgnPropMceInboxNewSub, EMbmMuiuQgn_prop_mce_inbox_new_sub, &listItem ); |
|
127 |
|
128 listItem.iId = KMceDocumentsEntryId; |
|
129 CreateAndAppendIconL( KAknsIIDQgnPropMceDocumentsSub, EMbmMuiuQgn_prop_mce_documents_sub, &listItem ); |
|
130 CreateAndAppendIconL( KAknsIIDQgnPropMceDocumentsNewSub, EMbmMuiuQgn_prop_mce_documents_new_sub, &listItem ); |
|
131 |
|
132 listItem.iId = KMsvDraftEntryId; |
|
133 CreateAndAppendIconL( KAknsIIDQgnPropMceDraftsSub, EMbmMuiuQgn_prop_mce_drafts_sub, &listItem ); |
|
134 listItem.iId = KMsvSentEntryId; |
|
135 CreateAndAppendIconL( KAknsIIDQgnPropMceSentSub, EMbmMuiuQgn_prop_mce_sent_sub, &listItem ); |
|
136 listItem.iId = KMsvGlobalOutBoxIndexEntryId; |
|
137 CreateAndAppendIconL( KAknsIIDQgnPropMceOutboxSub, EMbmMuiuQgn_prop_mce_outbox_sub, &listItem ); |
|
138 |
|
139 listItem.iId = KErrNone; |
|
140 CreateAndAppendIconL( KAknsIIDQgnPropMceUnknownRead, EMbmMuiuQgn_prop_mce_unknown_read, &listItem ); |
|
141 |
|
142 CreateAndAppendIconL( KAknsIIDQgnPropMceTemplate, iFilenameAvkon, EMbmAvkonQgn_prop_folder_temp, &listItem ); |
|
143 CreateAndAppendIconL( KAknsIIDQgnPropFolderSmall, iFilenameAvkon, EMbmAvkonQgn_prop_folder_small, &listItem ); |
|
144 CreateAndAppendIconL( KAknsIIDQgnPropFolderSmallNew, iFilenameAvkon, EMbmAvkonQgn_prop_folder_small_new, &listItem ); |
|
145 CreateAndAppendIconL( KAknsIIDQgnIndiAttachementAdd, iFilenameMuiu, EMbmMuiuQgn_indi_attach_add, &listItem, ETrue ); |
|
146 CreateAndAppendIconL( KAknsIIDQgnIndiConnectionOnAdd, iFilenameMuiu, EMbmMuiuQgn_indi_connection_on_add, &listItem, ETrue ); |
|
147 |
|
148 CreateAndAppendIconL( KAknsIIDQgnIndiConnectionAlwaysAdd, iFilenameMuiu, EMbmMuiuQgn_indi_connection_always_add, &listItem, ETrue ); |
|
149 CreateAndAppendIconL( KAknsIIDQgnIndiConnectionInactiveAdd, iFilenameMuiu, EMbmMuiuQgn_indi_connection_inactive_add, &listItem, ETrue ); |
|
150 CreateAndAppendIconL( KAknsIIDQgnIndiConnectionInactiveAdd, iFilenameMuiu, EMbmMuiuQgn_indi_connection_on_roam_add, &listItem, ETrue ); |
|
151 CreateAndAppendIconL( KAknsIIDQgnIndiMcePriorityHigh, iFilenameAvkon, EMbmAvkonQgn_indi_mce_priority_high, &listItem ); |
|
152 CreateAndAppendIconL( KAknsIIDQgnIndiMcePriorityLow, iFilenameAvkon, EMbmAvkonQgn_indi_mce_priority_low, &listItem ); |
|
153 |
|
154 |
|
155 // add one dummy item which will be replaced when querying message items icons |
|
156 CreateAndAppendIconL( KAknsIIDQgnPropMceUnknownRead, EMbmMuiuQgn_prop_mce_unknown_read ); |
|
157 |
|
158 iDescriptionLength = MceUtils::DescriptionLengthL(); |
|
159 } |
|
160 |
|
161 // ---------------------------------------------------- |
|
162 // CMceBitmapResolver::CreateAndAppendIconL |
|
163 // ---------------------------------------------------- |
|
164 void CMceBitmapResolver::CreateAndAppendIconL( TAknsItemID aId, TInt aBitmapIndex, const TMceBitmapListItem* aListItem /* = NULL */ ) |
|
165 { |
|
166 CreateAndAppendIconL( aId, iFilenameMuiu, aBitmapIndex, aListItem ); |
|
167 } |
|
168 |
|
169 // ---------------------------------------------------- |
|
170 // CMceBitmapResolver::CreateAndAppendIconL |
|
171 // ---------------------------------------------------- |
|
172 void CMceBitmapResolver::CreateAndAppendIconL( |
|
173 TAknsItemID aId, |
|
174 const TDesC& aFileName, |
|
175 TInt aBitmapIndex, |
|
176 const TMceBitmapListItem* aListItem /* = NULL */, |
|
177 TBool aColorSkinnedIcon /*= EFalse */ ) |
|
178 { |
|
179 MAknsSkinInstance* skins = AknsUtils::SkinInstance(); |
|
180 |
|
181 CFbsBitmap* bitmap = NULL; |
|
182 CFbsBitmap* mask = NULL; |
|
183 |
|
184 if ( aListItem && |
|
185 aListItem->iExtraItem && |
|
186 aListItem->iType.iUid > 0 && |
|
187 aListItem->iType.iUid != KUidMsvFolderEntryValue |
|
188 ) |
|
189 { |
|
190 // this is extra item and it has application uid, try to load it! |
|
191 TUid uid = aListItem->iType; |
|
192 AknsUtils::CreateAppIconLC( |
|
193 skins, |
|
194 uid, |
|
195 EAknsAppIconTypeList, |
|
196 bitmap, |
|
197 mask ); |
|
198 CleanupStack::Pop(2); |
|
199 } |
|
200 |
|
201 if ( !bitmap ) |
|
202 { |
|
203 if ( aColorSkinnedIcon ) |
|
204 { |
|
205 TRgb rgb; // What to add here? |
|
206 |
|
207 AknsUtils::CreateColorIconL( |
|
208 skins, |
|
209 aId, |
|
210 KAknsIIDQsnIconColors, |
|
211 EAknsCIQsnIconColorsCG13, |
|
212 bitmap, |
|
213 mask, |
|
214 aFileName, |
|
215 aBitmapIndex, |
|
216 aBitmapIndex + 1, |
|
217 rgb ); |
|
218 } |
|
219 else |
|
220 { |
|
221 AknsUtils::CreateIconL( skins, aId, bitmap, |
|
222 mask, aFileName, aBitmapIndex, aBitmapIndex + 1 ); |
|
223 } |
|
224 } |
|
225 |
|
226 CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); |
|
227 |
|
228 CleanupStack::PushL( icon ); |
|
229 if ( aListItem && aListItem->iExtraItem && aListItem->iId >= KMceFirstExtraItemId ) |
|
230 { |
|
231 iIcons->InsertL( iIconIndexes->Count(), icon ); |
|
232 } |
|
233 else |
|
234 { |
|
235 iIcons->AppendL( icon ); |
|
236 } |
|
237 CleanupStack::Pop( icon ); |
|
238 |
|
239 if ( aListItem ) |
|
240 { |
|
241 iIconIndexes->AppendL( *aListItem ); |
|
242 } |
|
243 iBitmapsLoaded = iIconIndexes->Count(); |
|
244 } |
|
245 |
|
246 |
|
247 // ---------------------------------------------------- |
|
248 // CMceBitmapResolver::IconArray |
|
249 // ---------------------------------------------------- |
|
250 CArrayPtrFlat<CGulIcon>* CMceBitmapResolver::IconArray() |
|
251 { |
|
252 return iIcons; |
|
253 } |
|
254 |
|
255 // ---------------------------------------------------- |
|
256 // CMceBitmapResolver::BitmapIndex |
|
257 // ---------------------------------------------------- |
|
258 TInt CMceBitmapResolver::BitmapIndex( const TMceBitmapListItem& aItem ) const |
|
259 { |
|
260 TInt foundIndex = KErrNotFound; |
|
261 if ( aItem.iExtraItem ) |
|
262 { |
|
263 if ( aItem.iId == KMceWriteMessageId ) |
|
264 { |
|
265 foundIndex = EMceBitmapIndexWrite; |
|
266 } |
|
267 else if ( aItem.iId == KMceDeliveryReportsId ) |
|
268 { |
|
269 foundIndex = EMceBitmapIndexDr; |
|
270 } |
|
271 else if ( aItem.iId == KMceNoMailboxesListId ) |
|
272 { |
|
273 foundIndex = EMceBitmapIndexRemote; |
|
274 } |
|
275 else |
|
276 { |
|
277 const TInt count = iIconIndexes->Count(); |
|
278 for ( TInt i = 0; i < count; i++) |
|
279 { |
|
280 const TMceBitmapListItem item = (*iIconIndexes)[i]; |
|
281 if ( (*iIconIndexes)[i].iId == aItem.iId ) |
|
282 { |
|
283 foundIndex = i; |
|
284 } |
|
285 } |
|
286 if ( foundIndex == KErrNotFound ) |
|
287 { |
|
288 foundIndex = EMceBitmapIndexUnknown; |
|
289 } |
|
290 } |
|
291 } |
|
292 if ( foundIndex == KErrNotFound && |
|
293 aItem.iMtm.iUid == KUidMsvLocalServiceMtmValue && |
|
294 aItem.iType.iUid == KUidMsvFolderEntryValue ) |
|
295 { |
|
296 foundIndex = LocalEntryBitmapIndex( aItem.iId ); |
|
297 } |
|
298 |
|
299 if ( foundIndex == KErrNotFound && |
|
300 aItem.iType.iUid == KUidMsvServiceEntryValue ) |
|
301 { |
|
302 // item is service entry (remote mailbox usually) so this |
|
303 // icon is loaded from mtm uid data when needed and |
|
304 // its index is last in icon array |
|
305 foundIndex = iIcons->Count()-1; |
|
306 } |
|
307 |
|
308 return ( foundIndex == KErrNotFound ? |
|
309 EMceBitmapIndexUnknown : |
|
310 foundIndex ); |
|
311 } |
|
312 |
|
313 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
314 // ---------------------------------------------------- |
|
315 // CMceBitmapResolver::BitmapIndex |
|
316 // ---------------------------------------------------- |
|
317 TInt CMceBitmapResolver::BitmapIndex( const TMsvEntry& aEntry ) |
|
318 { |
|
319 TInt foundIndex = KErrNotFound; |
|
320 const TMsvId id = aEntry.Id(); |
|
321 if ( aEntry.iMtm == KUidMsvLocalServiceMtm && |
|
322 aEntry.iType == KUidMsvFolderEntry ) |
|
323 { |
|
324 foundIndex = LocalEntryBitmapIndex( id ); |
|
325 |
|
326 // check if folder has unread messages |
|
327 if ( id == KMsvGlobalInBoxIndexEntryId || |
|
328 id == KMceDocumentsEntryId || |
|
329 id >= KFirstFreeEntryId |
|
330 ) |
|
331 { |
|
332 TBool unreadMessages = EFalse; |
|
333 TRAPD(err, ( unreadMessages = HasUnreadMessagesL( id ) ) ); |
|
334 if (err == KErrNone && unreadMessages ) |
|
335 { |
|
336 foundIndex++; |
|
337 } |
|
338 } |
|
339 } |
|
340 |
|
341 // special handling for remote mailboxes to make main view appear faster in startup |
|
342 if ( aEntry.iType == KUidMsvServiceEntry && |
|
343 ( aEntry.iMtm == KSenduiMtmImap4Uid || |
|
344 aEntry.iMtm == KSenduiMtmPop3Uid ) |
|
345 ) |
|
346 { |
|
347 foundIndex = EMceBitmapIndexRemote; |
|
348 TBool unreadMessages = EFalse; |
|
349 TRAPD(err, ( unreadMessages = HasUnreadMessagesL( id ) ) ); |
|
350 if (err == KErrNone && unreadMessages ) |
|
351 { |
|
352 foundIndex++; |
|
353 } |
|
354 } |
|
355 |
|
356 if ( foundIndex == KErrNotFound ) |
|
357 { |
|
358 TRAPD(err, ( foundIndex = LoadBitmapL( aEntry ) ) ); |
|
359 if (err != KErrNone ) |
|
360 { |
|
361 foundIndex = KErrNotFound; |
|
362 } |
|
363 } |
|
364 |
|
365 return ( foundIndex == KErrNotFound ? |
|
366 EMceBitmapIndexUnknown : foundIndex ); |
|
367 } |
|
368 |
|
369 #else |
|
370 // ---------------------------------------------------- |
|
371 // CMceBitmapResolver::BitmapIndex |
|
372 // ---------------------------------------------------- |
|
373 TInt CMceBitmapResolver::BitmapIndex( const TMsvEntry& aEntry ) |
|
374 { |
|
375 TInt messageCount = 0; |
|
376 return BitmapIndex( aEntry, messageCount ); |
|
377 } |
|
378 // ---------------------------------------------------- |
|
379 // CMceBitmapResolver::BitmapIndex |
|
380 // ---------------------------------------------------- |
|
381 TInt CMceBitmapResolver::BitmapIndex( const TMsvEntry& aEntry, TInt& aMessageCount ) |
|
382 { |
|
383 TInt foundIndex = KErrNotFound; |
|
384 aMessageCount = 0; |
|
385 TInt unreadCount = 0; |
|
386 TBool unreadMessages = EFalse; |
|
387 const TMsvId id = aEntry.Id(); |
|
388 if ( aEntry.iMtm == KUidMsvLocalServiceMtm && |
|
389 aEntry.iType == KUidMsvFolderEntry ) |
|
390 { |
|
391 foundIndex = LocalEntryBitmapIndex( id ); |
|
392 |
|
393 // check if folder has unread messages |
|
394 if ( id == KMsvGlobalInBoxIndexEntryId || |
|
395 id == KMceDocumentsEntryId || |
|
396 id == KMsvDraftEntryIdValue || |
|
397 id == KMsvSentEntryIdValue || |
|
398 id == KMsvGlobalOutBoxIndexEntryIdValue || |
|
399 id >= KFirstFreeEntryId |
|
400 ) |
|
401 { |
|
402 TRAPD(err, ( unreadMessages = HasUnreadMessagesL( id, aMessageCount, unreadCount ) ) ); |
|
403 if (err == KErrNone && unreadMessages ) |
|
404 { |
|
405 foundIndex++; |
|
406 } |
|
407 } |
|
408 } |
|
409 |
|
410 // special handling for remote mailboxes to make main view appear faster in startup |
|
411 if ( aEntry.iType == KUidMsvServiceEntry && |
|
412 ( aEntry.iMtm == KSenduiMtmImap4Uid || |
|
413 aEntry.iMtm == KSenduiMtmPop3Uid ) |
|
414 ) |
|
415 { |
|
416 foundIndex = EMceBitmapIndexRemote; |
|
417 TRAPD(err, ( unreadMessages = HasUnreadMessagesL( id, aMessageCount, unreadCount ) ) ); |
|
418 if (err == KErrNone && unreadMessages ) |
|
419 { |
|
420 foundIndex++; |
|
421 } |
|
422 } |
|
423 |
|
424 if ( foundIndex == KErrNotFound ) |
|
425 { |
|
426 TInt err = KErrNone; |
|
427 if ( aEntry.iType == KUidMsvServiceEntry || |
|
428 aEntry.iType == KUidMsvFolderEntry) |
|
429 { |
|
430 TRAP(err, ( unreadMessages = HasUnreadMessagesL( id, aMessageCount, unreadCount ) ) ); |
|
431 } |
|
432 TRAP(err, ( foundIndex = LoadBitmapL( aEntry, unreadCount ) ) ); |
|
433 if (err != KErrNone ) |
|
434 { |
|
435 foundIndex = KErrNotFound; |
|
436 } |
|
437 } |
|
438 |
|
439 return ( foundIndex == KErrNotFound ? |
|
440 EMceBitmapIndexUnknown : foundIndex ); |
|
441 } |
|
442 #endif // RD_MSG_NAVIPANE_IMPROVEMENT |
|
443 // ---------------------------------------------------- |
|
444 // CMceBitmapResolver::LoadBitmapL |
|
445 // ---------------------------------------------------- |
|
446 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
447 TInt CMceBitmapResolver::LoadBitmapL( const TMsvEntry& aEntry, TInt aPriority ) |
|
448 #else |
|
449 TInt CMceBitmapResolver::LoadBitmapL( const TMsvEntry& aEntry, TBool aHasUnreadMessages ) |
|
450 #endif |
|
451 { |
|
452 CBaseMtmUiData* uiData=iRegObserver.GetMtmUiDataL( aEntry.iMtm ); |
|
453 if ( uiData ) |
|
454 { |
|
455 TInt flags = 0; |
|
456 if ( aEntry.iType == KUidMsvServiceEntry || |
|
457 aEntry.iType == KUidMsvFolderEntry) |
|
458 { |
|
459 TBool unreadMessages = EFalse; |
|
460 TInt err = KErrNone; |
|
461 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
462 TRAP( err, ( unreadMessages = HasUnreadMessagesL( aEntry.Id() ) ) ); |
|
463 #else |
|
464 unreadMessages = aHasUnreadMessages; |
|
465 #endif // RD_MSG_NAVIPANE_IMPROVEMENT |
|
466 |
|
467 // leave error codes are filtered, because it is not important to know |
|
468 // if there are unread messages or not, |
|
469 // just different icon would be displayed |
|
470 if (err == KErrNone && unreadMessages ) |
|
471 { |
|
472 flags = EMtudEntryStateOpen; // includes unread messages |
|
473 } |
|
474 |
|
475 //check for sub folders |
|
476 |
|
477 TMsvSelectionOrdering selectionOrdering( KMsvGroupByType, EMsvSortByNone, ETrue ); |
|
478 CMsvEntry* entry = iSession->GetEntryL( aEntry.Id() ); |
|
479 entry->SetSortTypeL( selectionOrdering ); |
|
480 CleanupStack::PushL( entry ); |
|
481 TInt index = entry->Count()-1; |
|
482 while ( ( index>=0 ) && ( (*entry)[index].iType != KUidMsvFolderEntry ) ) |
|
483 { |
|
484 index--; |
|
485 } |
|
486 CleanupStack::PopAndDestroy( entry ); |
|
487 if( index != -1 ) |
|
488 { |
|
489 flags |= EMtudEntryStateSubFolder; |
|
490 } |
|
491 |
|
492 } |
|
493 |
|
494 const CBaseMtmUiData::CBitmapArray* bitmaps = NULL; |
|
495 |
|
496 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
497 if ( aPriority == KMceMmsPriority ) |
|
498 { |
|
499 bitmaps = &uiData->ContextIcon( aEntry, ETrue ); |
|
500 } |
|
501 else |
|
502 { |
|
503 bitmaps = &uiData->ContextIcon( aEntry, flags ); |
|
504 } |
|
505 #else |
|
506 bitmaps = &uiData->ContextIcon( aEntry, flags ); |
|
507 |
|
508 #endif |
|
509 |
|
510 if ( bitmaps ) |
|
511 { |
|
512 CGulIcon* tempBmp = NULL; |
|
513 |
|
514 if ( bitmaps->Count() == 1 ) |
|
515 { |
|
516 tempBmp = CGulIcon::NewL( bitmaps->At( 0 ) ); |
|
517 } |
|
518 else if ( bitmaps->Count() > 1 ) |
|
519 { |
|
520 tempBmp = CGulIcon::NewL( bitmaps->At( 0 ), bitmaps->At( 1 ) ); |
|
521 } |
|
522 |
|
523 if ( tempBmp ) |
|
524 { |
|
525 CleanupStack::PushL( tempBmp ); |
|
526 tempBmp->SetBitmapsOwnedExternally( ETrue ); |
|
527 |
|
528 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
529 if ( aPriority == KMceMmsPriority ) |
|
530 { |
|
531 iIcons->AppendL( tempBmp ); |
|
532 } |
|
533 else |
|
534 { |
|
535 TInt index = iIcons->Count() - 1; |
|
536 iIcons->AppendL( tempBmp ); // Array will be of count 22 |
|
537 // index greater than 20 so 21 or 22 |
|
538 if ( index > iBitmapsLoaded ) |
|
539 { |
|
540 while ( iIcons->Count() != iBitmapsLoaded+1 ) |
|
541 { |
|
542 CGulIcon* iconToBeDelete = iIcons->At( index ); |
|
543 iIcons->Delete( index ); |
|
544 delete iconToBeDelete; |
|
545 index--; |
|
546 } |
|
547 } |
|
548 else |
|
549 { |
|
550 CGulIcon* iconToBeDelete = iIcons->At( index ); |
|
551 iIcons->Delete( index ); |
|
552 delete iconToBeDelete; |
|
553 } |
|
554 } |
|
555 #else |
|
556 TInt index = iIcons->Count() - 1; |
|
557 iIcons->AppendL( tempBmp ); // Array will be of count 22 |
|
558 // index greater than 20 so 21 or 22 |
|
559 if ( index > iBitmapsLoaded ) |
|
560 { |
|
561 while ( iIcons->Count() != iBitmapsLoaded+1 ) |
|
562 { |
|
563 CGulIcon* iconToBeDelete = iIcons->At( index ); |
|
564 iIcons->Delete( index ); |
|
565 delete iconToBeDelete; |
|
566 index--; |
|
567 } |
|
568 } |
|
569 else |
|
570 { |
|
571 CGulIcon* iconToBeDelete = iIcons->At( index ); |
|
572 iIcons->Delete( index ); |
|
573 delete iconToBeDelete; |
|
574 } |
|
575 |
|
576 |
|
577 #endif |
|
578 CleanupStack::Pop(); // tempBmp |
|
579 } |
|
580 } |
|
581 else |
|
582 { |
|
583 return KErrNotFound; |
|
584 } |
|
585 } |
|
586 else |
|
587 { |
|
588 // something is wrong |
|
589 return EMceBitmapIndexUnknown; |
|
590 } |
|
591 return iIcons->Count() - 1; |
|
592 } |
|
593 |
|
594 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
595 // ---------------------------------------------------- |
|
596 // CMceBitmapResolver::HasUnreadMessagesL |
|
597 // ---------------------------------------------------- |
|
598 TBool CMceBitmapResolver::HasUnreadMessagesL( const TMsvId aId ) |
|
599 { |
|
600 TBool unreadMessages = EFalse; |
|
601 CMsvEntry* entry = iSession->GetEntryL( aId ); |
|
602 CleanupStack::PushL( entry ); |
|
603 |
|
604 const TInt count = entry->Count(); |
|
605 for ( TInt loop = 0; !unreadMessages && loop < count; loop++ ) |
|
606 { |
|
607 if ( (*entry)[loop].iType.iUid == KUidMsvFolderEntryValue ) |
|
608 { |
|
609 unreadMessages = HasUnreadMessagesL( (*entry)[loop].Id() ); |
|
610 } |
|
611 else |
|
612 { |
|
613 unreadMessages = (*entry)[loop].Unread(); |
|
614 } |
|
615 } |
|
616 |
|
617 CleanupStack::PopAndDestroy( entry ); |
|
618 |
|
619 return unreadMessages; |
|
620 } |
|
621 #else |
|
622 |
|
623 // ---------------------------------------------------- |
|
624 // CMceBitmapResolver::HasUnreadMessagesL |
|
625 // ---------------------------------------------------- |
|
626 TBool CMceBitmapResolver::HasUnreadMessagesL( |
|
627 const TMsvId aFolderId, TInt& aMessages, TInt& aUnreadMessages ) |
|
628 { |
|
629 CMsvEntry* entry = iSession->GetEntryL( aFolderId ); |
|
630 CleanupStack::PushL( entry ); |
|
631 |
|
632 const TInt count = entry->Count(); |
|
633 for ( TInt loop = 0; loop < count; loop++ ) |
|
634 { |
|
635 const TMsvEntry& tEntry = (*entry)[loop]; |
|
636 if ( tEntry.iType == KUidMsvFolderEntry ) |
|
637 { |
|
638 HasUnreadMessagesL( tEntry.Id(), aMessages, aUnreadMessages ); |
|
639 } |
|
640 else if ( tEntry.iType == KUidMsvMessageEntry ) |
|
641 { |
|
642 aMessages++; |
|
643 if ( tEntry.Unread() ) |
|
644 { |
|
645 aUnreadMessages++; |
|
646 } |
|
647 } |
|
648 } |
|
649 |
|
650 CleanupStack::PopAndDestroy(); // entry |
|
651 return aUnreadMessages; |
|
652 } |
|
653 |
|
654 #endif // RD_MSG_NAVIPANE_IMPROVEMENT |
|
655 |
|
656 // ---------------------------------------------------- |
|
657 // CMceBitmapResolver::LocalEntryBitmapIndex |
|
658 // ---------------------------------------------------- |
|
659 TInt CMceBitmapResolver::LocalEntryBitmapIndex( TMsvId aEntryId ) const |
|
660 { |
|
661 TInt foundIndex = EMceBitmapIndexFolderSmall; |
|
662 switch( aEntryId ) |
|
663 { |
|
664 case KMsvGlobalInBoxIndexEntryId: |
|
665 foundIndex = EMceBitmapIndexInbox; |
|
666 break; |
|
667 case KMsvGlobalOutBoxIndexEntryId: |
|
668 foundIndex = EMceBitmapIndexOutbox; |
|
669 break; |
|
670 case KMsvDraftEntryId: |
|
671 foundIndex = EMceBitmapIndexDrafts; |
|
672 break; |
|
673 case KMsvSentEntryId: |
|
674 foundIndex = EMceBitmapIndexSent; |
|
675 break; |
|
676 case KMceDocumentsEntryId: |
|
677 foundIndex = EMceBitmapIndexDocuments; |
|
678 break; |
|
679 case KMceTemplatesEntryId: |
|
680 foundIndex = EMceBitmapIndexFolderTemp; |
|
681 break; |
|
682 default: |
|
683 // set in foundIndex declaration |
|
684 break; |
|
685 } |
|
686 return foundIndex; |
|
687 } |
|
688 |
|
689 // ---------------------------------------------------- |
|
690 // CMceBitmapResolver::ChangeBitmapInIconArrayL |
|
691 // ---------------------------------------------------- |
|
692 void CMceBitmapResolver::ChangeBitmapInIconArrayL( ) |
|
693 { |
|
694 TBool colorSkinnedBitmap = EFalse; |
|
695 TAknsItemID id; |
|
696 id.iMajor = 0; |
|
697 id.iMinor = 0; |
|
698 TMceBitmapListItem bitmapListItem; |
|
699 |
|
700 TInt count = iIcons->Count(); |
|
701 TInt bitmapIndex = 0; |
|
702 TPtrC fileName( iFilenameMuiu ); |
|
703 MAknsSkinInstance* skins = AknsUtils::SkinInstance(); |
|
704 |
|
705 for ( TInt cc=count; --cc>=0; ) |
|
706 { |
|
707 colorSkinnedBitmap = EFalse; |
|
708 switch( cc ) |
|
709 { |
|
710 case EMceBitmapIndexWrite: |
|
711 fileName.Set( iFilenameMuiu ); |
|
712 bitmapIndex = EMbmMuiuQgn_prop_mce_write_sub; |
|
713 id = KAknsIIDQgnPropMceWriteSub; |
|
714 break; |
|
715 case EMceBitmapIndexRemote: |
|
716 fileName.Set( iFilenameMuiu ); |
|
717 bitmapIndex = EMbmMuiuQgn_prop_mce_remote_sub; |
|
718 id = KAknsIIDQgnPropMceRemoteSub; |
|
719 break; |
|
720 case EMceBitmapIndexRemoteNew: |
|
721 fileName.Set( iFilenameMuiu ); |
|
722 bitmapIndex = EMbmMuiuQgn_prop_mce_remote_new_sub; |
|
723 id = KAknsIIDQgnPropMceRemoteNewSub; |
|
724 break; |
|
725 case EMceBitmapIndexDr: |
|
726 fileName.Set( iFilenameMuiu ); |
|
727 bitmapIndex = EMbmMuiuQgn_prop_mce_dr_sub; |
|
728 id = KAknsIIDQgnPropMceDrSub; |
|
729 break; |
|
730 case EMceBitmapIndexInbox: |
|
731 fileName.Set( iFilenameMuiu ); |
|
732 bitmapIndex = EMbmMuiuQgn_prop_mce_inbox_sub; |
|
733 id = KAknsIIDQgnPropMceInboxSub; |
|
734 break; |
|
735 case EMceBitmapIndexInboxNew: |
|
736 fileName.Set( iFilenameMuiu ); |
|
737 bitmapIndex = EMbmMuiuQgn_prop_mce_inbox_new_sub; |
|
738 id = KAknsIIDQgnPropMceInboxNewSub; |
|
739 break; |
|
740 case EMceBitmapIndexDocuments: |
|
741 fileName.Set( iFilenameMuiu ); |
|
742 bitmapIndex = EMbmMuiuQgn_prop_mce_documents_sub; |
|
743 id = KAknsIIDQgnPropMceDocumentsSub; |
|
744 break; |
|
745 case EMceBitmapIndexDocumentsNew: |
|
746 fileName.Set( iFilenameMuiu ); |
|
747 bitmapIndex = EMbmMuiuQgn_prop_mce_documents_new_sub; |
|
748 id = KAknsIIDQgnPropMceDocumentsNewSub; |
|
749 break; |
|
750 case EMceBitmapIndexDrafts: |
|
751 fileName.Set( iFilenameMuiu ); |
|
752 bitmapIndex = EMbmMuiuQgn_prop_mce_drafts_sub; |
|
753 id = KAknsIIDQgnPropMceDraftsSub; |
|
754 break; |
|
755 case EMceBitmapIndexSent: |
|
756 fileName.Set( iFilenameMuiu ); |
|
757 bitmapIndex = EMbmMuiuQgn_prop_mce_sent_sub; |
|
758 id = KAknsIIDQgnPropMceSentSub; |
|
759 break; |
|
760 case EMceBitmapIndexOutbox: |
|
761 fileName.Set( iFilenameMuiu ); |
|
762 bitmapIndex = EMbmMuiuQgn_prop_mce_outbox_sub; |
|
763 id = KAknsIIDQgnPropMceOutboxSub; |
|
764 break; |
|
765 case EMceBitmapIndexUnknown: |
|
766 fileName.Set( iFilenameMuiu ); |
|
767 bitmapIndex = EMbmMuiuQgn_prop_mce_unknown_read; |
|
768 id = KAknsIIDQgnPropMceUnknownRead; |
|
769 break; |
|
770 case EMceBitmapIndexFolderTemp: |
|
771 fileName.Set( iFilenameAvkon ); |
|
772 bitmapIndex = EMbmAvkonQgn_prop_folder_temp; |
|
773 id = KAknsIIDQgnPropMceTemplate; |
|
774 break; |
|
775 case EMceBitmapIndexFolderSmall: |
|
776 fileName.Set( iFilenameAvkon ); |
|
777 bitmapIndex = EMbmAvkonQgn_prop_folder_small; |
|
778 id = KAknsIIDQgnPropFolderSmall; |
|
779 break; |
|
780 case EMceBitmapIndexFolderSmallNew: |
|
781 fileName.Set( iFilenameAvkon ); |
|
782 bitmapIndex = EMbmAvkonQgn_prop_folder_small_new; |
|
783 id = KAknsIIDQgnPropFolderSmallNew; |
|
784 break; |
|
785 case EMceBitmapIndexAttachment: |
|
786 fileName.Set( iFilenameMuiu ); |
|
787 bitmapIndex = EMbmMuiuQgn_indi_attach_add; |
|
788 id = KAknsIIDQgnIndiAttachementAdd; |
|
789 colorSkinnedBitmap = ETrue; |
|
790 break; |
|
791 case EMceBitmapIndexMailboxConnectionOn: |
|
792 fileName.Set( iFilenameMuiu ); |
|
793 bitmapIndex = EMbmMuiuQgn_indi_connection_on_add; |
|
794 id = KAknsIIDQgnIndiConnectionOnAdd; |
|
795 colorSkinnedBitmap = ETrue; |
|
796 break; |
|
797 case EMceBitmapIndexMessageSelected: |
|
798 fileName.Set( iFilenameAvkon ); |
|
799 bitmapIndex = EMbmAvkonQgn_indi_marked_add; |
|
800 id = KAknsIIDQgnIndiMarkedAdd; |
|
801 colorSkinnedBitmap = ETrue; |
|
802 break; |
|
803 case EMceBitmapIndexAlwaysAdd: |
|
804 fileName.Set( iFilenameMuiu ); |
|
805 bitmapIndex = EMbmMuiuQgn_indi_connection_always_add; |
|
806 id = KAknsIIDQgnIndiConnectionAlwaysAdd; |
|
807 colorSkinnedBitmap = ETrue; |
|
808 break; |
|
809 case EMceBitmapIndexAlwaysRoaming: |
|
810 fileName.Set( iFilenameMuiu ); |
|
811 bitmapIndex = EMbmMuiuQgn_indi_connection_on_roam_add; |
|
812 id = KAknsIIDQgnIndiConnectionInactiveAdd; |
|
813 colorSkinnedBitmap = ETrue; |
|
814 break; |
|
815 case EMceBitmapIndexPriorityHigh: |
|
816 fileName.Set( iFilenameAvkon ); |
|
817 bitmapIndex = EMbmAvkonQgn_indi_mce_priority_high; |
|
818 id = KAknsIIDQgnIndiMcePriorityHigh; |
|
819 colorSkinnedBitmap = ETrue; |
|
820 break; |
|
821 case EMceBitmapIndexPriorityLow: |
|
822 fileName.Set( iFilenameAvkon ); |
|
823 bitmapIndex = EMbmAvkonQgn_indi_mce_priority_low; |
|
824 id = KAknsIIDQgnIndiMcePriorityLow; |
|
825 colorSkinnedBitmap = ETrue; |
|
826 break; |
|
827 case EMceBitmapIndexInactiveAdd: |
|
828 fileName.Set( iFilenameMuiu ); |
|
829 bitmapIndex = EMbmMuiuQgn_indi_connection_inactive_add; |
|
830 id = KAknsIIDQgnIndiConnectionInactiveAdd; |
|
831 colorSkinnedBitmap = ETrue; |
|
832 break; |
|
833 case EMceBitmapIndexReplaceMtmIcon: |
|
834 default: |
|
835 fileName.Set( iFilenameMuiu ); |
|
836 bitmapIndex = EMbmMuiuQgn_prop_mce_unknown_read; |
|
837 id = KAknsIIDQgnPropMceUnknownRead; |
|
838 break; |
|
839 } |
|
840 |
|
841 if ( cc < iIconIndexes->Count() ) |
|
842 { |
|
843 bitmapListItem = (*iIconIndexes)[cc]; |
|
844 } |
|
845 else |
|
846 { |
|
847 bitmapListItem.iExtraItem = EFalse; |
|
848 } |
|
849 |
|
850 CFbsBitmap* bitmap = NULL; |
|
851 CFbsBitmap* mask = NULL; |
|
852 |
|
853 if ( bitmapListItem.iExtraItem && |
|
854 bitmapListItem.iId >= KMceFirstExtraItemId |
|
855 ) |
|
856 { |
|
857 if ( bitmapListItem.iType.iUid > 0 && |
|
858 bitmapListItem.iType.iUid != KUidMsvFolderEntryValue ) |
|
859 { |
|
860 // this is extra item and it has application uid, try to load it! |
|
861 TUid uid = bitmapListItem.iType; |
|
862 AknsUtils::CreateAppIconLC( |
|
863 skins, |
|
864 uid, |
|
865 EAknsAppIconTypeList, |
|
866 bitmap, |
|
867 mask ); |
|
868 CleanupStack::Pop(2); |
|
869 } |
|
870 else |
|
871 { |
|
872 // do no changes, this is extremly dirty way but once in the lifetime... |
|
873 continue; |
|
874 } |
|
875 } |
|
876 |
|
877 if ( !bitmap ) |
|
878 { |
|
879 if ( colorSkinnedBitmap ) |
|
880 { |
|
881 TRgb rgb; // What to add here? |
|
882 |
|
883 AknsUtils::CreateColorIconL( |
|
884 skins, |
|
885 id, |
|
886 KAknsIIDQsnIconColors, |
|
887 EAknsCIQsnIconColorsCG13, |
|
888 bitmap, |
|
889 mask, |
|
890 fileName, |
|
891 bitmapIndex, |
|
892 bitmapIndex + 1, |
|
893 rgb ); |
|
894 |
|
895 } |
|
896 else |
|
897 { |
|
898 AknsUtils::CreateIconL( skins, id, bitmap, |
|
899 mask, fileName, bitmapIndex, bitmapIndex + 1 ); |
|
900 } |
|
901 } |
|
902 |
|
903 |
|
904 CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); |
|
905 |
|
906 CleanupStack::PushL( icon ); |
|
907 CGulIcon* iconToBeDelete = iIcons->At( cc ); |
|
908 iIcons->At( cc ) = icon; |
|
909 delete iconToBeDelete; |
|
910 iconToBeDelete = NULL; |
|
911 |
|
912 CleanupStack::Pop( icon ); |
|
913 |
|
914 } |
|
915 } |
|
916 |
|
917 // ---------------------------------------------------- |
|
918 // CMceBitmapResolver::LocalEntryBitmapIndex |
|
919 // ---------------------------------------------------- |
|
920 TInt CMceBitmapResolver::MtmIconIndex() |
|
921 { |
|
922 return iBitmapsLoaded; |
|
923 } |
|
924 |
|
925 // ---------------------------------------------------- |
|
926 // CMceBitmapResolver::DescriptionLength |
|
927 // ---------------------------------------------------- |
|
928 TInt CMceBitmapResolver::DescriptionLength() |
|
929 { |
|
930 return iDescriptionLength; |
|
931 } |
|
932 |
|
933 // End of File |