phoneengine/PhoneCntFinder/ContactService/src/cphcntspeeddialimpl.cpp
branchRCL_3
changeset 58 40a3f856b14d
parent 57 94dc1107e8b2
--- a/phoneengine/PhoneCntFinder/ContactService/src/cphcntspeeddialimpl.cpp	Thu Jul 15 18:38:16 2010 +0300
+++ b/phoneengine/PhoneCntFinder/ContactService/src/cphcntspeeddialimpl.cpp	Thu Aug 19 09:54:27 2010 +0300
@@ -33,6 +33,11 @@
 #include "CPhCntContact.h"
 #include "cphcntvpbkcontactid.h"
 #include "CPhCntContactManager.h"
+#include "pevirtualengine.h"
+
+// Characters that are needed to be stripped out 
+// from phone number before dialing.
+_LIT( KInvalidPhonenumberCharacters, " ()-" );
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -97,6 +102,27 @@
         User::Leave( KErrArgument );
         }
     }
+
+// ---------------------------------------------------------------------------
+//  CPhCntSpeedDialImpl::ParseNumber
+// ---------------------------------------------------------------------------
+//
+void CPhCntSpeedDialImpl::ParseNumber( TDes& aNumber )
+    {
+    TBuf< KPEPhoneNumberMaxLength > parsedNumber = KNullDesC();
+    TLex parser( aNumber );
+    TChar c;
+    while( !parser.Eos() )
+        {
+        c = parser.Get();
+        if ( KErrNotFound == KInvalidPhonenumberCharacters().Locate( c ) )
+            {
+            parsedNumber.Append( c );
+            }
+        }
+    aNumber = parsedNumber;
+    }
+	
 // ---------------------------------------------------------------------------
 //  CPhCntSpeedDialImpl::CopyContactInfoToFieldInfoL
 // ---------------------------------------------------------------------------
@@ -186,6 +212,7 @@
         TPhCntNumber speedDial( contact->SpeedDialNumber( aSpeedDialPosition ) );
         CopyNumberL( aPhoneNumber, speedDial.Number() );        
         CleanupStack::PopAndDestroy( contact );
+        ParseNumber( aPhoneNumber );
         }
     return err;
     }
@@ -209,6 +236,7 @@
         CopyNumberL( aPhoneNumber, speedDial.Number() );         
         CopyContactInfoToFieldInfoL( *contact, aSpeedDialPosition, aFieldInfo );        
         CleanupStack::PopAndDestroy( contact );
+        ParseNumber( aPhoneNumber );
         }
     return err;
     }