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