phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 15 e8e3147d53eb
child 39 a6539d1e8e43
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp	Tue Apr 27 16:23:35 2010 +0300
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp	Tue May 11 16:00:21 2010 +0300
@@ -24,6 +24,7 @@
 #include <CPbk2IconArray.h>
 #include <MPbk2FieldProperty.h>
 #include <MPbk2ClipListBoxText.h>
+#include <f32file.h>
 
 #include <CVPbkContactManager.h>
 #include <MVPbkContactLink.h>
@@ -423,8 +424,7 @@
 TBool CSpbContactDataModelPrivate::IsHiddenField(const MVPbkFieldType* aFieldType)
     {
     TInt resId = aFieldType->FieldTypeResId();
-    return ( resId == R_VPBK_FIELD_TYPE_SYNCCLASS ||
-             resId == R_VPBK_FIELD_TYPE_CALLEROBJIMG );
+    return ( resId == R_VPBK_FIELD_TYPE_SYNCCLASS );
     }
 
 // ---------------------------------------------------------------------------
@@ -454,13 +454,37 @@
         }
     
     TPtrC fieldText = MVPbkContactFieldTextData::Cast(aFieldData).Text();
+    TInt resId = aFieldType.FieldTypeResId();
+    HBufC* defaultText = NULL;
+    if( resId == R_VPBK_FIELD_TYPE_CALLEROBJIMG )
+        {
+        RFs& fs = iCoeEnv.FsSession(); 
+        TEntry entry;
+        if ( fs.Entry( fieldText, entry) == KErrNone )
+           {
+           // get image name
+           TParse parse;
+           parse.Set(fieldText, NULL, NULL);
+           fieldText.Set(parse.Name());
+          
+           }
+        else
+            {
+            // use default image name
+            defaultText = iCoeEnv.AllocReadResourceLC( R_QTN_PHOB_FIELD_THUMBNAIL );
+            fieldText.Set( defaultText->Des() );
+            }
+        }
     TPtr columnBuf( ExpandColumnBufferL( fieldText.Length() ) );
     columnBuf.Zero();
 
     // replace listbox separator characters.
     Pbk2PresentationUtils::AppendAndReplaceChars( columnBuf, fieldText,
             KCharsToReplace, KReplacementChars );
-
+    if( defaultText )
+        {
+        CleanupStack::PopAndDestroy( defaultText );
+        }
     // Replace characters that can not be displayed correctly.
     Pbk2PresentationUtils::ReplaceNonGraphicCharacters( columnBuf, KReplacedChars );