phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp
branchRCL_3
changeset 15 34879f5cfc63
parent 0 e686773b3f54
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp	Wed Jun 09 09:26:27 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp	Mon Jun 21 15:24:27 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <MVPbkContactStore.h>
 #include <CVPbkContactFindOperation.h>
+#include <cntdb.h>
 
 CVPbkPhoneNumberParallelMatchStrategy::CVPbkPhoneNumberParallelMatchStrategy()
     {
@@ -54,16 +55,33 @@
         const TDesC& aPhoneNumber)
     {
     CVPbkContactFindOperation* operation = NULL;
-
+    
     if (!iMatchingStarted)
         {
         operation = CVPbkContactFindOperation::NewLC(FindObserver());
         const TInt storeCount = StoresToMatch().Count();
+        TInt maxDigits = MaxMatchDigits();
+        
         for (TInt i = 0; i < storeCount; ++i)
             {
-            MVPbkContactOperation* subOperation = 
-                    StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
-                               aPhoneNumber, MaxMatchDigits(), *operation);
+            MVPbkContactOperation* subOperation = NULL;
+            
+            if ( maxDigits == KBestMatchingPhoneNumbers &&
+                    IsSimStore( *( StoresToMatch()[i] ) ) )
+                {
+                // 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;
+                subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
+                        aPhoneNumber, KMaxDigitsForSimStore, *operation);
+                }
+            else
+                {
+                subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
+                        aPhoneNumber, maxDigits, *operation);
+                }
+
             if (subOperation)
                 {
                 CleanupDeletePushL(subOperation);