|
1 /* |
|
2 * Copyright (c) 2006 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: Settings view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <avkon.hrh> |
|
22 #include <aknViewAppUi.h> |
|
23 #include <akntabgrp.h> |
|
24 #include <akntitle.h> // CAknTitlePane |
|
25 #include <featmgr.h> |
|
26 #include <eikmenup.h> |
|
27 #include <barsread.h> |
|
28 #include <StringLoader.h> |
|
29 #include <hlplch.h> |
|
30 |
|
31 #include <vcommand.rsg> |
|
32 #include "vcommand.hrh" |
|
33 #include "vcappui.h" |
|
34 #include "vcsettingsview.h" |
|
35 #include "vcsettingscontainer.h" |
|
36 #include "vcommandconstants.h" |
|
37 #include "rubydebug.h" |
|
38 |
|
39 |
|
40 // ========================= MEMBER FUNCTIONS ================================ |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CVCSettingsView::ConstructL |
|
44 // Symbian OS 2nd phase constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 void CVCSettingsView::ConstructL() |
|
48 { |
|
49 BaseConstructL( R_VC_SETTING_LIST_VIEW ); |
|
50 } |
|
51 |
|
52 |
|
53 // Destructor |
|
54 CVCSettingsView::~CVCSettingsView() |
|
55 { |
|
56 if ( iContainer ) |
|
57 { |
|
58 AppUi()->RemoveFromStack( iContainer ); |
|
59 delete iContainer; |
|
60 } |
|
61 } |
|
62 |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CVCSettingsView::Id |
|
66 // From CAknView, returns Uid of View |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 TUid CVCSettingsView::Id() const |
|
70 { |
|
71 return KUidVCSettingsView; |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CVCSettingsView::HandleCommandL |
|
77 // From MEikMenuObserver delegate commands from the menu |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CVCSettingsView::HandleCommandL( TInt aCommand ) |
|
81 { |
|
82 if( !iOperationInProgress ) |
|
83 { |
|
84 iOperationInProgress = ETrue; |
|
85 |
|
86 switch ( aCommand ) |
|
87 { |
|
88 case EVCMenuCmdChange: |
|
89 { |
|
90 // ETrue for opening the settings view |
|
91 iContainer->EditCurrentL( ETrue ); |
|
92 break; |
|
93 } |
|
94 |
|
95 case EVCCmdChange: |
|
96 { |
|
97 iContainer->EditCurrentL( EFalse ); |
|
98 break; |
|
99 } |
|
100 |
|
101 case EVCCmdReset: |
|
102 { |
|
103 iContainer->ResetL(); |
|
104 break; |
|
105 } |
|
106 |
|
107 case EAknCmdHelp: |
|
108 { |
|
109 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
110 AppUi()->AppHelpContextL() ); |
|
111 break; |
|
112 } |
|
113 |
|
114 case EAknSoftkeyBack: |
|
115 { |
|
116 AppUi()->ActivateLocalViewL( iPreviousView.iViewUid ); |
|
117 break; |
|
118 } |
|
119 |
|
120 default: |
|
121 { |
|
122 AppUi()->HandleCommandL( aCommand ); |
|
123 break; |
|
124 } |
|
125 } |
|
126 |
|
127 iOperationInProgress = EFalse; |
|
128 } |
|
129 |
|
130 |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CVCSettingsView::DoActivateL |
|
135 // Activate this view |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CVCSettingsView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
139 TUid /*aCustomMessageId*/, |
|
140 const TDesC8& /*aCustomMessage*/ ) |
|
141 { |
|
142 if ( !iContainer ) |
|
143 { |
|
144 iContainer = new ( ELeave ) CVCSettingsContainer( *(Cba()) ); |
|
145 iContainer->SetMopParent( this ); |
|
146 iContainer->ConstructL( ClientRect() ); |
|
147 AppUi()->AddToStackL( *this, iContainer ); |
|
148 iContainer->ActivateL(); |
|
149 } |
|
150 |
|
151 iPreviousView = aPrevViewId; |
|
152 |
|
153 iContainer->SetMiddleSoftkeyLabelL(); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CVCSettingsView::DoDeactivate |
|
158 // Deactivate this view |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void CVCSettingsView::DoDeactivate() |
|
162 { |
|
163 if ( iContainer ) |
|
164 { |
|
165 AppUi()->RemoveFromStack(iContainer); |
|
166 delete iContainer; |
|
167 iContainer = NULL; |
|
168 } |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CVCSettingsView::DynInitMenuPaneL |
|
173 // Dynamically customize menu items |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 void CVCSettingsView::DynInitMenuPaneL( TInt aResourceId, |
|
177 CEikMenuPane* aMenuPane ) |
|
178 { |
|
179 if ( aResourceId == R_VC_SETTINGS_MENU ) |
|
180 { |
|
181 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
182 { |
|
183 aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); |
|
184 } |
|
185 |
|
186 TInt index = iContainer->CurrentItemIndex(); |
|
187 |
|
188 if ( index + 1 != iContainer->ItemListSize() ) |
|
189 { |
|
190 aMenuPane->SetItemDimmed( EVCCmdReset, ETrue ); |
|
191 } |
|
192 else |
|
193 { |
|
194 aMenuPane->SetItemDimmed( EVCMenuCmdChange, ETrue ); |
|
195 } |
|
196 } |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------- |
|
200 // CVCSettingsView::HandleClientRectChange |
|
201 // --------------------------------------------------------- |
|
202 // |
|
203 void CVCSettingsView::HandleClientRectChange() |
|
204 { |
|
205 if ( iContainer ) |
|
206 { |
|
207 TRect mainPaneRect; |
|
208 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
209 mainPaneRect ); |
|
210 iContainer->SetRect( mainPaneRect ); |
|
211 } |
|
212 } |
|
213 |
|
214 |
|
215 // End of File |