405 aNewItem.iPrintableText.AppendNum( index ); |
406 aNewItem.iPrintableText.AppendNum( index ); |
406 aNewItem.iPrintableText.Append( KColumnListSeparator ); |
407 aNewItem.iPrintableText.Append( KColumnListSeparator ); |
407 aNewItem.iPrintableText.Append( tempText ); |
408 aNewItem.iPrintableText.Append( tempText ); |
408 aNewItem.iPrintableText.Append( KColumnListSeparator ); |
409 aNewItem.iPrintableText.Append( KColumnListSeparator ); |
409 aNewItem.iPrintableText.Append( secondarytxt ); |
410 aNewItem.iPrintableText.Append( secondarytxt ); |
410 |
411 aNewItem.iText.Zero(); |
411 InsertL( aIndex, aNewItem ); |
412 InsertL( aIndex, aNewItem ); |
412 } |
413 } |
413 |
414 |
414 // ---------------------------------------------------- |
415 // ---------------------------------------------------- |
415 // CMceMainViewListItemArray::MdcaCount |
416 // CMceMainViewListItemArray::MdcaCount |
455 { |
456 { |
456 TPtr tempText = iListBoxText->Des(); |
457 TPtr tempText = iListBoxText->Des(); |
457 tempText.Zero(); |
458 tempText.Zero(); |
458 TMsvEntry entry; |
459 TMsvEntry entry; |
459 TMsvId serviceId; |
460 TMsvId serviceId; |
460 TInt visiblecount=0; |
461 |
461 const TMceListItem& item = At( aIndex ); |
462 const TMceListItem& item = At( aIndex ); |
462 if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone ) |
463 if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone ) |
463 { |
464 { |
464 if ( item.iIconIndex <= KErrNone || item.iIconIndex >= iBitmapResolver.MtmIconIndex() ) |
465 if ( item.iIconIndex <= KErrNone || item.iIconIndex >= iBitmapResolver.MtmIconIndex() ) |
465 { |
466 { |
466 TInt messageCount = 0; |
467 TInt messageCount = 0; |
467 TMsvId id = entry.Id(); |
468 TMsvId id = entry.Id(); |
|
469 CONST_CAST( TMceListItem*, &item)->iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount ); |
468 if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId ) |
470 if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId ) |
469 { |
471 { |
470 CONST_CAST( TMceListItem*, &item)->iIconIndex = EMceBitmapIndexInbox; |
472 CONST_CAST( TMceListItem*, &item)->iIconIndex = EMceBitmapIndexInbox; |
471 } |
473 } |
472 else |
|
473 { |
|
474 CONST_CAST( TMceListItem*, &item)->iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount ); |
|
475 } |
|
476 CONST_CAST( TMceListItem*, &item)->iMessageCount = messageCount; |
474 CONST_CAST( TMceListItem*, &item)->iMessageCount = messageCount; |
477 } |
475 } |
|
476 else if(iListItemArrayObserver ) |
|
477 { |
|
478 if(iListItemArrayObserver->MceListItemArrayFlickEvent()) |
|
479 { |
|
480 return item.iText; |
|
481 } |
|
482 } |
|
483 |
478 tempText.AppendNum( item.iIconIndex ); |
484 tempText.AppendNum( item.iIconIndex ); |
479 tempText.Append( KColumnListSeparator ); |
485 tempText.Append( KColumnListSeparator ); |
480 tempText.Append( item.iPrintableText ); |
486 tempText.Append( item.iPrintableText ); |
481 if((iSelectableEmail)||(iEmailFramework)) |
487 AppendMessageCountString( tempText, item.iMessageCount ); |
482 { |
488 |
483 if( item.iMsvId == KMsvDraftEntryId || |
|
484 item.iMsvId == KMsvSentEntryId || |
|
485 item.iMsvId == KMsvDeletedEntryFolderEntryId || |
|
486 item.iMsvId == KMsvGlobalInBoxIndexEntryId || item.iMsvId == KMsvGlobalOutBoxIndexEntryId ) |
|
487 { |
|
488 TRAP_IGNORE( visiblecount = FindVisibleCountL(item.iMsvId) ); |
|
489 AppendMessageCountString( tempText, visiblecount ); |
|
490 } |
|
491 else |
|
492 { |
|
493 AppendMessageCountString( tempText, item.iMessageCount ); |
|
494 } |
|
495 } |
|
496 else |
|
497 { |
|
498 AppendMessageCountString( tempText, item.iMessageCount ); |
|
499 } |
|
500 if ( entry.Connected() ) |
489 if ( entry.Connected() ) |
501 { |
490 { |
502 if ( iRoaming ) |
491 if ( iRoaming ) |
503 { |
492 { |
504 tempText.Append( KColumnListSeparator ); |
493 tempText.Append( KColumnListSeparator ); |
540 else |
529 else |
541 { |
530 { |
542 tempText.AppendNum( (TInt) EMceBitmapIndexInactiveAdd ); |
531 tempText.AppendNum( (TInt) EMceBitmapIndexInactiveAdd ); |
543 } |
532 } |
544 } |
533 } |
545 |
|
546 } |
534 } |
547 } |
535 } |
548 else |
536 else |
549 { |
537 { |
550 // this should never happend |
538 // this should never happend |
551 __ASSERT_DEBUG( 0, Panic(EMceListItemArrayEntryNotFound ) ); |
539 __ASSERT_DEBUG( 0, Panic(EMceListItemArrayEntryNotFound ) ); |
552 tempText.AppendNum( (TInt)EMceBitmapIndexUnknown ); |
540 tempText.AppendNum( (TInt)EMceBitmapIndexUnknown ); |
553 tempText.Append( KColumnListSeparator ); |
541 tempText.Append( KColumnListSeparator ); |
554 tempText.Append( item.iPrintableText ); |
542 tempText.Append( item.iPrintableText ); |
555 } |
543 } |
|
544 //save the complete string as chache, will be used when flick will start |
|
545 CONST_CAST( TMceListItem*, &item)->iText.Zero(); |
|
546 CONST_CAST( TMceListItem*, &item)->iText.Copy(tempText); |
556 return tempText; |
547 return tempText; |
557 } |
548 } |
558 |
549 |
559 // --------------------------------------------------------------------------- |
550 // --------------------------------------------------------------------------- |
560 // CMceMainViewListItemArray::ShouldAddToListL() |
551 // CMceMainViewListItemArray::ShouldAddToListL() |
1027 TMsvId serviceId; |
1018 TMsvId serviceId; |
1028 if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone ) |
1019 if ( iSession->GetEntry( item.iMsvId, serviceId, entry ) == KErrNone ) |
1029 { |
1020 { |
1030 TInt messageCount = 0; |
1021 TInt messageCount = 0; |
1031 TMsvId id = entry.Id(); |
1022 TMsvId id = entry.Id(); |
|
1023 item.iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount ); |
1032 if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId ) |
1024 if(iDefaultViewSettings == KMceConversationview && id == KMsvGlobalInBoxIndexEntryId ) |
1033 { |
1025 { |
1034 item.iIconIndex = EMceBitmapIndexInbox; |
1026 item.iIconIndex = EMceBitmapIndexInbox; |
1035 } |
1027 } |
1036 else |
1028 item.iMessageCount = messageCount; |
1037 { |
|
1038 item.iIconIndex = iBitmapResolver.BitmapIndex( entry, messageCount ); |
|
1039 } |
|
1040 item.iMessageCount = messageCount; |
|
1041 // item.iUnreadMessageCount = unreadMessageCount; |
1029 // item.iUnreadMessageCount = unreadMessageCount; |
1042 if ( iListItemArrayObserver ) |
1030 if ( iListItemArrayObserver ) |
1043 { |
1031 { |
1044 iListItemArrayObserver->MceListItemArrayChangedL(); |
1032 iListItemArrayObserver->MceListItemArrayChangedL(); |
1045 } |
1033 } |
1198 } |
1186 } |
1199 CleanupStack::PopAndDestroy( repository ); |
1187 CleanupStack::PopAndDestroy( repository ); |
1200 } |
1188 } |
1201 |
1189 |
1202 // ---------------------------------------------------- |
1190 // ---------------------------------------------------- |
1203 // CMceMainViewListItemArray::FindVisibleCountL() |
1191 // CMceMainViewListItemArray::CreateConversationsListItem() |
1204 // ---------------------------------------------------- |
1192 // ---------------------------------------------------- |
1205 TInt CMceMainViewListItemArray::FindVisibleCountL(TMsvId serviceId ) const |
1193 TPtrC CMceMainViewListItemArray::CreateConversationsListItem( TInt aIndex ) const |
1206 { |
1194 { |
1207 TInt visiblecount=0; |
1195 const TMceListItem& item = At( aIndex ); |
1208 TInt emailcount=0; |
1196 if(!iListItemArrayObserver->MceListItemArrayFlickEvent()) |
1209 TInt itemcount; |
1197 { |
1210 CMsvEntry* entry = iSession->GetEntryL( serviceId ); |
1198 TPtr tempText = iListBoxText->Des(); |
1211 CleanupStack::PushL( entry ); |
1199 tempText.Zero(); |
1212 itemcount=entry->Count(); |
1200 TInt bitmapidx = EMceBitmapIndexConversation; |
1213 |
1201 if(iDefaultViewSettings == KMceConversationview ) |
1214 //Find email messages |
1202 { |
1215 CMsvEntrySelection *smtpselection = entry->ChildrenWithMtmL( KUidMsgTypeSMTP ); |
1203 TInt msgCount = 0; |
1216 CleanupStack::PushL( smtpselection ); |
1204 TInt unreadCount = 0; |
1217 |
1205 iBitmapResolver.HasUnreadMessagesL(KMsvGlobalInBoxIndexEntryId,msgCount,unreadCount); |
1218 CMsvEntrySelection *pop3selection = NULL; |
1206 if( unreadCount > 0 ) |
1219 CMsvEntrySelection *imapselection = NULL ; |
1207 { |
1220 CMsvEntrySelection *cmailselection = NULL ; |
1208 bitmapidx = EMceBitmapIndexConversationNew ; |
1221 |
1209 } |
1222 if(!iEmailFramework) |
1210 } |
1223 { |
1211 tempText.AppendNum(bitmapidx); |
1224 pop3selection = entry->ChildrenWithMtmL( KUidMsgTypePOP3 ); |
1212 TPtrC Ptr(item.iPrintableText); |
1225 CleanupStack::PushL( pop3selection ); |
1213 TInt len = Ptr.Length(); |
1226 imapselection = entry->ChildrenWithMtmL( KUidMsgTypeIMAP4 ); |
1214 TInt pos = Ptr.Locate(KColumnListSeparator); |
1227 CleanupStack::PushL( imapselection ); |
1215 TPtrC Ptr1(Ptr.Mid(pos)); |
1228 } |
1216 tempText.Append(Ptr1); |
|
1217 CONST_CAST( TMceListItem*, &item)->iText.Zero(); |
|
1218 CONST_CAST( TMceListItem*, &item)->iText.Copy(tempText); |
|
1219 return tempText; |
|
1220 } |
1229 else |
1221 else |
1230 { |
|
1231 cmailselection = entry->ChildrenWithMtmL( |
|
1232 TUid::Uid(KUidMsgTypeFsMtmVal)); |
|
1233 CleanupStack::PushL( cmailselection ); |
|
1234 } |
|
1235 |
|
1236 if ( smtpselection!=0 && smtpselection->Count()>0 ) |
|
1237 { |
|
1238 emailcount=emailcount+smtpselection->Count(); |
|
1239 } |
|
1240 |
|
1241 if(!iEmailFramework) |
|
1242 { |
|
1243 if ( pop3selection!=0 && pop3selection->Count()>0 ) |
|
1244 { |
|
1245 emailcount=emailcount+pop3selection->Count(); |
|
1246 } |
|
1247 if ( imapselection!=0 && imapselection->Count()>0 ) |
|
1248 { |
|
1249 emailcount=emailcount+imapselection->Count(); |
|
1250 } |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 if ( cmailselection!=0 && cmailselection->Count()>0 ) |
|
1255 { |
|
1256 emailcount=emailcount+cmailselection->Count(); |
|
1257 } |
|
1258 } |
|
1259 |
|
1260 visiblecount = itemcount - emailcount; |
|
1261 |
|
1262 if(iEmailFramework) |
|
1263 { |
|
1264 CleanupStack::PopAndDestroy( cmailselection ); |
|
1265 } |
|
1266 else |
|
1267 { |
|
1268 CleanupStack::PopAndDestroy(imapselection); |
|
1269 CleanupStack::PopAndDestroy( pop3selection ); |
|
1270 } |
|
1271 CleanupStack::PopAndDestroy( smtpselection ); |
|
1272 CleanupStack::PopAndDestroy( entry ); |
|
1273 return visiblecount; |
|
1274 } |
|
1275 // ---------------------------------------------------- |
|
1276 // CMceMainViewListItemArray::CreateConversationsListItem() |
|
1277 // ---------------------------------------------------- |
|
1278 TPtrC CMceMainViewListItemArray::CreateConversationsListItem( TInt aIndex ) const |
|
1279 { |
|
1280 const TMceListItem& item = At( aIndex ); |
|
1281 TPtr tempText = iListBoxText->Des(); |
|
1282 tempText.Zero(); |
|
1283 TInt bitmapidx = EMceBitmapIndexConversation; |
|
1284 if(iDefaultViewSettings == KMceConversationview ) |
|
1285 { |
1222 { |
1286 TInt msgCount = 0; |
1223 return item.iText; |
1287 TInt unreadCount = 0; |
1224 } |
1288 iBitmapResolver.HasUnreadMessagesL(KMsvGlobalInBoxIndexEntryId,msgCount,unreadCount); |
|
1289 if( unreadCount > 0 ) |
|
1290 { |
|
1291 bitmapidx = EMceBitmapIndexConversationNew ; |
|
1292 } |
|
1293 } |
|
1294 tempText.AppendNum(bitmapidx); |
|
1295 TPtrC Ptr(item.iPrintableText); |
|
1296 TInt len = Ptr.Length(); |
|
1297 TInt pos = Ptr.Locate(KColumnListSeparator); |
|
1298 TPtrC Ptr1(Ptr.Mid(pos)); |
|
1299 tempText.Append(Ptr1); |
|
1300 return tempText; |
|
1301 } |
1225 } |
1302 |
1226 |
1303 // ---------------------------------------------------- |
1227 // ---------------------------------------------------- |
1304 // CMceMainViewListItemArray::SetDefaultViewSettings() |
1228 // CMceMainViewListItemArray::SetDefaultViewSettings() |
1305 // ---------------------------------------------------- |
1229 // ---------------------------------------------------- |