pkiutilities/SecModUI/src/SecModUIViewBase.cpp
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     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:   Implementation of the CSecModUIViewBase class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include  "SecModUIViewBase.h"
       
    21 #include  "SecModUIContainerBase.h" 
       
    22 #include  "SecModUIModel.h"
       
    23 #include  "SecModUILogger.h"
       
    24 #include  "secmodui.hrh"
       
    25 #include  <SecModUI.rsg>
       
    26 #include  <aknViewAppUi.h>
       
    27 #include  <avkon.hrh>
       
    28 #include  <eiktxlbx.h>
       
    29 #include  <aknnavi.h>
       
    30 #include  <aknnavide.h> 
       
    31 #include  <barsread.h>
       
    32 #include    <hlplch.h>   // For HlpLauncher 
       
    33 #include  <featmgr.h>
       
    34 
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CSecModUIViewBase::CSecModUIViewBase
       
    40 // C++ default constructor can NOT contain any code, that
       
    41 // might leave.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CSecModUIViewBase::CSecModUIViewBase(CSecModUIModel& aModel):
       
    45     CAknView(), iModel(aModel)
       
    46     {    
       
    47     LOG_WRITE( "CSecModUIViewBase::CSecModUIViewBase" );
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CSecModUIViewBase::~CSecModUIViewBase()
       
    52 // destructor
       
    53 // ---------------------------------------------------------
       
    54 //
       
    55 CSecModUIViewBase::~CSecModUIViewBase()
       
    56     {
       
    57     LOG_WRITE( "CSecModUIViewBase::~CSecModUIViewBase" );
       
    58     delete iNaviDecorator;
       
    59     if (iContainer)
       
    60         {
       
    61         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    62         }
       
    63     delete iContainer;
       
    64     }
       
    65     
       
    66 // ---------------------------------------------------------
       
    67 // CSecModUIViewBase::HandleCommandL(TInt aCommand)
       
    68 // takes care of view command handling
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 void CSecModUIViewBase::HandleCommandL(TInt aCommand)
       
    72     {
       
    73     LOG_ENTERFN("CSecModUIViewBase::HandleCommandL()");   
       
    74     switch ( aCommand )
       
    75         {
       
    76         case EAknSoftkeyBack:
       
    77             {
       
    78             AppUi()->ActivateLocalViewL(iPrevViewId.iViewUid);
       
    79             break;
       
    80             }
       
    81         case ESecModUICmdModuleInfo:
       
    82             {
       
    83             iModel.ViewOpenedSecModDetailsL();
       
    84             break;
       
    85             }
       
    86         case EAknCmdExit:
       
    87             {
       
    88             ((CAknViewAppUi*)iAvkonAppUi)->HandleCommandL(EAknCmdExit);
       
    89             break;
       
    90             }
       
    91         case EAknCmdHelp: 
       
    92             {
       
    93             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
    94                 {
       
    95                 HlpLauncher::LaunchHelpApplicationL(
       
    96                     iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );   
       
    97                 }    
       
    98             break;
       
    99             }    
       
   100         default:
       
   101             {            
       
   102             break;
       
   103             }
       
   104         }
       
   105     LOG_LEAVEFN("CSecModUIViewBase::HandleCommandL()");    
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CSecModUIViewBase::HandleClientRectChange()
       
   110 // ---------------------------------------------------------
       
   111 //
       
   112 void CSecModUIViewBase::HandleClientRectChange()
       
   113     {
       
   114     LOG_ENTERFN("CSecModUIViewBase::HandleClientRectChange()");   
       
   115     if ( iContainer )
       
   116         {
       
   117         iContainer->SetRect( ClientRect() );
       
   118         }
       
   119     LOG_LEAVEFN("CSecModUIViewBase::HandleClientRectChange()");        
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------
       
   123 // CSecModUIViewBase::DoActivateL(...)
       
   124 // 
       
   125 // ---------------------------------------------------------
       
   126 //
       
   127 void CSecModUIViewBase::SetTitlePaneL()
       
   128     {
       
   129     iModel.ActivateTokenLabelToTitleL();
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CSecModUIViewBase::AddNavipaneLabelL()
       
   134 // Default implementation is empty
       
   135 // ---------------------------------------------------------
       
   136 //
       
   137 void CSecModUIViewBase::AddNaviPaneLabelL()
       
   138     {
       
   139     DoAddNaviPaneL();               
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------
       
   143 // CSecModUIViewBase::DoAddNaviPaneL()
       
   144 // Creates navi pane text
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 void CSecModUIViewBase::DoAddNaviPaneL(TInt aResource)
       
   148     {
       
   149     TUid naviPaneUid;
       
   150     naviPaneUid.iUid = EEikStatusPaneUidNavi;
       
   151     CEikStatusPane* statusPane = StatusPane();
       
   152     CAknNavigationControlContainer* naviPane =
       
   153         (CAknNavigationControlContainer*) statusPane->ControlL(naviPaneUid);
       
   154     if(!iNaviDecorator)
       
   155         {
       
   156         // Let's try to create navipane
       
   157         CEikStatusPaneBase::TPaneCapabilities subPane =
       
   158         statusPane->PaneCapabilities(naviPaneUid);
       
   159     
       
   160         if (subPane.IsPresent() && subPane.IsAppOwned())
       
   161             {
       
   162             if (0 != aResource)
       
   163                 {
       
   164                 TResourceReader reader;
       
   165                 iCoeEnv->CreateResourceReaderLC(reader, aResource);
       
   166 
       
   167                  // set the navigation pane label
       
   168                 iNaviDecorator = naviPane->CreateNavigationLabelL(reader);
       
   169                 CleanupStack::PopAndDestroy();
       
   170                 }
       
   171              else
       
   172                 {
       
   173                 iNaviDecorator = naviPane->CreateNavigationLabelL();
       
   174                 }
       
   175             }
       
   176         }
       
   177     if (iNaviDecorator)
       
   178         {
       
   179         naviPane->PushL(*iNaviDecorator);
       
   180         }
       
   181     }
       
   182         
       
   183 // ---------------------------------------------------------
       
   184 // CSecModUIViewBase::DoActivateL(...)
       
   185 // 
       
   186 // ---------------------------------------------------------
       
   187 //
       
   188 void CSecModUIViewBase::DoActivateL(
       
   189    const TVwsViewId& aPrevViewId,TUid /*aCustomMessageId*/,
       
   190    const TDesC8& /*aCustomMessage*/)
       
   191     {
       
   192     LOG_ENTERFN("CSecModUIViewBase::DoActivateL()");   
       
   193     if (KNullUid == iPrevViewId.iViewUid)
       
   194         {
       
   195         iPrevViewId = aPrevViewId;
       
   196         }
       
   197     SetTitlePaneL();
       
   198     AddNaviPaneLabelL();
       
   199                     
       
   200     if (!iContainer)
       
   201         {
       
   202         CreateContainerL();
       
   203         iContainer->SetMopParent(this);
       
   204         iContainer->ConstructL(ClientRect());
       
   205         iContainer->ListBox().SetListBoxObserver(this);
       
   206         AppUi()->AddToStackL(*this, iContainer);
       
   207         }         
       
   208    iContainer->ListBox().SetTopItemIndex( iTopItem );
       
   209    //the iCurrentPostion can be -1, if no keystore presents.
       
   210    if ( iCurrentPosition >= 0 )
       
   211        {
       
   212        iContainer->ListBox().SetCurrentItemIndex( iCurrentPosition ); 	
       
   213        } 
       
   214    iContainer->MakeVisible(ETrue);
       
   215    iContainer->SetRect(ClientRect());
       
   216    iContainer->ActivateL();
       
   217    
       
   218    
       
   219    LOG_LEAVEFN("CSecModUIViewBase::DoActivateL()");    
       
   220    }
       
   221 
       
   222 // ---------------------------------------------------------
       
   223 // CSecModUIViewBase::DoDeactivate()
       
   224 // 
       
   225 // ---------------------------------------------------------
       
   226 //
       
   227 void CSecModUIViewBase::DoDeactivate()
       
   228     {
       
   229     LOG_ENTERFN("CSecModUIViewBase::DoDeactivate()");   
       
   230     if ( iContainer )
       
   231         {
       
   232         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   233         iCurrentPosition = iContainer->ListBox().CurrentItemIndex();
       
   234         iTopItem = iContainer->ListBox().TopItemIndex();
       
   235         }
       
   236     
       
   237     delete iContainer;
       
   238     iContainer = NULL;
       
   239     LOG_LEAVEFN("CSecModUIViewBase::DoDeactivate()");    
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CSecModUIContainerBase::HandleListBoxEventL(
       
   244 //     CEikListBox* aListBox, TListBoxEvent aEventType)
       
   245 // ---------------------------------------------------------
       
   246 //    
       
   247 void CSecModUIViewBase::HandleListBoxEventL(
       
   248     CEikListBox* /*aListBox*/, 
       
   249     TListBoxEvent aEventType)
       
   250     {
       
   251     LOG_ENTERFN("CSecModUIContainerBase::HandleListBoxEventL()");   
       
   252     switch( aEventType )
       
   253 		{	
       
   254         default:
       
   255             {
       
   256 			break;
       
   257             }
       
   258 		} 
       
   259     LOG_LEAVEFN("CSecModUIContainerBase::HandleListBoxEventL()");    		          
       
   260     }
       
   261 
       
   262 // End of File