Fixed Nabi Issues and Language related changes
[apps/osp/Internet.git] / inc / IntSettingPresentationModel.h
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file:        IntSettingsManager.cpp
20  *@brief:       Used to define SettingsManager
21  */
22
23 #ifndef _INT_SETTINGS_PRESENTATION_MODEL_H_
24 #define _INT_SETTINGS_PRESENTATION_MODEL_H_
25
26 #include <FApp.h>
27 #include <FAppApp.h>
28 #include <FBase.h>
29 #include <FIo.h>
30 #include <FWeb.h>
31
32 #include "IntISettingChangeListener.h"
33
34
35 enum SettingValues
36 {
37         REGISTRY_SETTING_INVALID = -1,
38         REGISTRY_SETTING_HOMEPAGE = 0,
39         REGISTRY_SETTING_DEFAULT_VIEW,          //1
40         REGISTRY_SETTING_RUN_JAVASCRIPT,        //2
41         REGISTRY_SETTING_DISPLAY_IMAGES,        //3
42         REGISTRY_SETTING_HTML5_VIDEOS,          //4
43         REGISTRY_SETTING_WORD_WRAPPING,         //5
44         REGISTRY_SETTING_BLOCK_POPUP,           //6
45         REGISTRY_SETTING_ACCEPT_COOKIES,        //7
46         REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD,  //8
47         REGISTRY_SETTING_SHOW_SECURITY_WARNINGS, //9
48         REGISTRY_SETTING_SEARCH_ENGINE,         //10
49         REGISTRY_SETTING_CASE_SENSITIVE,        //11
50         REGISTRY_SETTING_RUN_READER,            //12
51         REGISTRY_SETTING_READER_FONT_SIZE,              //13
52         REGISTRY_SETTING_FAVORITE_URL_VALUE,    //14
53         REGISTRY_SETTING_REMEMBER_FORM_DATA,    //15
54         REGISTRY_SETTING_REMEMBER_PASSWORD,             //16
55         MAX_REGISTRY_SETTING                    //17
56 };
57
58 class SettingPresentationModel
59 {
60 public:
61
62
63         /**
64          * @brief The method initializes the registry and the SettingsManager values.
65          *
66          * @return              An error code
67          * @param[in]   void
68          *
69          * @exception   E_SUCCESS                       The method is successful.
70          * @exception   E_INVALID_STATE         This instance has already been constructed.
71          * @exception   E_INVALID_ARG       A specified input parameter is invalid.
72          * @exception   E_OUT_OF_MEMORY     The memory is insufficient.
73          * @exception   E_SYSTEM                        A system error has occurred.
74          *
75          */
76         result Construct(void);
77
78         /**
79          * @brief               The method used to add a listener to get the setting change events
80          */
81         void AddSettingsEventListener(const ISettingChangeEventListener& pListener);
82
83
84
85         /**
86          * @name ClearCache
87          * @brief The method used to clear the cache of web browser
88          * @param[in]   void
89          * @return              String          The Search URL
90          */
91         void ClearCache(void);
92
93         /**
94          * @name ClearCookie
95          * @brief The method used to clear the cache of web browser
96          * @param[in]   void
97          * @return              void
98          */
99         void ClearCookie(void);
100
101         /**
102          * @name ClearFormData
103          * @brief The method used to clear the Form Data of web browser
104          * @param[in]   void
105          * @return              void
106          */
107         void ClearFormData(void);
108
109         /**
110          * @name ClearPasswords
111          * @brief The method used to clear the Passwords of web browser
112          * @param[in]   void
113          * @return              void
114          */
115         void ClearPasswords(void);
116
117         /**
118          * @brief The method used to get the default view
119          * @param[in]   void
120          * @return              String          The default view value
121          *
122          */
123         Tizen::Base::String GetDefaultView(void);
124
125         /**
126          * @brief The method used to get the Favorite URL
127          * @param[in]   void
128          * @return              String          The Favorite URL
129          */
130         Tizen::Base::String GetFavoriteUrl(void);
131
132         /**
133          * @brief               The method used to get the already created instance of the SettingPresentationModel
134          */
135         static SettingPresentationModel* GetInstance(void);
136
137         /**
138          * @brief The method used to set the homepage value
139          * @param[in]   void
140          * @return              String          The Homepage Value
141          */
142         Tizen::Base::String GetHomepage(void);
143
144         /**
145          * @brief The method used to get the value of reader font size
146          * @param[in]   void
147          * @return              int             fontSize of reader
148          */
149         int GetReaderFontSize(void);
150
151         /**
152          * @brief The method used to get the Save Password string value.
153          * @param[in]   void
154          * @return              String          The Save Password String
155          */
156         Tizen::Base::String GetSavePassword(void);
157
158         /**
159          * @brief The method used to get the Search Engine string value.
160          * @param[in]   void
161          * @return              String          The Search Engine String
162          */
163         Tizen::Base::String GetSearchEngine(void);
164
165         /**
166          * @brief The method used to get the Search URL Based on the default search engine value.
167          * @param[in]   void
168          * @return              String          The Search URL
169          */
170         Tizen::Base::String GetSearchUrl(const Tizen::Base::String& searchText);
171
172         bool GetPrivateOn(void);
173
174         /**
175          * @brief The method used to get the Block popup as true or false
176          * @param[in]   void
177          * @return              bool            true to enable and false for disable
178          */
179         bool IsBlockPopUp(void);
180
181         /**
182          * @brief The method used to get the Cookies Enabled as true or false
183          * @param[in]   void
184          * @return              bool            true to enable and false for disable
185          */
186         bool IsCookiesEnabled(void);
187
188         /**
189          * @brief The method used to get the case sensitivity as true or false
190          * @param[in]   void
191          * @return              bool            true to enable and false for disable
192          */
193         bool IsCaseSensitiveEnabled(void);
194
195         /**
196          * @brief The method used to get the Display Images value as true or false
197          * @param[in]   void
198          * @return              bool            true to enable and false for disable
199          */
200         bool IsDisplayImagesEnabled(void);
201
202         /**
203          * @brief The method used to get the HTML5 Videos as true or false
204          * @param[in]   void
205          * @return              bool            true to enable and false for disable
206          */
207         bool IsHtml5VideosEnabled(void);
208
209         /**
210          * @brief The method used to get the Remember password Enabled as true or false
211          * @param[in]   void
212          * @return              bool            true to enable and false for disable
213          */
214         bool IsRememberFormData(void);
215
216         /**
217          * @brief The method used to get the Remember password Enabled as true or false
218          * @param[in]   void
219          * @return              bool            true to enable and false for disable
220          */
221         bool IsRememberPassword(void);
222
223         /**
224          * @brief The method used to get the Javascript enabled value as true or false
225          * @param[in]   void
226          * @return              bool            true to enable and false for disable
227          */
228         bool IsRunJavascriptEnabled(void);
229
230         /**
231          * @brief The method used to get the Run Reader as true or false
232          * @param[in]   void
233          * @return              bool            true to enable and false for disable
234          */
235         bool IsRunReaderEnabled(void);
236
237         /**
238          * @brief The method used to get the Security Warnings as true or false
239          * @param[in]   void
240          * @return              bool            true to enable and false for disable
241          */
242         bool IsSecurityWarningsEnabled(void);
243
244         /**
245          * @brief The method used to get the Word Wrap as true or false
246          * @param[in]   void
247          * @return              bool            true to enable and false for disable
248          */
249         bool IsWordWrapEnabled(void);
250
251         /**
252          * @brief The method loads the data and the SettingsManager values from the registry.
253          *
254          * @return              An error code
255          * @param[in]   void
256          * @exception   E_SUCCESS                       The method is successful.
257          * @exception   E_INVALID_STATE         This instance has already been constructed.
258          * @exception   E_INVALID_ARG       A specified input parameter is invalid.
259          * @exception   E_OUT_OF_MEMORY     The memory is insufficient.
260          * @exception   E_SYSTEM                        A system error has occurred.
261          *
262          */
263         result LoadRegistry(void);
264
265         /**
266          * @brief               The method used to remove the ISettingsChangeListener
267          */
268         void RemoveSettingsEventListener(ISettingChangeEventListener& pListener);
269
270         /**
271          * @brief The method resets the registry and the SettingsManager values to default.
272          *
273          * @return              An error code
274          * @param[in]   void
275          * @exception   E_SUCCESS                       The method is successful.
276          * @exception   E_INVALID_STATE         This instance has already been constructed.
277          * @exception   E_INVALID_ARG       A specified input parameter is invalid.
278          * @exception   E_OUT_OF_MEMORY     The memory is insufficient.
279          * @exception   E_SYSTEM                        A system error has occurred.
280          *
281          */
282         result ResetRegistry(void);
283
284         /**
285          * @brief               The method used to set the Default values of settings
286          */
287         void SetDefaultValues(void);
288
289         /**
290          * @brief The method used to set the default view
291          * @param[in]   String          The default view value
292          * @return              void
293          */
294         void SetDefaultView(const Tizen::Base::String& viewLevel);
295
296         /**
297          * @brief The method used to set the homepage value
298          * @param[in]   String          The Homepage Value
299          * @return              void
300          */
301         void SetHomepage(const Tizen::Base::String& homePage);
302
303         /**
304          * @brief The method used to set the Javascript enabled value to true or false
305          * @param[in]   bool            true to enable and false for disable
306          * @return              void
307          */
308         void SetRunJavascriptEnabled(bool runJsEnabled);
309
310         /**
311          * @brief The method used to set the Display Images value to true or false
312          * @param[in]   bool            true to enable and false for disable
313          * @return              void
314          */
315         void SetDisplayImagesEnabled(bool displayImages);
316
317         /**
318          * @brief The method used to set the HTML5 Videos to true or false
319          * @param[in]   bool            true to enable and false for disable
320          * @return              void
321          */
322         void SetHtml5VideosEnabled(bool html5Videos);
323
324         /**
325          * @brief The method used to set the Word Wrap to true or false
326          * @param[in]   bool            true to enable and false for disable
327          * @return              void
328          */
329         void SetWordWrapEnabled(bool wordWrap);
330
331         /**
332          * @brief The method used to set the Block popup to true or false
333          * @param[in]   bool            true to enable and false for disable
334          * @return              void
335          */
336         void SetBlockPopUp(bool blockPopUp);
337
338         /**
339          * @brief The method used to set the Cookies Enabled to true or false
340          * @param[in]   bool            true to enable and false for disable
341          * @return              void
342          */
343         void SetCookiesEnabled(bool cookiesEnabled);
344
345         /**
346          * @brief The method used to set the Save Password string value.
347          * @param[in]   String          The Save Password String
348          * @return              void
349          */
350         void SetSavePassword(const Tizen::Base::String& savePassword);
351
352         /**
353          * @brief The method used to set Remember form data to true or false
354          * @param[in]   bool            true to enable false for disable
355          * @return              void
356          */
357         void SetRememberFormData(bool rememberFormData);
358
359         /**
360          * @brief The method used to set Remember password to true or false
361          * @param[in]   bool            true to enable false for disable
362          * @return              void
363          */
364         void SetRememberPassword(bool rememberPassword);
365
366         /**
367          * @brief The method used to enabling the Security Warnings to true or false
368          * @param[in]   bool            true to enable and false for disable
369          * @return              void
370          */
371         void SetSecurityWarningsEnabled(bool securityWarnings);
372
373         /**
374          * @brief The method used to set the Default Search Engine.
375          * @param[in]   String          The Search Engine String
376          * @return              void
377          */
378         void SetSearchEngine(const Tizen::Base::String& searchEngine);
379
380
381
382         void SetCaseSensitiveEnabled(bool caseSensitive);
383
384         /**
385          * @brief The method used to enabling the Reader to true or false
386          * @param[in]   bool            true to enable and false for disable
387          * @return              void
388          */
389         void SetRunReaderEnabled(bool runReader);
390
391         /**
392          * @brief The method used to set the value of reader font size
393          * @param[in]   int             fontSize of reader
394          * @return              void
395          */
396         void SetReaderFontSize(int fontSize);
397
398         /**
399          * @name GetWebSettings
400          * @brief The method used to get web browser settings
401          * @param[in]   void
402          * @return              WebSetting              The Settings of web browser
403          */
404         Tizen::Web::Controls::WebSetting& GetWebSettings(void);
405
406         /**
407          * @name SetFavoriteValue
408          * @brief The method used to set favourite URL for web browser
409          * @param[in]   val                                     favorite value to set
410          * @return              An error code
411          * @exception   E_INVALID_ARG           The length of the specified string for a section or entry is smaller than or equal to @c 0, or the specified string is a @c null value or string with '\0' and '\n'.
412          * @exception   E_KEY_NOT_FOUND         The specified key is not used in the application preferences.
413          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
414          * @exception   E_KEY_ALREADY_EXIST     The key has already been used in the application preferences.
415          * @exception   E_SUCCESS                       The method is successful.
416          */
417         result SetFavoriteValue(const Tizen::Base::String& val);
418
419         void SetPrivateOn(bool isPrivateOn);
420
421 private:
422         /**
423          * @brief The Default Constructor
424          */
425         SettingPresentationModel(void);
426
427         /**
428         * @brief                The Default Destructor
429         */
430         ~SettingPresentationModel(void);
431
432         /**
433          * copy constructor
434          */
435         SettingPresentationModel(const SettingPresentationModel& settingModelObj);
436
437         /**
438          * @brief               The method used to create the instance of the SettingsManager class
439          */
440         static void CreateInstance(void);
441
442         /**
443          * @brief               The method used to remove the already created instance of the SettingsManager
444          */
445         static void DestroyInstance(void);
446         /**
447          * assignment operator
448          */
449         SettingPresentationModel& operator=(const SettingPresentationModel& settingModelObj);
450
451         result SetValue(const int settingValueName, const Tizen::Base::String& val);
452
453 private:
454         static SettingPresentationModel* __pSettingsPresentationModel;
455
456         Tizen::Base::Collection::ArrayList __listenerList;
457         Tizen::Base::String __homePage;
458         Tizen::Base::String __defaultViewLevel;
459         Tizen::Base::String __favouriteURL;
460         bool __runJsEnabled;
461         bool __displayImages;
462         bool __html5Videos;
463         bool __wordWrap;
464         bool __blockPopUp;
465         bool __rememberFormData;
466         bool __rememberPassword;
467         bool __cookies;
468         Tizen::Base::String __savePassword;
469         bool __securityWarnings;
470         Tizen::Base::String __searchEngine;
471         bool __caseSensitive;
472         bool __runReader;
473         int __fontSize;
474         bool __isPrivateOn;
475         Tizen::Web::Controls::WebSetting __setting;
476
477         //      Tizen::Io::Registry* __pRegistry;
478         Tizen::Base::String __entry[MAX_REGISTRY_SETTING];
479         Tizen::Base::String __values[MAX_REGISTRY_SETTING];
480 };
481
482 #endif // _INT_SETTINGS_PRESENTATION_MODEL_H_