3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
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
99 void ClearCookie(void);
102 * @name ClearFormData
103 * @brief The method used to clear the Form Data of web browser
107 void ClearFormData(void);
110 * @name ClearPasswords
111 * @brief The method used to clear the Passwords of web browser
115 void ClearPasswords(void);
118 * @brief The method used to get the default view
120 * @return String The default view value
123 Tizen::Base::String GetDefaultView(void);
126 * @brief The method used to get the Favorite URL
128 * @return String The Favorite URL
130 Tizen::Base::String GetFavoriteUrl(void);
133 * @brief The method used to get the already created instance of the SettingPresentationModel
135 static SettingPresentationModel* GetInstance(void);
138 * @brief The method used to set the homepage value
140 * @return String The Homepage Value
142 Tizen::Base::String GetHomepage(void);
145 * @brief The method used to get the value of reader font size
147 * @return int fontSize of reader
149 int GetReaderFontSize(void);
152 * @brief The method used to get the Save Password string value.
154 * @return String The Save Password String
156 Tizen::Base::String GetSavePassword(void);
159 * @brief The method used to get the Search Engine string value.
161 * @return String The Search Engine String
163 Tizen::Base::String GetSearchEngine(void);
166 * @brief The method used to get the Search URL Based on the default search engine value.
168 * @return String The Search URL
170 Tizen::Base::String GetSearchUrl(const Tizen::Base::String& searchText);
172 bool GetPrivateOn(void);
175 * @brief The method used to get the Block popup as true or false
177 * @return bool true to enable and false for disable
179 bool IsBlockPopUp(void);
182 * @brief The method used to get the Cookies Enabled as true or false
184 * @return bool true to enable and false for disable
186 bool IsCookiesEnabled(void);
189 * @brief The method used to get the case sensitivity as true or false
191 * @return bool true to enable and false for disable
193 bool IsCaseSensitiveEnabled(void);
196 * @brief The method used to get the Display Images value as true or false
198 * @return bool true to enable and false for disable
200 bool IsDisplayImagesEnabled(void);
203 * @brief The method used to get the HTML5 Videos as true or false
205 * @return bool true to enable and false for disable
207 bool IsHtml5VideosEnabled(void);
210 * @brief The method used to get the Remember password Enabled as true or false
212 * @return bool true to enable and false for disable
214 bool IsRememberFormData(void);
217 * @brief The method used to get the Remember password Enabled as true or false
219 * @return bool true to enable and false for disable
221 bool IsRememberPassword(void);
224 * @brief The method used to get the Javascript enabled value as true or false
226 * @return bool true to enable and false for disable
228 bool IsRunJavascriptEnabled(void);
231 * @brief The method used to get the Run Reader as true or false
233 * @return bool true to enable and false for disable
235 bool IsRunReaderEnabled(void);
238 * @brief The method used to get the Security Warnings as true or false
240 * @return bool true to enable and false for disable
242 bool IsSecurityWarningsEnabled(void);
245 * @brief The method used to get the Word Wrap as true or false
247 * @return bool true to enable and false for disable
249 bool IsWordWrapEnabled(void);
252 * @brief The method loads the data and the SettingsManager values from the registry.
254 * @return An error code
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.
263 result LoadRegistry(void);
266 * @brief The method used to remove the ISettingsChangeListener
268 void RemoveSettingsEventListener(ISettingChangeEventListener& pListener);
271 * @brief The method resets the registry and the SettingsManager values to default.
273 * @return An error code
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.
282 result ResetRegistry(void);
285 * @brief The method used to set the Default values of settings
287 void SetDefaultValues(void);
290 * @brief The method used to set the default view
291 * @param[in] String The default view value
294 void SetDefaultView(const Tizen::Base::String& viewLevel);
297 * @brief The method used to set the homepage value
298 * @param[in] String The Homepage Value
301 void SetHomepage(const Tizen::Base::String& homePage);
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
308 void SetRunJavascriptEnabled(bool runJsEnabled);
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
315 void SetDisplayImagesEnabled(bool displayImages);
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
322 void SetHtml5VideosEnabled(bool html5Videos);
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
329 void SetWordWrapEnabled(bool wordWrap);
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
336 void SetBlockPopUp(bool blockPopUp);
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
343 void SetCookiesEnabled(bool cookiesEnabled);
346 * @brief The method used to set the Save Password string value.
347 * @param[in] String The Save Password String
350 void SetSavePassword(const Tizen::Base::String& savePassword);
353 * @brief The method used to set Remember form data to true or false
354 * @param[in] bool true to enable false for disable
357 void SetRememberFormData(bool rememberFormData);
360 * @brief The method used to set Remember password to true or false
361 * @param[in] bool true to enable false for disable
364 void SetRememberPassword(bool rememberPassword);
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
371 void SetSecurityWarningsEnabled(bool securityWarnings);
374 * @brief The method used to set the Default Search Engine.
375 * @param[in] String The Search Engine String
378 void SetSearchEngine(const Tizen::Base::String& searchEngine);
382 void SetCaseSensitiveEnabled(bool caseSensitive);
385 * @brief The method used to enabling the Reader to true or false
386 * @param[in] bool true to enable and false for disable
389 void SetRunReaderEnabled(bool runReader);
392 * @brief The method used to set the value of reader font size
393 * @param[in] int fontSize of reader
396 void SetReaderFontSize(int fontSize);
399 * @name GetWebSettings
400 * @brief The method used to get web browser settings
402 * @return WebSetting The Settings of web browser
404 Tizen::Web::Controls::WebSetting& GetWebSettings(void);
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.
417 result SetFavoriteValue(const Tizen::Base::String& val);
419 void SetPrivateOn(bool isPrivateOn);
423 * @brief The Default Constructor
425 SettingPresentationModel(void);
428 * @brief The Default Destructor
430 ~SettingPresentationModel(void);
435 SettingPresentationModel(const SettingPresentationModel& settingModelObj);
438 * @brief The method used to create the instance of the SettingsManager class
440 static void CreateInstance(void);
443 * @brief The method used to remove the already created instance of the SettingsManager
445 static void DestroyInstance(void);
447 * assignment operator
449 SettingPresentationModel& operator=(const SettingPresentationModel& settingModelObj);
451 result SetValue(const int settingValueName, const Tizen::Base::String& val);
454 static SettingPresentationModel* __pSettingsPresentationModel;
456 Tizen::Base::Collection::ArrayList __listenerList;
457 Tizen::Base::String __homePage;
458 Tizen::Base::String __defaultViewLevel;
459 Tizen::Base::String __favouriteURL;
461 bool __displayImages;
465 bool __rememberFormData;
466 bool __rememberPassword;
468 Tizen::Base::String __savePassword;
469 bool __securityWarnings;
470 Tizen::Base::String __searchEngine;
471 bool __caseSensitive;
475 Tizen::Web::Controls::WebSetting __setting;
477 // Tizen::Io::Registry* __pRegistry;
478 Tizen::Base::String __entry[MAX_REGISTRY_SETTING];
479 Tizen::Base::String __values[MAX_REGISTRY_SETTING];
482 #endif // _INT_SETTINGS_PRESENTATION_MODEL_H_