--- a/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Wed Aug 18 00:46:12 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp Tue Aug 31 18:53:38 2010 +0530
@@ -22,6 +22,8 @@
#include <MmsEngineDomainCRKeys.h>
#include <MsgMediaResolver.h>
#include <DRMHelper.h>
+#include <ccsdefs.h> // for KDefaultGsmNumberMatchLength
+#include <telconfigcrkeys.h> // for KCRUidTelephonyConfiguration
#include "MessagingVariant.hrh"
#include "MessagingInternalCRKeys.h" // Keys
@@ -47,7 +49,8 @@
UniEditorGenUtils::UniEditorGenUtils() :
mAbsMaxConcatenatedSms(-1),
mAbsMaxSmsCharacters(-1),
-mMaxMmsSize(-1)
+mMaxMmsSize(-1),
+mMatchDigitCount(-1)
{
}
@@ -602,4 +605,41 @@
return ( aDomain[length-1] != '.' );
}
+// ----------------------------------------------------
+// UniEditorGenUtils::MatchPhoneNumber
+// @see header
+// ----------------------------------------------------
+TBool UniEditorGenUtils::MatchPhoneNumberL(
+ TDesC& aFirstNumber, TDesC& aSecondNumber)
+ {
+ // if matching digit count is already read from CR, then don't do that again
+ if(mMatchDigitCount == -1)
+ {
+ mMatchDigitCount = KDefaultGsmNumberMatchLength;
+ // Read the amount of digits to be used in contact matching
+ // The key is owned by PhoneApp
+ CRepository* repository = CRepository::NewL(KCRUidTelConfiguration);
+ CleanupStack::PushL(repository);
+ if (repository->Get(KTelMatchDigits, mMatchDigitCount) == KErrNone)
+ {
+ // Min is 7
+ mMatchDigitCount = Max(mMatchDigitCount, KDefaultGsmNumberMatchLength);
+ }
+ CleanupStack::PopAndDestroy(); // repository
+ }
+
+ // start matching
+ if( (aFirstNumber.Length() == 0) || (aSecondNumber.Length() == 0) )
+ {
+ return EFalse;
+ }
+
+ if (aFirstNumber.Right(mMatchDigitCount).CompareF(
+ aSecondNumber.Right(mMatchDigitCount)) == 0)
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
// End of file