stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp
branchRCL_3
changeset 9 404ad6c9bc20
child 19 d40e813b23c0
equal deleted inserted replaced
8:87e9ebfbe96a 9:404ad6c9bc20
       
     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 CStartCasesView class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include  <eikmenub.h>
       
    20 #include  <aknViewAppUi.h>
       
    21 #include  <aknlistquerydialog.h> 
       
    22 #include  <barsread.h>	//TResourceReader
       
    23 #include  <Stifui.rsg>
       
    24 #include  "CreatedTestSetMenuView.h"
       
    25 #include  "CreatedTestSetMenuContainer.h"
       
    26 #include  "AppUIAppUi.h"
       
    27 #include  "Stifui.hrh" 
       
    28 #include "TestSetMenuView.h"
       
    29 
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 // ----------------------------------------------------------------------------
       
    33 // CStartCasesView::ConstructL
       
    34 // 
       
    35 // Symbian OS two-phased constructor.
       
    36 // ----------------------------------------------------------------------------
       
    37 //
       
    38 void CCreatedTestSetMenuView::ConstructL()
       
    39     {
       
    40     CView::ConstructL();  
       
    41     BaseConstructL(R_APPUI_LOADTESTSETVIEW);
       
    42     iCurrentTestCase = 0;
       
    43 
       
    44     }
       
    45 
       
    46 // ----------------------------------------------------------------------------
       
    47 // CreatedTestSetMenuView::~CStartCasesView
       
    48 // 
       
    49 // Destructor
       
    50 // ----------------------------------------------------------------------------
       
    51 //
       
    52 CCreatedTestSetMenuView::~CCreatedTestSetMenuView()
       
    53     {
       
    54     if ( iContainer )
       
    55         {
       
    56         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    57         delete iContainer;
       
    58         }
       
    59     delete iNaviDecorator;
       
    60     iNaviDecorator = NULL;
       
    61     }
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // CreatedTestSetMenuView::Id
       
    65 // 
       
    66 // Returns view´s id.
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 TUid CCreatedTestSetMenuView::Id() const
       
    70     {
       
    71     return TUid::Uid(ECreatedTestSetMenuViewId);
       
    72 
       
    73     }
       
    74 
       
    75 // ----------------------------------------------------------------------------
       
    76 // CreatedTestSetMenuView::HandleCommandL
       
    77 // 
       
    78 // Handles a command.
       
    79 // ----------------------------------------------------------------------------
       
    80 //
       
    81 void CCreatedTestSetMenuView::HandleCommandL(TInt aCommand)
       
    82     {   
       
    83     switch ( aCommand )
       
    84             {
       
    85             case EAknSoftkeyBack:
       
    86                 {
       
    87                 AppUi()->HandleCommandL(EAppUIGoToTestSetsMenu);
       
    88                 break;
       
    89                 }
       
    90     		case EAknCmdOpen:
       
    91     			{
       
    92     		   		HandleListBoxEventL(iContainer->ListBox(), EEventEnterKeyPressed);	
       
    93     			break;
       
    94     			}
       
    95             default:
       
    96                 {
       
    97                 AppUi()->HandleCommandL( aCommand );
       
    98                 break;
       
    99                 }
       
   100             }
       
   101 
       
   102     }
       
   103 
       
   104 // ----------------------------------------------------------------------------
       
   105 //CreatedTestSetMenuView::HandleClientRectChange
       
   106 // 
       
   107 // Handles client rect changes.
       
   108 // ----------------------------------------------------------------------------
       
   109 //
       
   110 void CCreatedTestSetMenuView::HandleClientRectChange()
       
   111     {
       
   112     if ( iContainer )
       
   113         {
       
   114         iContainer->SetRect( ClientRect() );
       
   115         }
       
   116 
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------------------------------
       
   120 // CreatedTestSetMenuView::DoActivateL
       
   121 // 
       
   122 // Initializes view when activated.
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 void CCreatedTestSetMenuView::DoActivateL(
       
   126    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   127    const TDesC8& /*aCustomMessage*/)
       
   128     {
       
   129     if (!iContainer)
       
   130         {
       
   131         ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: DoActivateL"));
       
   132         iContainer = new (ELeave) CCreatedTestSetMenuContainer;
       
   133         iContainer->SetMopParent(this);
       
   134         iContainer->ConstructL( ClientRect(), this );
       
   135            ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: container constructed"));
       
   136         AppUi()->AddToStackL( *this, iContainer );
       
   137         }
       
   138 
       
   139     iContainer->SetCurrentItemIndex(iCurrentTestCase);
       
   140     
       
   141     CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
       
   142 	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
       
   143 	
       
   144 	TResourceReader reader;
       
   145 	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_LOADTESTSET);
       
   146 	iNaviDecorator = np->CreateNavigationLabelL( reader );
       
   147 	CleanupStack::PopAndDestroy(); // resource reader
       
   148 	np->PushL(*iNaviDecorator);
       
   149 
       
   150     }
       
   151 
       
   152 // ----------------------------------------------------------------------------
       
   153 // CreatedTestSetMenuView::DoDeactivate
       
   154 // 
       
   155 // Deactivates view.
       
   156 // ----------------------------------------------------------------------------
       
   157 //
       
   158 void CCreatedTestSetMenuView::DoDeactivate()
       
   159     {
       
   160     if ( iContainer )
       
   161         {
       
   162         iContainer->SaveActiveLine();
       
   163         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   164         delete iContainer;
       
   165         iContainer = NULL;
       
   166         }
       
   167     delete iNaviDecorator;
       
   168     iNaviDecorator = NULL;
       
   169     }
       
   170 
       
   171 
       
   172 // ----------------------------------------------------------------------------
       
   173 // CreatedTestSetMenuView::HandleListBoxEventL
       
   174 // 
       
   175 // Handles listbox events.
       
   176 // ----------------------------------------------------------------------------
       
   177 //
       
   178 void CCreatedTestSetMenuView::HandleListBoxEventL( CEikListBox* aListBox, 
       
   179     TListBoxEvent aEventType )
       
   180 	{
       
   181 	if (  aEventType == MEikListBoxObserver::EEventEnterKeyPressed    )
       
   182 		{
       
   183 	 	// Checking with item from list was selected	
       
   184 		CTextListBoxModel* tmp = (CTextListBoxModel*)aListBox->Model();
       
   185 		TPtrC item = tmp->ItemText(aListBox->CurrentItemIndex());
       
   186 		// Geting propper format of item from list (ex. 2008_8_10_13_16.set ). 
       
   187 		TPtrC substracted(item.Left(item.Length()-2));
       
   188 		substracted.Set(substracted.Right(substracted.Length()-2));
       
   189 		// Creating new view containing 		
       
   190        	CTestSetMenuView* testSetMenu = (CTestSetMenuView*)AppUi()->View( TUid::Uid(ETestSetMenuViewId) ); 
       
   191        	TInt	error = testSetMenu->LoadTestSetL( substracted );
       
   192 		AppUi()->HandleCommandL(ECmdGoToTestSetView);
       
   193 		
       
   194         }
       
   195  
       
   196     }
       
   197 
       
   198 
       
   199 // End of File