phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp
branchRCL_3
changeset 39 a6539d1e8e43
parent 32 2828b4d142c0
child 57 2666d9724c76
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Tue May 25 12:26:45 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Wed Jun 09 09:26:27 2010 +0300
@@ -445,6 +445,21 @@
 
     AppendThumbnailL( aDataElement, aIndex );
     
+    // The cached element needs to be updated when the presence icon is changed
+    RArray<TPbk2IconId> ids;
+    CleanupClosePushL( ids );    
+    const MVPbkViewContact& contact = iView->ContactAtL( aIndex );
+    iContactIcons->GetIconIdsForContactL( contact, ids );
+
+    // If no icon was found, append an empty icon
+    if( ids.Count() == 0 )
+        {
+        ids.Append( iEmptyIconId );
+        }
+    
+    aDataElement.SetIconId( MPbk2DoubleListboxDataElement::EMainIcon, ids[ 0 ] );
+    CleanupStack::PopAndDestroy( &ids );
+    
     // Format line buffer based on element's content
     FormatBufferFromElement( aDataElement );
     }
@@ -460,7 +475,10 @@
     MVPbkContactLink* link = aViewContact.CreateLinkLC();
     CPbk2ContactViewDoubleListboxDataElement* element = 
         CPbk2ContactViewDoubleListboxDataElement::NewL( link, aIndex );
-    CleanupStack::Pop();    // link
+    if( link )
+        {
+        CleanupStack::Pop();    // link
+        }
     CleanupStack::PushL( element );
 
     // get data for element