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