3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (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
9 // http://floralicense.org/license/
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.
19 /*@file: IntSettingsManager.cpp
20 *@brief: Used to define SettingsManager
23 #ifndef _INT_SETTINGS_PRESENTATION_MODEL_H_
24 #define _INT_SETTINGS_PRESENTATION_MODEL_H_
32 #include "IntISettingChangeListener.h"
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
58 class SettingPresentationModel
64 * @brief The method initializes the registry and the SettingsManager values.
66 * @return An error code
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.
76 result Construct(void);
79 * @brief The method used to add a listener to get the setting change events
81 void AddSettingsEventListener(const ISettingChangeEventListener& pListener);
87 * @brief The method used to clear the cache of web browser
89 * @return String The Search URL
91 void ClearCache(void);
95 * @brief The method used to clear the cache of web browser
97 * @return String The Search URL
99 void ClearCookie(void);
102 * @brief The method used to get the default view
104 * @return String The default view value
107 Tizen::Base::String GetDefaultView(void);
110 * @brief The method used to get the Favorite URL
112 * @return String The Favorite URL
114 Tizen::Base::String GetFavoriteUrl(void);
117 * @brief The method used to get the already created instance of the SettingPresentationModel
119 static SettingPresentationModel* GetInstance(void);
122 * @brief The method used to set the homepage value
124 * @return String The Homepage Value
126 Tizen::Base::String GetHomepage(void);
129 * @brief The method used to get the value of reader font size
131 * @return int fontSize of reader
133 int GetReaderFontSize(void);
136 * @brief The method used to get the Save Password string value.
138 * @return String The Save Password String
140 Tizen::Base::String GetSavePassword(void);
143 * @brief The method used to get the Search Engine string value.
145 * @return String The Search Engine String
147 Tizen::Base::String GetSearchEngine(void);
150 * @brief The method used to get the Search URL Based on the default search engine value.
152 * @return String The Search URL
154 Tizen::Base::String GetSearchUrl(const Tizen::Base::String& searchText);
156 bool GetPrivateOn(void);
159 * @brief The method used to get the Block popup as true or false
161 * @return bool true to enable and false for disable
163 bool IsBlockPopUp(void);
166 * @brief The method used to get the Cookies Enabled as true or false
168 * @return bool true to enable and false for disable
170 bool IsCookiesEnabled(void);
173 * @brief The method used to get the case sensitivity as true or false
175 * @return bool true to enable and false for disable
177 bool IsCaseSensitiveEnabled(void);
180 * @brief The method used to get the Display Images value as true or false
182 * @return bool true to enable and false for disable
184 bool IsDisplayImagesEnabled(void);
187 * @brief The method used to get the HTML5 Videos as true or false
189 * @return bool true to enable and false for disable
191 bool IsHtml5VideosEnabled(void);
194 * @brief The method used to get the Remember password Enabled as true or false
196 * @return bool true to enable and false for disable
198 bool IsRememberFormData(void);
201 * @brief The method used to get the Remember password Enabled as true or false
203 * @return bool true to enable and false for disable
205 bool IsRememberPassword(void);
208 * @brief The method used to get the Javascript enabled value as true or false
210 * @return bool true to enable and false for disable
212 bool IsRunJavascriptEnabled(void);
215 * @brief The method used to get the Run Reader as true or false
217 * @return bool true to enable and false for disable
219 bool IsRunReaderEnabled(void);
222 * @brief The method used to get the Security Warnings as true or false
224 * @return bool true to enable and false for disable
226 bool IsSecurityWarningsEnabled(void);
229 * @brief The method used to get the Word Wrap as true or false
231 * @return bool true to enable and false for disable
233 bool IsWordWrapEnabled(void);
236 * @brief The method loads the data and the SettingsManager values from the registry.
238 * @return An error code
240 * @exception E_SUCCESS The method is successful.
241 * @exception E_INVALID_STATE This instance has already been constructed.
242 * @exception E_INVALID_ARG A specified input parameter is invalid.
243 * @exception E_OUT_OF_MEMORY The memory is insufficient.
244 * @exception E_SYSTEM A system error has occurred.
247 result LoadRegistry(void);
250 * @brief The method used to remove the ISettingsChangeListener
252 void RemoveSettingsEventListener(ISettingChangeEventListener& pListener);
255 * @brief The method resets the registry and the SettingsManager values to default.
257 * @return An error code
259 * @exception E_SUCCESS The method is successful.
260 * @exception E_INVALID_STATE This instance has already been constructed.
261 * @exception E_INVALID_ARG A specified input parameter is invalid.
262 * @exception E_OUT_OF_MEMORY The memory is insufficient.
263 * @exception E_SYSTEM A system error has occurred.
266 result ResetRegistry(void);
269 * @brief The method used to set the Default values of settings
271 void SetDefaultValues(void);
274 * @brief The method used to set the default view
275 * @param[in] String The default view value
278 void SetDefaultView(const Tizen::Base::String& viewLevel);
281 * @brief The method used to set the homepage value
282 * @param[in] String The Homepage Value
285 void SetHomepage(const Tizen::Base::String& homePage);
288 * @brief The method used to set the Javascript enabled value to true or false
289 * @param[in] bool true to enable and false for disable
292 void SetRunJavascriptEnabled(bool runJsEnabled);
295 * @brief The method used to set the Display Images value to true or false
296 * @param[in] bool true to enable and false for disable
299 void SetDisplayImagesEnabled(bool displayImages);
302 * @brief The method used to set the HTML5 Videos to true or false
303 * @param[in] bool true to enable and false for disable
306 void SetHtml5VideosEnabled(bool html5Videos);
309 * @brief The method used to set the Word Wrap to true or false
310 * @param[in] bool true to enable and false for disable
313 void SetWordWrapEnabled(bool wordWrap);
316 * @brief The method used to set the Block popup to true or false
317 * @param[in] bool true to enable and false for disable
320 void SetBlockPopUp(bool blockPopUp);
323 * @brief The method used to set the Cookies Enabled to true or false
324 * @param[in] bool true to enable and false for disable
327 void SetCookiesEnabled(bool cookiesEnabled);
330 * @brief The method used to set the Save Password string value.
331 * @param[in] String The Save Password String
334 void SetSavePassword(const Tizen::Base::String& savePassword);
337 * @brief The method used to set Remember form data to true or false
338 * @param[in] bool true to enable false for disable
341 void SetRememberFormData(bool rememberFormData);
344 * @brief The method used to set Remember password to true or false
345 * @param[in] bool true to enable false for disable
348 void SetRememberPassword(bool rememberPassword);
351 * @brief The method used to enabling the Security Warnings to true or false
352 * @param[in] bool true to enable and false for disable
355 void SetSecurityWarningsEnabled(bool securityWarnings);
358 * @brief The method used to set the Default Search Engine.
359 * @param[in] String The Search Engine String
362 void SetSearchEngine(const Tizen::Base::String& searchEngine);
366 void SetCaseSensitiveEnabled(bool caseSensitive);
369 * @brief The method used to enabling the Reader to true or false
370 * @param[in] bool true to enable and false for disable
373 void SetRunReaderEnabled(bool runReader);
376 * @brief The method used to set the value of reader font size
377 * @param[in] int fontSize of reader
380 void SetReaderFontSize(int fontSize);
383 * @name GetWebSettings
384 * @brief The method used to get web browser settings
386 * @return WebSetting The Settings of web browser
388 Tizen::Web::Controls::WebSetting& GetWebSettings(void);
391 * @name SetFavoriteValue
392 * @brief The method used to set favourite URL for web browser
393 * @param[in] val favorite value to set
394 * @return An error code
395 * @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'.
396 * @exception E_KEY_NOT_FOUND The specified key is not used in the application preferences.
397 * @exception E_OUT_OF_MEMORY The memory is insufficient.
398 * @exception E_KEY_ALREADY_EXIST The key has already been used in the application preferences.
399 * @exception E_SUCCESS The method is successful.
401 result SetFavoriteValue(const Tizen::Base::String& val);
403 void SetPrivateOn(bool isPrivateOn);
407 * @brief The Default Constructor
409 SettingPresentationModel(void);
412 * @brief The Default Destructor
414 ~SettingPresentationModel(void);
419 SettingPresentationModel(const SettingPresentationModel& settingModelObj);
422 * @brief The method used to create the instance of the SettingsManager class
424 static void CreateInstance(void);
427 * @brief The method used to remove the already created instance of the SettingsManager
429 static void DestroyInstance(void);
431 * assignment operator
433 SettingPresentationModel& operator=(const SettingPresentationModel& settingModelObj);
435 result SetValue(const int settingValueName, const Tizen::Base::String& val);
438 static SettingPresentationModel* __pSettingsPresentationModel;
440 Tizen::Base::Collection::ArrayList __listenerList;
441 Tizen::Base::String __homePage;
442 Tizen::Base::String __defaultViewLevel;
443 Tizen::Base::String __favouriteURL;
445 bool __displayImages;
449 bool __rememberFormData;
450 bool __rememberPassword;
452 Tizen::Base::String __savePassword;
453 bool __securityWarnings;
454 Tizen::Base::String __searchEngine;
455 bool __caseSensitive;
459 Tizen::Web::Controls::WebSetting __setting;
461 // Tizen::Io::Registry* __pRegistry;
462 Tizen::Base::String __entry[MAX_REGISTRY_SETTING];
463 Tizen::Base::String __values[MAX_REGISTRY_SETTING];
466 #endif // _INT_SETTINGS_PRESENTATION_MODEL_H_