phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkVCardImporter.cpp
branchRCL_3
changeset 9 0d28c1c5b6dd
parent 0 e686773b3f54
child 17 2666d9724c76
--- a/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkVCardImporter.cpp	Wed Apr 14 15:45:35 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkVCardImporter.cpp	Tue Apr 27 16:23:35 2010 +0300
@@ -43,6 +43,8 @@
 #include <VPbkStoreUriLiterals.h>
 _LIT8( KPropXSelf, "X-SELF" );
 _LIT8( KPropXCategories, "X-CATEGORIES");
+_LIT8( KPropXIMPP, "X-IMPP");
+_LIT(KColon, ":");
 
 CVPbkVCardImporter* CVPbkVCardImporter::NewL(
             RPointerArray<MVPbkStoreContact>& aImportedContacts,
@@ -203,6 +205,19 @@
     iObserver = &aObserver;
     }
 
+CParserProperty* CVPbkVCardImporter::GetCurrentProperty()
+    {
+    // Get current property from parser array
+    CParserProperty* property = NULL;
+    TInt elementCount = iParser->ArrayOfProperties( EFalse )->Count();
+    if ( iArrayElementIndex < elementCount ) 
+        {        
+        property = 
+            iParser->ArrayOfProperties( EFalse )->At( iArrayElementIndex );
+        }
+    return property;
+    }
+
 CParserProperty* CVPbkVCardImporter::NextProperty()
     {
     // Get next property from parser array
@@ -331,7 +346,19 @@
          aData.Uid() == TUid::Uid( KVersitPropertyCDesCArrayUid ) )
         {
         const TDesC& value = converter.GetDesCData( aData );
-        SaveL( aData, value );
+        TInt pos = value.Find(KColon);
+        if( 0 == pos && 0 == GetCurrentProperty()->Name().Compare(KPropXIMPP()) )
+            {
+            // If the service name is NULL and it's a IMPP field, don't save the data.
+            // e.g.:
+            // (1) If the value is YAHOO:peterpan@yahoo.com, YAHOO is the service name
+            // (2) If the value is :peterpan@yahoo.com, the service name is NULL
+            isSaved = EFalse;
+            }
+        else
+            {
+            SaveL( aData, value );
+            }
         }
     else if ( aData.Uid() == TUid::Uid( KVersitPropertyBinaryUid ) )
         {