stifui/stifui/src/TestSetBaseMenuView.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 CTestSetBaseMenuView class
       
    15 * definition.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include  <aknviewappui.h>
       
    21 #include  <aknlists.h> 
       
    22 #include  <barsread.h>	//TResourceReader
       
    23 #include  <Stifui.rsg>
       
    24 #include  "TestSetBaseMenuView.h"
       
    25 #include  "TestSetBaseMenuContainer.h"
       
    26 #include  "Stifui.hrh" 
       
    27 #include  "AppUIAppUi.h" // loggerin kayttoa varten, muuten ei tarvittaisi
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // CTestSetBaseMenuView::ConstructL
       
    33 // 
       
    34 // Symbian OS two-phased constructor.
       
    35 // ---------------------------------------------------------
       
    36 //
       
    37 void CTestSetBaseMenuView::ConstructL()
       
    38     {
       
    39     CView::ConstructL();
       
    40     BaseConstructL( R_APPUI_TESTSETBASEMENUVIEW );
       
    41     }
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CTestSetBaseMenuView::~CTestSetBaseMenuView
       
    45 // 
       
    46 // Destructor.
       
    47 // ----------------------------------------------------------------------------
       
    48 //
       
    49 CTestSetBaseMenuView::~CTestSetBaseMenuView()
       
    50     {
       
    51     if ( iContainer )
       
    52         {
       
    53         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    54         delete iContainer;
       
    55         iContainer = NULL;
       
    56         }
       
    57     delete iNaviDecorator;
       
    58     iNaviDecorator = NULL;
       
    59     }
       
    60 
       
    61 // ----------------------------------------------------------------------------
       
    62 // CTestSetBaseMenuView::Id
       
    63 // 
       
    64 // Returns view´s id.
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 TUid CTestSetBaseMenuView::Id() const
       
    68     {
       
    69     return TUid::Uid(ETestSetBaseMenuViewId); //KTestSetBaseMenuViewId;
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------------------------------
       
    73 // CTestSetBaseMenuView::HandleCommandL
       
    74 // 
       
    75 // Handles a command.
       
    76 // ----------------------------------------------------------------------------
       
    77 //
       
    78 void CTestSetBaseMenuView::HandleCommandL(TInt aCommand)
       
    79     {   
       
    80     switch ( aCommand )
       
    81         {
       
    82         case EAknSoftkeyBack:
       
    83             {
       
    84             AppUi()->HandleCommandL(EAppUIGoBack);
       
    85             break;
       
    86             }
       
    87 		case EAknCmdOpen:
       
    88 			{
       
    89 			break;
       
    90 			}
       
    91 		case ECmdCreateTestSet:
       
    92             {
       
    93             AppUi()->HandleCommandL(ECmdCreateTestSet);
       
    94             break;
       
    95             }
       
    96 		case ECmdLoadTestSet:
       
    97             {
       
    98             AppUi()->HandleCommandL(ECmdLoadTestSet);
       
    99             break;
       
   100             }
       
   101         default:
       
   102             {
       
   103             AppUi()->HandleCommandL( aCommand );
       
   104             break;
       
   105             }
       
   106         }
       
   107     }
       
   108 
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // CTestSetBaseMenuView::HandleListBoxEventL
       
   112 // 
       
   113 // Handles a list box event.
       
   114 // ----------------------------------------------------------------------------
       
   115 //
       
   116 void CTestSetBaseMenuView::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
       
   117 	{
       
   118 	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
       
   119 		{
       
   120 	    switch ( aListBox->CurrentItemIndex() )
       
   121 			{
       
   122 		    case 0:
       
   123 		    	HandleCommandL( ECmdCreateTestSet );
       
   124 				break;
       
   125 			case 1:
       
   126 				HandleCommandL( ECmdLoadTestSet );
       
   127 				break;
       
   128 			}
       
   129 		}
       
   130 	}
       
   131 	
       
   132 		
       
   133 // ----------------------------------------------------------------------------
       
   134 // CTestSetBaseMenuView::HandleClientRectChange
       
   135 // 
       
   136 // Handles client rect changes.
       
   137 // ----------------------------------------------------------------------------
       
   138 //
       
   139 void CTestSetBaseMenuView::HandleClientRectChange()
       
   140     {
       
   141     if ( iContainer )
       
   142         {
       
   143         iContainer->SetRect( ClientRect() );
       
   144         }
       
   145     }
       
   146 
       
   147 // ----------------------------------------------------------------------------
       
   148 // CTestSetBaseMenuView::DoActivateL
       
   149 // 
       
   150 // Initializes view when activated.
       
   151 // ----------------------------------------------------------------------------
       
   152 //
       
   153 void CTestSetBaseMenuView::DoActivateL(
       
   154    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   155    const TDesC8& /*aCustomMessage*/)
       
   156     {
       
   157     if (!iContainer)
       
   158         {
       
   159         ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: DoActivateL"));
       
   160         //message = _L("eng.open ret:");
       
   161         //message.AppendNum( ret , EDecimal );
       
   162         //AppUi->iLogger->Log( message );
       
   163         iContainer = new (ELeave) CTestSetBaseMenuContainer;
       
   164         iContainer->SetMopParent(this);
       
   165         iContainer->ConstructL( ClientRect(), this );
       
   166         ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: container constructed"));
       
   167         AppUi()->AddToStackL( *this, iContainer );
       
   168         } 
       
   169 	
       
   170     CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
       
   171 	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
       
   172 	
       
   173 	TResourceReader reader;
       
   174 	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET_BASE);
       
   175 	iNaviDecorator = np->CreateNavigationLabelL( reader );
       
   176 	CleanupStack::PopAndDestroy(); // resource reader
       
   177 	np->PushL(*iNaviDecorator);
       
   178 
       
   179    }
       
   180 
       
   181 // ----------------------------------------------------------------------------
       
   182 // CTestSetBaseMenuView::DoDeactivate
       
   183 // 
       
   184 // Deactivates view.
       
   185 // ----------------------------------------------------------------------------
       
   186 //
       
   187 void CTestSetBaseMenuView::DoDeactivate()
       
   188     {
       
   189     if ( iContainer )
       
   190         {
       
   191         iContainer->SaveActiveLine();
       
   192         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   193         delete iContainer;
       
   194         iContainer = NULL;         
       
   195         }    
       
   196     delete iNaviDecorator;
       
   197     iNaviDecorator = NULL;    
       
   198     }
       
   199 
       
   200 // End of File