Tizen 2.0 Release
[apps/osp/Internet.git] / src / IntSettingPresentationModel.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
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:        IntSettingsPresentationModel.cpp
20  *@brief:       Used to define SettingsManager
21  */
22
23 #include <cstdlib>
24 #include "IntCommonLib.h"
25 #include "IntSettingPresentationModel.h"
26
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Io;
31 using namespace Tizen::Ui::Controls;
32 using namespace Tizen::Web::Controls;
33
34 SettingPresentationModel* SettingPresentationModel::__pSettingsPresentationModel = null;
35
36 SettingPresentationModel::SettingPresentationModel(void)
37 {
38         __listenerList.Construct();
39         SetDefaultValues();
40         __isPrivateOn = false;
41 }
42
43 SettingPresentationModel::SettingPresentationModel(const SettingPresentationModel& settingModelObj)
44 {
45
46 }
47
48 SettingPresentationModel& SettingPresentationModel::operator=(const SettingPresentationModel& settingModelObj)
49 {
50         return *this;
51 }
52
53 SettingPresentationModel::~SettingPresentationModel(void)
54 {
55
56 }
57
58 void
59 SettingPresentationModel::SetDefaultValues(void)
60 {
61         //__homePage = CommonUtil::GetString(L"IDS_EMPTY_PAGE");
62         __homePage = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES");
63         __defaultViewLevel = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH"); // IDS_FIT_TO_WIDTH
64         __runJsEnabled = true;
65         __displayImages = true;
66         __html5Videos = true;
67         __wordWrap = true;
68         __blockPopUp = true;
69         __rememberFormData = false;
70         __rememberPassword = false;
71         __cookies = true;
72         __savePassword = CommonUtil::GetString(L"IDS_BR_BODY_ALWAYS_ASK");              // IDS_ALWAYS_ASK
73         __securityWarnings = true;
74         __searchEngine = CommonUtil::GetString(L"IDS_BR_BODY_YAHOO"); //        L"Yahoo";
75         __caseSensitive = false;
76         __runReader = true;
77         __fontSize = 24;
78
79         __setting.SetInputStyle(INPUT_STYLE_OVERLAY);
80         __setting.SetAutoImageLoadEnabled(__displayImages);
81         __setting.SetJavascriptEnabled(__runJsEnabled);
82         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
83
84         if (__securityWarnings == true)
85         {
86                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
87         }
88         else
89         {
90                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
91         }
92 }
93
94 void
95 SettingPresentationModel::CreateInstance(void)
96 {
97         if (__pSettingsPresentationModel == null)
98                 __pSettingsPresentationModel = new(std::nothrow) SettingPresentationModel();
99         result r = __pSettingsPresentationModel->Construct();
100         if (IsFailed(r))
101         {
102                 delete __pSettingsPresentationModel;
103                 __pSettingsPresentationModel = null;
104                 return;
105         }
106         std::atexit(DestroyInstance);
107 }
108
109 SettingPresentationModel*
110 SettingPresentationModel::GetInstance(void)
111 {
112         if (__pSettingsPresentationModel == null)
113         {
114                 CreateInstance();
115         }
116         return __pSettingsPresentationModel;
117 }
118
119 void
120 SettingPresentationModel::DestroyInstance(void)
121 {
122         if (__pSettingsPresentationModel)
123         {
124                 delete __pSettingsPresentationModel;
125                 __pSettingsPresentationModel = null;
126         }
127 }
128
129 result
130 SettingPresentationModel::LoadRegistry(void)
131 {
132         AppLog("SettingPresentationModel::LoadRegistry entered");
133         result r = E_FAILURE;
134
135         SetDefaultValues();
136         for (int settingValueName = REGISTRY_SETTING_HOMEPAGE; settingValueName < MAX_REGISTRY_SETTING; settingValueName++)
137         {
138                 r = AppRegistry::GetInstance()->Get(__entry[settingValueName], __values[settingValueName]);
139                 if (r != E_SUCCESS && r != E_KEY_NOT_FOUND)
140                 {
141                         AppLog("Registry Load failed with result %s settingValueName %d", GetErrorMessage(r),settingValueName);
142                         return r;
143                 }
144         }
145         if (__values[REGISTRY_SETTING_HOMEPAGE].CompareTo(L"") != 0)
146         {
147                 __homePage = __values[REGISTRY_SETTING_HOMEPAGE];
148                 AppLog("homepage Loading from registry %ls",__homePage.GetPointer());
149         }
150         if (__values[REGISTRY_SETTING_DEFAULT_VIEW].CompareTo(L"") != 0)
151         {
152                 __defaultViewLevel = __values[REGISTRY_SETTING_DEFAULT_VIEW];
153         }
154         if (__values[REGISTRY_SETTING_RUN_JAVASCRIPT].CompareTo(L"") != 0)
155         {
156                 __runJsEnabled = Boolean::Parse(__values[REGISTRY_SETTING_RUN_JAVASCRIPT], false);
157                 AppLogDebug("LoadRegistry __runJsEnabled %d",__runJsEnabled);
158         }
159         if (__values[REGISTRY_SETTING_DISPLAY_IMAGES].CompareTo(L"") != 0)
160         {
161                 __displayImages = Boolean::Parse(__values[REGISTRY_SETTING_DISPLAY_IMAGES], false);
162                 AppLogDebug("LoadRegistry __displayImages %d",__displayImages);
163         }
164         if (__values[REGISTRY_SETTING_HTML5_VIDEOS].CompareTo(L"") != 0)
165         {
166                 __html5Videos = Boolean::Parse(__values[REGISTRY_SETTING_HTML5_VIDEOS], false);
167                 AppLogDebug("LoadRegistry __html5Videos %d",__html5Videos);
168         }
169         if (__values[REGISTRY_SETTING_WORD_WRAPPING].CompareTo(L"") != 0)
170         {
171                 __wordWrap = Boolean::Parse(__values[REGISTRY_SETTING_WORD_WRAPPING], false);
172                 AppLogDebug("LoadRegistry __wordWrap %d",__wordWrap);
173         }
174         if (__values[REGISTRY_SETTING_BLOCK_POPUP].CompareTo(L"") != 0)
175         {
176                 __blockPopUp = Boolean::Parse(__values[REGISTRY_SETTING_BLOCK_POPUP], false);
177                 AppLogDebug("LoadRegistry __blockPopUp %d",__blockPopUp);
178         }
179         if (__values[REGISTRY_SETTING_ACCEPT_COOKIES].CompareTo(L"") != 0)
180         {
181                 __cookies = Boolean::Parse(__values[REGISTRY_SETTING_ACCEPT_COOKIES], false);
182                 AppLogDebug("LoadRegistry __cookies %d",__cookies);
183         }
184         if (__values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD].CompareTo(L"") != 0)
185         {
186                 __savePassword = __values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD];
187         }
188         if (__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS].CompareTo(L"") != 0)
189         {
190                 __securityWarnings = Boolean::Parse(__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS], false);
191                 AppLogDebug("LoadRegistry __securityWarnings %d",__securityWarnings);
192         }
193         if (__values[REGISTRY_SETTING_SEARCH_ENGINE].CompareTo(L"") != 0)
194         {
195                 __searchEngine = __values[REGISTRY_SETTING_SEARCH_ENGINE];
196         }
197         if (__values[REGISTRY_SETTING_CASE_SENSITIVE].CompareTo(L"") != 0)
198         {
199                 __caseSensitive = Boolean::Parse(__values[REGISTRY_SETTING_CASE_SENSITIVE], false);
200                 AppLogDebug("LoadRegistry __caseSensitive %d",__caseSensitive);
201         }
202         if (__values[REGISTRY_SETTING_RUN_READER].CompareTo(L"") != 0)
203         {
204                 __runReader = Boolean::Parse(__values[REGISTRY_SETTING_RUN_READER], false);
205                 AppLogDebug("LoadRegistry __runReader %d",__runReader);
206         }
207         if (__values[REGISTRY_SETTING_READER_FONT_SIZE].CompareTo(L"") != 0)
208         {
209                 Integer::Parse(__values[REGISTRY_SETTING_READER_FONT_SIZE], (int&)__fontSize);
210         }
211         if (__values[REGISTRY_SETTING_REMEMBER_FORM_DATA].CompareTo(L"") != 0)
212         {
213                 __rememberFormData = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_FORM_DATA], false);
214                 AppLogDebug("LoadRegistry form data %d",__rememberFormData);
215         }
216         if (__values[REGISTRY_SETTING_REMEMBER_PASSWORD].CompareTo(L"") != 0)
217         {
218                 __rememberPassword = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_PASSWORD], false);
219                 AppLogDebug("LoadRegistry form password %d",__rememberPassword);
220         }
221         //
222         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
223         {
224                 AppLogDebug("registry loaded value :%ls at index %d", __values[index].GetPointer(), index);
225         }
226         __setting.SetInputStyle(INPUT_STYLE_OVERLAY);
227         __setting.SetAutoImageLoadEnabled(__displayImages);
228         __setting.SetJavascriptEnabled(__runJsEnabled);
229         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
230
231         if (__securityWarnings == true)
232         {
233                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
234         }
235         else
236         {
237                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
238         }
239         __favouriteURL.Clear();
240         __favouriteURL = L"";
241         r = AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL);
242         AppLog("__favouriteURL taken from registry is %ls",__favouriteURL.GetPointer());
243
244         if (r != E_SUCCESS && r != E_KEY_NOT_FOUND)
245         {
246                 AppLogDebug("Registry Load failed with result %s", GetErrorMessage(r));
247                 return r;
248         }
249
250         return E_SUCCESS;
251 }
252
253 result
254 SettingPresentationModel::ResetRegistry(void)
255 {
256         result r = E_FAILURE;
257
258         AppLogDebug("SettingsManager::ResetRegistry");
259         for (int index = REGISTRY_SETTING_INVALID+1; index < MAX_REGISTRY_SETTING; index++)
260         {
261                 r = AppRegistry::GetInstance()->Remove(__entry[index]);
262                 AppLogDebug("Registry Remove result %s",GetErrorMessage(r));
263         }
264
265         AppRegistry::GetInstance()->Save();
266
267         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
268         {
269                 __values[index] = L"";
270         }
271
272         SetDefaultValues();
273         for (int index = 0; index < __listenerList.GetCount(); index++)
274         {
275                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
276                 if (pSettingsListener)
277                         pSettingsListener->OnSettingsReset();
278         }
279
280         return E_SUCCESS;
281 }
282
283 void
284 SettingPresentationModel::ClearCache(void)
285 {
286         for (int index = 0; index < __listenerList.GetCount(); index++)
287         {
288                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
289                 if (pSettingsListener)
290                         pSettingsListener->OnClearCache();
291         }
292 }
293
294 void
295 SettingPresentationModel::ClearCookie(void)
296 {
297         for (int index = 0; index < __listenerList.GetCount(); index++)
298         {
299                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
300                 if (pSettingsListener)
301                         pSettingsListener->OnClearCookie();
302         }
303 }
304
305 result
306 SettingPresentationModel::Construct(void)
307 {
308         result r = E_FAILURE;
309
310         for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++)
311         {
312                 __values[index] = L"";
313         }
314
315         __entry[REGISTRY_SETTING_HOMEPAGE] = L"homePage";
316         __entry[REGISTRY_SETTING_DEFAULT_VIEW] = L"defaultViewLevel";
317         __entry[REGISTRY_SETTING_RUN_JAVASCRIPT] = L"runJs";
318         __entry[REGISTRY_SETTING_DISPLAY_IMAGES] = L"displayImages";
319         __entry[REGISTRY_SETTING_HTML5_VIDEOS] = L"html5Videos";
320         __entry[REGISTRY_SETTING_WORD_WRAPPING] = L"wordWrap";
321         __entry[REGISTRY_SETTING_BLOCK_POPUP] = L"blockPopUp";
322         __entry[REGISTRY_SETTING_ACCEPT_COOKIES] = L"cookies";
323         __entry[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD] = L"savePassword";
324         __entry[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS] = L"securityWarnings";
325         __entry[REGISTRY_SETTING_SEARCH_ENGINE] = L"searchEngine";
326         __entry[REGISTRY_SETTING_CASE_SENSITIVE] = L"caseSensitive";
327         __entry[REGISTRY_SETTING_RUN_READER] = L"runReader";
328         __entry[REGISTRY_SETTING_READER_FONT_SIZE] = L"fontSize";
329         __entry[REGISTRY_SETTING_FAVORITE_URL_VALUE] = L"Favourite";
330         __entry[REGISTRY_SETTING_REMEMBER_FORM_DATA] = L"formData";
331         __entry[REGISTRY_SETTING_REMEMBER_PASSWORD] = L"rememberPassword";
332
333         r = LoadRegistry();
334         return E_SUCCESS;
335 }
336
337 result
338 SettingPresentationModel::SetValue(const int settingValueName, const String& val)
339 {
340         result r = E_FAILURE;
341
342         AppLogDebug("SettingsManager::SetValue settingValueName:%d val %ls", settingValueName, val.GetPointer());
343         if (__values[settingValueName] == L"")
344         {
345                 AppLogDebug("adding the new (std::nothrow) entry into registry");
346                 r = AppRegistry::GetInstance()->Add(__entry[settingValueName], val);
347         }
348         else
349         {
350                 AppLogDebug("modifying entry into registry");
351                 r = AppRegistry::GetInstance()->Set(__entry[settingValueName], val);
352         }
353         TryCatch(!IsFailed(r),,"Adding into registry failed %s",GetErrorMessage(r));
354
355         r = AppRegistry::GetInstance()->Save();
356         TryCatch(!IsFailed(r),,"Save Failed with error %s",GetErrorMessage(r));
357
358         for (int index = 0; index < __listenerList.GetCount(); index++)
359         {
360                 ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index));
361                 if (pSettingsListener)
362                         pSettingsListener->OnSettingsChange(settingValueName);
363         }
364
365         __values[settingValueName] = val;
366
367         CATCH:
368         return r;
369
370 }
371
372 result
373 SettingPresentationModel::SetFavoriteValue(const Tizen::Base::String& val)
374 {
375         result r = E_FAILURE;
376
377         if (__favouriteURL == L"")
378                 r = AppRegistry::GetInstance()->Add(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val);
379         else
380                 r = AppRegistry::GetInstance()->Set(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val);
381         TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r));
382         r = AppRegistry::GetInstance()->Save();
383         TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r));
384         __favouriteURL.Clear();
385         __favouriteURL.Append(val);
386
387         CATCH:
388         return r;
389 }
390
391 String
392 SettingPresentationModel::GetFavoriteUrl(void)
393 {
394         __favouriteURL.Clear();
395         __favouriteURL =  L"";
396         AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL);
397
398         return __favouriteURL;
399 }
400
401 void
402 SettingPresentationModel::AddSettingsEventListener(const ISettingChangeEventListener& listener)
403 {
404         __listenerList.Add(listener);
405 }
406
407 void
408 SettingPresentationModel::RemoveSettingsEventListener(ISettingChangeEventListener& listener)
409 {
410         __listenerList.Remove(listener, false);
411 }
412
413 void
414 SettingPresentationModel::SetHomepage(const String& homePage)
415 {
416         __homePage.Clear();
417         __homePage.Append(homePage);
418         AppLog("SettingPresentationModel::SetHomepage %ls",__homePage.GetPointer());
419         SetValue((int) REGISTRY_SETTING_HOMEPAGE, __homePage);
420 }
421
422 String
423 SettingPresentationModel::GetHomepage(void)
424 {
425         return __homePage;
426 }
427
428 void
429 SettingPresentationModel::SetDefaultView(const String& viewLevel)
430 {
431         __defaultViewLevel = viewLevel;
432         //CommonUtil::GetString(L"IDS_FIT_TO_WIDTH")
433         if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
434         {
435                 __setting.SetAutoFittingEnabled(true);
436         }
437         else if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_READABLE")) == 0)
438         {
439                 __setting.SetAutoFittingEnabled(false);
440         }
441
442         SetValue((int) REGISTRY_SETTING_DEFAULT_VIEW, viewLevel);
443 }
444
445 String
446 SettingPresentationModel::GetDefaultView(void)
447 {
448         return __defaultViewLevel;
449 }
450
451 void
452 SettingPresentationModel::SetRunJavascriptEnabled(bool runJsEnabled)
453 {
454         __runJsEnabled = runJsEnabled;
455         SetValue((int) REGISTRY_SETTING_RUN_JAVASCRIPT, Boolean::ToString(runJsEnabled));
456         __setting.SetJavascriptEnabled(runJsEnabled);
457 }
458
459 bool
460 SettingPresentationModel::IsRunJavascriptEnabled(void)
461 {
462         return __runJsEnabled;
463 }
464
465 void
466 SettingPresentationModel::SetDisplayImagesEnabled(bool displayImages)
467 {
468         __displayImages = displayImages;
469         SetValue((int) REGISTRY_SETTING_DISPLAY_IMAGES, Boolean::ToString(displayImages));
470         __setting.SetAutoImageLoadEnabled(__displayImages);
471 }
472
473 bool
474 SettingPresentationModel::IsDisplayImagesEnabled(void)
475 {
476         return __displayImages;
477 }
478
479 void
480 SettingPresentationModel::SetHtml5VideosEnabled(bool html5Videos)
481 {
482         __html5Videos = html5Videos;
483         SetValue((int) REGISTRY_SETTING_HTML5_VIDEOS, Boolean::ToString(html5Videos));
484 }
485
486 bool
487 SettingPresentationModel::IsHtml5VideosEnabled(void)
488 {
489         return __html5Videos;
490 }
491
492 void
493 SettingPresentationModel::SetWordWrapEnabled(bool wordWrap)
494 {
495         __wordWrap = wordWrap;
496         SetValue((int) REGISTRY_SETTING_WORD_WRAPPING, Boolean::ToString(wordWrap));
497 }
498
499 bool
500 SettingPresentationModel::IsWordWrapEnabled(void)
501 {
502         return __wordWrap;
503 }
504
505 void
506 SettingPresentationModel::SetBlockPopUp(bool blockPopUp)
507 {
508         __blockPopUp = blockPopUp;
509         SetValue((int) REGISTRY_SETTING_BLOCK_POPUP, Boolean::ToString(blockPopUp));
510         __setting.SetJavaScriptPopupEnabled(__blockPopUp);
511 }
512
513 bool
514 SettingPresentationModel::IsBlockPopUp(void)
515 {
516         return __blockPopUp;
517 }
518
519 void
520 SettingPresentationModel::SetCookiesEnabled(bool cookiesEnabled)
521 {
522         __cookies = cookiesEnabled;
523         SetValue((int) REGISTRY_SETTING_ACCEPT_COOKIES, Boolean::ToString(cookiesEnabled));
524 }
525
526 bool
527 SettingPresentationModel::IsCookiesEnabled(void)
528 {
529         return __cookies;
530 }
531
532 void
533 SettingPresentationModel::SetRememberFormData(bool formData)
534 {
535         __rememberFormData = formData;
536         SetValue((int) REGISTRY_SETTING_REMEMBER_FORM_DATA, Boolean::ToString(__rememberFormData));
537 }
538
539 bool
540 SettingPresentationModel::IsRememberFormData(void)
541 {
542         return __rememberFormData;
543 }
544
545 void SettingPresentationModel::SetRememberPassword(bool rememberPassword)
546 {
547         __rememberPassword = rememberPassword;
548         SetValue((int) REGISTRY_SETTING_REMEMBER_PASSWORD, Boolean::ToString(__rememberPassword));
549 }
550
551 bool SettingPresentationModel::IsRememberPassword(void)
552 {
553         return __rememberPassword;
554 }
555
556 void
557 SettingPresentationModel::SetSavePassword(const String& savePassword)
558 {
559         __savePassword = savePassword;
560         SetValue((int) REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD, savePassword);
561 }
562
563 String
564 SettingPresentationModel::GetSavePassword(void)
565 {
566         return __savePassword;
567 }
568
569 void
570 SettingPresentationModel::SetSecurityWarningsEnabled(bool securityWarnings)
571 {
572         __securityWarnings = securityWarnings;
573         SetValue((int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS, Boolean::ToString(securityWarnings));
574         if (__securityWarnings == true)
575         {
576                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
577         }
578         else
579         {
580                 __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
581         }
582 }
583
584 bool
585 SettingPresentationModel::IsSecurityWarningsEnabled(void)
586 {
587         return __securityWarnings;
588 }
589
590 void
591 SettingPresentationModel::SetSearchEngine(const String& searchEngine)
592 {
593         __searchEngine = searchEngine;
594         SetValue((int) REGISTRY_SETTING_SEARCH_ENGINE, searchEngine);
595 }
596
597 String
598 SettingPresentationModel::GetSearchEngine(void)
599 {
600         return __searchEngine;
601 }
602
603 void
604 SettingPresentationModel::SetCaseSensitiveEnabled(bool caseSensitive)
605 {
606         __caseSensitive = caseSensitive;
607         SetValue((int) REGISTRY_SETTING_CASE_SENSITIVE, Boolean::ToString(caseSensitive));
608 }
609
610 bool
611 SettingPresentationModel::IsCaseSensitiveEnabled(void)
612 {
613         return __caseSensitive;
614 }
615
616 void
617 SettingPresentationModel::SetRunReaderEnabled(bool runReader)
618 {
619         __runReader = runReader;
620         SetValue((int) REGISTRY_SETTING_RUN_READER, Boolean::ToString(runReader));
621 }
622
623 bool
624 SettingPresentationModel::IsRunReaderEnabled(void)
625 {
626         return __runReader;
627 }
628
629 void
630 SettingPresentationModel::SetReaderFontSize(int fontSize)
631 {
632         __fontSize = fontSize;
633         SetValue((int) REGISTRY_SETTING_READER_FONT_SIZE, Integer::ToString(__fontSize));
634 }
635
636 int
637 SettingPresentationModel::GetReaderFontSize(void)
638 {
639         return __fontSize;
640 }
641
642 String
643 SettingPresentationModel::GetSearchUrl(const String& searchText)
644 {
645         String searchStr = L"";
646         if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_YAHOO")) == 0)
647         {
648                 searchStr.Append(L"http://search.yahoo.com/search?p=");
649                 searchStr.Append(searchText);
650         }
651         else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_NAVER")) == 0)
652         {
653                 searchStr.Append(L"http://search.naver.com/search.naver?query=");
654                 searchStr.Append(searchText);
655         }
656         else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE")) == 0)
657         {
658                 searchStr.Append(L"http://www.google.com/search?q=");
659                 searchStr.Append(searchText);
660         }
661         return searchStr;
662 }
663
664 Tizen::Web::Controls::WebSetting&
665 SettingPresentationModel::GetWebSettings(void)
666 {
667         return __setting;
668 }
669
670 void
671 SettingPresentationModel::SetPrivateOn(bool isPrivateOn)
672 {
673         __isPrivateOn = isPrivateOn;
674         return;
675 }
676
677 bool
678 SettingPresentationModel::GetPrivateOn(void)
679 {
680         return __isPrivateOn;
681 }