pimprotocols/pbap/server/pbapvcardexporterutil.cpp
branchRCL_3
changeset 63 f4a778e096c2
parent 62 5b6f26637ad3
child 68 9da50d567e3c
--- a/pimprotocols/pbap/server/pbapvcardexporterutil.cpp	Tue Aug 31 15:05:21 2010 +0300
+++ b/pimprotocols/pbap/server/pbapvcardexporterutil.cpp	Wed Sep 01 12:29:52 2010 +0100
@@ -21,8 +21,6 @@
 #include <s32strm.h>
 #include <vprop.h>
 #include <vcard.h>
-#include <centralrepository.h>
-
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include "vcard3.h"
 #include "cntdb_internal.h"
@@ -31,13 +29,6 @@
 #include "pbaplogeng.h"
 #include "btaccesshostlog.h"
 
-/* These constants are properly defined in telconfigcrkeys.h, however we 
-are not allowed to include that from here.  As a temporary fix the constants 
-from that file are re-defined here. */
-const TUid KCRUidTelConfiguration = {0x102828B8};
-const TUint32 KTelMatchDigits = 0x00000001;
-/* And similarly this constant is defined in ccsdefs.h */
-const TInt KDefaultGsmNumberMatchLength = 7;
 
 //constants
 _LIT8(KVersitTokenCALLDATETIME,"X-IRMC-CALL-DATETIME");
@@ -68,23 +59,6 @@
 	LOG_FUNC
 	CVersitTlsData::VersitTlsDataL();		
 	User::LeaveIfError(iTzClient.Connect());
-	
-	// Read the amount of digits to be used in contact matching
-	// The key is properly owned by PhoneApp, however we cannot include
-	// that header file from here, so a temporary fix has been done to 
-	// use locally defined versions.  If there is a problem here it is 
-	// likely because these values have gone out of sync.
-	CRepository* repository = CRepository::NewLC(KCRUidTelConfiguration);
-    if ( repository->Get(KTelMatchDigits, iMatchDigitCount) == KErrNone )
-        {
-        // Min is 7
-        iMatchDigitCount = Max(iMatchDigitCount, KDefaultGsmNumberMatchLength);
-        }
-    else
-        {
-        iMatchDigitCount = KDefaultGsmNumberMatchLength;
-        }
-	CleanupStack::PopAndDestroy(repository);
 	}
 
 CPbapVCardExporterUtil::~CPbapVCardExporterUtil()
@@ -187,12 +161,16 @@
 TContactItemId CPbapVCardExporterUtil::FindContactIdFromNumberL(const TDesC& aNumber)
 	{
 	TContactItemId ret = KNullContactId;
-	CContactIdArray* contactIdArray = iDatabase.MatchPhoneNumberL(aNumber, iMatchDigitCount);
+	CContactItemFieldDef* fieldDef;
+	fieldDef = new(ELeave) CContactItemFieldDef;
+	CleanupStack::PushL(fieldDef);
+	fieldDef->AppendL(KUidContactFieldPhoneNumber);
+	CContactIdArray* contactIdArray = iDatabase.FindLC(aNumber, fieldDef);
 	if (contactIdArray->Count() > 0)
 		{
 		ret = (*contactIdArray)[0];
 		}
-	delete contactIdArray;
+	CleanupStack::PopAndDestroy(2); // contactIdArray, fieldDef
 	return ret;
 	}