cellular/psetnotesui/src/psuibarringobs.cpp
changeset 51 12bc758d6a02
parent 48 78df25012fda
child 53 25b8d29b7c59
equal deleted inserted replaced
48:78df25012fda 51:12bc758d6a02
     1 /*
       
     2 * Copyright (c) 2002-2007 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 related to Call Barrings operations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <psui.rsg> 
       
    21 #include <psuicontainer.h> 
       
    22 #include <exterror.h>
       
    23 #include <etelsat.h>
       
    24 
       
    25 #include "psuiinternalconstants.h" 
       
    26 #include "psuinotecontroller.h" 
       
    27 
       
    28 //  MEMBER FUNCTIONS
       
    29 // ---------------------------------------------------------------------------
       
    30 // Symbian OS two-phased Constructor.
       
    31 // ---------------------------------------------------------------------------
       
    32 EXPORT_C CPsuiBarringObs* CPsuiBarringObs::NewL( CPsuiContainer& aContainer )
       
    33     {
       
    34     CPsuiBarringObs* self = new( ELeave ) CPsuiBarringObs;
       
    35     self->SetContainer( aContainer );
       
    36     return self;
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Sets container.
       
    41 // ---------------------------------------------------------------------------
       
    42 void CPsuiBarringObs::SetContainer( CPsuiContainer& aContainer )
       
    43     {
       
    44     iContainer = &aContainer;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Handles changing of barring mode.
       
    49 // ---------------------------------------------------------------------------
       
    50 void CPsuiBarringObs::HandleBarringModeChangedL( TBarringProgram /* aType */, 
       
    51                                                 TBarringStatus aStatus, 
       
    52                                                 TBool aPlural )
       
    53     {
       
    54     if ( aStatus == EBarringStatusActive )
       
    55         {
       
    56         CPsuiNoteController::InstanceL()->ShowNoteL(
       
    57             EPsuiConfirmationNote, 
       
    58             R_CB_ACTIVE_NOTE );
       
    59         }
       
    60     else if ( aStatus == EBarringStatusInactive && !aPlural )
       
    61         {
       
    62         CPsuiNoteController::InstanceL()->ShowNoteL(
       
    63             EPsuiConfirmationNote, 
       
    64             R_CB_CANCEL_NOTE );
       
    65         }
       
    66     
       
    67     else if ( aStatus == EBarringStatusInactive && aPlural )
       
    68         {
       
    69         CPsuiNoteController::InstanceL()->ShowNoteL(
       
    70             EPsuiConfirmationNote, 
       
    71             R_CB_PLURAL_CANCEL_NOTE );
       
    72         }
       
    73     }  
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Handles the get status notifications.
       
    77 // ---------------------------------------------------------------------------
       
    78 void CPsuiBarringObs::HandleBarringModeStatusL( TUint8 aBsc[KPSUIMaxBscNumber],
       
    79                                                TBarringStatus aStatus )
       
    80     {
       
    81     if ( aStatus != EBarringStatusActive )
       
    82         {
       
    83         CPsuiNoteController::InstanceL()->ShowNoteL(
       
    84             EPsuiConfirmationNote, 
       
    85             R_BARRING_NOT_ACTIVE_NOTE );
       
    86         }
       
    87     else
       
    88         {
       
    89         //if no bsc-list, show "Barring active" note
       
    90         if ( aBsc[0] == KPSUINoBscGroup )
       
    91             {
       
    92             CPsuiNoteController::InstanceL()->ShowNoteL(
       
    93                 EPsuiConfirmationNote, 
       
    94                 R_BARRING_ACTIVE_NOTE );
       
    95             }
       
    96         //otherwise show bsc-list
       
    97         else
       
    98             {
       
    99             CPsuiNoteController::InstanceL()->ShowBscListL(
       
   100                 R_BARR_STATUS_HEADING, 
       
   101                 aBsc );
       
   102             }
       
   103         }
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // Handles showing of error notes.
       
   108 // ---------------------------------------------------------------------------
       
   109 void CPsuiBarringObs::HandleBarringErrorL( TInt aReason )
       
   110     {
       
   111     if ( aReason != KErrSatControl  )
       
   112         {
       
   113         TInt errorResource( 
       
   114             CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason ) ); 
       
   115         CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
       
   116         }
       
   117     } 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // Handles requesting notes (show/hide).
       
   121 // ---------------------------------------------------------------------------
       
   122 void CPsuiBarringObs::HandleCBRequestingL( TBool aOngoing, TBool aInterrupted )
       
   123     {
       
   124     if ( aInterrupted )
       
   125         {
       
   126         // if interrupted, means that incoming call and all notes must
       
   127         // be immediately destroyed.
       
   128         CPsuiNoteController::InstanceL()->RemoveNotesL();
       
   129         return;
       
   130         }
       
   131     if ( aOngoing )
       
   132         {
       
   133         // show requesting note
       
   134         CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   135             EPsuiWaitingNote, 
       
   136             -1 );
       
   137         }
       
   138     else
       
   139         {
       
   140         // hide requesting note
       
   141         CPsuiNoteController::InstanceL()->KillStaticNoteL();
       
   142         }
       
   143     }
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // Handles call barring password notes.
       
   147 // ---------------------------------------------------------------------------
       
   148 void CPsuiBarringObs::CbPasswordChangedL( TBool aSuccess )
       
   149     {
       
   150     if ( aSuccess )
       
   151         {
       
   152         CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   153             EPsuiConfirmationNote, 
       
   154             R_PASSWORD_CHANGED_NOTE );
       
   155         }
       
   156     else
       
   157         {
       
   158         HandleBarringErrorL( KErrGsmSSNegativePasswordCheck );
       
   159         }
       
   160     }
       
   161 
       
   162 // ---------------------------------------------------------------------------
       
   163 // Sets engine contact for observer.
       
   164 // ---------------------------------------------------------------------------
       
   165 void CPsuiBarringObs::SetEngineContact( MPsetCallBarring* aBarringEngine )
       
   166     {
       
   167     CPsuiNoteController::InstanceL()->SetEngineContacts( 
       
   168         NULL, 
       
   169         aBarringEngine, 
       
   170         NULL, 
       
   171         NULL );
       
   172     }
       
   173 
       
   174 // End of File