phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp
branchRCL_3
changeset 45 34879f5cfc63
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp	Wed Jun 09 09:26:27 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp	Mon Jun 21 15:24:27 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <MVPbkContactStore.h>
 #include <MVPbkContactOperation.h>
+#include <cntdb.h>
 
 CVPbkPhoneNumberSequentialMatchStrategy::CVPbkPhoneNumberSequentialMatchStrategy() 
     {
@@ -54,13 +55,26 @@
         const TDesC& aPhoneNumber)
     {
     MVPbkContactOperation* operation = NULL;
-
+    TInt maxDigits = MaxMatchDigits();
     // Get the next store's operation if it not null
     while ( iCurrentOperation < StoresToMatch().Count() && !operation )
         {
-        operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL(
-                aPhoneNumber, MaxMatchDigits(), FindObserver());
-        
+        if ( maxDigits == KBestMatchingPhoneNumbers &&
+                IsSimStore( *( StoresToMatch()[iCurrentOperation] ) ) )
+            {
+            // KBestMatchingPhoneNumbers enables best matching strategy 
+            // on store level only for phone memory stores, for sim store
+            // MaxDigits parameter should be set to 7 or greater
+            const TInt KMaxDigitsForSimStore = 7;
+            operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL(
+                    aPhoneNumber, KMaxDigitsForSimStore, FindObserver());
+            }
+        else
+            {
+            operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL(
+                    aPhoneNumber, maxDigits, FindObserver());
+            }
+
         if ( operation )
             {
             CleanupDeletePushL(operation);