gssettingsuis/Gs/GSCallDivertPlugin/Src/GSCallDivertView.cpp
branchRCL_3
changeset 23 8bda91a87a00
parent 17 3b47783fdf16
equal deleted inserted replaced
22:673fb3e04649 23:8bda91a87a00
    69 using namespace AiwContactAssign;
    69 using namespace AiwContactAssign;
    70 
    70 
    71 // LOCAL CONSTANTS
    71 // LOCAL CONSTANTS
    72 _LIT( KGSDivertClassName, "CGSCallDivertView" );
    72 _LIT( KGSDivertClassName, "CGSCallDivertView" );
    73 
    73 
       
    74 _LIT( KCallDivertInvalidchars, " ()" );
    74 
    75 
    75 // ========================= MEMBER FUNCTIONS ================================
    76 // ========================= MEMBER FUNCTIONS ================================
    76 
    77 
    77 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    78 // CGSCallDivertView::CGSCallDivertView
    79 // CGSCallDivertView::CGSCallDivertView
   586 void CGSCallDivertView::ExecuteDivertNumberQueryL( TDes& aValue, TInt aType )
   587 void CGSCallDivertView::ExecuteDivertNumberQueryL( TDes& aValue, TInt aType )
   587     {
   588     {
   588     TBool accepted = EFalse;
   589     TBool accepted = EFalse;
   589     while ( !accepted )
   590     while ( !accepted )
   590         {
   591         {
       
   592         RemoveInvalidChars( aValue ); 
   591         if ( aValue.Length() > KGSMaxDataLength )
   593         if ( aValue.Length() > KGSMaxDataLength )
   592             {
   594             {
   593             //Chop the first extra digits and keep the last KGSMaxDataLength
   595             //Chop the first extra digits and keep the last KGSMaxDataLength
   594             //digits intact. This is according to the spec.
   596             //digits intact. This is according to the spec.
   595             aValue.Delete( 0, aValue.Length() - KGSMaxDataLength );
   597             aValue.Delete( 0, aValue.Length() - KGSMaxDataLength );
  1355         }
  1357         }
  1356     CleanupStack::PopAndDestroy( list );
  1358     CleanupStack::PopAndDestroy( list );
  1357     return keyPress;
  1359     return keyPress;
  1358     }
  1360     }
  1359 
  1361 
  1360 
  1362 // --------------------------------------------------------------------------
       
  1363 // CGSCallDivertView::RemoveInvalidChars
       
  1364 // Remove invalid " ", "()" which were sync with PC suite. 
       
  1365 // --------------------------------------------------------------------------
       
  1366 //
       
  1367 void CGSCallDivertView::RemoveInvalidChars( TDes& aNumber )
       
  1368   {
       
  1369   TInt noOfInvalidchars = KCallDivertInvalidchars().Length();
       
  1370   TInt location = KErrNone; 
       
  1371   // delete the invalid chars of KCallDivertInvalidchars. 
       
  1372   //aNumber changed to valid phone number if it contains invalid chars
       
  1373   for ( TInt index = 0; index < noOfInvalidchars; index++ )
       
  1374        {     
       
  1375        while ( ETrue )
       
  1376            {
       
  1377            location = aNumber.Find( KCallDivertInvalidchars().Mid( index, 1 ) );   
       
  1378            if ( location == KErrNotFound )
       
  1379                {
       
  1380                break;
       
  1381                }
       
  1382            aNumber.Delete( location, 1 ); //delete the invalid char, aNumber changed
       
  1383            }
       
  1384        }
       
  1385   }
  1361 // End of File
  1386 // End of File