phoneengine/PhoneCntFinder/ContactService/src/cphcntcontactmatchstrategy.cpp
branchRCL_3
changeset 39 b8d67d6176f5
parent 0 5f000ab63145
child 58 40a3f856b14d
equal deleted inserted replaced
34:b68fcd923911 39:b8d67d6176f5
    18 
    18 
    19 #include <CVPbkContactManager.h>
    19 #include <CVPbkContactManager.h>
    20 #include <centralrepository.h>
    20 #include <centralrepository.h>
    21 #include <telconfigcrkeys.h>
    21 #include <telconfigcrkeys.h>
    22 #include <CVPbkContactStoreUriArray.h>
    22 #include <CVPbkContactStoreUriArray.h>
       
    23 #include <cntdb.h>  // KBestMatchingPhoneNumbers
    23 
    24 
    24 #include "cphcntcontactmatchstrategy.h"
    25 #include "cphcntcontactmatchstrategy.h"
    25 #include "cphcntcontactstoreuris.h"
    26 #include "cphcntcontactstoreuris.h"
    26 #include "CPhoneRawMatchNumberExtractor.h"
    27 #include "CPhoneRawMatchNumberExtractor.h"
       
    28 
    27 
    29 
    28 // Digit count used to match CS number.
    30 // Digit count used to match CS number.
    29 const TInt KPhCntMatchMin = 7;
    31 const TInt KPhCntMatchMin = 7;
    30 const TInt KPhCntMatchMax = 11;
    32 const TInt KPhCntMatchMax = 11;
    31 const TInt KPhCntMatchDefault = KPhCntMatchMin;
    33 const TInt KPhCntMatchDefault = KPhCntMatchMin;
    35 
    37 
    36 CPhCntContactMatchStrategy::CPhCntContactMatchStrategy(
    38 CPhCntContactMatchStrategy::CPhCntContactMatchStrategy(
    37     CVPbkContactManager& aContactManager,
    39     CVPbkContactManager& aContactManager,
    38     CPhCntContactStoreUris& aContactStoreUris,
    40     CPhCntContactStoreUris& aContactStoreUris,
    39     MVPbkContactFindObserver& aObserver,
    41     MVPbkContactFindObserver& aObserver,
    40     CVPbkPhoneNumberMatchStrategy::TVPbkPhoneNumberMatchFlags aMatchFlag ) :
    42     TUint32 aMatchFlags ) :
    41     iContactManager( aContactManager ),
    43     iContactManager( aContactManager ),
    42     iContactStoreUris( aContactStoreUris ),
    44     iContactStoreUris( aContactStoreUris ),
    43     iObserver( aObserver ),
    45     iObserver( aObserver ),
    44     iMatchFlag( aMatchFlag )
    46     iMatchFlags( aMatchFlags )
    45     {
    47     {
    46     iContactStoreUris.SetObserver( *this );
    48     iContactStoreUris.SetObserver( *this );
    47     }
    49     }
    48 
    50 
    49 
    51 
    89 //
    91 //
    90 CPhCntContactMatchStrategy* CPhCntContactMatchStrategy::NewL(
    92 CPhCntContactMatchStrategy* CPhCntContactMatchStrategy::NewL(
    91     CVPbkContactManager& aContactManager,
    93     CVPbkContactManager& aContactManager,
    92     CPhCntContactStoreUris& aContactStoreUris,
    94     CPhCntContactStoreUris& aContactStoreUris,
    93     MVPbkContactFindObserver& aObserver,
    95     MVPbkContactFindObserver& aObserver,
    94     CVPbkPhoneNumberMatchStrategy::TVPbkPhoneNumberMatchFlags aMatchFlag )
    96     TUint32 aMatchFlags )
    95     {
    97     {
    96     CPhCntContactMatchStrategy* self = 
    98     CPhCntContactMatchStrategy* self = 
    97         new( ELeave ) CPhCntContactMatchStrategy( 
    99         new( ELeave ) CPhCntContactMatchStrategy( 
    98             aContactManager,
   100             aContactManager,
    99             aContactStoreUris, 
   101             aContactStoreUris, 
   100             aObserver,
   102             aObserver,
   101             aMatchFlag );
   103             aMatchFlags );
   102     CleanupStack::PushL( self );
   104     CleanupStack::PushL( self );
   103     self->ConstructL();
   105     self->ConstructL();
   104     CleanupStack::Pop( self );
   106     CleanupStack::Pop( self );
   105     return self;
   107     return self;
   106     }
   108     }
   240 // ---------------------------------------------------------------------------
   242 // ---------------------------------------------------------------------------
   241 //     
   243 //     
   242 TInt CPhCntContactMatchStrategy::DoCreateMatchStrategy()
   244 TInt CPhCntContactMatchStrategy::DoCreateMatchStrategy()
   243     {
   245     {
   244     CVPbkPhoneNumberMatchStrategy::TConfig config( 
   246     CVPbkPhoneNumberMatchStrategy::TConfig config( 
   245             iNumberOfDigits,
   247             KBestMatchingPhoneNumbers,
   246             *iUriArray,
   248             *iUriArray,
   247             CVPbkPhoneNumberMatchStrategy::EVPbkSequentialMatch, 
   249             CVPbkPhoneNumberMatchStrategy::EVPbkSequentialMatch, 
   248             iMatchFlag
   250             iMatchFlags
   249             );
   251             );
   250     TRAPD( err, iMatchStrategy = CVPbkPhoneNumberMatchStrategy::NewL( 
   252     TRAPD( err, iMatchStrategy = CVPbkPhoneNumberMatchStrategy::NewL( 
   251                     config, 
   253                     config, 
   252                     iContactManager, 
   254                     iContactManager, 
   253                     iObserver ) );       
   255                     iObserver ) );