phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkVCardImporter.cpp
branchRCL_3
changeset 57 2666d9724c76
parent 26 0d28c1c5b6dd
child 58 d4f567ce2e7c
equal deleted inserted replaced
45:34879f5cfc63 57:2666d9724c76
    32 #include <MVPbkContactStoreProperties.h>
    32 #include <MVPbkContactStoreProperties.h>
    33 #include <MVPbkContactAttribute.h>
    33 #include <MVPbkContactAttribute.h>
    34 #include <MVPbkContactOperationBase.h>
    34 #include <MVPbkContactOperationBase.h>
    35 #include <CVPbkContactManager.h>
    35 #include <CVPbkContactManager.h>
    36 #include <MVPbkStoreContactFieldCollection.h>
    36 #include <MVPbkStoreContactFieldCollection.h>
       
    37 #include <vpbkeng.rsg>
    37 
    38 
    38 // System includes
    39 // System includes
    39 #include <vcard.h>
    40 #include <vcard.h>
    40 #include <bldvariant.hrh>
    41 #include <bldvariant.hrh>
    41 #include <s32buf.h>
    42 #include <s32buf.h>
    42 
    43 
    43 #include <VPbkStoreUriLiterals.h>
    44 #include <VPbkStoreUriLiterals.h>
    44 _LIT8( KPropXSelf, "X-SELF" );
    45 _LIT8( KPropXSelf, "X-SELF" );
    45 _LIT8( KPropXCategories, "X-CATEGORIES");
    46 _LIT8( KPropXCategories, "X-CATEGORIES");
    46 _LIT8( KPropXIMPP, "X-IMPP");
       
    47 _LIT(KColon, ":");
    47 _LIT(KColon, ":");
    48 
    48 
    49 CVPbkVCardImporter* CVPbkVCardImporter::NewL(
    49 CVPbkVCardImporter* CVPbkVCardImporter::NewL(
    50             RPointerArray<MVPbkStoreContact>& aImportedContacts,
    50             RPointerArray<MVPbkStoreContact>& aImportedContacts,
    51             RReadStream& aSourceStream,
    51             RReadStream& aSourceStream,
   344     TVPbkVCardDataConverter converter;
   344     TVPbkVCardDataConverter converter;
   345     if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) ||
   345     if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) ||
   346          aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) )
   346          aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) )
   347         {
   347         {
   348         const TDesC& value = converter.GetDesCData( aData );
   348         const TDesC& value = converter.GetDesCData( aData );
   349         TInt pos = value.Find(KColon);
   349         if ( aData.FieldType().FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP )
   350         if( 0 == pos && 0 == GetCurrentProperty()->Name().Compare(KPropXIMPP()) )
   350             {
   351             {
   351             TInt pos = value.Find(KColon);
   352             // If the service name is NULL and it's a IMPP field, don't save the data.
   352             if( 0 == pos )
   353             // e.g.:
   353                 {
   354             // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name
   354                 // If the service name is NULL and it's a IMPP field, don't save the data.
   355             // (2) If the value is :peterpan@yahoo.com, the service name is NULL
   355                 // e.g.:
   356             isSaved = EFalse;
   356                 // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name
   357             }
   357                 // (2) If the value is :peterpan@yahoo.com, the service name is NULL
   358         else
   358                 isSaved = EFalse;
       
   359                 }
       
   360             }
       
   361         if ( isSaved )
   359             {
   362             {
   360             SaveL( aData, value );
   363             SaveL( aData, value );
   361             }
   364             }
   362         }
   365         }
   363     else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) )
   366     else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) )