cellular/telephonysettings/src/PSetCallDivertingBase.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include "psetcalldivertingbasicimpl.h" 
    20 #include "PSetCallDivertingBasicImpl.h"
    21 
    21 
    22 #include <badesca.h>
    22 #include <badesca.h>
    23 #include <etelmm.h>           
    23 #include <etelmm.h>           
    24 #include <e32math.h>
    24 #include <e32math.h>
       
    25 #include <vmnumber.h>
    25 #include <e32svr.h>
    26 #include <e32svr.h>
    26 #include <featmgr.h>
    27 #include <featmgr.h>
    27 #include <centralrepository.h>
    28 #include <centralrepository.h>
    28 #include <settingsinternalcrkeys.h> 
    29 #include <settingsinternalcrkeys.h>
    29 
    30 
    30 #include "psetcalldiverting.h" 
    31 #include "PsetCallDiverting.h"
    31 #include "psetcontainer.h" 
    32 #include "PsetContainer.h"
    32 #include "mpsetdivertobs.h" 
    33 #include "MPsetDivertObs.h"
    33 #include "psettelephony.h" 
    34 #include "PsetTelephony.h"
    34 #include "psetpanic.h" 
    35 #include "PSetPanic.h"
    35 #include "mpsetrequestobs.h" 
    36 #include "MPsetRequestObs.h"
    36 #include "psetutility.h" 
    37 #include "PSetUtility.h"
    37 #include "phonesettingslogger.h" 
    38 #include "PhoneSettingsLogger.h"
    38 #include "psetsaobserver.h" 
    39 #include "PsetSAObserver.h"
    39 #include "psetcalldivertingbase.h" 
    40 #include "PSetCallDivertingBase.h"
    40 
    41 
    41 //  LOCAL CONSTANTS AND MACROS
    42 //  LOCAL CONSTANTS AND MACROS
    42 
    43 
    43 // ============================ MEMBER FUNCTIONS ===============================
    44 // ============================ MEMBER FUNCTIONS ===============================
    44 
    45 
   162 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
   163 //
   164 //
   164 void CPSetCallDivertingBase::DoCancel()
   165 void CPSetCallDivertingBase::DoCancel()
   165     {
   166     {
   166     // Empty implementation.
   167     // Empty implementation.
   167     }
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // SetRequestObserver
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 void CPSetCallDivertingBase::SetRequestObserver( MPsetRequestObserver* aObs )
       
   174     {
       
   175     iReqObserver = aObs;
       
   176     }
   168     }
   177 
   169 
   178 // ---------------------------------------------------------------------------
   170 // ---------------------------------------------------------------------------
   179 // SetDivertingL
   171 // SetDivertingL
   180 // ---------------------------------------------------------------------------
   172 // ---------------------------------------------------------------------------
   814 
   806 
   815 // ---------------------------------------------------------------------------
   807 // ---------------------------------------------------------------------------
   816 // Verifies whether the divert-to number is to voice mail box.
   808 // Verifies whether the divert-to number is to voice mail box.
   817 // ---------------------------------------------------------------------------
   809 // ---------------------------------------------------------------------------
   818 //
   810 //
   819 TBool CPSetCallDivertingBase::IsVMBXDivertL( TDesC& /*aTelNumber*/ )
   811 TBool CPSetCallDivertingBase::IsVMBXDivertL( TDesC& aTelNumber )
   820     {
   812     {
   821 
       
   822     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::IsVMBXDivertL" );
   813     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::IsVMBXDivertL" );
   823     
   814     
   824     TBool result = EFalse;
   815     TBool result = EFalse;
       
   816     
       
   817     if ( FeatureManager::FeatureSupported ( KFeatureIdVmbxCallDivertIcon ) )
       
   818         {
       
   819         RVmbxNumber vmbxConnection;
       
   820         TTelNumber telNumber;
       
   821         TInt retValue = OpenVmbxLC( telNumber, vmbxConnection );
       
   822         __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsVMBXDivertL: telNumber = %S", &telNumber );
       
   823         __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsVMBXDivertL: retValue = %d", retValue );
       
   824 
       
   825         CleanupStack::PopAndDestroy(); //vmbxConnection is closed when popped    
       
   826         if ( retValue == KErrNone ) //VMBX number found
       
   827             {
       
   828             
       
   829             //Concatenate the existing number and add '*' to the beginning
       
   830             TTelNumber tempStr;
       
   831             tempStr.Zero();
       
   832             tempStr.Append( KPSetAsterisk );
       
   833         
       
   834             //Match with seven characters
       
   835             TInt matchChars = KPsetMatchingChars;
       
   836             if ( telNumber.Length() < matchChars )
       
   837                 {                
       
   838                 matchChars = telNumber.Length();
       
   839                 }
       
   840             tempStr.Append( telNumber.Right( matchChars ) );
       
   841         
       
   842             //Compare value with divert-to number
       
   843             if ( aTelNumber.Match ( tempStr ) != KErrNotFound )
       
   844                 {
       
   845                 __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::IsVMBXDivertL: Match found" );
       
   846                 result = ETrue;
       
   847                 }
       
   848             }
       
   849         }
   825     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsVMBXDivertL" );
   850     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsVMBXDivertL" );
   826     return result;
   851     return result;
   827     }
   852     }
   828 
   853 
   829 // ---------------------------------------------------------------------------
   854 // ---------------------------------------------------------------------------
       
   855 // Opens Vmbx. Leaves vmbx to the stack.  
       
   856 // ---------------------------------------------------------------------------
       
   857 TInt CPSetCallDivertingBase::OpenVmbxLC( TDes& aTelNumber, RVmbxNumber& aVmbx )
       
   858     {
       
   859     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::OpenVmbxLC" );
       
   860     User::LeaveIfError( aVmbx.Open( iPhone ) );
       
   861     CleanupClosePushL( aVmbx );         
       
   862     __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBase::OpenVmbxLC" );
       
   863     return aVmbx.GetVmbxNumber( aTelNumber );
       
   864     }
       
   865 
       
   866 // ---------------------------------------------------------------------------
   830 // If SsSettings notifies of settings change, copy new value to member variable. 
   867 // If SsSettings notifies of settings change, copy new value to member variable. 
   831 // ---------------------------------------------------------------------------
   868 // ---------------------------------------------------------------------------
   832 void CPSetCallDivertingBase::PhoneSettingChanged( 
   869 void CPSetCallDivertingBase::PhoneSettingChanged( 
   833     TSSSettingsSetting aSetting, TInt aNewValue )
   870     TSSSettingsSetting aSetting, TInt aNewValue )
   834     {
   871     {