phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp
branchRCL_3
changeset 45 34879f5cfc63
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
39:a6539d1e8e43 45:34879f5cfc63
    18 
    18 
    19 #include "CVPbkPhoneNumberParallelMatchStrategy.h"
    19 #include "CVPbkPhoneNumberParallelMatchStrategy.h"
    20 
    20 
    21 #include <MVPbkContactStore.h>
    21 #include <MVPbkContactStore.h>
    22 #include <CVPbkContactFindOperation.h>
    22 #include <CVPbkContactFindOperation.h>
       
    23 #include <cntdb.h>
    23 
    24 
    24 CVPbkPhoneNumberParallelMatchStrategy::CVPbkPhoneNumberParallelMatchStrategy()
    25 CVPbkPhoneNumberParallelMatchStrategy::CVPbkPhoneNumberParallelMatchStrategy()
    25     {
    26     {
    26     }
    27     }
    27 
    28 
    52 
    53 
    53 MVPbkContactOperation* CVPbkPhoneNumberParallelMatchStrategy::CreateFindOperationLC(
    54 MVPbkContactOperation* CVPbkPhoneNumberParallelMatchStrategy::CreateFindOperationLC(
    54         const TDesC& aPhoneNumber)
    55         const TDesC& aPhoneNumber)
    55     {
    56     {
    56     CVPbkContactFindOperation* operation = NULL;
    57     CVPbkContactFindOperation* operation = NULL;
    57 
    58     
    58     if (!iMatchingStarted)
    59     if (!iMatchingStarted)
    59         {
    60         {
    60         operation = CVPbkContactFindOperation::NewLC(FindObserver());
    61         operation = CVPbkContactFindOperation::NewLC(FindObserver());
    61         const TInt storeCount = StoresToMatch().Count();
    62         const TInt storeCount = StoresToMatch().Count();
       
    63         TInt maxDigits = MaxMatchDigits();
       
    64         
    62         for (TInt i = 0; i < storeCount; ++i)
    65         for (TInt i = 0; i < storeCount; ++i)
    63             {
    66             {
    64             MVPbkContactOperation* subOperation = 
    67             MVPbkContactOperation* subOperation = NULL;
    65                     StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
    68             
    66                                aPhoneNumber, MaxMatchDigits(), *operation);
    69             if ( maxDigits == KBestMatchingPhoneNumbers &&
       
    70                     IsSimStore( *( StoresToMatch()[i] ) ) )
       
    71                 {
       
    72                 // KBestMatchingPhoneNumbers enables best matching strategy 
       
    73                 // on store level only for phone memory stores, for sim store
       
    74                 // MaxDigits parameter should be set to 7 or greater
       
    75                 const TInt KMaxDigitsForSimStore = 7;
       
    76                 subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
       
    77                         aPhoneNumber, KMaxDigitsForSimStore, *operation);
       
    78                 }
       
    79             else
       
    80                 {
       
    81                 subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL(
       
    82                         aPhoneNumber, maxDigits, *operation);
       
    83                 }
       
    84 
    67             if (subOperation)
    85             if (subOperation)
    68                 {
    86                 {
    69                 CleanupDeletePushL(subOperation);
    87                 CleanupDeletePushL(subOperation);
    70                 operation->AddSubOperationL(subOperation);
    88                 operation->AddSubOperationL(subOperation);
    71                 CleanupStack::Pop(); // subOperation
    89                 CleanupStack::Pop(); // subOperation