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