phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkVCardImporter.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 17 2666d9724c76
equal deleted inserted replaced
17:2666d9724c76 18:d4f567ce2e7c
   203         MVPbkImportOperationObserver& aObserver )
   203         MVPbkImportOperationObserver& aObserver )
   204     {
   204     {
   205     iObserver = &aObserver;
   205     iObserver = &aObserver;
   206     }
   206     }
   207 
   207 
   208 CParserProperty* CVPbkVCardImporter::GetCurrentProperty()
       
   209     {
       
   210     // Get current property from parser array
       
   211     CParserProperty* property = NULL;
       
   212     TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count();
       
   213     if ( iArrayElementIndex < elementCount ) 
       
   214         {        
       
   215         property = 
       
   216             iParser->ArrayOfProperties( EFalse )->At( iArrayElementIndex );
       
   217         }
       
   218     return property;
       
   219     }
       
   220 
       
   221 CParserProperty* CVPbkVCardImporter::NextProperty()
   208 CParserProperty* CVPbkVCardImporter::NextProperty()
   222     {
   209     {
   223     // Get next property from parser array
   210     // Get next property from parser array
   224     CParserProperty* property = NULL;
   211     CParserProperty* property = NULL;
   225     TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count();
   212     TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count();
   344     TVPbkVCardDataConverter converter;
   331     TVPbkVCardDataConverter converter;
   345     if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) ||
   332     if ( aData.Uid() == TUid::Uid( KVersitPropertyHBufCUid ) ||
   346          aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) )
   333          aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) )
   347         {
   334         {
   348         const TDesC& value = converter.GetDesCData( aData );
   335         const TDesC& value = converter.GetDesCData( aData );
       
   336         // If it is an IMPP field
   349         if ( aData.FieldType().FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP )
   337         if ( aData.FieldType().FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP )
   350             {
   338             {
   351             TInt pos = value.Find(KColon);
   339             TInt pos = value.Find(KColon);
   352             if( 0 == pos )
   340             if( 0 == pos || KErrNotFound == pos )
   353                 {
   341                 {
   354                 // If the service name is NULL and it's a IMPP field, don't save the data.
   342                 // If the service name or the colon doesn't exist, don't save the data.
   355                 // e.g.:
   343                 // e.g.:
   356                 // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name
   344                 // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name
   357                 // (2) If the value is :peterpan@yahoo.com, the service name is NULL
   345                 // (2) If the value is :peterpan@yahoo.com, the service name is NULL
       
   346                 // (3) If the value is peterpan@yahoo.com, neither the service name and the colon exists
   358                 isSaved = EFalse;
   347                 isSaved = EFalse;
   359                 }
   348                 }
   360             }
   349             }
   361         if ( isSaved )
   350         if ( isSaved )
   362             {
   351             {
   477     {
   466     {
   478     if (&aOperation == iAddFieldOperation)
   467     if (&aOperation == iAddFieldOperation)
   479         {
   468         {
   480         delete iAddFieldOperation;
   469         delete iAddFieldOperation;
   481         iAddFieldOperation = NULL;
   470         iAddFieldOperation = NULL;
   482         StartAsync( ESaveField );
       
   483         }    
   471         }    
   484     if (&aOperation == iAddCntContactFieldOperation)
   472     if (&aOperation == iAddCntContactFieldOperation)
   485         {
   473         {
   486         delete iAddCntContactFieldOperation;
   474         delete iAddCntContactFieldOperation;
   487         iAddCntContactFieldOperation = NULL;
   475         iAddCntContactFieldOperation = NULL;
       
   476         }
       
   477     // When both operations have completed
       
   478     if ( !iAddFieldOperation && !iAddCntContactFieldOperation )
       
   479         {
       
   480         StartAsync( ESaveField );
   488         }
   481         }
   489     }
   482     }
   490     
   483     
   491 void CVPbkVCardImporter::FieldAddingFailed(
   484 void CVPbkVCardImporter::FieldAddingFailed(
   492         MVPbkContactOperationBase& aOperation, 
   485         MVPbkContactOperationBase& aOperation,