Fixed Nabi Issues and removal of deprecated Footer API
[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
265         SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
266         __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST"));
267         if ( __pList != NULL )
268         {
269
270                 r = __pList->SetItemProvider(*this);
271                 TryCatch(!IsFailed(r),,"setItemProvider failed with error %s",GetErrorMessage(r));
272                 __pList->AddGroupedListViewItemEventListener(*this);
273         }
274
275 //      pFooter = GetFooter();
276 //      if (pFooter)
277 //      {
278 //              AppLogDebug("setting back button");
279 //              pFooter->SetBackButtonEnabled(true);
280 //      }
281         SetFormBackEventListener(this);
282         AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
283         pSceneManager = SceneManager::GetInstance();
284         if (pSceneManager != null)
285         {
286                 r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS, *this);
287                 TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r));
288         }
289         AddOrientationEventListener(*this);
290
291         CATCH:
292         return r;
293 }
294
295 void
296 SettingForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
297 {
298
299 }
300
301 void
302 SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
303 {
304         int effectiveIndex = 0;
305         SettingPresentationModel* pSettingMgr = SettingPresentationModel::GetInstance();
306
307         if (pSettingMgr == null)
308                 return;
309
310         for (int i = 0; i < groupIndex; i++)
311                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
312         effectiveIndex = effectiveIndex + itemIndex;
313
314         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
315         {
316                 AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount);
317                 if (settingInfo[effectiveIndex].isOpen == false)
318                 {
319                         settingInfo[effectiveIndex].isOpen = true;
320                         settingInfo[effectiveIndex].childCount = 0;
321                         for (int iter = effectiveIndex + 1; iter < SETTING_MAX; iter++)
322                         {
323                                 if (settingInfo[iter].itemType == ITEM_TYPE_RADIO)
324                                         settingInfo[effectiveIndex].childCount++;
325                                 else
326                                         break;
327                         }
328                         listView.UpdateList();
329                 }
330                 else
331                 {
332                         settingInfo[effectiveIndex].isOpen = false;
333                         listView.UpdateList();
334                 }
335         }
336         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
337         {
338                 int parentIndex = 0;
339                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
340                 {
341                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
342                                 break;
343                 }
344                 settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;
345
346                 for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++)
347                 {
348                         if (parentIndex + iter + 1 != effectiveIndex)
349                         {
350                                 AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1);
351                                 settingInfo[parentIndex + iter + 1].isSelected = false;
352                         }
353                         else
354                         {
355                                 AppLogDebug("effectiveIndex %d set to true", effectiveIndex);
356                                 settingInfo[effectiveIndex].isSelected = true;
357                         }
358                         if (effectiveIndex == SETTING_CURRENT_PAGE)
359                         {
360                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
361                                 settingInfo[SETTING_FAVORITE_URL].isSelected = true;
362                         }
363                         //listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
364                 }
365 //              listView.UpdateList();
366                 //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP);
367                 Invalidate(true);
368         }
369         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
370         {
371                 if (settingInfo[effectiveIndex].isSelected == true)
372                 {
373                         settingInfo[effectiveIndex].isSelected = false;
374                 }
375                 else
376                 {
377                         settingInfo[effectiveIndex].isSelected = true;
378                 }
379 //              listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
380                 if(__pList != null)
381                 {
382                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
383                 }
384         }
385
386         switch (effectiveIndex)
387         {
388         case SETTING_CURRENT_PAGE:
389                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
390                 AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
391                 if (__currentURL.CompareTo(L"") != 0)
392                 {
393                         AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
394                         SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
395                         SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL);
396                         settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL;
397 //                      listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
398                         listView.UpdateList();
399                 }
400                 break;
401         case SETTING_BLANK_PAGE:
402                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_BLANK_PAGE].titleText);
403                 SettingPresentationModel::GetInstance()->SetHomepage((L"IDS_BR_BODY_BLANK_PAGE"));
404                 AppLog("GetHomepage() %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());
405                 listView.UpdateList();
406
407                 break;
408         case SETTING_MOST_VISITED_SITE:
409                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
410                 listView.UpdateList();
411                 break;
412
413         case SETTING_FAVORITE_URL:
414                 //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
415                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EDIT_HOMEPAGE_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
416                 break;
417
418         case SETTING_FIT_TO_WIDTH:
419                 SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");
420                 listView.UpdateList();
421                 break;
422
423         case SETTING_READABLE:
424                 SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");
425                 listView.UpdateList();
426                 break;
427
428         case SETTING_RUN_JAVASCRIPT:
429                 SettingPresentationModel::GetInstance()->SetRunJavascriptEnabled(settingInfo[SETTING_RUN_JAVASCRIPT].isSelected);
430                 break;
431
432         case SETTING_DISPLAY_IMAGES:
433                 SettingPresentationModel::GetInstance()->SetDisplayImagesEnabled(settingInfo[SETTING_DISPLAY_IMAGES].isSelected);
434                 break;
435
436         case SETTING_BLOCK_POPUP:
437                 SettingPresentationModel::GetInstance()->SetBlockPopUp(!settingInfo[SETTING_BLOCK_POPUP].isSelected);
438                 break;
439
440         case SETTING_CLEAR_CACHE:
441                 ClearCache();
442                 break;
443
444         case SETTING_CLEAR_HISTORY:
445                 ClearHistory();
446                 break;
447
448         case SETTING_SHOW_SECURITY_WARNINGS:
449                 SettingPresentationModel::GetInstance()->SetSecurityWarningsEnabled(settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected);
450                 break;
451
452         case SETTING_ACCEPT_COOKIES:
453                 SettingPresentationModel::GetInstance()->SetCookiesEnabled(settingInfo[SETTING_ACCEPT_COOKIES].isSelected);
454                 break;
455
456         case SETTING_CLEAR_COOKIE_DATA:
457                 ClearCookie();
458                 break;
459
460         case SETTING_REMEMBER_FORM_DATA:
461                 SettingPresentationModel::GetInstance()->SetRememberFormData(settingInfo[SETTING_REMEMBER_FORM_DATA].isSelected);
462                 break;
463
464         case SETTING_CLEAR_FORM_DATA:
465                 ClearFormData();
466                 break;
467
468         case SETTING_CLEAR_PASSWORDS:
469                 ClearPasswords();
470                 break;
471
472         case SETTING_REMEMBER_PASSWORD:
473                 SettingPresentationModel::GetInstance()->SetRememberPassword(settingInfo[SETTING_REMEMBER_PASSWORD].isSelected);
474                 break;
475
476         case SETTING_SEARCH_ENGINE_YAHOO:
477                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);
478                 listView.UpdateList();
479                 break;
480
481         case SETTING_SEARCH_ENGINE_NAVER:
482                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText);
483                 listView.UpdateList();
484                 break;
485
486         case SETTING_SEARCH_ENGINE_GOOGLE:
487                 SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText);
488                 listView.UpdateList();
489                 break;
490
491         case SETTING_RESET_TO_DEFAULT:
492                 //OpenResetPopup();
493                 ResetToDefault();
494                 break;
495
496         default:
497                 break;
498         }
499 }
500
501 void
502 SettingForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
503 {
504
505 }
506
507 GroupItem*
508 SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
509 {
510         result r = E_FAILURE;
511         String text(L"");
512         GroupItem* pItem = null;
513         const Color ITEM_TEXT_COLOR = CUSTOM_COLOR_SETTINGS_GROUPTITLE;
514
515         pItem = new(std::nothrow) GroupItem();
516         if (pItem == null)
517         {
518                 return null;
519         }
520         r = pItem->Construct(Dimension(itemWidth, 46));
521         if (IsFailed(r))
522         {
523                 delete pItem;
524                 return null;
525         }
526
527         switch (groupIndex)
528         {
529         case 0:
530                 text = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); // IDS_HOMEPAGE
531                 settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();
532                 break;
533
534         case 1:
535                 text = CommonUtil::GetString(L"IDS_BR_MBODY_PAGE_CONTENT_SETTINGS"); // IDS_BR_MBODY_PAGE_CONTENT_SETTINGS
536                 break;
537
538         case 2:
539                 text = CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB");  // IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB
540                 break;
541
542         case 3:
543                 text = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");    // IDS_BR_BODY_SEARCH
544                 break;
545
546         case 4:
547                 text = L"";
548                 break;
549
550         default:
551                 break;
552         }
553
554         pItem->SetElement(text, null);
555
556         AppLogDebug("background color set result %s", GetErrorMessage(r));
557
558         pItem->SetTextColor(ITEM_TEXT_COLOR);
559         return pItem;
560 }
561
562 ListItemBase*
563 SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
564 {
565         AppLog("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, itemWidth);
566
567         result r = E_SUCCESS;
568         int effectiveIndex = 0;
569         const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;
570         const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;
571         const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED;
572
573         for (int i = 0; i < groupIndex; i++)
574                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
575         effectiveIndex = effectiveIndex + itemIndex;
576         AppLogDebug("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
577
578         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
579         {
580                 SettingToggleCustomItem* pItem = new(std::nothrow) SettingToggleCustomItem();
581                 r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
582                 if (IsFailed(r))
583                 {
584                         delete pItem;
585                         return null;
586                 }
587
588                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
589                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
590                 if(__pList != null)
591                 {
592                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
593                 }
594
595                 pItem->SetText(settingInfo[effectiveIndex].titleText);
596                 pItem->Make();
597
598                 return pItem;
599
600         }
601         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
602         {
603                 DropDownCustomItem* pItem = new(std::nothrow) DropDownCustomItem();
604                 r = pItem->Construct(itemWidth);
605                 if (IsFailed(r))
606                 {
607                         delete pItem;
608                         return null;
609                 }
610
611 /*              Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,128);
612                 Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
613
614                 if (pNormalBackgroundBitmap != NULL)
615                 {
616                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
617                         delete pNormalBackgroundBitmap;
618                 }
619
620                 if (pPressedBackgroundBitmap != NULL)
621                 {
622                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
623                         delete pPressedBackgroundBitmap;
624                 }*/
625
626                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
627                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
628
629                 pItem->SetMainText(settingInfo[effectiveIndex].titleText);
630                 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)
631                 {
632                         pItem->SetSubText(CommonUtil::GetString(settingInfo[effectiveIndex].subText));
633                 }
634                 else
635                 {
636                         pItem->SetSubText(settingInfo[effectiveIndex].subText);
637                 }
638                 if (settingInfo[effectiveIndex].isOpen)
639                 {
640                         pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED);
641                 }
642                 else
643                 {
644                         pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED);
645                 }
646                 r = pItem->Make();
647                 //      if (pBitmap != null)
648                 //              pItem->AddElement(Rectangle(0, 0, 10, 128), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null);
649
650                 if (IsFailed(r))
651                 {
652                         delete pItem;
653                         return null;
654                 }
655
656                 return pItem;
657         }
658         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
659         {
660
661
662                 RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem();
663                 int parentIndex = 0;
664                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
665                 {
666                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
667                                 break;
668                 }
669                 if (settingInfo[parentIndex].isOpen == false || (__isCurrentPageDisable == true && groupIndex == 0 && itemIndex == 1))
670                 {
671                         r = pItem->Construct(itemWidth, 0);
672                         AppLogDebug("construct with height 0 %s", GetErrorMessage(r));
673                         return pItem;
674                 }
675                 else
676                 {
677                         pItem->Construct(itemWidth, 112 +  (__fontSize - 44));
678                 }
679 /*
680                 Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
681                 Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
682
683                 if (pNormalBackgroundBitmap != NULL)
684                 {
685                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
686                         delete pNormalBackgroundBitmap;
687                 }
688
689                 if (pPressedBackgroundBitmap != NULL)
690                 {
691                         pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
692                         delete pPressedBackgroundBitmap;
693                 }*/
694
695                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_RADIO_ITEM_BACKGROUND_COLOR);
696                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
697
698
699                 pItem->SetText(settingInfo[effectiveIndex].titleText);
700                 AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
701
702                 //if (pBitmap != null)
703                 //      pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
704
705                 pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
706                 pItem->Make();
707
708                 return pItem;
709         }
710         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_NORMAL)
711         {
712                 DefaultCustomItem* pItem = new(std::nothrow) DefaultCustomItem();
713
714                 r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
715                 if (IsFailed(r))
716                 {
717                         delete pItem;
718                         return null;
719                 }
720
721
722 //              Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
723 //              Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
724 //
725 //              if (pNormalBackgroundBitmap != NULL)
726 //              {
727 //                      pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
728 //                      delete pNormalBackgroundBitmap;
729 //              }
730 //
731 //              if (pPressedBackgroundBitmap != NULL)
732 //              {
733 //                      pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
734 //                      delete pPressedBackgroundBitmap;
735 //              }
736
737                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
738                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
739
740                 pItem->SetText(settingInfo[effectiveIndex].titleText);
741
742                 //if (pBitmap != null)
743                 //      pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
744
745                 r = pItem->Make();
746                 if (IsFailed(r))
747                 {
748                         delete pItem;
749                         return null;
750                 }
751                 return pItem;
752         }
753         else
754         {
755                 return null;
756         }
757 }
758
759 bool
760 SettingForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
761 {
762         delete pItem;
763         pItem = null;
764         return true;
765 }
766
767 bool
768 SettingForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
769 {
770         delete pItem;
771         pItem = null;
772         return true;
773 }
774
775 int
776 SettingForm::GetGroupCount(void)
777 {
778         return groupCount;
779 }
780
781 int
782 SettingForm::GetItemCount(int groupIndex)
783 {
784         AppLog(" SettingForm::GetItemCount --> groupIndex : %d,", groupIndex);
785         return pGroupItemCount[groupIndex];
786 }
787
788 void
789 SettingForm::OnFormBackRequested(Form& source)
790 {
791         AppLog("SettingForm::OnFormBackRequested entered");
792         String* pSelectedScene = NULL;
793         Object* value = NULL;
794         MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value);
795         pSelectedScene = (String*) value;
796         if (pSelectedScene)
797         {
798                 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
799 //              delete pSelectedScene;
800 //              pSelectedScene = null;
801         }
802 }
803
804 void
805 SettingForm::OnActionPerformed(const Control& source, int actionId)
806 {
807         switch (actionId)
808         {
809         case IDA_BUTTON_NO:
810                 if(__pConfirmationPopup)
811                 {
812                         __pConfirmationPopup->SetShowState(false);
813                         __pConfirmationPopup->Show();
814                         delete __pConfirmationPopup;
815                         __pConfirmationPopup = null;
816                 }
817                 break;
818
819         case IDA_BUTTON_YES:
820                 if(__pConfirmationPopup)
821                 {
822                         String message = L"";
823                         __pConfirmationPopup->SetShowState(false);
824                         __pConfirmationPopup->Show();
825                         if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO"))
826                         {
827                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
828                                 SettingPresentationModel::GetInstance()->ClearCookie();
829                         }
830                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q"))
831                         {
832                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
833                                 SettingPresentationModel::GetInstance()->ClearFormData();
834                         }
835                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q"))
836                         {
837                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
838                                 SettingPresentationModel::GetInstance()->ClearPasswords();
839                         }
840                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q"))
841                         {
842                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
843                                 SettingPresentationModel::GetInstance()->ClearCache();
844                         }
845                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q"))
846                         {
847                                 message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
848                                 HistoryPresentationModel::GetInstance()->ClearHistory();
849                         }
850                         else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_Q"))
851                         {
852                                 message = CommonUtil::GetString(L"IDS_BR_SK_DONE");
853                                 SettingPresentationModel::GetInstance()->ResetRegistry();
854                                 InitializeSettingValues();
855                                 if(__pList != null)
856                                 {
857                                         __pList->UpdateList();
858                                 }
859                         }
860                         delete __pConfirmationPopup;
861                         __pConfirmationPopup = null;
862
863                         NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
864                         pNotification->SetText(message);
865                         pNotification->SetPositionDiff(0);
866                         pNotification->ShowNotification();
867                 }
868                 break;
869
870         default:
871                 break;
872         }
873 }
874
875 void
876 SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
877 {
878         Rectangle rect = GetClientAreaBounds();
879         if(__pList == null)
880         {
881                 return;
882         }
883         __pList->SetBounds(rect.x,rect.y,rect.width-16,rect.height);
884         __pList->UpdateList();
885 }
886
887 SettingForm::SettingItemInfo::SettingItemInfo(void)
888 {
889         titleText = L"";
890         subText = L"";
891         childCount = 0;
892         isOpen = false;
893         isSelected = false ;
894 }
895 void
896 SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
897 {
898         WindowInfo* pWindowInfo = null;
899         String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
900
901         pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo();
902
903         if (previousSceneId == IDSCN_EDIT_HOMEPAGE_VIEW)
904         {
905                 if (pArgs != null)
906                 {
907                         String* pValue = NULL;
908                         pValue = dynamic_cast<String*>(pArgs->GetAt(0));
909                         if( pValue != NULL )
910                         {
911                                 if (pValue->CompareTo(L"Done") == 0)
912                                 {
913                                 //      SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
914                                 }
915                                 else if (pValue->CompareTo(L"Cancel") == 0)
916                                 {
917                                         String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
918                                         if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
919                                         {
920                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
921                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
922                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
923                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
924                                                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
925
926                                         }
927                                         else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
928                                         {
929                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
930                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = true;
931                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
932                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = false;
933                                                 SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_BLANK_PAGE");
934                                         }
935                                         else
936                                         {
937                                                 settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
938                                                 settingInfo[SETTING_BLANK_PAGE].isSelected = false;
939                                                 settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
940                                                 settingInfo[SETTING_FAVORITE_URL].isSelected = true;
941                                         }
942
943                                 }
944                         }
945                 }
946         }
947
948         if (pWindowInfo != null)
949         {
950                 __currentURL.Clear();
951                 __currentURL.Append(pWindowInfo->pageUrl);
952                 AppLog("current url is %ls",__currentURL.GetPointer());
953
954                 if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)
955                 {
956                         if (pWindowInfo->pageUrl.CompareTo(L"") == 0)
957                         {
958                                 //settingInfo[SETTING_FAVORITE_URL].titleText = CommonUtil::GetString(L"IDS_SET_HOMEPAGE");
959                                 settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";
960                         }
961                         else
962                         {
963                                 settingInfo[SETTING_FAVORITE_URL].titleText = pWindowInfo->pageUrl;
964                         }
965                 }
966                 else
967                 {
968                         settingInfo[SETTING_FAVORITE_URL].titleText = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
969                 }
970         }
971
972         if (__pList != null)
973         {
974                 __pList->UpdateList();
975                 if (pWindowInfo && pWindowInfo->pageUrl.CompareTo(L"") == 0)
976                 {
977                         __isCurrentPageDisable = true;
978                         AppLog("set item enabled is false");
979                         __pList->SetItemEnabled(0, 1, false);
980                 }
981                 else
982                 {
983                         __isCurrentPageDisable = false;
984                         AppLog("set item enabled is true");
985                         __pList->SetItemEnabled(0, 1, true);
986                 }
987                 for(int grpindex = 0; grpindex < groupCount; grpindex++)
988                 {
989                         for(int index = 0; index < *(pGroupItemCount+groupCount); index++)
990                         {
991                                 int effectiveIndex = 0;
992                                 for (int i = 0; i < grpindex; i++)
993                                                 effectiveIndex = effectiveIndex + pGroupItemCount[i];
994                                         effectiveIndex = effectiveIndex + index;
995
996                                         if(effectiveIndex >= SETTING_MAX)
997                                         {
998                                                 continue;
999                                         }
1000                                 if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO )
1001                                 {
1002                                         __pList->SetItemChecked(grpindex, index, settingInfo[effectiveIndex].isSelected);
1003                                 }
1004                         }
1005                 }
1006         }
1007         return;
1008 }
1009
1010 void
1011 SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1012 {
1013         return;
1014 }
1015
1016 void
1017 SettingForm::ClearHistory(void)
1018 {
1019         String message = CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q");
1020         if(!__pConfirmationPopup)
1021         {
1022                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1023                 __pConfirmationPopup->Initialize();
1024                 __pConfirmationPopup->RemoveActionListener(*this);
1025                 __pConfirmationPopup->AddActionListener(*this);
1026                 __pConfirmationPopup->setMessage(message);
1027                 __pConfirmationPopup->Show();
1028         }
1029 }
1030
1031 void
1032 SettingForm::ClearCache(void)
1033 {
1034         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q");
1035         if(!__pConfirmationPopup)
1036         {
1037                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1038                 __pConfirmationPopup->Initialize();
1039                 __pConfirmationPopup->RemoveActionListener(*this);
1040                 __pConfirmationPopup->AddActionListener(*this);
1041                 __pConfirmationPopup->setMessage(message);
1042                 __pConfirmationPopup->Show();
1043         }
1044 }
1045
1046 void
1047 SettingForm::ClearCookie(void)
1048 {
1049         String message = CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO");
1050         if(!__pConfirmationPopup)
1051         {
1052                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1053                 __pConfirmationPopup->Initialize();
1054                 __pConfirmationPopup->RemoveActionListener(*this);
1055                 __pConfirmationPopup->AddActionListener(*this);
1056                 __pConfirmationPopup->setMessage(message);
1057                 __pConfirmationPopup->Show();
1058         }
1059 }
1060
1061 void
1062 SettingForm::ClearFormData(void)
1063 {
1064         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q");
1065         if(!__pConfirmationPopup)
1066         {
1067                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1068                 __pConfirmationPopup->Initialize();
1069                 __pConfirmationPopup->RemoveActionListener(*this);
1070                 __pConfirmationPopup->AddActionListener(*this);
1071                 __pConfirmationPopup->setMessage(message);
1072                 __pConfirmationPopup->Show();
1073         }
1074 }
1075
1076 void
1077 SettingForm::ClearPasswords(void)
1078 {
1079         String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q");
1080         if(!__pConfirmationPopup)
1081         {
1082                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
1083                 __pConfirmationPopup->Initialize();
1084                 __pConfirmationPopup->RemoveActionListener(*this);
1085                 __pConfirmationPopup->AddActionListener(*this);
1086                 __pConfirmationPopup->setMessage(message);
1087                 __pConfirmationPopup->Show();
1088         }
1089 }
1090
1091
1092 void
1093 SettingForm::ResetToDefault()
1094 {
1095         String message = CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_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 }