gssettingsuis/Gs/GSCallBarringPlugin/Src/GSLocalBaseView.cpp
branchRCL_3
changeset 54 7e0eff37aedb
equal deleted inserted replaced
53:8ee96d21d9bf 54:7e0eff37aedb
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Base view for all the views in General Settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "GSLocalBaseView.h"
       
    21 
       
    22 #include <aknViewAppUi.h>
       
    23 #include <akntitle.h>
       
    24 #include <barsread.h>
       
    25 #include <aknnavi.h>
       
    26 #include <akntabgrp.h>
       
    27 #include <aknnavide.h>
       
    28 #include <AknUtils.h>
       
    29 #include <bldvariant.hrh>
       
    30 #include <featmgr.h>
       
    31 #include <gsbasecontainer.h>
       
    32 #include <gscallbarringpluginrsc.rsg>
       
    33 
       
    34 // CONSTANTS
       
    35 #ifdef _DEBUG
       
    36 _LIT( KGSDoActivateError, "DoActivateL" );
       
    37 #endif
       
    38 
       
    39 // ========================= MEMBER FUNCTIONS ================================
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CGSLocalBaseView::CGSLocalBaseView
       
    43 //
       
    44 // C++ constructor
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CGSLocalBaseView::CGSLocalBaseView()
       
    48     {
       
    49     iAppUi = iAvkonViewAppUi;
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CGSLocalBaseView::~CGSLocalBaseView
       
    55 //
       
    56 // Destructor
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CGSLocalBaseView::~CGSLocalBaseView()
       
    60     {
       
    61     if ( iContainer && iAppUi )
       
    62         {
       
    63         iAppUi->RemoveFromViewStack( *this, iContainer );
       
    64         delete iContainer;
       
    65         }
       
    66     }
       
    67 
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CGSLocalBaseView::SetCurrentItem
       
    71 //
       
    72 //
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CGSLocalBaseView::SetCurrentItem( TInt aIndex )
       
    76     {
       
    77     iCurrentItem = aIndex;
       
    78     if( iContainer )
       
    79         {
       
    80         iContainer->SetSelectedItem( aIndex );
       
    81         }
       
    82     }
       
    83 
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CGSLocalBaseView::HandleListBoxEventL
       
    87 //
       
    88 //
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CGSLocalBaseView::HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
    92                                             TListBoxEvent aEventType )
       
    93     {
       
    94     switch ( aEventType )
       
    95         {
       
    96         case EEventEnterKeyPressed:
       
    97         case EEventItemSingleClicked:
       
    98             HandleListBoxSelectionL();
       
    99             break;
       
   100         default:
       
   101            break;
       
   102         }
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CGSLocalBaseView::SetNaviPaneL
       
   108 //
       
   109 //
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 void CGSLocalBaseView::SetNaviPaneL()
       
   113     {
       
   114     }
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CGSLocalBaseView::CreateNaviPaneContextL
       
   119 //
       
   120 //
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CGSLocalBaseView::CreateNaviPaneContextL( TInt /*aResourceId*/ )
       
   124     {
       
   125     }
       
   126 
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CGSLocalBaseView::HandleClientRectChange
       
   130 //
       
   131 //
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CGSLocalBaseView::HandleClientRectChange()
       
   135     {
       
   136     if ( iContainer && iContainer->iListBox )
       
   137         {
       
   138         iContainer->SetRect( ClientRect() );
       
   139         }
       
   140     }
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CGSLocalBaseView::DoActivateL
       
   145 // Activates the view.
       
   146 //
       
   147 // ---------------------------------------------------------------------------
       
   148 //
       
   149 void CGSLocalBaseView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
       
   150                               TUid /*aCustomMessageId*/,
       
   151                               const TDesC8& /*aCustomMessage*/)
       
   152     {
       
   153     if( iContainer )
       
   154         {
       
   155         iAppUi->RemoveFromViewStack( *this, iContainer );
       
   156         delete iContainer;
       
   157         iContainer = NULL;
       
   158         }
       
   159 
       
   160     CreateContainerL();
       
   161 
       
   162     iAppUi->AddToViewStackL( *this, iContainer );
       
   163     iContainer->iListBox->SetListBoxObserver( this );
       
   164 
       
   165     SetNaviPaneL();
       
   166     }
       
   167 
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // CGSLocalBaseView::DoDeactivate()
       
   171 //
       
   172 //
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CGSLocalBaseView::DoDeactivate()
       
   176     {
       
   177     if ( iContainer )
       
   178         {
       
   179         iAppUi->RemoveFromViewStack( *this, iContainer );
       
   180         delete iContainer;
       
   181         iContainer = NULL;
       
   182         }
       
   183     }
       
   184 
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // CGSLocalBaseView::CreateContainerL()
       
   188 //
       
   189 //
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 void CGSLocalBaseView::CreateContainerL()
       
   193     {
       
   194     NewContainerL();
       
   195     __ASSERT_DEBUG( iContainer,
       
   196         User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) );
       
   197     iContainer->SetMopParent( this );
       
   198 
       
   199     TRAPD( error, iContainer->ConstructL( ClientRect() ) );
       
   200 
       
   201     if ( error )
       
   202         {
       
   203         delete iContainer;
       
   204         iContainer = NULL;
       
   205         User::Leave( error );
       
   206         }
       
   207     }
       
   208 
       
   209 
       
   210 //End of File