phoneengine/PhoneCntFinder/ContactService/src/cphcntspeeddialimpl.cpp
branchRCL_3
changeset 81 c26cc2a7c548
parent 62 5266b1f337bd
equal deleted inserted replaced
73:e30d4a1b8bad 81:c26cc2a7c548
    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, " ()-" );
       
    41 
    36 
    42 // ======== MEMBER FUNCTIONS ========
    37 // ======== MEMBER FUNCTIONS ========
    43 
    38 
    44 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    45 // Default constructor.
    40 // Default constructor.
   100     else
    95     else
   101         {
    96         {
   102         User::Leave( KErrArgument );
    97         User::Leave( KErrArgument );
   103         }
    98         }
   104     }
    99     }
   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 	
       
   126 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   127 //  CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL
   101 //  CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL
   128 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   129 //  
   103 //  
   130 void CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL( 
   104 void CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL( 
   210         {
   184         {
   211         CleanupStack::PushL( contact );
   185         CleanupStack::PushL( contact );
   212         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   186         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   213         CopyNumberL( aPhoneNumber, speedDial.Number() );        
   187         CopyNumberL( aPhoneNumber, speedDial.Number() );        
   214         CleanupStack::PopAndDestroy( contact );
   188         CleanupStack::PopAndDestroy( contact );
   215         ParseNumber( aPhoneNumber );
       
   216         }
   189         }
   217     return err;
   190     return err;
   218     }
   191     }
   219 
   192 
   220 // ---------------------------------------------------------------------------
   193 // ---------------------------------------------------------------------------
   234         CleanupStack::PushL( contact );
   207         CleanupStack::PushL( contact );
   235         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   208         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
   236         CopyNumberL( aPhoneNumber, speedDial.Number() );         
   209         CopyNumberL( aPhoneNumber, speedDial.Number() );         
   237         CopyContactInfoToFieldInfoL( *contact, aSpeedDialPosition, aFieldInfo );        
   210         CopyContactInfoToFieldInfoL( *contact, aSpeedDialPosition, aFieldInfo );        
   238         CleanupStack::PopAndDestroy( contact );
   211         CleanupStack::PopAndDestroy( contact );
   239         ParseNumber( aPhoneNumber );
       
   240         }
   212         }
   241     return err;
   213     return err;
   242     }
   214     }
   243     
   215     
   244 // -----------------------------------------------------------------------------
   216 // -----------------------------------------------------------------------------