cellular/psetnotesui/src/psuicliobserver.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 Identity operations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <psui.rsg> 
       
    21 #include <featmgr.h>
       
    22 #include <etelsat.h>
       
    23  
       
    24 #include "psuicliobserver.h" 
       
    25 #include "psuicontainer.h" 
       
    26 #include "psuinotecontroller.h" 
       
    27 
       
    28 //  MEMBER FUNCTIONS
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // Symbian OS two-phased constructor.
       
    32 // ---------------------------------------------------------------------------
       
    33 EXPORT_C CPsuiCliObserver* CPsuiCliObserver::NewL( CPsuiContainer& aContainer )
       
    34     {
       
    35     CPsuiCliObserver* self = new( ELeave ) CPsuiCliObserver;
       
    36     CleanupStack::PushL( self );
       
    37     // Sets up TLS, must be done before FeatureManager is used.
       
    38     FeatureManager::InitializeLibL();    
       
    39     CleanupStack::Pop( self );
       
    40     self->SetContainer( aContainer );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // Handles calling identity notes.
       
    46 // ---------------------------------------------------------------------------
       
    47 void CPsuiCliObserver::CliInformationL( TPsuiCli aType )
       
    48     {
       
    49     TInt resourceID = R_NOT_DONE_NOTE;
       
    50     switch( aType ) 
       
    51         {
       
    52         case EPsuiClirOn:
       
    53             resourceID = R_CLIR_ACTIVE_NOTE;
       
    54             break;
       
    55         case EPsuiClirOff:
       
    56             resourceID = R_CLIR_INACTIVE_NOTE;
       
    57             break;
       
    58         case EPsuiClipOn:
       
    59             resourceID = R_CLIP_ACTIVE_NOTE;
       
    60             break;
       
    61         case EPsuiClipOff:
       
    62             resourceID = R_CLIP_INACTIVE_NOTE;
       
    63             break;
       
    64         case EPsuiColrOn:
       
    65             resourceID = R_COLR_ACTIVE_NOTE;
       
    66             break;
       
    67         case EPsuiColrOff:
       
    68             resourceID = R_COLR_INACTIVE_NOTE;
       
    69             break;
       
    70         case EPsuiColpOn:
       
    71             resourceID = R_COLP_ACTIVE_NOTE;
       
    72             break;
       
    73         case EPsuiColpOff:
       
    74             resourceID = R_COLP_INACTIVE_NOTE;
       
    75             break;
       
    76         case EPsuiCliUnknown:
       
    77         default:
       
    78             resourceID = R_NOT_DONE_NOTE;
       
    79             break;
       
    80         }
       
    81     CPsuiNoteController::InstanceL()->ShowNoteL( 
       
    82         EPsuiConfirmationNote, 
       
    83         resourceID );
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // Handles requesting notes (show/hide).
       
    88 // ---------------------------------------------------------------------------
       
    89 void CPsuiCliObserver::HandleCliRequestingL( TBool aOngoing, TBool aInterrupted )
       
    90     {
       
    91     if ( aInterrupted )
       
    92         {
       
    93         CPsuiNoteController::InstanceL()->RemoveNotesL();
       
    94         }
       
    95     else
       
    96         {
       
    97         if ( aOngoing )
       
    98             {
       
    99             CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   100                 EPsuiWaitingNote, -1 );    
       
   101             }
       
   102         else
       
   103             {
       
   104             CPsuiNoteController::InstanceL()->KillStaticNoteL();
       
   105             }
       
   106         }
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // Sets engine contact for observer.
       
   111 // ---------------------------------------------------------------------------
       
   112 void CPsuiCliObserver::SetEngineContact( MPsetCli* aEngine )
       
   113     {
       
   114     CPsuiNoteController::InstanceL()->SetEngineContacts( 
       
   115         NULL, 
       
   116         NULL, 
       
   117         NULL, 
       
   118         aEngine );
       
   119     }
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // Handles Cnap status requests.
       
   123 // ---------------------------------------------------------------------------
       
   124 void CPsuiCliObserver::HandleCnapStatusL( TInt 
       
   125     aStatus 
       
   126     )
       
   127     {
       
   128     if ( FeatureManager::FeatureSupported( KFeatureIdPhoneCnap ) )
       
   129         {
       
   130         switch ( aStatus )
       
   131             {
       
   132             case RMobilePhone::EIdServiceActivePermanent:        
       
   133             case RMobilePhone::EIdServiceActiveDefaultAllowed:
       
   134                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   135                     EPsuiConfirmationNote, 
       
   136                     R_CNAP_ACTIVE );
       
   137                 break;
       
   138             case RMobilePhone::EIdServiceActiveDefaultRestricted:
       
   139             case RMobilePhone::EIdServiceNotProvisioned:
       
   140                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   141                     EPsuiConfirmationNote, 
       
   142                     R_CNAP_INACTIVE );
       
   143                 break;
       
   144             default:
       
   145                 CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   146                     EPsuiConfirmationNote, 
       
   147                     R_NOT_DONE_NOTE );
       
   148                 break;
       
   149             }
       
   150         }
       
   151     else
       
   152         {
       
   153         CPsuiNoteController::InstanceL()->ShowNoteL( 
       
   154             EPsuiConfirmationNote, 
       
   155             R_NOT_DONE_NOTE );
       
   156         }
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // Handles errors.
       
   161 // ---------------------------------------------------------------------------
       
   162 void CPsuiCliObserver::HandleCliErrorL( TInt aError )
       
   163     {
       
   164     if ( aError != KErrSatControl  )
       
   165         {
       
   166         TInt errorResource = 
       
   167             CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aError );
       
   168         CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
       
   169         }
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // Sets container.
       
   174 // ---------------------------------------------------------------------------
       
   175 void CPsuiCliObserver::SetContainer( CPsuiContainer& aContainer )
       
   176     {
       
   177     iContainer = &aContainer;
       
   178     }
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // Destructor.
       
   182 // ---------------------------------------------------------------------------
       
   183 CPsuiCliObserver::~CPsuiCliObserver()
       
   184     {
       
   185     //Remove FeatureManager
       
   186     FeatureManager::UnInitializeLib();    
       
   187     }
       
   188 
       
   189 // End of File