phoneengine/phonemodel/src/cpeparserphonenumberhandler.cpp
branchRCL_3
changeset 25 5266b1f337bd
parent 24 41a7f70b3818
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
    67     TEFLOGSTRING3( KTAINT, 
    67     TEFLOGSTRING3( KTAINT, 
    68         "PE CPEParserPhoneNumberHandler::ProcessDialToNumberL, number: %S, dtmf postfix: %S", 
    68         "PE CPEParserPhoneNumberHandler::ProcessDialToNumberL, number: %S, dtmf postfix: %S", 
    69         &aNumber, 
    69         &aNumber, 
    70         &aDtmfPostfix );
    70         &aDtmfPostfix );
    71     
    71     
    72     // Check if phone is locked
       
    73     iOwner.CheckIfPhoneIsLockedL();
       
    74     
       
    75     if ( aNumber.Length() == 0 )
    72     if ( aNumber.Length() == 0 )
    76         {
    73         {
    77         User::Leave( ECCPErrorInvalidPhoneNumber );
    74         User::Leave( ECCPErrorInvalidPhoneNumber );
    78         }
    75         }
    79 
    76 
    90     
    87     
    91     TPECallType processType = iDataStore.CallTypeCommand();
    88     TPECallType processType = iDataStore.CallTypeCommand();
    92     if( processType != EPECallTypeVideo )
    89     if( processType != EPECallTypeVideo )
    93         {
    90         {
    94         // TSY not accept phone number that include + or w chartes.
    91         // TSY not accept phone number that include + or w chartes.
    95         TPEPhoneNumber postfix = FilterPostfixL( aDtmfPostfix );
    92         TPEPhoneNumber postfix = FilterPostfix( aDtmfPostfix );
    96         if( postfix.Length() )
    93         if( postfix.Length() )
    97             {
    94             {
    98             phoneNumber.Append( postfix );
    95             phoneNumber.Append( postfix );
    99             }
    96             }
   100         }
    97         }
   164 
   161 
   165 // -----------------------------------------------------------------------------
   162 // -----------------------------------------------------------------------------
   166 // CPEParserPhoneNumberHandler::FilterPostfix
   163 // CPEParserPhoneNumberHandler::FilterPostfix
   167 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   168 // 
   165 // 
   169 TPtrC CPEParserPhoneNumberHandler::FilterPostfixL( TPtrC aPostfix )
   166 TPtrC CPEParserPhoneNumberHandler::FilterPostfix( TPtrC aPostfix )
   170     {
   167     {
   171     TLex input( aPostfix );
   168     TLex input( aPostfix );
   172     TInt stripStart = KErrNotFound;
   169     TInt stripStart = KErrNotFound;
   173     TInt postfixLength = aPostfix.Length();
   170     TInt postfixLength = aPostfix.Length();
   174     for ( TInt i = 0; i != postfixLength; i ++ )
   171     for ( TInt i = 0; i != postfixLength; i ++ )
   175         {
   172         {
   176         TChar ch( input.Peek() );
   173         TChar ch( input.Peek() );
   177         if (ch == KDtmfPlus)
   174         if ( ch == KDtmfWait ||
   178             {
   175              ch == KDtmfPlus )
   179             User::Leave ( ECCPErrorInvalidPhoneNumber );
       
   180             }
       
   181         else if ( ch == KDtmfWait )
       
   182             {
   176             {
   183             if ( i < stripStart || stripStart == KErrNotFound )
   177             if ( i < stripStart || stripStart == KErrNotFound )
   184                 {
   178                 {
   185                 stripStart = i;
   179                 stripStart = i;
   186                 }
   180                 }
   187             }
   181             }
   188         input.Inc();
       
   189         }
   182         }
   190     if ( stripStart != KErrNotFound )
   183     if ( stripStart != KErrNotFound )
   191         {
   184         {
   192         return aPostfix.Left( stripStart );
   185         return aPostfix.Left( stripStart );
   193         }
   186         }
   204 TBool CPEParserPhoneNumberHandler::IsPhoneOffline()
   197 TBool CPEParserPhoneNumberHandler::IsPhoneOffline()
   205     {
   198     {
   206     TBool isPhoneOffline( EFalse );
   199     TBool isPhoneOffline( EFalse );
   207 
   200 
   208     if( FeatureManager::FeatureSupported( KFeatureIdOfflineMode )
   201     if( FeatureManager::FeatureSupported( KFeatureIdOfflineMode )
   209         && ( EFalse == iOwner.IsNetworkConnectionAllowed() ) )
   202         && ( iDataStore.ProfileId() == EProfileOffLineId ) )
   210         {
   203         {
   211         isPhoneOffline = ETrue;
   204         isPhoneOffline = ETrue;
   212         }
   205         }
   213     
   206     
   214     TNWNetworkRegistrationStatus networkRegStatus
   207     TNWNetworkRegistrationStatus networkRegStatus
   219         || ( networkRegStatus == ENWStatusNotRegisteredEmergencyOnly )
   212         || ( networkRegStatus == ENWStatusNotRegisteredEmergencyOnly )
   220         || ( networkRegStatus == ENWStatusRegistrationDenied ) )
   213         || ( networkRegStatus == ENWStatusRegistrationDenied ) )
   221         {
   214         {
   222         isPhoneOffline = ETrue;
   215         isPhoneOffline = ETrue;
   223         }
   216         }
   224 
   217     
   225     return isPhoneOffline;
   218     return isPhoneOffline;
   226     }
   219     }
       
   220 
   227     
   221     
   228 //  End of File
   222 //  End of File