phoneengine/PhoneCntFinder/ContactService/src/cphcntspeeddialimpl.cpp
branchRCL_3
changeset 58 40a3f856b14d
parent 57 94dc1107e8b2
equal deleted inserted replaced
57:94dc1107e8b2 58:40a3f856b14d
    31 #include "CPhCntContactStores.h"
    31 #include "CPhCntContactStores.h"
    32 #include "MPhCntContactManager.h"
    32 #include "MPhCntContactManager.h"
    33 #include "CPhCntContact.h"
    33 #include "CPhCntContact.h"
    34 #include "cphcntvpbkcontactid.h"
    34 #include "cphcntvpbkcontactid.h"
    35 #include "CPhCntContactManager.h"
    35 #include "CPhCntContactManager.h"
       
    36 #include "pevirtualengine.h"
       
    37 
       
    38 // Characters that are needed to be stripped out 
       
    39 // from phone number before dialing.
       
    40 _LIT( KInvalidPhonenumberCharacters, " ()-" );
    36 
    41 
    37 // ======== MEMBER FUNCTIONS ========
    42 // ======== MEMBER FUNCTIONS ========
    38 
    43 
    39 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    40 // Default constructor.
    45 // Default constructor.
    95     else
   100     else
    96         {
   101         {
    97         User::Leave( KErrArgument );
   102         User::Leave( KErrArgument );
    98         }
   103         }
    99     }
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 //  CPhCntSpeedDialImpl::ParseNumber
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void CPhCntSpeedDialImpl::ParseNumber( TDes& aNumber )
       
   111     {
       
   112     TBuf< KPEPhoneNumberMaxLength > parsedNumber = KNullDesC();
       
   113     TLex parser( aNumber );
       
   114     TChar c;
       
   115     while( !parser.Eos() )
       
   116         {
       
   117         c = parser.Get();
       
   118         if ( KErrNotFound == KInvalidPhonenumberCharacters().Locate( c ) )
       
   119             {
       
   120             parsedNumber.Append( c );
       
   121             }
       
   122         }
       
   123     aNumber = parsedNumber;
       
   124     }
       
   125 	
   100 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   101 //  CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL
   127 //  CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL
   102 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   103 //  
   129 //  
   104 void CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL( 
   130 void CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL( 
   184         {
   210         {
   185         CleanupStack::PushL( contact );
   211         CleanupStack::PushL( contact );
   186         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   212         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   187         CopyNumberL( aPhoneNumber, speedDial.Number() );        
   213         CopyNumberL( aPhoneNumber, speedDial.Number() );        
   188         CleanupStack::PopAndDestroy( contact );
   214         CleanupStack::PopAndDestroy( contact );
       
   215         ParseNumber( aPhoneNumber );
   189         }
   216         }
   190     return err;
   217     return err;
   191     }
   218     }
   192 
   219 
   193 // ---------------------------------------------------------------------------
   220 // ---------------------------------------------------------------------------
   207         CleanupStack::PushL( contact );
   234         CleanupStack::PushL( contact );
   208         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   235         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   209         CopyNumberL( aPhoneNumber, speedDial.Number() );         
   236         CopyNumberL( aPhoneNumber, speedDial.Number() );         
   210         CopyContactInfoToFieldInfoL( *contact, aSpeedDialPosition, aFieldInfo );        
   237         CopyContactInfoToFieldInfoL( *contact, aSpeedDialPosition, aFieldInfo );        
   211         CleanupStack::PopAndDestroy( contact );
   238         CleanupStack::PopAndDestroy( contact );
       
   239         ParseNumber( aPhoneNumber );
   212         }
   240         }
   213     return err;
   241     return err;
   214     }
   242     }
   215     
   243     
   216 // -----------------------------------------------------------------------------
   244 // -----------------------------------------------------------------------------