stifui/stifui/src/StartedCasesMenuView.cpp
changeset 0 d6fe6244b863
child 3 2703485a934c
equal deleted inserted replaced
-1:000000000000 0:d6fe6244b863
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains CStartedCasesMenuView class
       
    15 * definition.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include  <aknviewappui.h>
       
    21 #include  <barsread.h>	//TResourceReader
       
    22 #include  <Stifui.rsg>
       
    23 #include  "StartedCasesMenuView.h"
       
    24 #include  "StartedCasesMenuContainer.h"
       
    25 #include  "Stifui.hrh" 
       
    26 #include  "AppUIAppUi.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 // ----------------------------------------------------------------------------
       
    30 // CStartedCasesMenuView::ConstructL
       
    31 // 
       
    32 // Symbian OS two-phased constructor.
       
    33 // ----------------------------------------------------------------------------
       
    34 //
       
    35 void CStartedCasesMenuView::ConstructL()
       
    36     {
       
    37     CView::ConstructL();
       
    38     BaseConstructL( R_APPUI_STARTEDCASESMENUVIEW );
       
    39     }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // CStartedCasesMenuView::~CStartedCasesMenuView
       
    43 // 
       
    44 // Destructor.
       
    45 // ----------------------------------------------------------------------------
       
    46 //
       
    47 CStartedCasesMenuView::~CStartedCasesMenuView()
       
    48     {
       
    49     if ( iContainer )
       
    50         {
       
    51         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    52         delete iContainer;
       
    53         }
       
    54     delete iNaviDecorator;
       
    55     iNaviDecorator = NULL;
       
    56     }
       
    57 
       
    58 // ----------------------------------------------------------------------------
       
    59 // CStartedCasesMenuView::Id
       
    60 // 
       
    61 // Returns view´s id.
       
    62 // ----------------------------------------------------------------------------
       
    63 //
       
    64 TUid CStartedCasesMenuView::Id() const
       
    65     {
       
    66     return TUid::Uid(EStartedCasesMenuViewId); //KTestCaseMenuViewId;
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------------------------------
       
    70 // CStartedCasesMenuView::HandleCommandL
       
    71 // 
       
    72 // Handles a command.
       
    73 // ----------------------------------------------------------------------------
       
    74 //
       
    75 void CStartedCasesMenuView::HandleCommandL(TInt aCommand)
       
    76     {   
       
    77     switch ( aCommand )
       
    78         {
       
    79         case EAknSoftkeyBack:
       
    80             {
       
    81             AppUi()->HandleCommandL(EAppUIGoBack);
       
    82             break;
       
    83             }
       
    84 		case EAknCmdOpen:
       
    85 			{
       
    86 			TInt a = iContainer->GetActiveLine();
       
    87 			iContainer->HandleSelectedListItemL( a );
       
    88 			}
       
    89 			break;              
       
    90         default:
       
    91             {
       
    92             AppUi()->HandleCommandL( aCommand );
       
    93             break;
       
    94             }
       
    95         }
       
    96     }
       
    97 
       
    98 // ----------------------------------------------------------------------------
       
    99 // CStartedCasesMenuView::HandleClientRectChange
       
   100 // 
       
   101 // Handles client rect changes.
       
   102 // ----------------------------------------------------------------------------
       
   103 //
       
   104 void CStartedCasesMenuView::HandleClientRectChange()
       
   105     {
       
   106     if ( iContainer )
       
   107         {
       
   108         iContainer->SetRect( ClientRect() );
       
   109         }
       
   110     }
       
   111 
       
   112 // ----------------------------------------------------------------------------
       
   113 // CStartedCasesMenuView::DoActivateL
       
   114 // 
       
   115 // Initializes view when activated.
       
   116 // ----------------------------------------------------------------------------
       
   117 //
       
   118 void CStartedCasesMenuView::DoActivateL(
       
   119    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   120    const TDesC8& /*aCustomMessage*/)
       
   121     {
       
   122     if (!iContainer)
       
   123         {
       
   124         iContainer = new (ELeave) CStartedCasesMenuContainer;
       
   125         iContainer->SetMopParent(this);
       
   126         iContainer->ConstructL( ClientRect() );
       
   127         AppUi()->AddToStackL( *this, iContainer );
       
   128         } 
       
   129         
       
   130     CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
       
   131 	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
       
   132 	
       
   133 	TResourceReader reader;
       
   134 	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTEDCASES);
       
   135 	iNaviDecorator = np->CreateNavigationLabelL( reader );
       
   136 	CleanupStack::PopAndDestroy(); // resource reader
       
   137 	np->PushL(*iNaviDecorator);
       
   138    }
       
   139 
       
   140 // ----------------------------------------------------------------------------
       
   141 // CStartedCasesMenuView::DoDeactivate
       
   142 // 
       
   143 // Deactivates view.
       
   144 // ----------------------------------------------------------------------------
       
   145 //
       
   146 void CStartedCasesMenuView::DoDeactivate()
       
   147     {
       
   148     if ( iContainer )
       
   149         {
       
   150         iContainer->SaveActiveLine();
       
   151         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   152         delete iContainer;
       
   153         iContainer = NULL;
       
   154         }
       
   155     delete iNaviDecorator;
       
   156     iNaviDecorator = NULL;
       
   157     }
       
   158 
       
   159 // End of File
       
   160