|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: |
|
15 * View of the information about the active settings |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <AKNLISTS.H> |
|
24 #include <CALSLBS.H> |
|
25 #include <AKNVIEWAPPUI.H> |
|
26 #include <BrowserNG.rsg> |
|
27 #include <EikMenuP.H> |
|
28 |
|
29 #include "BrowserAppUi.h" |
|
30 #include "BrowserPreferences.h" |
|
31 #include "BrowserDialogs.h" |
|
32 #include "SettingsView.h" |
|
33 #include "SettingsContainer.h" |
|
34 #include "CommonConstants.h" |
|
35 |
|
36 #include <eikapp.h> |
|
37 // CONSTS |
|
38 |
|
39 // ========================= MEMBER FUNCTIONS ================================ |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CBrowserSettingsView::ConstructL |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 void CBrowserSettingsView::ConstructL() |
|
46 { |
|
47 BaseConstructL( R_BROWSER_SETTINGS_SETTINGS_VIEW ); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------- |
|
51 // CBrowserSettingsView::NewLC |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 CBrowserSettingsView* CBrowserSettingsView::NewLC( MApiProvider& aApiProvider ) |
|
55 { |
|
56 CBrowserSettingsView* result; |
|
57 result = new( ELeave ) CBrowserSettingsView( aApiProvider ); |
|
58 CleanupStack::PushL( result ); |
|
59 result->ConstructL(); |
|
60 return result; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CBrowserSettingsView::NewL |
|
65 // --------------------------------------------------------- |
|
66 // |
|
67 CBrowserSettingsView* CBrowserSettingsView::NewL( MApiProvider& aApiProvider ) |
|
68 { |
|
69 CBrowserSettingsView* result; |
|
70 result = CBrowserSettingsView::NewLC( aApiProvider ); |
|
71 CleanupStack::Pop(); |
|
72 return result; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // CBrowserSettingsView::CBrowserSettingsView |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 CBrowserSettingsView::CBrowserSettingsView( MApiProvider& aApiProvider ) |
|
80 : CBrowserViewBase( aApiProvider ) |
|
81 { |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------- |
|
85 // CBrowserSettingsView::~CBrowserSettingsView |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 CBrowserSettingsView::~CBrowserSettingsView() |
|
89 { |
|
90 delete iContainer; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CBrowserSettingsView::CommandSetResourceIdL |
|
95 // --------------------------------------------------------------------------- |
|
96 TInt CBrowserSettingsView::CommandSetResourceIdL() |
|
97 { |
|
98 // It is never called, but this function have to be implemented |
|
99 return KWmlEmptyResourceId; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------- |
|
103 // CBrowserSettingsView::HandleCommsModelChangeL |
|
104 // --------------------------------------------------------- |
|
105 // |
|
106 void CBrowserSettingsView::HandleCommsModelChangeL() |
|
107 { |
|
108 MPreferences& preferences = ApiProvider().Preferences(); |
|
109 TUint defaultAp = preferences.DefaultAccessPoint(); |
|
110 |
|
111 // re-check default access point in case it was deleted. |
|
112 preferences.SetDefaultAccessPointL(defaultAp); |
|
113 |
|
114 if ( iContainer ) |
|
115 { |
|
116 iContainer->DisplayCorrectSettingCategoryListL(); |
|
117 } |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CBrowserSettingsView::HandleCommandL |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 void CBrowserSettingsView::HandleCommandL( TInt aCommandId ) |
|
125 { |
|
126 switch ( aCommandId ) |
|
127 { |
|
128 case EWmlCmdSettingsOpen: |
|
129 { |
|
130 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); |
|
131 iContainer->DisplayCorrectSettingCategoryListL(); |
|
132 break; |
|
133 } |
|
134 case EWmlCmdSettingsChange: |
|
135 { |
|
136 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); |
|
137 iContainer->ChangeItemL( ETrue ); |
|
138 break; |
|
139 } |
|
140 case EAknSoftkeyBack: |
|
141 { |
|
142 if ( iContainer->SettingsError() ) |
|
143 { |
|
144 TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG ); |
|
145 break; |
|
146 } |
|
147 |
|
148 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN); |
|
149 |
|
150 // Close the settings |
|
151 if ( iContainer->CloseSettingsListL() ) |
|
152 { |
|
153 if ( iLastViewId != KNullViewId ) |
|
154 { |
|
155 ActivateViewL( iLastViewId ); |
|
156 } |
|
157 } |
|
158 break; |
|
159 } |
|
160 case EWmlNoCmd: |
|
161 { |
|
162 // Fake MSK command for settings -- update cba to label MSK as Change |
|
163 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); |
|
164 break; |
|
165 } |
|
166 |
|
167 case EWmlCmdUserExit: |
|
168 { |
|
169 if ( iContainer->SettingsError() ) |
|
170 { |
|
171 TBrowserDialogs::ErrorNoteL( R_BROWSER_SETTING_TOOLBAR_SAVE_DIALOG ); |
|
172 break; |
|
173 } |
|
174 |
|
175 // Save the settings |
|
176 iContainer->SaveChangesL(); |
|
177 } |
|
178 // intentional fall through to default case below. |
|
179 |
|
180 default: |
|
181 { |
|
182 AppUi()->HandleCommandL( aCommandId ); |
|
183 break; |
|
184 } |
|
185 } |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------- |
|
189 // CBrowserSettingsView::Id |
|
190 // --------------------------------------------------------- |
|
191 // |
|
192 TUid CBrowserSettingsView::Id() const |
|
193 { |
|
194 return KUidBrowserSettingsViewId; |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------- |
|
198 // CBrowserSettingsView::DoActivateL |
|
199 // --------------------------------------------------------- |
|
200 // |
|
201 void CBrowserSettingsView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
202 TUid aCustomMessageId, |
|
203 const TDesC8& /*aCustomMessage*/ ) |
|
204 { |
|
205 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
206 StatusPane()->MakeVisible( ETrue ); |
|
207 |
|
208 if (aPrevViewId.iAppUid == AppUi()->Application()->AppDllUid()) |
|
209 { // store this only if our own... |
|
210 iLastViewId = aPrevViewId; |
|
211 } |
|
212 else |
|
213 { |
|
214 iLastViewId = TVwsViewId(AppUi()->Application()->AppDllUid(), ApiProvider().LastActiveViewId()); |
|
215 } |
|
216 |
|
217 ApiProvider().SetLastActiveViewId( Id() ); |
|
218 |
|
219 // restoring container |
|
220 iContainer = CSettingsContainer::NewL |
|
221 ( ClientRect(), ApiProvider(), *this ); |
|
222 |
|
223 |
|
224 AppUi()->AddToViewStackL( *this, iContainer ); |
|
225 ApiProvider().CommsModel().AddObserverL( *this ); |
|
226 |
|
227 if (iContainer && ( aCustomMessageId == KUidSettingsGotoToolbarGroup ) ) |
|
228 { |
|
229 iContainer->DisplayToolbarSettingsL(); |
|
230 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); |
|
231 } |
|
232 else if (iContainer && ( aCustomMessageId == KUidSettingsGotoShortcutsGroup ) ) |
|
233 { |
|
234 iContainer->DisplayShortcutsSettingsL(); |
|
235 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_CHANGE); |
|
236 } |
|
237 else if (iContainer) |
|
238 { |
|
239 UpdateCbaL(R_BROWSER_SETTINGS_CBA_OPTIONS_BACK_OPEN); |
|
240 } |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------- |
|
244 // CBrowserSettingsView::DoDeactivate |
|
245 // --------------------------------------------------------- |
|
246 // |
|
247 void CBrowserSettingsView::DoDeactivate() |
|
248 { |
|
249 if ( !ApiProvider().ExitInProgress() ) |
|
250 { |
|
251 ApiProvider().CommsModel().RemoveObserver( *this ); |
|
252 } |
|
253 // removing container |
|
254 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
255 delete iContainer; |
|
256 iContainer = NULL; |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------- |
|
260 // CBrowserSettingsView::HandleClientRectChange |
|
261 // --------------------------------------------------------- |
|
262 // |
|
263 void CBrowserSettingsView::HandleClientRectChange() |
|
264 { |
|
265 if( iContainer ) |
|
266 { |
|
267 iContainer->SetRect( ClientRect() ); |
|
268 } |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // CBrowserSettingsView::DynInitMenuPaneL |
|
273 // --------------------------------------------------------------------------- |
|
274 void CBrowserSettingsView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
275 { |
|
276 if ( aResourceId == R_BROWSER_SETTINGS_SETTINGS_MENU ) |
|
277 { |
|
278 // Show the appropriate menu items, depending on whether |
|
279 // we are in the main setting list, or sub category e.g. Page |
|
280 if ( iContainer->IsSettingModifiable() ) |
|
281 { |
|
282 aMenuPane->SetItemDimmed( EWmlCmdSettingsOpen, ETrue ); |
|
283 } |
|
284 else |
|
285 { |
|
286 aMenuPane->SetItemDimmed( EWmlCmdSettingsChange, ETrue ); |
|
287 } |
|
288 |
|
289 } |
|
290 |
|
291 } |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // CBrowserSettingsView::UpdateCba() |
|
295 // --------------------------------------------------------------------------- |
|
296 void CBrowserSettingsView::UpdateCbaL(TInt aCommandSet) |
|
297 { |
|
298 if (Cba()) |
|
299 { |
|
300 Cba()->SetCommandSetL(aCommandSet); |
|
301 Cba()->DrawDeferred(); |
|
302 } |
|
303 } |
|
304 // End of File |