Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntSettingForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 //!Internet SettingForm class
18 /*@file:        IntSettingForm.cpp
19  *@brief:       The SettingForm
20  */
21
22 #include <FApp.h>
23 #include <FGraphics.h>
24 #include <FUi.h>
25
26 #include "IntCommonLib.h"
27 #include "IntConfirmationPopup.h"
28 #include "IntDefaultCustomItem.h"
29 #include "IntDropDownCustomItem.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntInternetApp.h"
32 #include "IntMultipleWindowPresentationModel.h"
33 #include "IntNotificationPanel.h"
34 #include "IntRadioCustomItem.h"
35 #include "IntSceneRegister.h"
36 #include "IntSettingForm.h"
37 #include "IntSettingPresentationModel.h"
38 #include "IntSettingToggleCustomItem.h"
39
40
41 using namespace Tizen::App;
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Collection;
44 using namespace Tizen::Graphics;
45 using namespace Tizen::System;
46 using namespace Tizen::Ui;
47 using namespace Tizen::Ui::Controls;
48 using namespace Tizen::Ui::Scenes;
49
50
51
52 SettingForm::SettingForm(void)
53 : __fontValue(0),__pResetPopup(null),__pWindowInfo(null) , __pConfirmationPopup(null)
54 {
55         __currentURL = L"";
56         __pList = null;
57         InitializeSettingValues();
58         __fontSize = 44;
59 }
60
61 SettingForm::~SettingForm(void)
62 {
63         if (pGroupItemCount)
64         {
65                 delete[] pGroupItemCount;
66                 pGroupItemCount = null;
67         }
68 }
69
70 void
71 SettingForm::InitializeSettingValues(void)
72 {
73         AppLog("SettingForm::InitializeSettingValues homepage %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());
74         groupCount = 5;
75         pGroupItemCount = new(std::nothrow) int[5];
76         pGroupItemCount[0] = 5;  //Homepage
77         pGroupItemCount[1] = 6;  //Page content settings
78         pGroupItemCount[2] = 9;  //Private and Security
79         pGroupItemCount[3] = 4;  //Search
80         pGroupItemCount[4] = 1;  //Website settings and Reset
81
82         for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; iter++)
83         {
84                 settingInfo[iter].isSelected = false;
85         }
86
87         AppLogDebug("image display %d", (int) SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
88         settingInfo[SETTING_HOMEPAGE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE");
89         settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();
90         settingInfo[SETTING_HOMEPAGE_TITLE].itemType = ITEM_TYPE_DROPDOWN;
91
92         settingInfo[SETTING_CURRENT_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CURRENT_PAGE");
93         settingInfo[SETTING_CURRENT_PAGE].subText = L"";
94         settingInfo[SETTING_CURRENT_PAGE].itemType = ITEM_TYPE_RADIO;
95
96         settingInfo[SETTING_BLANK_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE");
97         settingInfo[SETTING_BLANK_PAGE].subText = L"";
98         settingInfo[SETTING_BLANK_PAGE].itemType = ITEM_TYPE_RADIO;
99         if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
100         {
101                 settingInfo[SETTING_BLANK_PAGE].isSelected = true;
102         }
103
104         settingInfo[SETTING_MOST_VISITED_SITE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES");
105         settingInfo[SETTING_MOST_VISITED_SITE].subText = L"";
106         settingInfo[SETTING_MOST_VISITED_SITE].itemType = ITEM_TYPE_RADIO;
107         if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
108         {
109                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
110         }
111         WindowInfo* pWindowInfo = null;
112         String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
113         AppLog("SettingForm::OnSceneActivatedN check1");
114
115         settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";
116         if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)
117         {
118                 SettingPresentationModel::GetInstance()->SetFavoriteValue(L"http://www.tizen.org");
119         }
120         settingInfo[SETTING_FAVORITE_URL].subText = L"";
121         settingInfo[SETTING_FAVORITE_URL].itemType = ITEM_TYPE_RADIO;
122
123         String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
124         if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
125         {
126                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
127                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
128                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
129                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
130                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
131         }
132         else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
133         {
134                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
135                 settingInfo[SETTING_BLANK_PAGE].isSelected = true;
136                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
137                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
138                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_BLANK_PAGE");
139         }
140         else
141         {
142                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
143                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
144                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
145                 settingInfo[SETTING_FAVORITE_URL].isSelected = true;
146         }
147
148         settingInfo[SETTING_DEFAULT_VIEW_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DEFAULT_VIEW");
149         settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText = CommonUtil::GetString(SettingPresentationModel::GetInstance()->GetDefaultView());
150         settingInfo[SETTING_DEFAULT_VIEW_TITLE].itemType = ITEM_TYPE_DROPDOWN;
151
152         settingInfo[SETTING_FIT_TO_WIDTH].titleText = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH");
153         settingInfo[SETTING_FIT_TO_WIDTH].subText = L"";
154         settingInfo[SETTING_FIT_TO_WIDTH].itemType = ITEM_TYPE_RADIO;
155         settingInfo[SETTING_FIT_TO_WIDTH].isSelected = !(String::Compare(settingInfo[SETTING_FIT_TO_WIDTH].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));
156
157         settingInfo[SETTING_READABLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_READABLE");
158         settingInfo[SETTING_READABLE].subText = L"";
159         settingInfo[SETTING_READABLE].itemType = ITEM_TYPE_RADIO;
160         settingInfo[SETTING_READABLE].isSelected = !(String::Compare(settingInfo[SETTING_READABLE].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));
161
162         settingInfo[SETTING_RUN_JAVASCRIPT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RUN_JAVASCRIPT");
163         settingInfo[SETTING_RUN_JAVASCRIPT].subText = L"";
164         settingInfo[SETTING_RUN_JAVASCRIPT].itemType = ITEM_TYPE_TOGGLE;
165         settingInfo[SETTING_RUN_JAVASCRIPT].isSelected = SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled();
166
167         settingInfo[SETTING_DISPLAY_IMAGES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_IMAGES");
168         settingInfo[SETTING_DISPLAY_IMAGES].subText = L"";
169         settingInfo[SETTING_DISPLAY_IMAGES].itemType = ITEM_TYPE_TOGGLE;
170         settingInfo[SETTING_DISPLAY_IMAGES].isSelected = SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled();
171
172         settingInfo[SETTING_BLOCK_POPUP].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLOCK_POP_UPS_ABB");
173         settingInfo[SETTING_BLOCK_POPUP].subText = L"";
174         settingInfo[SETTING_BLOCK_POPUP].itemType = ITEM_TYPE_TOGGLE;
175         settingInfo[SETTING_BLOCK_POPUP].isSelected = !SettingPresentationModel::GetInstance()->IsBlockPopUp();
176
177         settingInfo[SETTING_CLEAR_CACHE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_CACHE");
178         settingInfo[SETTING_CLEAR_CACHE].subText = L"";
179         settingInfo[SETTING_CLEAR_CACHE].itemType = ITEM_TYPE_NORMAL;
180
181         settingInfo[SETTING_CLEAR_HISTORY].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_HISTORY");
182         settingInfo[SETTING_CLEAR_HISTORY].subText = L"";
183         settingInfo[SETTING_CLEAR_HISTORY].itemType = ITEM_TYPE_NORMAL;
184
185         settingInfo[SETTING_SHOW_SECURITY_WARNINGS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_SECURITY_WARNINGS");
186         settingInfo[SETTING_SHOW_SECURITY_WARNINGS].subText = L"";
187         settingInfo[SETTING_SHOW_SECURITY_WARNINGS].itemType = ITEM_TYPE_TOGGLE;
188         settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected = SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled();
189
190         settingInfo[SETTING_ACCEPT_COOKIES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_ACCEPT_COOKIES");
191         settingInfo[SETTING_ACCEPT_COOKIES].subText = L"";
192         settingInfo[SETTING_ACCEPT_COOKIES].itemType = ITEM_TYPE_TOGGLE;
193         settingInfo[SETTING_ACCEPT_COOKIES].isSelected = SettingPresentationModel::GetInstance()->IsCookiesEnabled();
194
195         settingInfo[SETTING_CLEAR_COOKIE_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_ALL_COOKIE_DATA");
196         settingInfo[SETTING_CLEAR_COOKIE_DATA].subText = CommonUtil::GetString(L"IDS_BR_BODY_COOKIES");
197         settingInfo[SETTING_CLEAR_COOKIE_DATA].itemType = ITEM_TYPE_NORMAL;
198
199         settingInfo[SETTING_REMEMBER_FORM_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_REMEMBER_FORM_DATA");
200         settingInfo[SETTING_REMEMBER_FORM_DATA].subText = L"";
201         settingInfo[SETTING_REMEMBER_FORM_DATA].itemType = ITEM_TYPE_TOGGLE;
202         settingInfo[SETTING_REMEMBER_FORM_DATA].isSelected = SettingPresentationModel::GetInstance()->IsRememberFormData();
203
204         settingInfo[SETTING_CLEAR_FORM_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_FORM_DATA");
205         settingInfo[SETTING_CLEAR_FORM_DATA].subText = CommonUtil::GetString(L"IDS_BR_HEADER_FORM_DATA");
206         settingInfo[SETTING_CLEAR_FORM_DATA].itemType = ITEM_TYPE_NORMAL;
207
208         settingInfo[SETTING_REMEMBER_PASSWORD].titleText = CommonUtil::GetString(L"IDS_BR_BODY_REMEMBER_PASSWORDS");
209         settingInfo[SETTING_REMEMBER_PASSWORD].subText = L"";
210         settingInfo[SETTING_REMEMBER_PASSWORD].itemType = ITEM_TYPE_TOGGLE;
211         settingInfo[SETTING_REMEMBER_PASSWORD].isSelected = SettingPresentationModel::GetInstance()->IsRememberPassword();
212
213
214         settingInfo[SETTING_CLEAR_PASSWORDS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_PASSWORDS");
215         settingInfo[SETTING_CLEAR_PASSWORDS].subText = L"";
216         settingInfo[SETTING_CLEAR_PASSWORDS].itemType = ITEM_TYPE_NORMAL;
217
218         settingInfo[SETTING_SEARCH_ENGINE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_ENGINE");
219         settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText = SettingPresentationModel::GetInstance()->GetSearchEngine();
220         settingInfo[SETTING_SEARCH_ENGINE_TITLE].itemType = ITEM_TYPE_DROPDOWN;
221
222         settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText = L"Yahoo";  //CommonUtil::GetString(L"IDS_BR_BODY_YAHOO");
223         settingInfo[SETTING_SEARCH_ENGINE_YAHOO].subText = L"";
224         settingInfo[SETTING_SEARCH_ENGINE_YAHOO].itemType = ITEM_TYPE_RADIO;
225         settingInfo[SETTING_SEARCH_ENGINE_YAHOO].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
226
227         settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText = L"Naver";          //CommonUtil::GetString(L"IDS_BR_BODY_NAVER");
228         settingInfo[SETTING_SEARCH_ENGINE_NAVER].subText = L"";
229         settingInfo[SETTING_SEARCH_ENGINE_NAVER].itemType = ITEM_TYPE_RADIO;
230         settingInfo[SETTING_SEARCH_ENGINE_NAVER].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
231
232         settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText = CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE");
233         settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].subText = L"";
234         settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].itemType = ITEM_TYPE_RADIO;
235         settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
236
237         settingInfo[SETTING_RESET_TO_DEFAULT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RESET_TO_DEFAULT");
238         settingInfo[SETTING_RESET_TO_DEFAULT].subText = L"";
239         settingInfo[SETTING_RESET_TO_DEFAULT].itemType = ITEM_TYPE_NORMAL;
240 }
241
242 bool
243 SettingForm::Initialize(void)
244 {
245         result r = E_FAILURE;
246
247         r = Construct(L"IDL_SETTING_FORM");
248         if (IsFailed(r))
249         {
250                 return false;
251         }
252         return true;
253 }
254
255 result
256 SettingForm::OnInitializing(void)
257 {
258         result r = E_FAILURE;
259         Footer* pFooter = NULL;
260         SceneManager* pSceneManager = NULL;
261
262         __fontSize = CommonUtil::GetFontSize();
263
264         bool isHwKeySupported = false;
265
266         SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
267         __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST"));
268         if ( __pList != NULL )
269         {
270
271                 r = __pList->SetItemProvider(*this);
272                 TryCatch(!IsFailed(r),,"setItemProvider failed with error %s",GetErrorMessage(r));
273                 __pList->AddGroupedListViewItemEventListener(*this);
274         }
275
276 //      pFooter = GetFooter();
277 //      if (pFooter)
278 //      {
279 //              AppLogDebug("setting back button");
280 //              pFooter->SetBackButtonEnabled(true);
281 //      }
282         SetFormBackEventListener(this);
283         AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
284         pSceneManager = SceneManager::GetInstance();
285         if (pSceneManager != null)
286         {
287                 r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS, *this);
288                 TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r));
289         }
290         AddOrientationEventListener(*this);
291
292         CATCH:
293         return r;
294 }
295
296 void
297 SettingForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
298 {
299
300 }
301
302 void
303 SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
304 {
305         int effectiveIndex = 0;
306         SettingPresentationModel* pSettingMgr = SettingPresentationModel::GetInstance();
307
308         if (pSettingMgr == null)
309                 return;
310
311         for (int i = 0; i < groupIndex; i++)
312                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
313         effectiveIndex = effectiveIndex + itemIndex;
314
315         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
316         {
317                 AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount);
318                 if (settingInfo[effectiveIndex].isOpen == false)
319                 {
320                         settingInfo[effectiveIndex].isOpen = true;
321                         settingInfo[effectiveIndex].childCount = 0;
322                         for (int iter = effectiveIndex + 1; iter < SETTING_MAX; iter++)
323                         {
324                                 if (settingInfo[iter].itemType == ITEM_TYPE_RADIO)
325                                         settingInfo[effectiveIndex].childCount++;
326                                 else
327                                         break;
328                         }
329                         listView.UpdateList();
330                 }
331                 else
332                 {
333                         settingInfo[effectiveIndex].isOpen = false;
334                         listView.UpdateList();
335                 }
336         }
337         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
338         {
339                 int parentIndex = 0;
340                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
341                 {
342                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
343                                 break;
344                 }
345                 settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;
346
347                 for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++)
348                 {
349                         if (parentIndex + iter + 1 != effectiveIndex)
350                         {
351                                 AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1);
352                                 settingInfo[parentIndex + iter + 1].isSelected = false;
353                         }
354                         else
355                         {
356                                 AppLogDebug("effectiveIndex %d set to true", effectiveIndex);
357                                 settingInfo[effectiveIndex].isSelected = true;
358                         }
359                         if (effectiveIndex == SETTING_CURRENT_PAGE)
360                         {
361                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
362                                 settingInfo[SETTING_FAVORITE_URL].isSelected = true;
363                         }
364                         //listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
365                 }
366 //              listView.UpdateList();
367                 //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP);
368                 Invalidate(true);
369         }
370         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
371         {
372                 if (settingInfo[effectiveIndex].isSelected == true)
373                 {
374                         settingInfo[effectiveIndex].isSelected = false;
375                 }
376                 else
377                 {
378                         settingInfo[effectiveIndex].isSelected = true;
379                 }
380 //              listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
381                 if(__pList != null)
382                 {
383                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
384                 }
385         }
386
387         switch (effectiveIndex)
388         {
389         case SETTING_CURRENT_PAGE:
390                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
391                 AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
392                 if (__currentURL.CompareTo(L"") != 0)
393                 {
394                         AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
395                         SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
396                         SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL);
397                         settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL;
398 //                      listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
399                         listView.UpdateList();
400                 }
401                 break;
402         case SETTING_BLANK_PAGE:
403                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_BLANK_PAGE].titleText);
404                 SettingPresentationModel::GetInstance()->SetHomepage((L"IDS_BR_BODY_BLANK_PAGE"));
405                 AppLog("GetHomepage() %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());
406                 listView.UpdateList();
407
408                 break;
409         case SETTING_MOST_VISITED_SITE:
410                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
411                 listView.UpdateList();
412                 break;
413
414         case SETTING_FAVORITE_URL:
415                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
416                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EDIT_HOMEPAGE_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
417                 break;
418
419         case SETTING_FIT_TO_WIDTH:
420                 SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");
421                 listView.UpdateList();
422                 break;
423
424         case SETTING_READABLE:
425                 SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");
426                 listView.UpdateList();
427                 break;
428
429         case SETTING_RUN_JAVASCRIPT:
430                 SettingPresentationModel::GetInstance()->SetRunJavascriptEnabled(settingInfo[SETTING_RUN_JAVASCRIPT].isSelected);
431                 break;
432
433         case SETTING_DISPLAY_IMAGES:
434                 SettingPresentationModel::GetInstance()->SetDisplayImagesEnabled(settingInfo[SETTING_DISPLAY_IMAGES].isSelected);
435                 break;
436
437         case SETTING_BLOCK_POPUP:
438                 SettingPresentationModel::GetInstance()->SetBlockPopUp(!settingInfo[SETTING_BLOCK_POPUP].isSelected);
439                 break;
440
441         case SETTING_CLEAR_CACHE:
442                 ClearCache();
443                 break;
444
445         case SETTING_CLEAR_HISTORY:
446                 ClearHistory();
447                 break;
448
449         case SETTING_SHOW_SECURITY_WARNINGS:
450                 SettingPresentationModel::GetInstance()->SetSecurityWarningsEnabled(settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected);
451                 break;
452
453         case SETTING_ACCEPT_COOKIES:
454                 SettingPresentationModel::GetInstance()->SetCookiesEnabled(settingInfo[SETTING_ACCEPT_COOKIES].isSelected);
455                 break;
456
457         case SETTING_CLEAR_COOKIE_DATA:
458                 ClearCookie();
459                 break;
460
461         case SETTING_REMEMBER_FORM_DATA:
462                 SettingPresentationModel::GetInstance()->SetRememberFormData(settingInfo[SETTING_REMEMBER_FORM_DATA].isSelected);
463                 break;
464
465         case SETTING_CLEAR_FORM_DATA:
466                 ClearFormData();
467                 break;
468
469         case SETTING_CLEAR_PASSWORDS:
470                 ClearPasswords();
471                 break;
472
473         case SETTING_REMEMBER_PASSWORD:
474                 SettingPresentationModel::GetInstance()->SetRememberPassword(settingInfo[SETTING_REMEMBER_PASSWORD].isSelected);
475                 break;
476
477         case SETTING_SEARCH_ENGINE_YAHOO:
478                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);
479                 listView.UpdateList();
480                 break;
481
482         case SETTING_SEARCH_ENGINE_NAVER:
483                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText);
484                 listView.UpdateList();
485                 break;
486
487         case SETTING_SEARCH_ENGINE_GOOGLE:
488                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText);
489                 listView.UpdateList();
490                 break;
491
492         case SETTING_RESET_TO_DEFAULT:
493                 //OpenResetPopup();
494                 ResetToDefault();
495                 break;
496
497         default:
498                 break;
499         }
500 }
501
502 void
503 SettingForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
504 {
505
506 }
507
508 GroupItem*
509 SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
510 {
511         result r = E_FAILURE;
512         String text(L"");
513         GroupItem* pItem = null;
514         const Color ITEM_TEXT_COLOR = CUSTOM_COLOR_SETTINGS_GROUPTITLE;
515
516         pItem = new(std::nothrow) GroupItem();
517         if (pItem == null)
518         {
519                 return null;
520         }
521         r = pItem->Construct(Dimension(itemWidth, 46));
522         if (IsFailed(r))
523         {
524                 delete pItem;
525                 return null;
526         }
527
528         switch (groupIndex)
529         {
530         case 0:
531                 text = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); // IDS_HOMEPAGE
532                 settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();
533                 break;
534
535         case 1:
536                 text = CommonUtil::GetString(L"IDS_BR_MBODY_PAGE_CONTENT_SETTINGS"); // IDS_BR_MBODY_PAGE_CONTENT_SETTINGS
537                 break;
538
539         case 2:
540                 text = CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB");  // IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB
541                 break;
542
543         case 3:
544                 text = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");    // IDS_BR_BODY_SEARCH
545                 break;
546
547         case 4:
548                 text = L" ";
549                 break;
550
551         default:
552                 break;
553         }
554
555         pItem->SetElement(text, null);
556
557         AppLogDebug("background color set result %s", GetErrorMessage(r));
558
559         pItem->SetTextColor(ITEM_TEXT_COLOR);
560         return pItem;
561 }
562
563 ListItemBase*
564 SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
565 {
566         AppLog("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, itemWidth);
567
568         result r = E_SUCCESS;
569         int effectiveIndex = 0;
570         const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;
571         const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;
572         const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED;
573
574         for (int i = 0; i < groupIndex; i++)
575                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
576         effectiveIndex = effectiveIndex + itemIndex;
577         AppLogDebug("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
578
579         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
580         {
581                 SettingToggleCustomItem* pItem = new(std::nothrow) SettingToggleCustomItem();
582                 r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
583                 if (IsFailed(r))
584                 {
585                         delete pItem;
586                         return null;
587                 }
588
589                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
590                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
591                 if(__pList != null)
592                 {
593                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
594                 }
595
596                 pItem->SetText(settingInfo[effectiveIndex].titleText);
597                 pItem->Make();
598
599                 return pItem;
600
601         }
602         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
603         {
604                 DropDownCustomItem* pItem = new(std::nothrow) DropDownCustomItem();
605                 r = pItem->Construct(itemWidth);
606                 if (IsFailed(r))
607                 {
608                         delete pItem;
609                         return null;
610                 }
611
612 /*              Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,128);
613                 Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
614
615                 if (pNormalBackgroundBitmap != NULL)
616                 {
617                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
618                         delete pNormalBackgroundBitmap;
619                 }
620
621                 if (pPressedBackgroundBitmap != NULL)
622                 {
623                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
624                         delete pPressedBackgroundBitmap;
625                 }*/
626
627                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
628                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
629
630                 pItem->SetMainText(settingInfo[effectiveIndex].titleText);
631                 if(settingInfo[effectiveIndex].subText.CompareTo(L"IDS_BR_BODY_BLANK_PAGE") == 0 || settingInfo[effectiveIndex].subText.CompareTo(L"IDS_BR_BODY_MOST_VISITED_SITES") == 0  || settingInfo[effectiveIndex].subText.CompareTo(L"IDS_BR_BODY_FIT_TO_WIDTH") == 0 || settingInfo[effectiveIndex].subText.CompareTo(L"IDS_BR_BODY_READABLE") == 0)
632                 {
633                         pItem->SetSubText(CommonUtil::GetString(settingInfo[effectiveIndex].subText));
634                 }
635                 else
636                 {
637                         pItem->SetSubText(settingInfo[effectiveIndex].subText);
638                 }
639                 if (settingInfo[effectiveIndex].isOpen)
640                 {
641                         pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED);
642                 }
643                 else
644                 {
645                         pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED);
646                 }
647                 r = pItem->Make();
648                 //      if (pBitmap != null)
649                 //              pItem->AddElement(Rectangle(0, 0, 10, 128), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null);
650
651                 if (IsFailed(r))
652                 {
653                         delete pItem;
654                         return null;
655                 }
656
657                 return pItem;
658         }
659         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
660         {
661                 RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem();
662                 int parentIndex = 0;
663                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
664                 {
665                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
666                                 break;
667                 }
668                 if (settingInfo[parentIndex].isOpen == false || (__isCurrentPageDisable == true && groupIndex == 0 && itemIndex == 1))
669                 {
670                         r = pItem->Construct(itemWidth, 0);
671                         __pList->SetItemEnabled(groupIndex,itemIndex,false);
672                         AppLogDebug("construct with height 0 %s", GetErrorMessage(r));
673                         return pItem;
674                 }
675                 else
676                 {
677                         __pList->SetItemEnabled(groupIndex,itemIndex,true);
678                         pItem->Construct(itemWidth, 112 +  (__fontSize - 44));
679                 }
680 /*
681                 Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
682                 Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
683
684                 if (pNormalBackgroundBitmap != NULL)
685                 {
686                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
687                         delete pNormalBackgroundBitmap;
688                 }
689
690                 if (pPressedBackgroundBitmap != NULL)
691                 {
692                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
693                         delete pPressedBackgroundBitmap;
694                 }*/
695
696                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_RADIO_ITEM_BACKGROUND_COLOR);
697                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
698
699
700                 pItem->SetText(settingInfo[effectiveIndex].titleText);
701                 AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
702
703                 //if (pBitmap != null)
704                 //      pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
705
706 //              pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
707                 __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected);
708                 pItem->Make();
709
710                 return pItem;
711         }
712         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_NORMAL)
713         {
714                 DefaultCustomItem* pItem = new(std::nothrow) DefaultCustomItem();
715
716                 r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
717                 if (IsFailed(r))
718                 {
719                         delete pItem;
720                         return null;
721                 }
722
723
724 //              Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
725 //              Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
726 //
727 //              if (pNormalBackgroundBitmap != NULL)
728 //              {
729 //                      pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
730 //                      delete pNormalBackgroundBitmap;
731 //              }
732 //
733 //              if (pPressedBackgroundBitmap != NULL)
734 //              {
735 //                      pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
736 //                      delete pPressedBackgroundBitmap;
737 //              }
738
739                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
740                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
741
742
743                 pItem->SetText(settingInfo[effectiveIndex].titleText);
744
745                 //if (pBitmap != null)
746                 //      pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
747
748                 r = pItem->Make();
749                 if (IsFailed(r))
750                 {
751                         delete pItem;
752                         return null;
753                 }
754                 return pItem;
755         }
756         else
757         {
758                 return null;
759         }
760 }
761
762 bool
763 SettingForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
764 {
765         delete pItem;
766         pItem = null;
767         return true;
768 }
769
770 bool
771 SettingForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
772 {
773         delete pItem;
774         pItem = null;
775         return true;
776 }
777
778 int
779 SettingForm::GetGroupCount(void)
780 {
781         return groupCount;
782 }
783
784 int
785 SettingForm::GetItemCount(int groupIndex)
786 {
787         AppLog(" SettingForm::GetItemCount --> groupIndex : %d,", groupIndex);
788         return pGroupItemCount[groupIndex];
789 }
790
791 void
792 SettingForm::OnFormBackRequested(Form& source)
793 {
794         AppLog("SettingForm::OnFormBackRequested entered");
795         String* pSelectedScene = NULL;
796         Object* value = NULL;
797         MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value);
798         pSelectedScene = (String*) value;
799         if (pSelectedScene)
800         {
801                 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
802 //              delete pSelectedScene;
803 //              pSelectedScene = null;
804         }
805 }
806
807 void
808 SettingForm::OnActionPerformed(const Control& source, int actionId)
809 {
810         switch (actionId)
811         {
812         case IDA_BUTTON_NO:
813                 if(__pConfirmationPopup)
814                 {
815                         __pConfirmationPopup->SetShowState(false);
816                         __pConfirmationPopup->Show();
817                         delete __pConfirmationPopup;
818                         __pConfirmationPopup = null;
819                 }
820                 break;
821
822         case IDA_BUTTON_YES:
823                 if(__pConfirmationPopup)
824                 {
825                         String message = L"";
826                         __pConfirmationPopup->SetShowState(false);
827                         __pConfirmationPopup->Show();
828                         if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO"))
829                         {
830                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
831                                 SettingPresentationModel::GetInstance()->ClearCookie();
832                         }
833                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q"))
834                         {
835                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
836                                 SettingPresentationModel::GetInstance()->ClearFormData();
837                         }
838                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q"))
839                         {
840                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
841                                 SettingPresentationModel::GetInstance()->ClearPasswords();
842                         }
843                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q"))
844                         {
845                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
846                                 SettingPresentationModel::GetInstance()->ClearCache();
847                         }
848                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q"))
849                         {
850                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
851                                 HistoryPresentationModel::GetInstance()->ClearHistory();
852                         }
853                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_Q"))
854                         {
855                                 message = CommonUtil::GetString(L"IDS_BR_SK_DONE");
856                                 SettingPresentationModel::GetInstance()->ResetRegistry();
857                                 InitializeSettingValues();
858                                 if(__pList != null)
859                                 {
860                                         __pList->UpdateList();
861                                 }
862                         }
863                         delete __pConfirmationPopup;
864                         __pConfirmationPopup = null;
865
866                         NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
867                         pNotification->SetText(message);
868                         pNotification->SetPositionDiff(0);
869                         pNotification->ShowNotification();
870                 }
871                 break;
872
873         default:
874                 break;
875         }
876 }
877
878 void
879 SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
880 {
881         Rectangle rect = GetClientAreaBounds();
882         if(__pList == null)
883         {
884                 return;
885         }
886         __pList->SetBounds(rect.x,rect.y,rect.width-16,rect.height);
887         __pList->UpdateList();
888 }
889
890 SettingForm::SettingItemInfo::SettingItemInfo(void)
891 {
892         titleText = L"";
893         subText = L"";
894         childCount = 0;
895         isOpen = false;
896         isSelected = false ;
897 }
898 void
899 SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
900 {
901         WindowInfo* pWindowInfo = null;
902         String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
903
904         pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo();
905
906         if (previousSceneId == IDSCN_EDIT_HOMEPAGE_VIEW)
907         {
908                 if (pArgs != null)
909                 {
910                         String* pValue = NULL;
911                         pValue = dynamic_cast<String*>(pArgs->GetAt(0));
912                         if( pValue != NULL )
913                         {
914                                 if (pValue->CompareTo(L"Done") == 0)
915                                 {
916                                 //      SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
917                                 }
918                                 else if (pValue->CompareTo(L"Cancel") == 0)
919                                 {
920                                         String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
921                                         if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
922                                         {
923                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
924                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
925                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
926                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
927                                                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
928
929                                         }
930                                         else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
931                                         {
932                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
933                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = true;
934                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
935                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
936                                                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_BLANK_PAGE");
937                                         }
938                                         else
939                                         {
940                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
941                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
942                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
943                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = true;
944                                         }
945
946                                 }
947                         }
948                 }
949         }
950
951         if (pWindowInfo != null)
952         {
953                 __currentURL.Clear();
954                 __currentURL.Append(pWindowInfo->pageUrl);
955                 AppLog("current url is %ls",__currentURL.GetPointer());
956
957                 if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)
958                 {
959                         if (pWindowInfo->pageUrl.CompareTo(L"") == 0)
960                         {
961                                 //settingInfo[SETTING_FAVORITE_URL].titleText = CommonUtil::GetString(L"IDS_SET_HOMEPAGE");
962                                 settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";
963                         }
964                         else
965                         {
966                                 settingInfo[SETTING_FAVORITE_URL].titleText = pWindowInfo->pageUrl;
967                         }
968                 }
969                 else
970                 {
971                         settingInfo[SETTING_FAVORITE_URL].titleText = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
972                 }
973         }
974
975         if (__pList != null)
976         {
977                 __pList->UpdateList();
978                 if (pWindowInfo && pWindowInfo->pageUrl.CompareTo(L"") == 0)
979                 {
980                         __isCurrentPageDisable = true;
981                         AppLog("set item enabled is false");
982                         __pList->SetItemEnabled(0, 1, false);
983                 }
984                 else
985                 {
986                         __isCurrentPageDisable = false;
987                         AppLog("set item enabled is true");
988                         __pList->SetItemEnabled(0, 1, true);
989                 }
990                 for(int grpindex = 0; grpindex < groupCount; grpindex++)
991                 {
992                         for(int index = 0; index < *(pGroupItemCount+groupCount); index++)
993                         {
994                                 int effectiveIndex = 0;
995                                 for (int i = 0; i < grpindex; i++)
996                                                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
997                                         effectiveIndex = effectiveIndex + index;
998
999                                         if(effectiveIndex >= SETTING_MAX)
1000                                         {
1001                                                 continue;
1002                                         }
1003                                 if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO )
1004                                 {
1005                                         __pList->SetItemChecked(grpindex, index, settingInfo[effectiveIndex].isSelected);
1006                                 }
1007                         }
1008                 }
1009         }
1010         return;
1011 }
1012
1013 void
1014 SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1015 {
1016         return;
1017 }
1018
1019 void
1020 SettingForm::ClearHistory(void)
1021 {
1022         if(__pConfirmationPopup)
1023         {
1024                 __pConfirmationPopup->SetShowState(false);
1025                 __pConfirmationPopup->Show();
1026                 delete __pConfirmationPopup;
1027                 __pConfirmationPopup = null;
1028         }
1029         String message = CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q");
1030         if(!__pConfirmationPopup)
1031         {
1032                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1033                 __pConfirmationPopup->Initialize();
1034                 __pConfirmationPopup->RemoveActionListener(*this);
1035                 __pConfirmationPopup->AddActionListener(*this);
1036                 __pConfirmationPopup->setMessage(message);
1037                 __pConfirmationPopup->Show();
1038         }
1039 }
1040
1041 void
1042 SettingForm::ClearCache(void)
1043 {
1044         if(__pConfirmationPopup)
1045         {
1046                 __pConfirmationPopup->SetShowState(false);
1047                 __pConfirmationPopup->Show();
1048                 delete __pConfirmationPopup;
1049                 __pConfirmationPopup = null;
1050         }
1051         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q");
1052         if(!__pConfirmationPopup)
1053         {
1054                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1055                 __pConfirmationPopup->Initialize();
1056                 __pConfirmationPopup->RemoveActionListener(*this);
1057                 __pConfirmationPopup->AddActionListener(*this);
1058                 __pConfirmationPopup->setMessage(message);
1059                 __pConfirmationPopup->Show();
1060         }
1061 }
1062
1063 void
1064 SettingForm::ClearCookie(void)
1065 {
1066         if(__pConfirmationPopup)
1067         {
1068                 __pConfirmationPopup->SetShowState(false);
1069                 __pConfirmationPopup->Show();
1070                 delete __pConfirmationPopup;
1071                 __pConfirmationPopup = null;
1072         }
1073         String message = CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO");
1074         if(!__pConfirmationPopup)
1075         {
1076                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1077                 __pConfirmationPopup->Initialize();
1078                 __pConfirmationPopup->RemoveActionListener(*this);
1079                 __pConfirmationPopup->AddActionListener(*this);
1080                 __pConfirmationPopup->setMessage(message);
1081                 __pConfirmationPopup->Show();
1082         }
1083 }
1084
1085 void
1086 SettingForm::ClearFormData(void)
1087 {
1088         if(__pConfirmationPopup)
1089         {
1090                 __pConfirmationPopup->SetShowState(false);
1091                 __pConfirmationPopup->Show();
1092                 delete __pConfirmationPopup;
1093                 __pConfirmationPopup = null;
1094         }
1095         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q");
1096         if(!__pConfirmationPopup)
1097         {
1098                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1099                 __pConfirmationPopup->Initialize();
1100                 __pConfirmationPopup->RemoveActionListener(*this);
1101                 __pConfirmationPopup->AddActionListener(*this);
1102                 __pConfirmationPopup->setMessage(message);
1103                 __pConfirmationPopup->Show();
1104         }
1105 }
1106
1107 void
1108 SettingForm::ClearPasswords(void)
1109 {
1110         if(__pConfirmationPopup)
1111         {
1112                 __pConfirmationPopup->SetShowState(false);
1113                 __pConfirmationPopup->Show();
1114                 delete __pConfirmationPopup;
1115                 __pConfirmationPopup = null;
1116         }
1117         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q");
1118         if(!__pConfirmationPopup)
1119         {
1120                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1121                 __pConfirmationPopup->Initialize();
1122                 __pConfirmationPopup->RemoveActionListener(*this);
1123                 __pConfirmationPopup->AddActionListener(*this);
1124                 __pConfirmationPopup->setMessage(message);
1125                 __pConfirmationPopup->Show();
1126         }
1127 }
1128
1129
1130 void
1131 SettingForm::ResetToDefault()
1132 {
1133         if(__pConfirmationPopup)
1134         {
1135                 __pConfirmationPopup->SetShowState(false);
1136                 __pConfirmationPopup->Show();
1137                 delete __pConfirmationPopup;
1138                 __pConfirmationPopup = null;
1139         }
1140         String message = CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_Q");
1141         if(!__pConfirmationPopup)
1142         {
1143                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1144                 __pConfirmationPopup->Initialize();
1145                 __pConfirmationPopup->RemoveActionListener(*this);
1146                 __pConfirmationPopup->AddActionListener(*this);
1147                 __pConfirmationPopup->setMessage(message);
1148                 __pConfirmationPopup->Show();
1149         }
1150 }