equal
deleted
inserted
replaced
357 return EReadFullForMerge; |
357 return EReadFullForMerge; |
358 } |
358 } |
359 } |
359 } |
360 else if(iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) |
360 else if(iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) |
361 { |
361 { |
362 // It's an unsortable contact, just append its lightweight object |
362 // It's an unsortable contact, |
363 // to unsortable view contacts list. |
363 // just append it to unsortable view contacts list. |
364 contact->ChangeToLightweightObject(); |
|
365 iUnsortedViewContacts->AppendL(contact); |
364 iUnsortedViewContacts->AppendL(contact); |
366 CleanupStack::Pop(contact); |
365 CleanupStack::Pop(contact); |
367 } |
366 } |
368 else |
367 else |
369 { |
368 { |
521 TInt diff = CompareContactsAndIdsL(*firstLeftContact, *firstRightContact); |
520 TInt diff = CompareContactsAndIdsL(*firstLeftContact, *firstRightContact); |
522 |
521 |
523 if(diff > 0) |
522 if(diff > 0) |
524 { |
523 { |
525 resultContacts->AppendL(firstRightContact); |
524 resultContacts->AppendL(firstRightContact); |
526 firstRightContact->ChangeToLightweightObject(); |
|
527 ++indexRight; |
525 ++indexRight; |
528 } |
526 } |
529 else |
527 else |
530 { |
528 { |
531 resultContacts->AppendL(firstLeftContact); |
529 resultContacts->AppendL(firstLeftContact); |
532 firstLeftContact->ChangeToLightweightObject(); |
|
533 ++indexLeft; |
530 ++indexLeft; |
534 if(diff == 0) |
531 if(diff == 0) |
535 { |
532 { |
536 aRightContacts.Remove(indexRight); |
533 aRightContacts.Remove(indexRight); |
537 delete firstRightContact; |
534 delete firstRightContact; |
547 } |
544 } |
548 |
545 |
549 while(indexRight < aRightContacts.Count()) |
546 while(indexRight < aRightContacts.Count()) |
550 { |
547 { |
551 CViewContact* firstRightContact = static_cast<CViewContact*>(aRightContacts[indexRight]); |
548 CViewContact* firstRightContact = static_cast<CViewContact*>(aRightContacts[indexRight]); |
552 |
|
553 //change all the fullfil view objects to lightweight into the merged list. |
|
554 firstRightContact->ChangeToLightweightObject(); |
|
555 |
|
556 resultContacts->AppendL(firstRightContact); |
549 resultContacts->AppendL(firstRightContact); |
557 ++indexRight; |
550 ++indexRight; |
558 } |
551 } |
559 |
552 |
560 CleanupStack::Pop(resultContacts); |
553 CleanupStack::Pop(resultContacts); |
651 } |
644 } |
652 } |
645 } |
653 |
646 |
654 User::LeaveIfError(error); |
647 User::LeaveIfError(error); |
655 |
648 |
656 //Make the view contact object to be lightweighted before insert to iViewContacts. |
|
657 const_cast<CViewContact*>(aNewContact)->ChangeToLightweightObject(); |
|
658 iViewContacts->InsertL(aNewContact, position); |
649 iViewContacts->InsertL(aNewContact, position); |
659 |
650 |
660 return position; |
651 return position; |
661 } |
652 } |
662 |
653 |
819 @param aSeparator the charactors to split the fields content. |
810 @param aSeparator the charactors to split the fields content. |
820 @return Buffer of the formated fields content. |
811 @return Buffer of the formated fields content. |
821 */ |
812 */ |
822 HBufC* CViewContactManager::AllFieldsLC(TInt aIndex, const TDesC& aSeparator) const |
813 HBufC* CViewContactManager::AllFieldsLC(TInt aIndex, const TDesC& aSeparator) const |
823 { |
814 { |
824 TBool ifWasFullObject = EFalse; |
|
825 |
|
826 CViewContact& viewContact = ViewContactAtL(aIndex); |
815 CViewContact& viewContact = ViewContactAtL(aIndex); |
827 if(viewContact.IsLightweightObject()) |
816 if(viewContact.IsLightweightObject()) |
828 { |
817 { |
829 CViewContact* contact = iLplViewItemMgr.ItemAtL(viewContact.Id(), iViewSessionId); |
818 CViewContact* contact = iLplViewItemMgr.ItemAtL(viewContact.Id(), iViewSessionId); |
830 if(contact == NULL) |
819 if(contact == NULL) |
833 } |
822 } |
834 |
823 |
835 CleanupStack::PushL(contact); |
824 CleanupStack::PushL(contact); |
836 viewContact.CopyL(*contact); |
825 viewContact.CopyL(*contact); |
837 CleanupStack::PopAndDestroy(contact); |
826 CleanupStack::PopAndDestroy(contact); |
838 |
|
839 ifWasFullObject = ETrue; |
|
840 } |
827 } |
841 |
828 |
842 HBufC* buf = FieldsWithSeparatorLC(viewContact,aSeparator); |
829 HBufC* buf = FieldsWithSeparatorLC(viewContact,aSeparator); |
843 |
830 |
844 if(ifWasFullObject) |
|
845 { |
|
846 //loadFullContent is set in ViewContactAtL if the viewContact was a lightweight object and |
|
847 //loaded to be full content object in that function. So we need to change it to lightweight |
|
848 //in order to save more memory. |
|
849 viewContact.ChangeToLightweightObject(); |
|
850 } |
|
851 return buf; |
831 return buf; |
852 } |
832 } |
853 |
833 |
854 |
834 |
855 /** |
835 /** |
891 } |
871 } |
892 else if (iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) |
872 else if (iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) |
893 { |
873 { |
894 // unsortable contacts go at the end or beginning |
874 // unsortable contacts go at the end or beginning |
895 // we want this to be stable (e.g. when ICC becomes unlocked) |
875 // we want this to be stable (e.g. when ICC becomes unlocked) |
896 contact->ChangeToLightweightObject(); |
|
897 iUnsortedViewContacts->AppendL(contact); |
876 iUnsortedViewContacts->AppendL(contact); |
898 index = iUnsortedViewContacts->Count() - 1; |
877 index = iUnsortedViewContacts->Count() - 1; |
899 |
878 |
900 // calc new index |
879 // calc new index |
901 if (iViewPreferences & EUnSortedAtEnd) |
880 if (iViewPreferences & EUnSortedAtEnd) |