cellular/psetnotesui/src/psuidivertobs.cpp
changeset 51 12bc758d6a02
parent 48 78df25012fda
child 53 25b8d29b7c59
equal deleted inserted replaced
48:78df25012fda 51:12bc758d6a02
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Shows notes and lists for Divert supplementary service
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <psui.rsg> 
       
    21 #include <mmlist.h>
       
    22 #include <featmgr.h> 
       
    23 #include <psuicontainer.h> 
       
    24 #include <etelsat.h>
       
    25 
       
    26 #include "psuinotecontroller.h" 
       
    27 
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // Symbian OS two-phased constructor.
       
    31 // ---------------------------------------------------------------------------
       
    32 EXPORT_C CPsuiDivertObs* CPsuiDivertObs::NewL( CPsuiContainer& aContainer )
       
    33     {
       
    34     CPsuiDivertObs* self = new ( ELeave ) CPsuiDivertObs;
       
    35     self->SetContainer( aContainer );
       
    36     return self;
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Sets container.
       
    41 // ---------------------------------------------------------------------------
       
    42 void CPsuiDivertObs::SetContainer( CPsuiContainer& aContainer )
       
    43     {
       
    44     iContainer = &aContainer;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Handles changing of diverting.
       
    49 // ---------------------------------------------------------------------------
       
    50 void CPsuiDivertObs::HandleDivertingChangedL( 
       
    51     const TCallDivertSetting& aSetting, 
       
    52     TBool aPlural )
       
    53     {    
       
    54     switch( aSetting.iStatus )
       
    55         {
       
    56         case EDivertingStatusActive:
       
    57             if ( aPlural )
       
    58                 {
       
    59                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    60                     EPsuiConfirmationNote, R_PLURAL_ACTIVATE_NOTE );
       
    61                 }
       
    62             else
       
    63                 {
       
    64                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    65                     EPsuiConfirmationNote, R_ACTIVATE_NOTE );
       
    66                 }
       
    67             
       
    68             // Diverting calls does not affect Internet calls    
       
    69             if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) &&
       
    70                  aSetting.iServiceGroup == EServiceGroupVoice )
       
    71                 {
       
    72                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    73                     EPsuiInformationNote, R_VOIP_DIVERT_NOT_SUPPORTED );
       
    74                 }
       
    75             break;
       
    76         case EDivertingStatusNotRegistered:
       
    77         case EDivertingStatusInactive:
       
    78             if ( aPlural )
       
    79                 {
       
    80                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    81                     EPsuiConfirmationNote, R_PLURAL_CANCEL_NOTE );
       
    82                 }
       
    83             else
       
    84                 {
       
    85                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    86                     EPsuiConfirmationNote, R_CANCEL_NOTE );
       
    87                 }
       
    88             break;
       
    89         case EDivertingStatusNotProvisioned:
       
    90         case EDivertingStatusUnknown:
       
    91         default:
       
    92             CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    93                 EPsuiConfirmationNote, R_NOT_DONE_NOTE );
       
    94         }
       
    95     }  
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // Handles the get status notifications.
       
    99 // ---------------------------------------------------------------------------
       
   100 /*****************************************************
       
   101 *    Series 60 Customer / ETel
       
   102 *    Series 60  ETel API
       
   103 *****************************************************/ 
       
   104 void CPsuiDivertObs::HandleDivertingStatusL( CMobilePhoneCFList&  aSetting, 
       
   105                                             TBool /*aPlural*/ )
       
   106     {
       
   107     TInt index = 0;
       
   108     TCFType action = EPsuiCFOther;
       
   109     
       
   110     //check the first item
       
   111     RMobilePhone::TMobilePhoneCFInfoEntryV1 cfInfo;
       
   112     cfInfo = aSetting.GetEntryL( index );
       
   113     switch( cfInfo.iStatus )
       
   114         {
       
   115         case RMobilePhone::ECallForwardingStatusNotActive:
       
   116             CPsuiNoteController::InstanceL()->ShowBscCFListL( 
       
   117                 R_TEXT_DIVERT_INACTIVE, 
       
   118                 aSetting, 
       
   119                 EPsuiNoCF, 
       
   120                 index );
       
   121             break;
       
   122         case RMobilePhone::ECallForwardingStatusActive:
       
   123             while ( action != EPsuiNoCF )
       
   124                 {
       
   125                 if ( cfInfo.iTimeout > 0 ) //cfnry involved
       
   126                     {
       
   127                     action = EPsuiCFNry;
       
   128                     }
       
   129                 else // other type of cf
       
   130                     {
       
   131                     action = EPsuiCFOther;
       
   132                     }
       
   133                 action = CPsuiNoteController::InstanceL()->ShowBscCFListL(
       
   134                     R_TEXT_DIVERT_ACTIVE,  
       
   135                     aSetting,
       
   136                     action, 
       
   137                     index );
       
   138                 
       
   139                 if ( action != EPsuiNoCF ) //EPsuiCFNry or EPsuiCFOther                
       
   140                     {
       
   141                     cfInfo = aSetting.GetEntryL( index );                
       
   142                     // display details-view with time and number
       
   143                     CPsuiNoteController::InstanceL()->ShowCfInfoL( action, cfInfo );
       
   144                     }
       
   145                 }
       
   146             break;
       
   147         case RMobilePhone::ECallForwardingStatusNotRegistered:
       
   148             CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   149                 EPsuiConfirmationNote, 
       
   150                 R_NOT_ACTIVE_NOTE );
       
   151             break;
       
   152         case RMobilePhone::ECallForwardingStatusNotProvisioned:
       
   153             CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   154                 EPsuiConfirmationNote, 
       
   155                 R_NOT_ALLOWED );
       
   156             break;
       
   157         default:
       
   158             CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   159                 EPsuiConfirmationNote, 
       
   160                 R_NOT_DONE_NOTE );
       
   161             break;
       
   162         }        
       
   163     }
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // Handles showing of error notes.
       
   167 // ---------------------------------------------------------------------------
       
   168 void CPsuiDivertObs::HandleDivertingErrorL( TInt aReason )
       
   169     {
       
   170     if ( aReason != KErrSatControl  )
       
   171         {
       
   172         TInt errorResource = 
       
   173             CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason );
       
   174         CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
       
   175         }
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // Handles requesting notes (show/hide).
       
   180 // ---------------------------------------------------------------------------
       
   181 void CPsuiDivertObs::HandleCFRequestingL( TBool aTrue, TBool aInterrupted )
       
   182     {
       
   183     if ( aInterrupted )
       
   184         {
       
   185         CPsuiNoteController::InstanceL()->RemoveNotesL();
       
   186         return;
       
   187         }
       
   188     if ( aTrue )
       
   189         {
       
   190         CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   191             EPsuiWaitingNote, -1 );
       
   192         }
       
   193     else
       
   194         {
       
   195         CPsuiNoteController::InstanceL()->KillStaticNoteL();
       
   196         }
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // Sets engine contact for observer.
       
   201 // ---------------------------------------------------------------------------
       
   202 void CPsuiDivertObs::SetEngineContact( MPsetCallDiverting* aDivertEngine )
       
   203     {
       
   204     CPsuiNoteController::InstanceL()->SetEngineContacts( 
       
   205         NULL, 
       
   206         NULL, 
       
   207         aDivertEngine, 
       
   208         NULL );
       
   209     }
       
   210 
       
   211 // End of File