|
1 /* |
|
2 * Copyright (c) 2005 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 * Container of the information about the active settings |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef SETTINGS_CONTAINER_H |
|
21 #define SETTINGS_CONTAINER_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <coecntrl.h> |
|
25 #include <coemop.h> |
|
26 #include <AknLists.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KWmlSettingsIndexNone = -1; |
|
30 const TInt KWmlSettingsItemMaxLength = 100; |
|
31 |
|
32 // FORWARD DECLARATION |
|
33 class MApiProvider; |
|
34 class CAknNavigationDecorator; |
|
35 class CAknSettingStyleListBox; |
|
36 |
|
37 |
|
38 struct TEncodingStruct |
|
39 { |
|
40 TUint32 iSystemId; // System id of the encoding (CHARCONV.h) |
|
41 TUint32 iResId; // Resource string id |
|
42 }; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Container of the settings view |
|
48 * @since 1.2 |
|
49 */ |
|
50 class CSettingsContainer : public CCoeControl, public MEikListBoxObserver |
|
51 { |
|
52 public: // construction, destruction |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @since 1.2 |
|
57 * @param aRect Rectangle. |
|
58 * @param aPreferences Preferences. |
|
59 * @param aCommsModel Comms model. |
|
60 */ |
|
61 static CSettingsContainer* NewLC( |
|
62 const TRect& aRect, |
|
63 MApiProvider& aApiProvider, |
|
64 MObjectProvider& aMopParent |
|
65 ); |
|
66 |
|
67 /** |
|
68 * Two-phased constructor. |
|
69 * @since 1.2 |
|
70 * @param aRect Rectangle. |
|
71 * @param aPreferences Preferences. |
|
72 * @param aCommsModel Comms model. |
|
73 */ |
|
74 static CSettingsContainer* NewL( |
|
75 const TRect& aRect, |
|
76 MApiProvider& aApiProvider, |
|
77 MObjectProvider& aMopParent |
|
78 ); |
|
79 |
|
80 /** |
|
81 * Destructor. |
|
82 */ |
|
83 virtual ~CSettingsContainer(); |
|
84 |
|
85 private: // constructor |
|
86 |
|
87 /** |
|
88 * Constructor. |
|
89 * @param aPreferences Preferences. |
|
90 * @param aCommsModel Comms model. |
|
91 */ |
|
92 CSettingsContainer |
|
93 ( MApiProvider& aApiProvider, MObjectProvider& aMopParent ); |
|
94 |
|
95 /** |
|
96 * By default constructor is private. |
|
97 */ |
|
98 void ConstructL( const TRect& aRect ); |
|
99 |
|
100 /** |
|
101 * Inherited functions |
|
102 */ |
|
103 public: // from CCoeControl |
|
104 |
|
105 /** |
|
106 * Count component controls. |
|
107 * @since 1.2 |
|
108 * @return Number of component controls. |
|
109 */ |
|
110 virtual TInt CountComponentControls() const; |
|
111 |
|
112 /** |
|
113 * Handles focus changing |
|
114 * @param aDrawNow |
|
115 */ |
|
116 void FocusChanged( TDrawNow aDrawNow ); |
|
117 |
|
118 /** |
|
119 * Handle resource change. |
|
120 * @param aType Event type. |
|
121 */ |
|
122 void HandleResourceChange( TInt aType ); |
|
123 |
|
124 |
|
125 /** |
|
126 * Get a component control by index. |
|
127 * @since 1.2 |
|
128 * @param aIndex Index of component control to be returned. |
|
129 * @return Component control or NULL. |
|
130 */ |
|
131 virtual CCoeControl* ComponentControl( TInt aIndex ) const; |
|
132 |
|
133 /** |
|
134 * Handle size change, lay out and draw components. |
|
135 * @since 1.2 |
|
136 */ |
|
137 virtual void SizeChanged(); |
|
138 |
|
139 /** |
|
140 * Handle key event. Forwards all key events to the listbox, if present. |
|
141 * @since 1.2 |
|
142 * @param aKeyEvent The key event. |
|
143 * @param aType Key event type. |
|
144 * @return Response (was the key event consumed?). |
|
145 */ |
|
146 virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
147 |
|
148 /** |
|
149 * HandleListBoxEventL |
|
150 * From CCoeControl |
|
151 * |
|
152 */ |
|
153 void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType); |
|
154 |
|
155 /** |
|
156 * New functions |
|
157 */ |
|
158 public: |
|
159 |
|
160 /** |
|
161 * Handles selection key or menu command to change value of an item. |
|
162 * @since 1.2 |
|
163 */ |
|
164 void ChangeItemL( TBool aSelectKeyWasPressed ); |
|
165 |
|
166 MApiProvider& ApiProvider() { return iApiProvider; } |
|
167 |
|
168 /** |
|
169 * Opens the appropriate setting list e.g. Page |
|
170 * @since 3.1 |
|
171 */ |
|
172 void DisplayCorrectSettingCategoryListL(); |
|
173 |
|
174 /** |
|
175 * Closes the current setting list, if the main list, |
|
176 * then leaves settings |
|
177 * @return ETrue if settings lists are closed EFalse if still open |
|
178 * @since 3.1 |
|
179 */ |
|
180 TBool CloseSettingsListL(); |
|
181 |
|
182 |
|
183 /** |
|
184 * Checks for errors in settings values |
|
185 * @return ETrue if settings values are set incorrectly |
|
186 * @since 5.0 |
|
187 */ |
|
188 TBool SettingsError(); |
|
189 |
|
190 |
|
191 /** |
|
192 * Indicates if a setting item is modifiable |
|
193 * |
|
194 * @return TInt |
|
195 * @since 3.1 |
|
196 */ |
|
197 TBool IsSettingModifiable() const; |
|
198 |
|
199 |
|
200 /** |
|
201 * Saves changes made by the user to the ini file |
|
202 * @since 1.2 |
|
203 */ |
|
204 void SaveChangesL(); |
|
205 |
|
206 |
|
207 |
|
208 /** |
|
209 * Shows the main setting categories in a list box |
|
210 * @since 3.1 |
|
211 */ |
|
212 void DisplaySettingCategoriesL(); |
|
213 |
|
214 void DisplayGeneralSettingsL(); |
|
215 void DisplayPageSettingsL(); |
|
216 void DisplayPrivacySettingsL(); |
|
217 void DisplayWebFeedsSettingsL(); |
|
218 void DisplayToolbarSettingsL(); |
|
219 void DisplayShortcutsSettingsL(); |
|
220 |
|
221 /** |
|
222 * New functions |
|
223 */ |
|
224 private: |
|
225 TInt SetToolbarButtonValues(CArrayFixFlat<TInt> *values, TInt value, CArrayFixFlat<TInt> *displaymap); |
|
226 TInt SetShortcutKeysValues(CArrayFixFlat<TInt> *values, TInt value, CArrayFixFlat<TInt> *displaymap); |
|
227 |
|
228 void AddCategoryListBoxItemL( TInt aResourceId, CDesCArray& aList ); |
|
229 void ClearListBoxContentL(); |
|
230 void StoreListBoxIndexL(); |
|
231 void RestoreListBoxIndexL(); |
|
232 |
|
233 // Methods for adding settings to the settings lists |
|
234 |
|
235 //--------------------------------------------------------------------- |
|
236 // General Settings |
|
237 void AppendDefaultAccessPointL( CDesCArray*& aItemArray, |
|
238 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
239 |
|
240 void AppendHomePageL( CDesCArray*& aItemArray, |
|
241 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
242 |
|
243 void AppendPageOverviewL( CDesCArray*& aItemArray, |
|
244 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
245 |
|
246 void AppendBackListL( CDesCArray*& aItemArray, |
|
247 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
248 void AppendURLSuffixListL( CDesCArray*& aItemArray, |
|
249 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
250 void AppendHttpSecurityWarningsL( CDesCArray*& aItemArray, |
|
251 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
252 |
|
253 void AppendEcmaL( CDesCArray*& aItemArray, |
|
254 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
255 |
|
256 void AppendScriptLogL( CDesCArray*& aItemArray, |
|
257 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
258 |
|
259 void AppendDownloadsOpenL( CDesCArray*& aItemArray, |
|
260 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
261 //--------------------------------------------------------------------- |
|
262 // Page Settings |
|
263 void AppendAutoLoadContentL( CDesCArray*& aItemArray, |
|
264 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
265 |
|
266 void AppendAutoFullScreenL( CDesCArray*& aItemArray, |
|
267 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
268 |
|
269 void AppendAutoMediaVolumeL( CDesCArray*& aItemArray, |
|
270 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
271 |
|
272 void AppendEncodingL( CDesCArray*& aItemArray, |
|
273 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
274 |
|
275 void AppendPopupBlockingL( CDesCArray*& aItemArray, |
|
276 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
277 |
|
278 void AppendAutoRefreshL( CDesCArray*& aItemArray, |
|
279 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
280 |
|
281 void AppendFontSizeL( CDesCArray*& aItemArray, |
|
282 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
283 |
|
284 TInt GetFontSizeString(); |
|
285 |
|
286 |
|
287 //--------------------------------------------------------------------- |
|
288 // Toolbar Settings |
|
289 void AppendToolbarOnOffL( CDesCArray*& aItemArray, |
|
290 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
291 |
|
292 void AppendToolbarButtonsL( CDesCArray*& aItemArray, |
|
293 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
294 |
|
295 void AppendShortcutKeysL( CDesCArray*& aItemArray, |
|
296 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
297 |
|
298 //--------------------------------------------------------------------- |
|
299 // Privacy Settings |
|
300 void AppendAdaptiveBookmarksL( CDesCArray*& aItemArray, |
|
301 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
302 |
|
303 void AppendFormDataSavingL( CDesCArray*& aItemArray, |
|
304 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
305 |
|
306 void AppendCookiesL( CDesCArray*& aItemArray, |
|
307 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
308 |
|
309 void AppendIMEIL( CDesCArray*& aItemArray, |
|
310 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
311 |
|
312 //--------------------------------------------------------------------- |
|
313 // Web feeds Settings |
|
314 void AppendAutomaticUpdatingAPL( CDesCArray*& aItemArray, |
|
315 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
316 |
|
317 void AppendAutomaticUpdatingWhileRoamingL( CDesCArray*& aItemArray, |
|
318 TBuf<KWmlSettingsItemMaxLength>& aItemText ); |
|
319 //--------------------------------------------------------------------- |
|
320 // |
|
321 /** |
|
322 * Pops up a custom dialog to allow user to set setting items |
|
323 */ |
|
324 TInt ShowRadioButtonSettingPageL( TInt aTitle, |
|
325 CArrayFixFlat<TInt>* aValues, |
|
326 TInt aCurrentItem ); |
|
327 |
|
328 |
|
329 /** |
|
330 * Pops up a custom dialog to allow user to set setting items |
|
331 */ |
|
332 TBool ShowRadioButtonSettingPageBoolL( TInt aTitle, |
|
333 CArrayFixFlat<TInt>* aValues, |
|
334 TInt* aCurrentItem ); |
|
335 |
|
336 /** |
|
337 * Appends two text from resources to display it on lisbox |
|
338 */ |
|
339 void CreateItemFromTwoStringsL( |
|
340 TInt aFirst, |
|
341 TInt aSecond, |
|
342 TBuf<KWmlSettingsItemMaxLength>& aResult); |
|
343 |
|
344 TInt MapCurrentItem( TUint aCurrentItem ) const; |
|
345 |
|
346 /** |
|
347 * Gets encoding information as parameters. |
|
348 * Creates an encoding object and add the new object to iEncodingArray. |
|
349 */ |
|
350 void AddEncodingL( TUint32 aSystemId, TUint32 aResId ); |
|
351 |
|
352 /** |
|
353 * Add encodings here. |
|
354 * To add or remove encodings modify this function! |
|
355 */ |
|
356 void CreateEncodingArrayL(); |
|
357 |
|
358 /** |
|
359 * Check if the added encodings are supported by the system. Removes those that are not. |
|
360 */ |
|
361 void RemoveUnsupportedEncodingsL(); |
|
362 |
|
363 /** |
|
364 * Notify BrowserControl that a setting has been changed in the UI |
|
365 */ |
|
366 void NotifySettingChanged( TInt aSettingItem, TInt aSettingValue ); |
|
367 |
|
368 /** |
|
369 * Query user to delete Form data plus Password data |
|
370 */ |
|
371 void ShowFormDataDeleteAllQueryDialogL( ); |
|
372 /** |
|
373 * Query user to delete Form Password data |
|
374 */ |
|
375 void ShowFormDataDeletePasswordQueryDialogL( ); |
|
376 |
|
377 /** |
|
378 * Query user to select fromm user defined AP |
|
379 */ |
|
380 void SelectUserDefinedAPL( TUint32& id ); |
|
381 |
|
382 #ifdef __SERIES60_HELP |
|
383 /** |
|
384 * Get help context for the control. |
|
385 * @param aContext The context that is filled in. |
|
386 * @return None. |
|
387 */ |
|
388 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
389 |
|
390 #endif // __SERIES60_HELP |
|
391 |
|
392 private: |
|
393 |
|
394 // Media Volume indices |
|
395 enum TMediaVolumeIndices |
|
396 { |
|
397 EVolumeMute = 0, |
|
398 EVolumeLevel1, |
|
399 EVolumeLevel2, |
|
400 EVolumeLevel3, |
|
401 EVolumeLevel4 |
|
402 }; |
|
403 |
|
404 enum TSettingCategory |
|
405 { |
|
406 EMain = 0, |
|
407 EGeneral, |
|
408 EPrivacy, |
|
409 EPage, |
|
410 EWebFeeds, |
|
411 EToolbar, |
|
412 EShortCuts, |
|
413 ENone |
|
414 }; |
|
415 |
|
416 private: // members |
|
417 |
|
418 MApiProvider& iApiProvider; // not owned |
|
419 CAknNavigationDecorator* iNaviDecorator; // not owned |
|
420 |
|
421 // Settings List Box related members |
|
422 CAknSettingStyleListBox* iSettingListBox; // OWNED |
|
423 CArrayFixFlat<TUint>* iSettingIndex; // OWNED |
|
424 TInt iMainSettingCurrentIndex; // hold the most recent index in the main setting list box |
|
425 TInt iMainSettingTopPosIndex; |
|
426 TInt iSubSettingCurrentIndex; // hold the most recent index in the sub setting list boxes |
|
427 TInt iSubSettingTopPosIndex; |
|
428 TBool iActionCancelled; |
|
429 TBool iPenEnabled; // stores platform pen enabled flag value |
|
430 |
|
431 TSettingCategory iCurrentSettingCategory; |
|
432 |
|
433 // The settings are only updated when we leave the settings |
|
434 // view to avoid unnecessary redraws |
|
435 TInt iFontSize; |
|
436 TUint32 iEncoding; |
|
437 TBool iTextWrap; |
|
438 |
|
439 // Holds a 'list' of all encodings |
|
440 CArrayFixFlat<TEncodingStruct>* iEncodingArray; // OWNED |
|
441 TBool iSelectionKeyDownPressed; |
|
442 |
|
443 TBool iFlashPluginPresent; |
|
444 }; |
|
445 |
|
446 #endif // SETTINGS_CONTAINER_H |
|
447 |
|
448 // End of File |