|
1 /* |
|
2 * Copyright (c) 2003 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __UTIL_SETTINGS_H |
|
20 #define __UTIL_SETTINGS_H |
|
21 |
|
22 #include <bldvariant.hrh> |
|
23 #include <coemain.h> |
|
24 #include "nwx_defs.h" |
|
25 #include "nwx_settings.h" |
|
26 |
|
27 // FYI: All key literals come from \epoc32\include\oem\SharedDataKeysVariant.h |
|
28 // Please do not define key literal strings here. |
|
29 |
|
30 _LIT( KValueOn, "True" ); |
|
31 _LIT( KValueOff, "False" ); |
|
32 |
|
33 class CRepository; |
|
34 |
|
35 enum TBrowserSetting |
|
36 { |
|
37 EFontSizeLevel = 0x1, |
|
38 EEncoding = 0x2, |
|
39 ECookiesEnabled = 0x4, |
|
40 EImagesEnabled = 0x8, |
|
41 EEcmaScriptEnabled = 0x10, |
|
42 ETextWrapEnabled = 0x20, |
|
43 EOriginalEncoding = 0x40, |
|
44 EVerticalLayoutEnabled = 0x80, |
|
45 ECSSFetchEnabled = 0x100, |
|
46 EDisableSmallScreenLayout = 0x200, |
|
47 EIsEmbedded = 0x400, |
|
48 EIMEINotifyEnabled = 0x800, |
|
49 ESendReferrerHeader = 0x1000, |
|
50 EHttpSecurityWarnings = 0x2000 |
|
51 }; |
|
52 |
|
53 /***************************************************************** |
|
54 |
|
55 Description: abstract observer calss |
|
56 |
|
57 ******************************************************************/ |
|
58 /*class MBrowserSettingsObserver |
|
59 { |
|
60 // |
|
61 public: |
|
62 |
|
63 virtual void BrowserSettingChanged( enum TBrowserSetting aBrowserSetting ) = 0; |
|
64 }; |
|
65 */ |
|
66 /***************************************************************** |
|
67 |
|
68 Description: This class keeps track of the settings. |
|
69 |
|
70 ******************************************************************/ |
|
71 |
|
72 NONSHARABLE_CLASS(CBrowserSettings) : public CBase |
|
73 { |
|
74 public: |
|
75 |
|
76 //Construction |
|
77 |
|
78 static CBrowserSettings* Instance(); |
|
79 |
|
80 ~CBrowserSettings(); |
|
81 |
|
82 // observer methods |
|
83 //void SetObserver( MBrowserSettingsObserver* aBrowserSettingsObserver, |
|
84 // TUint aObservedSettings ); |
|
85 |
|
86 void RemoveObserver( void ); |
|
87 |
|
88 // Access methods |
|
89 NW_Bool GetStartFromHomepage(void); |
|
90 |
|
91 NW_Uint8 GetFontSizeLevel(void); |
|
92 void SetFontSizeLevel(NW_Uint8 fontSizeLevel); |
|
93 |
|
94 NW_Uint16 GetEncoding(void); |
|
95 void SetEncoding(NW_Uint16 encoding); |
|
96 |
|
97 NW_Bool GetCookiesEnabled(void); |
|
98 void SetCookiesEnabled(const NW_Bool enabled); |
|
99 |
|
100 NW_Bool GetImagesEnabled(void); |
|
101 void SetImagesEnabled(const NW_Bool enabled); |
|
102 |
|
103 NW_Bool GetEcmaScriptEnabled(void); |
|
104 void SetEcmaScriptEnabled(const NW_Bool enabled); |
|
105 |
|
106 NW_Bool GetTextWrapEnabled(void); |
|
107 void SetTextWrapEnabled(const NW_Bool enabled); |
|
108 |
|
109 NW_Bool GetAlwaysConfirmDtmfSending(void); |
|
110 void SetAlwaysConfirmDtmfSending(const NW_Bool enabled); |
|
111 |
|
112 NW_Uint32 GetOriginalEncoding(void); |
|
113 void SetOriginalEncoding(NW_Uint32 encoding); |
|
114 |
|
115 NW_Bool GetVerticalLayoutEnabled(void); |
|
116 void SetVerticalLayoutEnabled(const NW_Bool enabled); |
|
117 |
|
118 void SetInternalVerticalLayoutEnabled(const NW_Bool enabled); |
|
119 |
|
120 void SetCSSFetchEnabled(const NW_Bool disabled); |
|
121 NW_Bool GetCSSFetchEnabled(void); |
|
122 |
|
123 NW_Uint16 GetDefaultCharset(void); |
|
124 void SetDefaultCharset(NW_Uint16 defaultCharset); |
|
125 |
|
126 void SetDisableSmallScreenLayout(const NW_Bool disabled); |
|
127 NW_Bool GetDisableSmallScreenLayout(); |
|
128 |
|
129 NW_Bool GetIsBrowserEmbedded(void); |
|
130 void SetIsBrowserEmbedded(const NW_Bool isEmbedded); |
|
131 |
|
132 TUint GetLocalFeatures(void); |
|
133 |
|
134 NW_Ucs2* GetTempFilesPath(void); |
|
135 |
|
136 NW_Uint8 GetMMCDrive(void); |
|
137 |
|
138 NW_Uint8 GetIMEINotifyEnabled(void); |
|
139 void SetIMEINotifyEnabled(NW_Uint8 enabled); |
|
140 |
|
141 NW_Uint8 GetSendReferrerHeader(void); |
|
142 void SetSendReferrerHeader(NW_Uint8 enabled); |
|
143 |
|
144 NW_Bool GetHttpSecurityWarnings(void); |
|
145 void SetHttpSecurityWarnings(NW_Bool enabled); |
|
146 |
|
147 NW_Uint32 GetIAPId(void); |
|
148 void SetIAPId(NW_Uint32 aIapId); |
|
149 |
|
150 private: |
|
151 |
|
152 CBrowserSettings(); |
|
153 |
|
154 // observer method |
|
155 void PublishSettingChange( enum TBrowserSetting aBrowserSetting ); |
|
156 |
|
157 // Utility methods |
|
158 TInt GetIntValue(const TUint32 aKey); |
|
159 NW_Bool GetBooleanValue(const TUint32 aKey); |
|
160 NW_Ucs2* GetStringValue( const TUint32 aKey ); |
|
161 |
|
162 private: |
|
163 |
|
164 NW_Bool iStartFromHomepage; |
|
165 NW_Uint8 iFontSizeLevel; |
|
166 NW_Uint16 iEncoding; |
|
167 NW_Bool iCookiesEnabled; |
|
168 NW_Bool iImagesEnabled; |
|
169 NW_Uint8 iEcmaScriptEnabled; |
|
170 NW_Uint8 iTextWrapEnabled; |
|
171 NW_Uint32 iOriginalEncoding; |
|
172 NW_Uint8 iVerticalLayoutEnabled; |
|
173 NW_Bool iCSSFetchEnabled; |
|
174 NW_Bool iDisableSmallScreenLayout; |
|
175 NW_Uint16 iDefaultCharset; |
|
176 |
|
177 CRepository* iRepository; |
|
178 NW_Bool iIsEmbedded; |
|
179 TUint iFeatureBitmask; |
|
180 NW_Ucs2* iTempFilesPath; |
|
181 NW_Uint8 iMMCDrive; |
|
182 NW_Uint8 iIMEINotifyEnabled; |
|
183 NW_Uint8 iSendReferrerHeader; |
|
184 NW_Bool iHttpSecurityWarnings; |
|
185 NW_Bool iSecUI; |
|
186 NW_Uint32 iIapId; |
|
187 |
|
188 //MBrowserSettingsObserver* iBrowserSettingsObserver; |
|
189 TUint iObservedSettings; |
|
190 }; |
|
191 |
|
192 #endif /* __UTIL_SETTINGS_H */ |