gssettingsuis/Gs/GSCallBarringPlugin/Src/GSMainBarringView.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2005 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:  View for the Main Barring folder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <featmgr.h>
       
    22 #include <StringLoader.h>
       
    23 #include <gscallbarringpluginrsc.rsg>
       
    24 #include "CallBarringPlugin.hrh"            //for enumerations (e.g.TGSBarringSetting)
       
    25 #include "GSMainBarringView.h"      //for CGSSettListMainBarringView
       
    26 #include "GSMainBarringContainer.h" //for CGSBaseContainer
       
    27 #include "GSCellularCallBarringView.h"          //for CGSSettListBarringView
       
    28 #include "GSInternetBarringView.h"  //for CGSSettListInternetBarringView
       
    29 #include "GSPhoneSettingConstants.h"//for constant values
       
    30 #include "LocalViewIds.h"           //for KSettListBarringViewId, KGSMainViewId
       
    31 #include <eikmenup.h>               //for menu bar
       
    32 #include "GSCallBarringPlugin.h"
       
    33 #include <aknViewAppUi.h>
       
    34 #include <gsfwviewuids.h>
       
    35 #include <gscommon.hrh>
       
    36 #include <aknlists.h>
       
    37 #include <hlplch.h>                 // For HlpLauncher
       
    38 
       
    39 // ========================= MEMBER FUNCTIONS ================================
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 // C++ constructor.
       
    43 //
       
    44 // ---------------------------------------------------------------------------
       
    45 CGSSettListMainBarringView::CGSSettListMainBarringView()
       
    46     {
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 // Symbian OS two-phased constructor (second phase)
       
    52 //
       
    53 // ---------------------------------------------------------------------------
       
    54 void CGSSettListMainBarringView::ConstructL()
       
    55     {
       
    56     BaseConstructL( R_GS_BARRING_MAIN_VIEW );
       
    57 
       
    58     // Create call barring and Internet call barring views.
       
    59     iBarringView = CGSSettListBarringView::NewL();
       
    60     iAppUi->AddViewL( iBarringView );
       
    61 
       
    62     iInternetBarringView = CGSSettListInternetBarringView::NewL();
       
    63     iAppUi->AddViewL( iInternetBarringView );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 // Symbian OS two-phased constructor (first phase)
       
    69 //
       
    70 // ---------------------------------------------------------------------------
       
    71 CGSSettListMainBarringView* CGSSettListMainBarringView::NewLC()
       
    72     {
       
    73     CGSSettListMainBarringView* self =
       
    74         new ( ELeave ) CGSSettListMainBarringView;
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     return self;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 // C++ destructor
       
    83 //
       
    84 // ---------------------------------------------------------------------------
       
    85 CGSSettListMainBarringView::~CGSSettListMainBarringView()
       
    86     {
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 // Returns Id of the Barring view.
       
    92 //
       
    93 // ---------------------------------------------------------------------------
       
    94 TUid CGSSettListMainBarringView::Id() const
       
    95     {
       
    96     return KCallMainBarringViewId;
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 // Handles other than list box events.
       
   102 //
       
   103 // ---------------------------------------------------------------------------
       
   104 void CGSSettListMainBarringView::HandleCommandL( TInt aCommand )
       
   105     {
       
   106     iCurrentItem = iContainer->iListBox->CurrentItemIndex();
       
   107 
       
   108     switch ( aCommand )
       
   109         {
       
   110         case EAknSoftkeyOpen:
       
   111 		case EGSCmdAppOpen:
       
   112             HandleListBoxSelectionL();
       
   113             break;
       
   114         case EAknSoftkeyBack:
       
   115             iAppUi->ActivateLocalViewL( KGSTelPluginUid );
       
   116             break;
       
   117         case EAknCmdHelp:
       
   118             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   119                 {
       
   120                 HlpLauncher::LaunchHelpApplicationL(
       
   121                     iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
       
   122                 }
       
   123             break;
       
   124         default:
       
   125             iAppUi->HandleCommandL( aCommand );
       
   126             break;
       
   127         }
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 // Activates view.
       
   133 //
       
   134 // ---------------------------------------------------------------------------
       
   135 void CGSSettListMainBarringView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   136                                           TUid aCustomMessageId,
       
   137                                           const TDesC8& aCustomMessage )
       
   138     {
       
   139     CGSLocalBaseView::DoActivateL( aPrevViewId, aCustomMessageId,
       
   140                                    aCustomMessage );
       
   141 
       
   142     iContainer->iListBox->SetTopItemIndex( iTopItemIndex );
       
   143 
       
   144     if ( iCurrentItem >= 0 &&
       
   145          iCurrentItem < iContainer->iListBox->Model()->NumberOfItems() )
       
   146         {
       
   147         iContainer->iListBox->SetCurrentItemIndexAndDraw( iCurrentItem );
       
   148         }
       
   149     }
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 // Deactivates view.
       
   154 //
       
   155 // ---------------------------------------------------------------------------
       
   156 void CGSSettListMainBarringView::DoDeactivate()
       
   157     {
       
   158     if ( iContainer )
       
   159         {
       
   160         iCurrentItem = iContainer->iListBox->CurrentItemIndex();
       
   161         iTopItemIndex = iContainer->iListBox->TopItemIndex();
       
   162 
       
   163         iAppUi->RemoveFromViewStack( *this, iContainer );
       
   164         delete iContainer;
       
   165         iContainer = NULL;
       
   166         }
       
   167     }
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CGSSettListMainBarringView::ProcessCommandL
       
   171 // -----------------------------------------------------------------------------
       
   172 void CGSSettListMainBarringView::ProcessCommandL( TInt aCommand )
       
   173     {
       
   174     MenuBar()->SetContextMenuTitleResourceId(R_CALL_BARRING_MSK_CONTEXTMENUBAR);
       
   175     // Call base class
       
   176     CAknView::ProcessCommandL( aCommand );
       
   177     }
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 // Before showing a options menu, delete options key specific settings if
       
   181 // rocker key has been pressed.
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 void CGSSettListMainBarringView::DynInitMenuPaneL( TInt aResourceId,
       
   185                                                    CEikMenuPane* aMenuPane )
       
   186     {
       
   187     // show or hide the 'help' menu item when supported
       
   188     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
   189         {
       
   190         User::LeaveIfNull( aMenuPane );
       
   191             
       
   192         //Handle Help Fature
       
   193         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   194             {
       
   195             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   196             }
       
   197         else
       
   198             {
       
   199             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   200             }
       
   201         }
       
   202     }
       
   203 
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 // Creates new iContainer.
       
   207 //
       
   208 // ---------------------------------------------------------------------------
       
   209 void CGSSettListMainBarringView::NewContainerL()
       
   210     {
       
   211     iContainer = new ( ELeave ) CGSSettListMainBarringContainer;
       
   212     }
       
   213 
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 // Handles changing of barring password.
       
   218 //
       
   219 // ---------------------------------------------------------------------------
       
   220 void CGSSettListMainBarringView::HandleListBoxSelectionL()
       
   221     {
       
   222     const TInt currentItem = Container()->CurrentFeatureId();
       
   223 
       
   224     switch ( currentItem )
       
   225         {
       
   226         case EGSCBCellular:
       
   227             iAppUi->ActivateLocalViewL( KCallBarringViewId );
       
   228             break;
       
   229         case EGSCBInternet:
       
   230             iAppUi->ActivateLocalViewL( KCallInternetBarringViewId );
       
   231             break;
       
   232         default:
       
   233             break;
       
   234         }
       
   235     }
       
   236 
       
   237 // ---------------------------------------------------------------------------
       
   238 // CGSSettListMainBarringView::Container
       
   239 //
       
   240 // Returns call container item
       
   241 // ---------------------------------------------------------------------------
       
   242 //
       
   243 CGSSettListMainBarringContainer* CGSSettListMainBarringView::Container()
       
   244     {
       
   245     return static_cast <CGSSettListMainBarringContainer*> ( iContainer );
       
   246     }
       
   247 
       
   248 // End of File
       
   249