phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp
branchRCL_3
changeset 17 2666d9724c76
parent 15 34879f5cfc63
child 18 d4f567ce2e7c
equal deleted inserted replaced
15:34879f5cfc63 17:2666d9724c76
    85 #include <Pbk2Debug.h>
    85 #include <Pbk2Debug.h>
    86 
    86 
    87 _LIT( KGeoSeparator, ",");
    87 _LIT( KGeoSeparator, ",");
    88 const TInt KGeoSeparatorLength = 1;
    88 const TInt KGeoSeparatorLength = 1;
    89 const TReal32 KGeoHorizontalAccuracy = 0;
    89 const TReal32 KGeoHorizontalAccuracy = 0;
    90 const TInt KGeoMaxSize = 50;
    90 const TInt KGeoMaxSize = 60;
    91 const TInt KGeoFormatWidth = 11;
    91 const TInt KGeoFormatWidth = 11;
    92 
    92 
    93 // --------------------------------------------------------------------------
    93 // --------------------------------------------------------------------------
    94 // CPmapCmd::CPmapCmd
    94 // CPmapCmd::CPmapCmd
    95 // --------------------------------------------------------------------------
    95 // --------------------------------------------------------------------------
   341     MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
   341     MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
   342 	TInt count = arrFields.FieldCount();
   342 	TInt count = arrFields.FieldCount();
   343 	for( TInt idx = 0; idx < count; idx++)
   343 	for( TInt idx = 0; idx < count; idx++)
   344 		{
   344 		{
   345 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
   345 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
   346 		TArray<TVPbkFieldVersitProperty> arrProp = field.BestMatchingFieldType()->VersitProperties();
   346 		const MVPbkFieldType* type = field.BestMatchingFieldType();
   347 		for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
   347 		if ( type )
   348 			{
   348 		    {
   349 			if( arrProp[idx2].Name() == EVPbkVersitNameADR  )
   349             TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties();
   350 				{
   350             for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ )
   351 				if( arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME ) )
   351                 {
   352 					{
   352                 if ( arrProp[idx2].Name() == EVPbkVersitNameADR )
   353 					if( grupId == EPbk2FieldGroupIdNone )
   353                     {
   354 						{
   354                     if ( arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME ) )
   355 						grupId = EPbk2FieldGroupIdHomeAddress;
   355                         {
   356 						}
   356                         if ( grupId == EPbk2FieldGroupIdNone )
   357 					else if( grupId != EPbk2FieldGroupIdHomeAddress )
   357                             {
   358 						{
   358                             grupId = EPbk2FieldGroupIdHomeAddress;
   359 						return EPbk2FieldGroupIdNone;
   359                             }
   360 						}
   360                         else if ( grupId != EPbk2FieldGroupIdHomeAddress )
   361 					}
   361                             {
   362 				else if( arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ) )
   362                             return EPbk2FieldGroupIdNone;
   363 					{
   363                             }
   364 					if( grupId == EPbk2FieldGroupIdNone )
   364                         }
   365 						{
   365                     else if ( arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ) )
   366 						grupId = EPbk2FieldGroupIdCompanyAddress;
   366                         {
   367 						}
   367                         if ( grupId == EPbk2FieldGroupIdNone )
   368 					else if( grupId != EPbk2FieldGroupIdCompanyAddress )
   368                             {
   369 						{
   369                             grupId = EPbk2FieldGroupIdCompanyAddress;
   370 						return EPbk2FieldGroupIdNone;
   370                             }
   371 						}
   371                         else if ( grupId != EPbk2FieldGroupIdCompanyAddress )
   372 					}
   372                             {
   373 				else
   373                             return EPbk2FieldGroupIdNone;
   374 					{
   374                             }
   375 					if( grupId == EPbk2FieldGroupIdNone )
   375                         }
   376 						{
   376                     else
   377 						grupId = EPbk2FieldGroupIdPostalAddress;
   377                         {
   378 						}
   378                         if ( grupId == EPbk2FieldGroupIdNone )
   379 					else if( grupId != EPbk2FieldGroupIdPostalAddress )
   379                             {
   380 						{
   380                             grupId = EPbk2FieldGroupIdPostalAddress;
   381 						return EPbk2FieldGroupIdNone;
   381                             }
   382 						}
   382                         else if ( grupId != EPbk2FieldGroupIdPostalAddress )
   383 					}
   383                             {
   384 				}
   384                             return EPbk2FieldGroupIdNone;
   385 			}
   385                             }
       
   386                         }
       
   387                     }
       
   388                 }
       
   389 		    }
   386 		}
   390 		}
   387     
   391     
   388 	return grupId;
   392 	return grupId;
   389     }
   393     }
   390 
   394 
   684 			
   688 			
   685 			if( !dataText.Length() )
   689 			if( !dataText.Length() )
   686 				{
   690 				{
   687 				continue;
   691 				continue;
   688 				}
   692 				}
   689 			
   693 			const MVPbkFieldType* type = field.BestMatchingFieldType();
   690 			TArray<TVPbkFieldVersitProperty> arrProp = field.BestMatchingFieldType()->VersitProperties();
   694 			if ( type )
   691 			for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
   695 			    {
   692 				{
   696 			    TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties();
   693 				if( arrProp[idx2].Name() == EVPbkVersitNameADR && 
   697                 for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ )
   694 					( arrProp[idx2].Parameters().Contains(aAddressType) ||
   698                     {
   695 					  ( aAddressType == EVPbkVersitParamPREF && 
   699                     if ( arrProp[idx2].Name() == EVPbkVersitNameADR
   696 					    !arrProp[idx2].Parameters().Contains(EVPbkVersitParamHOME) &&
   700                         && (arrProp[idx2].Parameters().Contains( aAddressType )
   697 					    !arrProp[idx2].Parameters().Contains(EVPbkVersitParamWORK) ) ) )
   701                             || (aAddressType == EVPbkVersitParamPREF
   698 					{
   702                                 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME )
   699 					if( arrProp[idx2].SubField() == EVPbkVersitSubFieldCountry )
   703                                 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ))) )
   700 						{
   704                         {
   701 						aLandmark.SetPositionFieldL( EPositionFieldCountry, dataText );
   705                         if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldCountry )
   702 						continue;
   706                             {
   703 						}
   707                             aLandmark.SetPositionFieldL( EPositionFieldCountry, dataText );
   704 					else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldLocality )
   708                             continue;
   705 						{
   709                             }
   706 						aLandmark.SetPositionFieldL( EPositionFieldCity, dataText );
   710                         else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldLocality )
   707 						continue;
   711                             {
   708 						}
   712                             aLandmark.SetPositionFieldL( EPositionFieldCity, dataText );
   709 					else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldStreet )
   713                             continue;
   710 						{
   714                             }
   711 						aLandmark.SetPositionFieldL( EPositionFieldStreet, dataText );
   715                         else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldStreet )
   712 						continue;
   716                             {
   713 						}
   717                             aLandmark.SetPositionFieldL( EPositionFieldStreet, dataText );
   714 					else if( arrProp[idx2].SubField() == EVPbkVersitSubFieldPostalCode )
   718                             continue;
   715 						{
   719                             }
   716 						aLandmark.SetPositionFieldL( EPositionFieldPostalCode, dataText );
   720                         else if ( arrProp[idx2].SubField() == EVPbkVersitSubFieldPostalCode )
   717 						continue;
   721                             {
   718 						}
   722                             aLandmark.SetPositionFieldL( EPositionFieldPostalCode, dataText );
   719 					}
   723                             continue;
   720 				}
   724                             }
       
   725                         }
       
   726                     }
       
   727 			    }
   721 			}
   728 			}
   722 		}
   729 		}
   723 	}
   730 	}
   724 
   731 
   725 void CPmapCmd::SetLandmarkNameL(CPosLandmark& aLandmark)
   732 void CPmapCmd::SetLandmarkNameL(CPosLandmark& aLandmark)
   809 			{
   816 			{
   810 			continue;
   817 			continue;
   811 			}
   818 			}
   812 		const TDesC& dataText =
   819 		const TDesC& dataText =
   813 		    MVPbkContactFieldTextData::Cast( fieldData ).Text();
   820 		    MVPbkContactFieldTextData::Cast( fieldData ).Text();
   814 		TInt countProps =
   821 		const MVPbkFieldType* type = field.BestMatchingFieldType();
   815 			field.BestMatchingFieldType()->VersitProperties().Count();
   822 		if ( type )
   816 		TArray<TVPbkFieldVersitProperty> props =
   823 		    {
   817 			field.BestMatchingFieldType()->VersitProperties();
   824 		    TInt countProps = type->VersitProperties().Count();
   818 		for ( TInt idx2 = 0; idx2 < countProps; idx2++ )
   825             TArray<TVPbkFieldVersitProperty> props = type->VersitProperties();
   819 			{
   826             for (TInt idx2 = 0; idx2 < countProps; idx2++ )
   820 		    if ( ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) &&
   827                 {
   821 		         aAddressType == EVPbkVersitParamHOME ) ||
   828                 if ( (props[idx2].Parameters().Contains( EVPbkVersitParamHOME )
   822 			     ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) &&
   829                     && aAddressType == EVPbkVersitParamHOME)
   823 		           aAddressType == EVPbkVersitParamWORK ) ||
   830                     || (props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) 
   824 		           ( !props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) &&
   831                         && aAddressType == EVPbkVersitParamWORK)
   825 		             !props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) &&
   832                     || (!props[idx2].Parameters().Contains( EVPbkVersitParamHOME )
   826 		             aAddressType == EVPbkVersitParamPREF ) )
   833                         && !props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) 
   827 		    	{
   834                         && aAddressType == EVPbkVersitParamPREF) )
   828 			    result = DoFillGeoLandmarkL( aLandmark, dataText );
   835                     {
   829 			    break;
   836                     result = DoFillGeoLandmarkL( aLandmark, dataText );
   830 		    	}
   837                     break;
   831 			}
   838                     }
       
   839                 }
       
   840 		    }
   832 		}
   841 		}
   833 	return result;
   842 	return result;
   834 	}
   843 	}
   835 
   844 
   836 // --------------------------------------------------------------------------
   845 // --------------------------------------------------------------------------
   844 	TInt separator = aDataText.Find( KGeoSeparator );
   853 	TInt separator = aDataText.Find( KGeoSeparator );
   845 	if ( separator != KErrNotFound )
   854 	if ( separator != KErrNotFound )
   846 		{
   855 		{
   847 		TReal64 latitude = 0;
   856 		TReal64 latitude = 0;
   848 		TReal64 logitude = 0;
   857 		TReal64 logitude = 0;
   849 		TLex lexLatitude( aDataText.Left( aDataText.Length() - separator ) );
   858         TLex lexLatitude( aDataText.Left( separator ) );
   850 		TLex lexLogitude( aDataText.Right( aDataText.Length()
   859 		TLex lexLogitude( aDataText.Right( aDataText.Length()
   851 				- separator - KGeoSeparatorLength ) );
   860 				- separator - KGeoSeparatorLength ) );
   852 		if ( lexLatitude.Val( latitude ) == KErrNone
   861 		if ( lexLatitude.Val( latitude ) == KErrNone
   853 				&& lexLogitude.Val( logitude ) == KErrNone )
   862 				&& lexLogitude.Val( logitude ) == KErrNone )
   854 			{
   863 			{
   855 			TLocality loc( TCoordinate( latitude, logitude ),
   864 			TLocality loc( TCoordinate( latitude, logitude ),
   856 					KGeoHorizontalAccuracy );
   865 					KGeoHorizontalAccuracy );
   857 			aLandmark.SetPositionL( loc );
   866 			aLandmark.SetPositionL( loc );
   858 			result = ETrue;
   867             TInt separator2 = aDataText.Right( aDataText.Length() - separator - KGeoSeparatorLength ).Find( KGeoSeparator );
   859 			}
   868             if(separator2 != KErrNotFound)
       
   869                 {
       
   870                 separator += separator2;
       
   871                 aLandmark.SetPositionFieldL(EPositionFieldCountryCode,aDataText.Right( aDataText.Length() - separator - (KGeoSeparatorLength * 2) ));
       
   872                 }
       
   873             result = ETrue;
       
   874             }
   860 		}
   875 		}
   861 	return result;
   876 	return result;
   862 	}
   877 	}
   863 
   878 
   864 // --------------------------------------------------------------------------
   879 // --------------------------------------------------------------------------
   892 		{
   907 		{
   893 		landmarks.AppendL( landmark );
   908 		landmarks.AppendL( landmark );
   894 		iMapView->AddLandmarksToShowL( landmarks );
   909 		iMapView->AddLandmarksToShowL( landmarks );
   895 		iNoAddress = EFalse;
   910 		iNoAddress = EFalse;
   896 		}
   911 		}
       
   912     else
       
   913         {
       
   914         landmark->SetPositionFieldL(EPositionFieldCity,KNullDesC16);
       
   915         TLocality tempLoc;
       
   916         tempLoc.SetCoordinate(-0.0,-0.0);
       
   917         landmark->SetPositionL(tempLoc);
       
   918         
       
   919         landmarks.AppendL( landmark );
       
   920         iMapView->AddLandmarksToShowL( landmarks );
       
   921         }
   897 
   922 
   898 	iMapView->SelectFromMapL( iStatus );
   923 	iMapView->SelectFromMapL( iStatus );
   899 	iCurrentMapLaunchedByState = EMapAssignFromMaps;
   924 	iCurrentMapLaunchedByState = EMapAssignFromMaps;
   900 	SetActive();
   925 	SetActive();
   901 	CleanupStack::PopAndDestroy( landmark );
   926 	CleanupStack::PopAndDestroy( landmark );
   905 // --------------------------------------------------------------------------
   930 // --------------------------------------------------------------------------
   906 // CPmapCmd::UpdateCoordsL
   931 // CPmapCmd::UpdateCoordsL
   907 // --------------------------------------------------------------------------
   932 // --------------------------------------------------------------------------
   908 //
   933 //
   909 void CPmapCmd::UpdateCoordsL( 
   934 void CPmapCmd::UpdateCoordsL( 
   910 		TLocality& aLocality,
   935         const CPosLandmark& aLandmark,
   911 		TVPbkFieldTypeParameter aAddressType )
   936 		TVPbkFieldTypeParameter aAddressType )
   912 	{
   937 	{
   913 	TReal64 latitude = aLocality.Latitude();
   938     TLocality locality;
   914 	TReal64 longitude = aLocality.Longitude();
   939     aLandmark.GetPosition(locality);   
       
   940     TReal64 latitude = locality.Latitude();
       
   941     TReal64 longitude = locality.Longitude();
   915 	RBuf geoData;
   942 	RBuf geoData;
   916 	RBuf textNumber;
   943 	RBuf textNumber;
   917 	CleanupClosePushL( geoData );
   944 	CleanupClosePushL( geoData );
   918 	CleanupClosePushL( textNumber );
   945 	CleanupClosePushL( textNumber );
   919 	geoData.CreateL( KGeoMaxSize );
   946 	geoData.CreateL( KGeoMaxSize );
   922 	textNumber.Num( latitude, format );
   949 	textNumber.Num( latitude, format );
   923 	geoData = textNumber;
   950 	geoData = textNumber;
   924 	geoData += KGeoSeparator();
   951 	geoData += KGeoSeparator();
   925 	textNumber.Num( longitude, format );
   952 	textNumber.Num( longitude, format );
   926 	geoData += textNumber;
   953 	geoData += textNumber;
       
   954 
       
   955     if(aLandmark.IsPositionFieldAvailable( EPositionFieldCountryCode ))
       
   956         {
       
   957         TPtrC countryCode;
       
   958         aLandmark.GetPositionField(EPositionFieldCountryCode,countryCode);
       
   959         geoData += KGeoSeparator();
       
   960         geoData += countryCode;
       
   961         }
   927 	CleanupStack::PopAndDestroy( &textNumber );
   962 	CleanupStack::PopAndDestroy( &textNumber );
   928 	
   963 	
   929 	TBool updated = EFalse;
   964 	TBool updated = EFalse;
   930 	MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
   965 	MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
   931 	TInt count = arrFields.FieldCount();
   966 	TInt count = arrFields.FieldCount();
   932 	for( TInt idx = 0; idx < count; idx++)
   967 	for( TInt idx = 0; idx < count; idx++)
   933 		{
   968 		{
   934 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
   969 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
   935 		TInt countProps =
   970 		const MVPbkFieldType* type = field.BestMatchingFieldType();
   936 		    field.BestMatchingFieldType()->VersitProperties().Count();
   971 		if ( type )
   937 		TArray<TVPbkFieldVersitProperty> props =
   972 		    {		    
   938 		    field.BestMatchingFieldType()->VersitProperties();
   973 		    TInt countProps = type->VersitProperties().Count();
   939 		for ( TInt idx2 = 0; idx2 < countProps; idx2++ )
   974             TArray<TVPbkFieldVersitProperty> props = type->VersitProperties();
   940 		    {
   975             for (TInt idx2 = 0; idx2 < countProps; idx2++ )
   941 		    if ( props[ idx2 ].Name() == EVPbkVersitNameGEO &&
   976                 {
   942 		    	 ( ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) &&
   977                 if ( props[idx2].Name() == EVPbkVersitNameGEO
   943                    aAddressType == EVPbkVersitParamHOME ) ||
   978                     && ((props[idx2].Parameters().Contains( EVPbkVersitParamHOME ) 
   944 		    	   ( props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) &&
   979                         && aAddressType == EVPbkVersitParamHOME)
   945                      aAddressType == EVPbkVersitParamWORK ) ||
   980                         || (props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) 
   946                      ( !props[ idx2 ].Parameters().Contains( EVPbkVersitParamHOME ) &&
   981                             && aAddressType == EVPbkVersitParamWORK)
   947                        !props[ idx2 ].Parameters().Contains( EVPbkVersitParamWORK ) &&
   982                         || (!props[idx2].Parameters().Contains( EVPbkVersitParamHOME )
   948                        aAddressType == EVPbkVersitParamPREF ) ) )
   983                             && !props[idx2].Parameters().Contains( EVPbkVersitParamWORK ) 
   949 		        {
   984                             && aAddressType == EVPbkVersitParamPREF)) )
   950 		        MVPbkContactFieldData& fieldData = field.FieldData();
   985                     {
   951 		        MVPbkContactFieldTextData& data = 
   986                     MVPbkContactFieldData& fieldData = field.FieldData();
   952 		            MVPbkContactFieldTextData::Cast( fieldData );
   987                     MVPbkContactFieldTextData& data =
   953 		        data.SetTextL( geoData );
   988                         MVPbkContactFieldTextData::Cast( fieldData );
   954 		        updated = ETrue;
   989                     data.SetTextL( geoData );
   955 		        break;
   990                     updated = ETrue;
   956 		        }
   991                     break;
       
   992                     }
       
   993                 }
   957 		    }
   994 		    }
   958 		}
   995 		}
   959 	
   996 	
   960 	if( !updated )
   997 	if( !updated )
   961 		{
   998 		{
  1050 		MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
  1087 		MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
  1051 		TInt count = arrFields.FieldCount();
  1088 		TInt count = arrFields.FieldCount();
  1052 		for( TInt idx = 0; idx < count; idx++)
  1089 		for( TInt idx = 0; idx < count; idx++)
  1053 			{
  1090 			{
  1054 			MVPbkStoreContactField& field = arrFields.FieldAt(idx);
  1091 			MVPbkStoreContactField& field = arrFields.FieldAt(idx);
  1055 			TArray<TVPbkFieldVersitProperty> arrProp = field.BestMatchingFieldType()->VersitProperties();
  1092 			const MVPbkFieldType* type = field.BestMatchingFieldType();
  1056 			for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
  1093 			if ( type )
  1057 				{
  1094 			    {
  1058 				if( arrProp[idx2].Name() == EVPbkVersitNameADR && 
  1095                 TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties();
  1059 					arrProp[idx2].SubField() == aVersitSubField &&
  1096                 for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ )
  1060 					( arrProp[idx2].Parameters().Contains(aAddressType) ||
  1097                     {
  1061 					  ( aAddressType == EVPbkVersitParamPREF && 
  1098                     if ( arrProp[idx2].Name() == EVPbkVersitNameADR
  1062 						!arrProp[idx2].Parameters().Contains(EVPbkVersitParamHOME) &&
  1099                         && arrProp[idx2].SubField() == aVersitSubField
  1063 						!arrProp[idx2].Parameters().Contains(EVPbkVersitParamWORK) ) ) )
  1100                         && (arrProp[idx2].Parameters().Contains( aAddressType )
  1064 					{
  1101                             || (aAddressType == EVPbkVersitParamPREF
  1065 					MVPbkContactFieldData& fieldData = field.FieldData();
  1102                                 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamHOME )
  1066 					if( fieldData.DataType() != EVPbkFieldStorageTypeText )
  1103                                 && !arrProp[idx2].Parameters().Contains( EVPbkVersitParamWORK ))) )
  1067 						{
  1104                         {
  1068 						continue;
  1105                         MVPbkContactFieldData& fieldData = field.FieldData();
  1069 						}
  1106                         if ( fieldData.DataType() != EVPbkFieldStorageTypeText )
  1070 					MVPbkContactFieldTextData& data = 
  1107                             {
  1071 					   MVPbkContactFieldTextData::Cast( fieldData );
  1108                             continue;
  1072 					if ( aLandmark.IsPositionFieldAvailable( aPositionField ) )
  1109                             }
  1073 						{
  1110                         MVPbkContactFieldTextData& data =
  1074 						data.SetTextL( textData );
  1111                             MVPbkContactFieldTextData::Cast( fieldData );
  1075 						}
  1112                         if ( aLandmark.IsPositionFieldAvailable( aPositionField ) )
  1076 					else
  1113                             {
  1077 						{
  1114                             data.SetTextL( textData );
  1078 						data.SetTextL( KNullDesC() );
  1115                             }
  1079 						}
  1116                         else
  1080 					
  1117                             {
  1081 					updated = ETrue;
  1118                             data.SetTextL( KNullDesC() );
  1082 					continue;
  1119                             }
  1083 					}
  1120 
  1084 				}
  1121                         updated = ETrue;
       
  1122                         continue;
       
  1123                         }
       
  1124                     }
       
  1125 			    }
  1085 			}
  1126 			}
  1086 		}
  1127 		}
  1087 	
  1128 	
  1088 	if( !updated && aLandmark.IsPositionFieldAvailable( aPositionField ) )
  1129 	if( !updated && aLandmark.IsPositionFieldAvailable( aPositionField ) )
  1089 		{
  1130 		{
  1133 	MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
  1174 	MVPbkStoreContactFieldCollection& arrFields = iContact->Fields();
  1134 	TInt count = arrFields.FieldCount();
  1175 	TInt count = arrFields.FieldCount();
  1135 	for( TInt idx = 0; idx < count; idx++)
  1176 	for( TInt idx = 0; idx < count; idx++)
  1136 		{
  1177 		{
  1137 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
  1178 		MVPbkStoreContactField& field = arrFields.FieldAt(idx);
  1138 		TArray<TVPbkFieldVersitProperty> arrProp = field.BestMatchingFieldType()->VersitProperties();
  1179 		const MVPbkFieldType* type = field.BestMatchingFieldType();
  1139 		for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
  1180 		if ( type )
  1140 			{
  1181 		    {
  1141 			if( arrProp[idx2].Name() == EVPbkVersitNameADR  )
  1182 		    TArray<TVPbkFieldVersitProperty> arrProp = type->VersitProperties();
  1142 				{
  1183 		    for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
  1143 				return ETrue;
  1184 			    {
  1144 				}
  1185 			    if( arrProp[idx2].Name() == EVPbkVersitNameADR  )
       
  1186 			    	{
       
  1187 				    return ETrue;
       
  1188 				    }
       
  1189 			    }
  1145 			}
  1190 			}
  1146 		}
  1191 		}
  1147 	return EFalse;
  1192 	return EFalse;
  1148     }
  1193     }
  1149 
  1194 
  1371             UpdateFieldL( *result, EPositionFieldNone, 
  1416             UpdateFieldL( *result, EPositionFieldNone, 
  1372                             EVPbkVersitSubFieldExtendedAddress, iAddressType );
  1417                             EVPbkVersitSubFieldExtendedAddress, iAddressType );
  1373             
  1418             
  1374             if( geocoordsExist )
  1419             if( geocoordsExist )
  1375                 {
  1420                 {
  1376                 UpdateCoordsL( locality, iAddressType );
  1421                 UpdateCoordsL( *result, iAddressType);
  1377                 }
  1422                 }
  1378             if ( !iEditorControl )
  1423             if ( !iEditorControl )
  1379                 {
  1424                 {
  1380                 iContact->CommitL( *this );
  1425                 iContact->CommitL( *this );
  1381                 CActiveScheduler::Start();
  1426                 CActiveScheduler::Start();
  1556         UpdateFieldL( *result, EPositionFieldNone,
  1601         UpdateFieldL( *result, EPositionFieldNone,
  1557             EVPbkVersitSubFieldExtendedAddress, iAddressType );
  1602             EVPbkVersitSubFieldExtendedAddress, iAddressType );
  1558 
  1603 
  1559         if ( geocoordsExist )
  1604         if ( geocoordsExist )
  1560             {
  1605             {
  1561             UpdateCoordsL( locality, iAddressType );
  1606             UpdateCoordsL( *result, iAddressType );
  1562             }
  1607             }
  1563         if ( !iEditorControl )
  1608         if ( !iEditorControl )
  1564             {
  1609             {
  1565             iContact->CommitL( *this );
  1610             iContact->CommitL( *this );
  1566             CActiveScheduler::Start();
  1611             CActiveScheduler::Start();