phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 15 e8e3147d53eb
child 39 a6539d1e8e43
equal deleted inserted replaced
26:0d28c1c5b6dd 32:2828b4d142c0
    22 #include <CPbk2PresentationContactField.h>
    22 #include <CPbk2PresentationContactField.h>
    23 #include <CPbk2PresentationContactFieldCollection.h>
    23 #include <CPbk2PresentationContactFieldCollection.h>
    24 #include <CPbk2IconArray.h>
    24 #include <CPbk2IconArray.h>
    25 #include <MPbk2FieldProperty.h>
    25 #include <MPbk2FieldProperty.h>
    26 #include <MPbk2ClipListBoxText.h>
    26 #include <MPbk2ClipListBoxText.h>
       
    27 #include <f32file.h>
    27 
    28 
    28 #include <CVPbkContactManager.h>
    29 #include <CVPbkContactManager.h>
    29 #include <MVPbkContactLink.h>
    30 #include <MVPbkContactLink.h>
    30 #include <MVPbkFieldType.h>
    31 #include <MVPbkFieldType.h>
    31 #include <MVPbkContactFieldTextData.h>
    32 #include <MVPbkContactFieldTextData.h>
   421 // --------------------------------------------------------------------------
   422 // --------------------------------------------------------------------------
   422 //
   423 //
   423 TBool CSpbContactDataModelPrivate::IsHiddenField(const MVPbkFieldType* aFieldType)
   424 TBool CSpbContactDataModelPrivate::IsHiddenField(const MVPbkFieldType* aFieldType)
   424     {
   425     {
   425     TInt resId = aFieldType->FieldTypeResId();
   426     TInt resId = aFieldType->FieldTypeResId();
   426     return ( resId == R_VPBK_FIELD_TYPE_SYNCCLASS ||
   427     return ( resId == R_VPBK_FIELD_TYPE_SYNCCLASS );
   427              resId == R_VPBK_FIELD_TYPE_CALLEROBJIMG );
       
   428     }
   428     }
   429 
   429 
   430 // ---------------------------------------------------------------------------
   430 // ---------------------------------------------------------------------------
   431 // CSpbContactDataModelPrivate::IsFieldTypeL
   431 // CSpbContactDataModelPrivate::IsFieldTypeL
   432 // ---------------------------------------------------------------------------
   432 // ---------------------------------------------------------------------------
   452         {
   452         {
   453         aRow->SetClipRequired( ETrue );
   453         aRow->SetClipRequired( ETrue );
   454         }
   454         }
   455     
   455     
   456     TPtrC fieldText = MVPbkContactFieldTextData::Cast(aFieldData).Text();
   456     TPtrC fieldText = MVPbkContactFieldTextData::Cast(aFieldData).Text();
       
   457     TInt resId = aFieldType.FieldTypeResId();
       
   458     HBufC* defaultText = NULL;
       
   459     if( resId == R_VPBK_FIELD_TYPE_CALLEROBJIMG )
       
   460         {
       
   461         RFs& fs = iCoeEnv.FsSession(); 
       
   462         TEntry entry;
       
   463         if ( fs.Entry( fieldText, entry) == KErrNone )
       
   464            {
       
   465            // get image name
       
   466            TParse parse;
       
   467            parse.Set(fieldText, NULL, NULL);
       
   468            fieldText.Set(parse.Name());
       
   469           
       
   470            }
       
   471         else
       
   472             {
       
   473             // use default image name
       
   474             defaultText = iCoeEnv.AllocReadResourceLC( R_QTN_PHOB_FIELD_THUMBNAIL );
       
   475             fieldText.Set( defaultText->Des() );
       
   476             }
       
   477         }
   457     TPtr columnBuf( ExpandColumnBufferL( fieldText.Length() ) );
   478     TPtr columnBuf( ExpandColumnBufferL( fieldText.Length() ) );
   458     columnBuf.Zero();
   479     columnBuf.Zero();
   459 
   480 
   460     // replace listbox separator characters.
   481     // replace listbox separator characters.
   461     Pbk2PresentationUtils::AppendAndReplaceChars( columnBuf, fieldText,
   482     Pbk2PresentationUtils::AppendAndReplaceChars( columnBuf, fieldText,
   462             KCharsToReplace, KReplacementChars );
   483             KCharsToReplace, KReplacementChars );
   463 
   484     if( defaultText )
       
   485         {
       
   486         CleanupStack::PopAndDestroy( defaultText );
       
   487         }
   464     // Replace characters that can not be displayed correctly.
   488     // Replace characters that can not be displayed correctly.
   465     Pbk2PresentationUtils::ReplaceNonGraphicCharacters( columnBuf, KReplacedChars );
   489     Pbk2PresentationUtils::ReplaceNonGraphicCharacters( columnBuf, KReplacedChars );
   466 
   490 
   467     aRow->AppendColumnL( columnBuf );
   491     aRow->AppendColumnL( columnBuf );
   468     }
   492     }