-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://floralicense.org/license/\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-//!Internet SettingForm class\r
-/*@file: IntSettingForm.cpp\r
- *@brief: The SettingForm\r
- */\r
-\r
-#include <FApp.h>\r
-#include <FGraphics.h>\r
-#include <FUi.h>\r
-\r
-#include "IntCommonLib.h"\r
-#include "IntConfirmationPopup.h"\r
-#include "IntDefaultCustomItem.h"\r
-#include "IntDropDownCustomItem.h"\r
-#include "IntHistoryPresentationModel.h"\r
-#include "IntMultipleWindowPresentationModel.h"\r
-#include "IntNotificationPanel.h"\r
-#include "IntRadioCustomItem.h"\r
-#include "IntSceneRegister.h"\r
-#include "IntSettingForm.h"\r
-#include "IntSettingPresentationModel.h"\r
-#include "IntSettingToggleCustomItem.h"\r
-\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::Graphics;\r
-using namespace Tizen::Ui;\r
-using namespace Tizen::Ui::Controls;\r
-using namespace Tizen::Ui::Scenes;\r
-\r
-\r
-SettingForm::SettingForm(void)\r
-: __fontValue(0),__pResetPopup(null),__pWindowInfo(null) , __pConfirmationPopup(null)\r
-{\r
- __currentURL = L"";\r
- __pList = null;\r
- InitializeSettingValues();\r
-}\r
-\r
-SettingForm::~SettingForm(void)\r
-{\r
- if (pGroupItemCount)\r
- {\r
- delete[] pGroupItemCount;\r
- pGroupItemCount = null;\r
- }\r
-}\r
-\r
-void\r
-SettingForm::InitializeSettingValues(void)\r
-{\r
- AppLog("SettingForm::InitializeSettingValues homepage %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());\r
- groupCount = 5;\r
- pGroupItemCount = new(std::nothrow) int[5];\r
- pGroupItemCount[0] = 5; //Homepage\r
- pGroupItemCount[1] = 6; //Page content settings\r
- pGroupItemCount[2] = 5; //Private and Security\r
- pGroupItemCount[3] = 4; //Search\r
- pGroupItemCount[4] = 1; //Website settings and Reset\r
-\r
- for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; iter++)\r
- {\r
- settingInfo[iter].isSelected = false;\r
- }\r
-\r
- AppLogDebug("image display %d", (int) SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());\r
- settingInfo[SETTING_HOMEPAGE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE");\r
- settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();\r
- settingInfo[SETTING_HOMEPAGE_TITLE].itemType = ITEM_TYPE_DROPDOWN;\r
-\r
- settingInfo[SETTING_CURRENT_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CURRENT_PAGE");\r
- settingInfo[SETTING_CURRENT_PAGE].subText = L"";\r
- settingInfo[SETTING_CURRENT_PAGE].itemType = ITEM_TYPE_RADIO;\r
-\r
- settingInfo[SETTING_BLANK_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE");\r
- settingInfo[SETTING_BLANK_PAGE].subText = L"";\r
- settingInfo[SETTING_BLANK_PAGE].itemType = ITEM_TYPE_RADIO;\r
- if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)\r
- {\r
- settingInfo[SETTING_BLANK_PAGE].isSelected = true;\r
- }\r
-\r
- settingInfo[SETTING_MOST_VISITED_SITE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES");\r
- settingInfo[SETTING_MOST_VISITED_SITE].subText = L"";\r
- settingInfo[SETTING_MOST_VISITED_SITE].itemType = ITEM_TYPE_RADIO;\r
- if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)\r
- {\r
- settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;\r
- }\r
- WindowInfo* pWindowInfo = null;\r
- String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();\r
- AppLog("SettingForm::OnSceneActivatedN check1");\r
-\r
- settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";\r
- if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)\r
- {\r
- SettingPresentationModel::GetInstance()->SetFavoriteValue(L"http://www.tizen.org");\r
- }\r
- settingInfo[SETTING_FAVORITE_URL].subText = L"";\r
- settingInfo[SETTING_FAVORITE_URL].itemType = ITEM_TYPE_RADIO;\r
-\r
- if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE")) == 0)\r
- {\r
- settingInfo[SETTING_FAVORITE_URL].isSelected = true;\r
- }\r
-\r
- settingInfo[SETTING_DEFAULT_VIEW_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DEFAULT_VIEW");\r
- settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText = CommonUtil::GetString(SettingPresentationModel::GetInstance()->GetDefaultView());\r
- settingInfo[SETTING_DEFAULT_VIEW_TITLE].itemType = ITEM_TYPE_DROPDOWN;\r
-\r
- settingInfo[SETTING_FIT_TO_WIDTH].titleText = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH");\r
- settingInfo[SETTING_FIT_TO_WIDTH].subText = L"";\r
- settingInfo[SETTING_FIT_TO_WIDTH].itemType = ITEM_TYPE_RADIO;\r
- settingInfo[SETTING_FIT_TO_WIDTH].isSelected = !(String::Compare(settingInfo[SETTING_FIT_TO_WIDTH].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));\r
-\r
- settingInfo[SETTING_READABLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_READABLE");\r
- settingInfo[SETTING_READABLE].subText = L"";\r
- settingInfo[SETTING_READABLE].itemType = ITEM_TYPE_RADIO;\r
- settingInfo[SETTING_READABLE].isSelected = !(String::Compare(settingInfo[SETTING_READABLE].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));\r
-\r
- settingInfo[SETTING_RUN_JAVASCRIPT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RUN_JAVASCRIPT");\r
- settingInfo[SETTING_RUN_JAVASCRIPT].subText = L"";\r
- settingInfo[SETTING_RUN_JAVASCRIPT].itemType = ITEM_TYPE_TOGGLE;\r
- settingInfo[SETTING_RUN_JAVASCRIPT].isSelected = SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled();\r
-\r
- settingInfo[SETTING_DISPLAY_IMAGES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DISPLAY_IMAGES");\r
- settingInfo[SETTING_DISPLAY_IMAGES].subText = L"";\r
- settingInfo[SETTING_DISPLAY_IMAGES].itemType = ITEM_TYPE_TOGGLE;\r
- settingInfo[SETTING_DISPLAY_IMAGES].isSelected = SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled();\r
-\r
- settingInfo[SETTING_BLOCK_POPUP].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLOCK_POP_UPS_ABB");\r
- settingInfo[SETTING_BLOCK_POPUP].subText = L"";\r
- settingInfo[SETTING_BLOCK_POPUP].itemType = ITEM_TYPE_TOGGLE;\r
- settingInfo[SETTING_BLOCK_POPUP].isSelected = !SettingPresentationModel::GetInstance()->IsBlockPopUp();\r
-\r
- settingInfo[SETTING_CLEAR_CACHE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_CACHE");\r
- settingInfo[SETTING_CLEAR_CACHE].subText = L"";\r
- settingInfo[SETTING_CLEAR_CACHE].itemType = ITEM_TYPE_NORMAL;\r
-\r
- settingInfo[SETTING_CLEAR_HISTORY].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_HISTORY");\r
- settingInfo[SETTING_CLEAR_HISTORY].subText = L"";\r
- settingInfo[SETTING_CLEAR_HISTORY].itemType = ITEM_TYPE_NORMAL;\r
-\r
- settingInfo[SETTING_SHOW_SECURITY_WARNINGS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_SECURITY_WARNINGS");\r
- settingInfo[SETTING_SHOW_SECURITY_WARNINGS].subText = L"";\r
- settingInfo[SETTING_SHOW_SECURITY_WARNINGS].itemType = ITEM_TYPE_TOGGLE;\r
- settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected = SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled();\r
-\r
- settingInfo[SETTING_ACCEPT_COOKIES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_ACCEPT_COOKIES");\r
- settingInfo[SETTING_ACCEPT_COOKIES].subText = L"";\r
- settingInfo[SETTING_ACCEPT_COOKIES].itemType = ITEM_TYPE_TOGGLE;\r
- settingInfo[SETTING_ACCEPT_COOKIES].isSelected = SettingPresentationModel::GetInstance()->IsCookiesEnabled();\r
-\r
- settingInfo[SETTING_CLEAR_COOKIE_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_ALL_COOKIE_DATA");\r
- settingInfo[SETTING_CLEAR_COOKIE_DATA].subText = CommonUtil::GetString(L"IDS_BR_HEADER_COOKIES");\r
- settingInfo[SETTING_CLEAR_COOKIE_DATA].itemType = ITEM_TYPE_NORMAL;\r
-\r
- settingInfo[SETTING_SEARCH_ENGINE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_ENGINE");\r
- settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText = SettingPresentationModel::GetInstance()->GetSearchEngine();\r
- settingInfo[SETTING_SEARCH_ENGINE_TITLE].itemType = ITEM_TYPE_DROPDOWN;\r
-\r
- settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText = CommonUtil::GetString(L"IDS_BR_BODY_YAHOO");\r
- settingInfo[SETTING_SEARCH_ENGINE_YAHOO].subText = L"";\r
- settingInfo[SETTING_SEARCH_ENGINE_YAHOO].itemType = ITEM_TYPE_RADIO;\r
- settingInfo[SETTING_SEARCH_ENGINE_YAHOO].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));\r
-\r
- settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText = CommonUtil::GetString(L"IDS_BR_BODY_NAVER");\r
- settingInfo[SETTING_SEARCH_ENGINE_NAVER].subText = L"";\r
- settingInfo[SETTING_SEARCH_ENGINE_NAVER].itemType = ITEM_TYPE_RADIO;\r
- settingInfo[SETTING_SEARCH_ENGINE_NAVER].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));\r
-\r
- settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText = CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE");\r
- settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].subText = L"";\r
- settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].itemType = ITEM_TYPE_RADIO;\r
- settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));\r
-\r
- settingInfo[SETTING_RESET_TO_DEFAULT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RESET_TO_DEFAULT");\r
- settingInfo[SETTING_RESET_TO_DEFAULT].subText = L"";\r
- settingInfo[SETTING_RESET_TO_DEFAULT].itemType = ITEM_TYPE_NORMAL;\r
-}\r
-\r
-bool\r
-SettingForm::Initialize(void)\r
-{\r
- result r = E_FAILURE;\r
-\r
- r = Construct(L"IDL_SETTING_FORM");\r
- if (IsFailed(r))\r
- {\r
- return false;\r
- }\r
- return true;\r
-}\r
-\r
-result\r
-SettingForm::OnInitializing(void)\r
-{\r
- result r = E_FAILURE;\r
- Footer* pFooter = NULL;\r
- SceneManager* pSceneManager = NULL;\r
-\r
- __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST"));\r
- if ( __pList != NULL )\r
- {\r
-\r
- r = __pList->SetItemProvider(*this);\r
- TryCatch(!IsFailed(r),,"setItemProvider failed with error %s",GetErrorMessage(r));\r
- __pList->AddGroupedListViewItemEventListener(*this);\r
- }\r
-\r
- pFooter = GetFooter();\r
- if (pFooter)\r
- {\r
- AppLogDebug("setting back button");\r
- pFooter->SetBackButtonEnabled(true);\r
- SetFormBackEventListener(this);\r
- }\r
- pSceneManager = SceneManager::GetInstance();\r
- if (pSceneManager != null)\r
- {\r
- r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS, *this);\r
- TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r));\r
- }\r
- AddOrientationEventListener(*this);\r
-\r
- CATCH:\r
- return r;\r
-}\r
-\r
-void\r
-SettingForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)\r
-{\r
-\r
-}\r
-\r
-void\r
-SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)\r
-{\r
- int effectiveIndex = 0;\r
- SettingPresentationModel* pSettingMgr = SettingPresentationModel::GetInstance();\r
-\r
- if (pSettingMgr == null)\r
- return;\r
-\r
- for (int i = 0; i < groupIndex; i++)\r
- effectiveIndex = effectiveIndex + pGroupItemCount[i];\r
- effectiveIndex = effectiveIndex + itemIndex;\r
-\r
- if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)\r
- {\r
- AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount);\r
- if (settingInfo[effectiveIndex].isOpen == false)\r
- {\r
- settingInfo[effectiveIndex].isOpen = true;\r
- settingInfo[effectiveIndex].childCount = 0;\r
- for (int iter = effectiveIndex + 1; iter < SETTING_MAX; iter++)\r
- {\r
- if (settingInfo[iter].itemType == ITEM_TYPE_RADIO)\r
- settingInfo[effectiveIndex].childCount++;\r
- else\r
- break;\r
- }\r
- listView.UpdateList();\r
- }\r
- else\r
- {\r
- settingInfo[effectiveIndex].isOpen = false;\r
- listView.UpdateList();\r
- }\r
- }\r
- else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)\r
- {\r
- int parentIndex = 0;\r
- for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)\r
- {\r
- if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)\r
- break;\r
- }\r
- settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;\r
-\r
- for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++)\r
- {\r
- if (parentIndex + iter + 1 != effectiveIndex)\r
- {\r
- AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1);\r
- settingInfo[parentIndex + iter + 1].isSelected = false;\r
- }\r
- else\r
- {\r
- AppLogDebug("effectiveIndex %d set to true", effectiveIndex);\r
- settingInfo[effectiveIndex].isSelected = true;\r
- }\r
- if (effectiveIndex == SETTING_CURRENT_PAGE)\r
- {\r
- settingInfo[SETTING_CURRENT_PAGE].isSelected = false;\r
- settingInfo[SETTING_FAVORITE_URL].isSelected = true;\r
- }\r
- //listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- }\r
-// listView.UpdateList();\r
- //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP);\r
- Invalidate(true);\r
- }\r
- else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)\r
- {\r
- if (settingInfo[effectiveIndex].isSelected == true)\r
- {\r
- settingInfo[effectiveIndex].isSelected = false;\r
- }\r
- else\r
- {\r
- settingInfo[effectiveIndex].isSelected = true;\r
- }\r
-// listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- if(__pList != null)\r
- {\r
- __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);\r
- }\r
- }\r
-\r
- switch (effectiveIndex)\r
- {\r
- case SETTING_CURRENT_PAGE:\r
- //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);\r
- AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());\r
- if (__currentURL.CompareTo(L"") != 0)\r
- {\r
- AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());\r
- SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));\r
- SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL);\r
- settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL;\r
-// listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- listView.UpdateList();\r
- }\r
- break;\r
- case SETTING_BLANK_PAGE:\r
- //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_BLANK_PAGE].titleText);\r
- SettingPresentationModel::GetInstance()->SetHomepage((L"IDS_BR_BODY_BLANK_PAGE"));\r
- AppLog("GetHomepage() %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());\r
- listView.UpdateList();\r
-\r
- break;\r
- case SETTING_MOST_VISITED_SITE:\r
- SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_FAVORITE_URL:\r
- //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);\r
- SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EDIT_HOMEPAGE_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));\r
- break;\r
-\r
- case SETTING_FIT_TO_WIDTH:\r
- SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_READABLE:\r
- SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_RUN_JAVASCRIPT:\r
- SettingPresentationModel::GetInstance()->SetRunJavascriptEnabled(settingInfo[SETTING_RUN_JAVASCRIPT].isSelected);\r
- break;\r
-\r
- case SETTING_DISPLAY_IMAGES:\r
- SettingPresentationModel::GetInstance()->SetDisplayImagesEnabled(settingInfo[SETTING_DISPLAY_IMAGES].isSelected);\r
- break;\r
-\r
- case SETTING_BLOCK_POPUP:\r
- SettingPresentationModel::GetInstance()->SetBlockPopUp(!settingInfo[SETTING_BLOCK_POPUP].isSelected);\r
- break;\r
-\r
- case SETTING_CLEAR_CACHE:\r
- ClearCache();\r
- break;\r
-\r
- case SETTING_CLEAR_HISTORY:\r
- ClearHistory();\r
- break;\r
-\r
- case SETTING_SHOW_SECURITY_WARNINGS:\r
- SettingPresentationModel::GetInstance()->SetSecurityWarningsEnabled(settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected);\r
- break;\r
-\r
- case SETTING_ACCEPT_COOKIES:\r
- SettingPresentationModel::GetInstance()->SetCookiesEnabled(settingInfo[SETTING_ACCEPT_COOKIES].isSelected);\r
- break;\r
-\r
- case SETTING_CLEAR_COOKIE_DATA:\r
- ClearCookie();\r
- break;\r
-\r
- case SETTING_SEARCH_ENGINE_YAHOO:\r
- SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_SEARCH_ENGINE_NAVER:\r
- SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText);\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_SEARCH_ENGINE_GOOGLE:\r
- SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText);\r
- listView.UpdateList();\r
- break;\r
-\r
- case SETTING_RESET_TO_DEFAULT:\r
- //OpenResetPopup();\r
- ResetToDefault();\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
-}\r
-\r
-void\r
-SettingForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)\r
-{\r
-\r
-}\r
-\r
-GroupItem*\r
-SettingForm::CreateGroupItem(int groupIndex, int itemWidth)\r
-{\r
- result r = E_FAILURE;\r
- String text(L"");\r
- GroupItem* pItem = null;\r
- const Color ITEM_TEXT_COLOR = CUSTOM_COLOR_SETTINGS_GROUPTITLE;\r
-\r
- pItem = new(std::nothrow) GroupItem();\r
- if (pItem == null)\r
- {\r
- return null;\r
- }\r
- r = pItem->Construct(Dimension(itemWidth, 46));\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
-\r
- switch (groupIndex)\r
- {\r
- case 0:\r
- text = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); // IDS_HOMEPAGE\r
- settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();\r
- break;\r
-\r
- case 1:\r
- text = CommonUtil::GetString(L"IDS_BR_MBODY_PAGE_CONTENT_SETTINGS"); // IDS_BR_MBODY_PAGE_CONTENT_SETTINGS\r
- break;\r
-\r
- case 2:\r
- text = CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"); // IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB\r
- break;\r
-\r
- case 3:\r
- text = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH"); // IDS_BR_BODY_SEARCH\r
- break;\r
-\r
- case 4:\r
- text = L"";\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
-\r
- pItem->SetElement(text, null);\r
-\r
- AppLogDebug("background color set result %s", GetErrorMessage(r));\r
-\r
- pItem->SetTextColor(ITEM_TEXT_COLOR);\r
- return pItem;\r
-}\r
-\r
-ListItemBase*\r
-SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)\r
-{\r
- AppLog("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, itemWidth);\r
-\r
- result r = E_SUCCESS;\r
- int effectiveIndex = 0;\r
- const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;\r
- const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;\r
-\r
- for (int i = 0; i < groupIndex; i++)\r
- effectiveIndex = effectiveIndex + pGroupItemCount[i];\r
- effectiveIndex = effectiveIndex + itemIndex;\r
- AppLogDebug("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);\r
-\r
- if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)\r
- {\r
- SettingToggleCustomItem* pItem = new(std::nothrow) SettingToggleCustomItem();\r
- r = pItem->Construct(itemWidth, 112);\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
-/*\r
- Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);\r
- Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);\r
-\r
- if (pNormalBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);\r
- delete pNormalBackgroundBitmap;\r
- }\r
-\r
- if (pPressedBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);\r
- delete pPressedBackgroundBitmap;\r
- }*/\r
-\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR);\r
- if(__pList != null)\r
- {\r
- __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);\r
- }\r
-\r
- pItem->SetText(settingInfo[effectiveIndex].titleText);\r
-\r
- //if (pBitmap != null)\r
- // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);\r
-\r
- pItem->Make();\r
-// if (__pList)\r
-// {\r
-// __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);\r
-// AppLog("asdasda %s %d,%d-> %d",GetErrorMessage(r),groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);\r
-// }\r
- return pItem;\r
-\r
- }\r
- else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)\r
- {\r
- DropDownCustomItem* pItem = new(std::nothrow) DropDownCustomItem();\r
- r = pItem->Construct(itemWidth);\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
-\r
-/* Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,128);\r
- Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);\r
-\r
- if (pNormalBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);\r
- delete pNormalBackgroundBitmap;\r
- }\r
-\r
- if (pPressedBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);\r
- delete pPressedBackgroundBitmap;\r
- }*/\r
-\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR);\r
-\r
- pItem->SetMainText(settingInfo[effectiveIndex].titleText);\r
- 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)\r
- {\r
- pItem->SetSubText(CommonUtil::GetString(settingInfo[effectiveIndex].subText));\r
- }\r
- else\r
- {\r
- pItem->SetSubText(settingInfo[effectiveIndex].subText);\r
- }\r
- if (settingInfo[effectiveIndex].isOpen)\r
- {\r
- pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED);\r
- }\r
- else\r
- {\r
- pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED);\r
- }\r
- r = pItem->Make();\r
- // if (pBitmap != null)\r
- // pItem->AddElement(Rectangle(0, 0, 10, 128), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null);\r
-\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
-\r
- return pItem;\r
- }\r
- else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)\r
- {\r
-\r
-\r
- RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem();\r
- int parentIndex = 0;\r
- for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)\r
- {\r
- if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)\r
- break;\r
- }\r
- if (settingInfo[parentIndex].isOpen == false || (__isCurrentPageDisable == true && groupIndex == 0 && itemIndex == 1))\r
- {\r
- r = pItem->Construct(itemWidth, 0);\r
- AppLogDebug("construct with height 0 %s", GetErrorMessage(r));\r
- return pItem;\r
- }\r
- else\r
- {\r
- pItem->Construct(itemWidth, 112);\r
- }\r
-/*\r
- Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);\r
- Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);\r
-\r
- if (pNormalBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);\r
- delete pNormalBackgroundBitmap;\r
- }\r
-\r
- if (pPressedBackgroundBitmap != NULL)\r
- {\r
- pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);\r
- delete pPressedBackgroundBitmap;\r
- }*/\r
-\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_RADIO_ITEM_BACKGROUND_COLOR);\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_RADIO_ITEM_BACKGROUND_COLOR);\r
-\r
-\r
- pItem->SetText(settingInfo[effectiveIndex].titleText);\r
- AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);\r
-\r
- //if (pBitmap != null)\r
- // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);\r
-\r
- pItem->SetSelected(settingInfo[effectiveIndex].isSelected);\r
- pItem->Make();\r
-\r
- return pItem;\r
- }\r
- else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_NORMAL)\r
- {\r
- DefaultCustomItem* pItem = new(std::nothrow) DefaultCustomItem();\r
-\r
- r = pItem->Construct(itemWidth, 112);\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
-\r
-\r
-// Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);\r
-// Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);\r
-//\r
-// if (pNormalBackgroundBitmap != NULL)\r
-// {\r
-// pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);\r
-// delete pNormalBackgroundBitmap;\r
-// }\r
-//\r
-// if (pPressedBackgroundBitmap != NULL)\r
-// {\r
-// pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);\r
-// delete pPressedBackgroundBitmap;\r
-// }\r
-\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);\r
- pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR);\r
-\r
- pItem->SetText(settingInfo[effectiveIndex].titleText);\r
-\r
- //if (pBitmap != null)\r
- // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);\r
-\r
- r = pItem->Make();\r
- if (IsFailed(r))\r
- {\r
- delete pItem;\r
- return null;\r
- }\r
- return pItem;\r
- }\r
- else\r
- {\r
- return null;\r
- }\r
-}\r
-\r
-bool\r
-SettingForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)\r
-{\r
- delete pItem;\r
- pItem = null;\r
- return true;\r
-}\r
-\r
-bool\r
-SettingForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)\r
-{\r
- delete pItem;\r
- pItem = null;\r
- return true;\r
-}\r
-\r
-int\r
-SettingForm::GetGroupCount(void)\r
-{\r
- return groupCount;\r
-}\r
-\r
-int\r
-SettingForm::GetItemCount(int groupIndex)\r
-{\r
- AppLog(" SettingForm::GetItemCount --> groupIndex : %d,", groupIndex);\r
- return pGroupItemCount[groupIndex];\r
-}\r
-\r
-void\r
-SettingForm::OnFormBackRequested(Form& source)\r
-{\r
- String* pSelectedScene = NULL;\r
- Object* value = NULL;\r
- MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value);\r
- pSelectedScene = (String*) value;\r
- if (pSelectedScene)\r
- {\r
- SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE));\r
-// delete pSelectedScene;\r
-// pSelectedScene = null;\r
- }\r
-}\r
-\r
-void\r
-SettingForm::OnActionPerformed(const Control& source, int actionId)\r
-{\r
- switch (actionId)\r
- {\r
- case IDA_BUTTON_NO:\r
- if(__pConfirmationPopup)\r
- {\r
- __pConfirmationPopup->SetShowState(false);\r
- __pConfirmationPopup->Show();\r
- delete __pConfirmationPopup;\r
- __pConfirmationPopup = null;\r
- }\r
- break;\r
-\r
- case IDA_BUTTON_YES:\r
- if(__pConfirmationPopup)\r
- {\r
- String message = L"";\r
- __pConfirmationPopup->SetShowState(false);\r
- __pConfirmationPopup->Show();\r
- if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO"))\r
- {\r
- message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");\r
- SettingPresentationModel::GetInstance()->ClearCookie();\r
- }\r
- else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q"))\r
- {\r
- message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");\r
- SettingPresentationModel::GetInstance()->ClearCache();\r
- }\r
- else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q"))\r
- {\r
- message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");\r
- HistoryPresentationModel::GetInstance()->ClearHistory();\r
- }\r
- else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_RESET_ALL_SETTINGS_TO_DEFAULT_Q"))\r
- {\r
- message = CommonUtil::GetString(L"IDS_BR_SK_DONE");\r
- SettingPresentationModel::GetInstance()->ResetRegistry();\r
- InitializeSettingValues();\r
- if(__pList != null)\r
- {\r
- __pList->UpdateList();\r
- }\r
- }\r
- delete __pConfirmationPopup;\r
- __pConfirmationPopup = null;\r
-\r
- NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);\r
- pNotification->SetText(message);\r
- pNotification->SetPositionDiff(0);\r
- pNotification->ShowNotification();\r
- }\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
-}\r
-\r
-void\r
-SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)\r
-{\r
- Rectangle rect = GetClientAreaBounds();\r
- if(__pList == null)\r
- {\r
- return;\r
- }\r
- __pList->SetBounds(rect.x,rect.y,rect.width-16,rect.height);\r
- __pList->UpdateList();\r
-}\r
-\r
-SettingForm::SettingItemInfo::SettingItemInfo(void)\r
-{\r
- titleText = L"";\r
- subText = L"";\r
- childCount = 0;\r
- isOpen = false;\r
- isSelected = false ;\r
-}\r
-void\r
-SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)\r
-{\r
- WindowInfo* pWindowInfo = null;\r
- String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();\r
-\r
- pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo();\r
-\r
- if (previousSceneId == IDSCN_EDIT_HOMEPAGE_VIEW)\r
- {\r
- if (pArgs != null)\r
- {\r
- String* pValue = NULL;\r
- pValue = dynamic_cast<String*>(pArgs->GetAt(0));\r
- if( pValue != NULL )\r
- {\r
- if (pValue->CompareTo(L"Done") == 0)\r
- {\r
- SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));\r
- }\r
- else if (pValue->CompareTo(L"Cancel") == 0)\r
- {\r
- String homePage = SettingPresentationModel::GetInstance()->GetHomepage();\r
- if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)\r
- {\r
- settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;\r
- settingInfo[SETTING_BLANK_PAGE].isSelected = false;\r
- settingInfo[SETTING_CURRENT_PAGE].isSelected = false;\r
- settingInfo[SETTING_FAVORITE_URL].isSelected = false;\r
-\r
- }\r
- else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)\r
- {\r
- settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;\r
- settingInfo[SETTING_BLANK_PAGE].isSelected = true;\r
- settingInfo[SETTING_CURRENT_PAGE].isSelected = false;\r
- settingInfo[SETTING_FAVORITE_URL].isSelected = false;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (pWindowInfo != null)\r
- {\r
- __currentURL.Clear();\r
- __currentURL.Append(pWindowInfo->pageUrl);\r
- AppLog("current url is %ls",__currentURL.GetPointer());\r
-\r
- if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)\r
- {\r
- if (pWindowInfo->pageUrl.CompareTo(L"") == 0)\r
- {\r
- //settingInfo[SETTING_FAVORITE_URL].titleText = CommonUtil::GetString(L"IDS_SET_HOMEPAGE");\r
- settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";\r
- }\r
- else\r
- {\r
- settingInfo[SETTING_FAVORITE_URL].titleText = pWindowInfo->pageUrl;\r
- }\r
- }\r
- else\r
- {\r
- settingInfo[SETTING_FAVORITE_URL].titleText = SettingPresentationModel::GetInstance()->GetFavoriteUrl();\r
- }\r
- }\r
-\r
- if (__pList != null)\r
- {\r
- __pList->UpdateList();\r
- if (pWindowInfo && pWindowInfo->pageUrl.CompareTo(L"") == 0)\r
- {\r
- __isCurrentPageDisable = true;\r
- AppLog("set item enabled is false");\r
- __pList->SetItemEnabled(0, 1, false);\r
- }\r
- else\r
- {\r
- __isCurrentPageDisable = false;\r
- AppLog("set item enabled is true");\r
- __pList->SetItemEnabled(0, 1, true);\r
- }\r
- for(int grpindex = 0; grpindex < groupCount; grpindex++)\r
- {\r
- for(int index = 0; index < *(pGroupItemCount+groupCount); index++)\r
- {\r
- int effectiveIndex = 0;\r
- for (int i = 0; i < grpindex; i++)\r
- effectiveIndex = effectiveIndex + pGroupItemCount[i];\r
- effectiveIndex = effectiveIndex + index;\r
-\r
- if(effectiveIndex >= SETTING_MAX)\r
- {\r
- continue;\r
- }\r
- if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO )\r
- {\r
- __pList->SetItemChecked(grpindex, index, settingInfo[effectiveIndex].isSelected);\r
- }\r
- }\r
- }\r
- }\r
- return;\r
-}\r
-\r
-void\r
-SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)\r
-{\r
- return;\r
-}\r
-\r
-void\r
-SettingForm::ClearHistory(void)\r
-{\r
- String message = CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q");\r
- __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();\r
- __pConfirmationPopup->Initialize();\r
- __pConfirmationPopup->RemoveActionListener(*this);\r
- __pConfirmationPopup->AddActionListener(*this);\r
- __pConfirmationPopup->setMessage(message);\r
- __pConfirmationPopup->Show();\r
-}\r
-\r
-void\r
-SettingForm::ClearCache(void)\r
-{\r
- String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q");\r
- __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();\r
- __pConfirmationPopup->Initialize();\r
- __pConfirmationPopup->RemoveActionListener(*this);\r
- __pConfirmationPopup->AddActionListener(*this);\r
- __pConfirmationPopup->setMessage(message);\r
- __pConfirmationPopup->Show();\r
-}\r
-\r
-void\r
-SettingForm::ClearCookie(void)\r
-{\r
- String message = CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO");\r
- __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();\r
- __pConfirmationPopup->Initialize();\r
- __pConfirmationPopup->RemoveActionListener(*this);\r
- __pConfirmationPopup->AddActionListener(*this);\r
- __pConfirmationPopup->setMessage(message);\r
- __pConfirmationPopup->Show();\r
-}\r
-\r
-void\r
-SettingForm::ResetToDefault()\r
-{\r
- String message = CommonUtil::GetString(L"IDS_BR_POP_RESET_ALL_SETTINGS_TO_DEFAULT_Q");\r
- __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();\r
- __pConfirmationPopup->Initialize();\r
- __pConfirmationPopup->RemoveActionListener(*this);\r
- __pConfirmationPopup->AddActionListener(*this);\r
- __pConfirmationPopup->setMessage(message);\r
- __pConfirmationPopup->Show();\r
-}\r
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+//!Internet SettingForm class
+/*@file: IntSettingForm.cpp
+ *@brief: The SettingForm
+ */
+
+#include <FApp.h>
+#include <FGraphics.h>
+#include <FUi.h>
+
+#include "IntCommonLib.h"
+#include "IntConfirmationPopup.h"
+#include "IntDefaultCustomItem.h"
+#include "IntDropDownCustomItem.h"
+#include "IntHistoryPresentationModel.h"
+#include "IntInternetApp.h"
+#include "IntMultipleWindowPresentationModel.h"
+#include "IntNotificationPanel.h"
+#include "IntRadioCustomItem.h"
+#include "IntSceneRegister.h"
+#include "IntSettingForm.h"
+#include "IntSettingPresentationModel.h"
+#include "IntSettingToggleCustomItem.h"
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+
+
+SettingForm::SettingForm(void)
+: __fontValue(0),__pResetPopup(null),__pWindowInfo(null) , __pConfirmationPopup(null)
+{
+ __currentURL = L"";
+ __pList = null;
+ InitializeSettingValues();
+ __fontSize = 44;
+}
+
+SettingForm::~SettingForm(void)
+{
+ if (pGroupItemCount)
+ {
+ delete[] pGroupItemCount;
+ pGroupItemCount = null;
+ }
+}
+
+void
+SettingForm::InitializeSettingValues(void)
+{
+ AppLog("SettingForm::InitializeSettingValues homepage %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());
+ groupCount = 5;
+ pGroupItemCount = new(std::nothrow) int[5];
+ pGroupItemCount[0] = 5; //Homepage
+ pGroupItemCount[1] = 6; //Page content settings
+ pGroupItemCount[2] = 9; //Private and Security
+ pGroupItemCount[3] = 4; //Search
+ pGroupItemCount[4] = 1; //Website settings and Reset
+
+ for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; iter++)
+ {
+ settingInfo[iter].isSelected = false;
+ }
+
+ AppLogDebug("image display %d", (int) SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
+ settingInfo[SETTING_HOMEPAGE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE");
+ settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();
+ settingInfo[SETTING_HOMEPAGE_TITLE].itemType = ITEM_TYPE_DROPDOWN;
+
+ settingInfo[SETTING_CURRENT_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CURRENT_PAGE");
+ settingInfo[SETTING_CURRENT_PAGE].subText = L"";
+ settingInfo[SETTING_CURRENT_PAGE].itemType = ITEM_TYPE_RADIO;
+
+ settingInfo[SETTING_BLANK_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE");
+ settingInfo[SETTING_BLANK_PAGE].subText = L"";
+ settingInfo[SETTING_BLANK_PAGE].itemType = ITEM_TYPE_RADIO;
+ if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ {
+ settingInfo[SETTING_BLANK_PAGE].isSelected = true;
+ }
+
+ settingInfo[SETTING_MOST_VISITED_SITE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES");
+ settingInfo[SETTING_MOST_VISITED_SITE].subText = L"";
+ settingInfo[SETTING_MOST_VISITED_SITE].itemType = ITEM_TYPE_RADIO;
+ if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
+ }
+ WindowInfo* pWindowInfo = null;
+ String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
+ AppLog("SettingForm::OnSceneActivatedN check1");
+
+ settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";
+ if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)
+ {
+ SettingPresentationModel::GetInstance()->SetFavoriteValue(L"http://www.tizen.org");
+ }
+ settingInfo[SETTING_FAVORITE_URL].subText = L"";
+ settingInfo[SETTING_FAVORITE_URL].itemType = ITEM_TYPE_RADIO;
+
+ String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
+ if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = false;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = false;
+ SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
+ }
+ else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = true;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = false;
+ SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_BLANK_PAGE");
+ }
+ else
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = false;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = true;
+ }
+
+ settingInfo[SETTING_DEFAULT_VIEW_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DEFAULT_VIEW");
+ settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText = CommonUtil::GetString(SettingPresentationModel::GetInstance()->GetDefaultView());
+ settingInfo[SETTING_DEFAULT_VIEW_TITLE].itemType = ITEM_TYPE_DROPDOWN;
+
+ settingInfo[SETTING_FIT_TO_WIDTH].titleText = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH");
+ settingInfo[SETTING_FIT_TO_WIDTH].subText = L"";
+ settingInfo[SETTING_FIT_TO_WIDTH].itemType = ITEM_TYPE_RADIO;
+ settingInfo[SETTING_FIT_TO_WIDTH].isSelected = !(String::Compare(settingInfo[SETTING_FIT_TO_WIDTH].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));
+
+ settingInfo[SETTING_READABLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_READABLE");
+ settingInfo[SETTING_READABLE].subText = L"";
+ settingInfo[SETTING_READABLE].itemType = ITEM_TYPE_RADIO;
+ settingInfo[SETTING_READABLE].isSelected = !(String::Compare(settingInfo[SETTING_READABLE].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText));
+
+ settingInfo[SETTING_RUN_JAVASCRIPT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RUN_JAVASCRIPT");
+ settingInfo[SETTING_RUN_JAVASCRIPT].subText = L"";
+ settingInfo[SETTING_RUN_JAVASCRIPT].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_RUN_JAVASCRIPT].isSelected = SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled();
+
+ settingInfo[SETTING_DISPLAY_IMAGES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_IMAGES");
+ settingInfo[SETTING_DISPLAY_IMAGES].subText = L"";
+ settingInfo[SETTING_DISPLAY_IMAGES].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_DISPLAY_IMAGES].isSelected = SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled();
+
+ settingInfo[SETTING_BLOCK_POPUP].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLOCK_POP_UPS_ABB");
+ settingInfo[SETTING_BLOCK_POPUP].subText = L"";
+ settingInfo[SETTING_BLOCK_POPUP].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_BLOCK_POPUP].isSelected = !SettingPresentationModel::GetInstance()->IsBlockPopUp();
+
+ settingInfo[SETTING_CLEAR_CACHE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_CACHE");
+ settingInfo[SETTING_CLEAR_CACHE].subText = L"";
+ settingInfo[SETTING_CLEAR_CACHE].itemType = ITEM_TYPE_NORMAL;
+
+ settingInfo[SETTING_CLEAR_HISTORY].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_HISTORY");
+ settingInfo[SETTING_CLEAR_HISTORY].subText = L"";
+ settingInfo[SETTING_CLEAR_HISTORY].itemType = ITEM_TYPE_NORMAL;
+
+ settingInfo[SETTING_SHOW_SECURITY_WARNINGS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_SECURITY_WARNINGS");
+ settingInfo[SETTING_SHOW_SECURITY_WARNINGS].subText = L"";
+ settingInfo[SETTING_SHOW_SECURITY_WARNINGS].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected = SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled();
+
+ settingInfo[SETTING_ACCEPT_COOKIES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_ACCEPT_COOKIES");
+ settingInfo[SETTING_ACCEPT_COOKIES].subText = L"";
+ settingInfo[SETTING_ACCEPT_COOKIES].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_ACCEPT_COOKIES].isSelected = SettingPresentationModel::GetInstance()->IsCookiesEnabled();
+
+ settingInfo[SETTING_CLEAR_COOKIE_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_ALL_COOKIE_DATA");
+ settingInfo[SETTING_CLEAR_COOKIE_DATA].subText = CommonUtil::GetString(L"IDS_BR_BODY_COOKIES");
+ settingInfo[SETTING_CLEAR_COOKIE_DATA].itemType = ITEM_TYPE_NORMAL;
+
+ settingInfo[SETTING_REMEMBER_FORM_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_REMEMBER_FORM_DATA");
+ settingInfo[SETTING_REMEMBER_FORM_DATA].subText = L"";
+ settingInfo[SETTING_REMEMBER_FORM_DATA].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_REMEMBER_FORM_DATA].isSelected = SettingPresentationModel::GetInstance()->IsRememberFormData();
+
+ settingInfo[SETTING_CLEAR_FORM_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_FORM_DATA");
+ settingInfo[SETTING_CLEAR_FORM_DATA].subText = CommonUtil::GetString(L"IDS_BR_HEADER_FORM_DATA");
+ settingInfo[SETTING_CLEAR_FORM_DATA].itemType = ITEM_TYPE_NORMAL;
+
+ settingInfo[SETTING_REMEMBER_PASSWORD].titleText = CommonUtil::GetString(L"IDS_BR_BODY_REMEMBER_PASSWORDS");
+ settingInfo[SETTING_REMEMBER_PASSWORD].subText = L"";
+ settingInfo[SETTING_REMEMBER_PASSWORD].itemType = ITEM_TYPE_TOGGLE;
+ settingInfo[SETTING_REMEMBER_PASSWORD].isSelected = SettingPresentationModel::GetInstance()->IsRememberPassword();
+
+
+ settingInfo[SETTING_CLEAR_PASSWORDS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_PASSWORDS");
+ settingInfo[SETTING_CLEAR_PASSWORDS].subText = L"";
+ settingInfo[SETTING_CLEAR_PASSWORDS].itemType = ITEM_TYPE_NORMAL;
+
+ settingInfo[SETTING_SEARCH_ENGINE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_ENGINE");
+ settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText = SettingPresentationModel::GetInstance()->GetSearchEngine();
+ settingInfo[SETTING_SEARCH_ENGINE_TITLE].itemType = ITEM_TYPE_DROPDOWN;
+
+ settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText = L"Yahoo"; //CommonUtil::GetString(L"IDS_BR_BODY_YAHOO");
+ settingInfo[SETTING_SEARCH_ENGINE_YAHOO].subText = L"";
+ settingInfo[SETTING_SEARCH_ENGINE_YAHOO].itemType = ITEM_TYPE_RADIO;
+ settingInfo[SETTING_SEARCH_ENGINE_YAHOO].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
+
+ settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText = L"Naver"; //CommonUtil::GetString(L"IDS_BR_BODY_NAVER");
+ settingInfo[SETTING_SEARCH_ENGINE_NAVER].subText = L"";
+ settingInfo[SETTING_SEARCH_ENGINE_NAVER].itemType = ITEM_TYPE_RADIO;
+ settingInfo[SETTING_SEARCH_ENGINE_NAVER].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
+
+ settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText = CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE");
+ settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].subText = L"";
+ settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].itemType = ITEM_TYPE_RADIO;
+ settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText));
+
+ settingInfo[SETTING_RESET_TO_DEFAULT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RESET_TO_DEFAULT");
+ settingInfo[SETTING_RESET_TO_DEFAULT].subText = L"";
+ settingInfo[SETTING_RESET_TO_DEFAULT].itemType = ITEM_TYPE_NORMAL;
+}
+
+bool
+SettingForm::Initialize(void)
+{
+ result r = E_FAILURE;
+
+ r = Construct(L"IDL_SETTING_FORM");
+ if (IsFailed(r))
+ {
+ return false;
+ }
+ return true;
+}
+
+result
+SettingForm::OnInitializing(void)
+{
+ result r = E_FAILURE;
+ Footer* pFooter = NULL;
+ SceneManager* pSceneManager = NULL;
+
+ __fontSize = CommonUtil::GetFontSize();
+
+ bool isHwKeySupported = false;
+
+ SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
+ __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST"));
+ if ( __pList != NULL )
+ {
+
+ r = __pList->SetItemProvider(*this);
+ TryCatch(!IsFailed(r),,"setItemProvider failed with error %s",GetErrorMessage(r));
+ __pList->AddGroupedListViewItemEventListener(*this);
+ }
+
+// pFooter = GetFooter();
+// if (pFooter)
+// {
+// AppLogDebug("setting back button");
+// pFooter->SetBackButtonEnabled(true);
+// }
+ SetFormBackEventListener(this);
+ AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
+ pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager != null)
+ {
+ r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS, *this);
+ TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r));
+ }
+ AddOrientationEventListener(*this);
+
+ CATCH:
+ return r;
+}
+
+void
+SettingForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
+{
+
+}
+
+void
+SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
+{
+ int effectiveIndex = 0;
+ SettingPresentationModel* pSettingMgr = SettingPresentationModel::GetInstance();
+
+ if (pSettingMgr == null)
+ return;
+
+ for (int i = 0; i < groupIndex; i++)
+ effectiveIndex = effectiveIndex + pGroupItemCount[i];
+ effectiveIndex = effectiveIndex + itemIndex;
+
+ if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
+ {
+ AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount);
+ if (settingInfo[effectiveIndex].isOpen == false)
+ {
+ settingInfo[effectiveIndex].isOpen = true;
+ settingInfo[effectiveIndex].childCount = 0;
+ for (int iter = effectiveIndex + 1; iter < SETTING_MAX; iter++)
+ {
+ if (settingInfo[iter].itemType == ITEM_TYPE_RADIO)
+ settingInfo[effectiveIndex].childCount++;
+ else
+ break;
+ }
+ listView.UpdateList();
+ }
+ else
+ {
+ settingInfo[effectiveIndex].isOpen = false;
+ listView.UpdateList();
+ }
+ }
+ else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
+ {
+ int parentIndex = 0;
+ for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
+ {
+ if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
+ break;
+ }
+ settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;
+
+ for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++)
+ {
+ if (parentIndex + iter + 1 != effectiveIndex)
+ {
+ AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1);
+ settingInfo[parentIndex + iter + 1].isSelected = false;
+ }
+ else
+ {
+ AppLogDebug("effectiveIndex %d set to true", effectiveIndex);
+ settingInfo[effectiveIndex].isSelected = true;
+ }
+ if (effectiveIndex == SETTING_CURRENT_PAGE)
+ {
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = true;
+ }
+ //listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
+ }
+// listView.UpdateList();
+ //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP);
+ Invalidate(true);
+ }
+ else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
+ {
+ if (settingInfo[effectiveIndex].isSelected == true)
+ {
+ settingInfo[effectiveIndex].isSelected = false;
+ }
+ else
+ {
+ settingInfo[effectiveIndex].isSelected = true;
+ }
+// listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+ if(__pList != null)
+ {
+ __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
+ }
+ }
+
+ switch (effectiveIndex)
+ {
+ case SETTING_CURRENT_PAGE:
+ //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
+ AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
+ if (__currentURL.CompareTo(L"") != 0)
+ {
+ AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer());
+ SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
+ SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL);
+ settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL;
+// listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+ listView.UpdateList();
+ }
+ break;
+ case SETTING_BLANK_PAGE:
+ //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_BLANK_PAGE].titleText);
+ SettingPresentationModel::GetInstance()->SetHomepage((L"IDS_BR_BODY_BLANK_PAGE"));
+ AppLog("GetHomepage() %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer());
+ listView.UpdateList();
+
+ break;
+ case SETTING_MOST_VISITED_SITE:
+ SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
+ listView.UpdateList();
+ break;
+
+ case SETTING_FAVORITE_URL:
+ //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText);
+ SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EDIT_HOMEPAGE_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
+ break;
+
+ case SETTING_FIT_TO_WIDTH:
+ SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");
+ listView.UpdateList();
+ break;
+
+ case SETTING_READABLE:
+ SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");
+ listView.UpdateList();
+ break;
+
+ case SETTING_RUN_JAVASCRIPT:
+ SettingPresentationModel::GetInstance()->SetRunJavascriptEnabled(settingInfo[SETTING_RUN_JAVASCRIPT].isSelected);
+ break;
+
+ case SETTING_DISPLAY_IMAGES:
+ SettingPresentationModel::GetInstance()->SetDisplayImagesEnabled(settingInfo[SETTING_DISPLAY_IMAGES].isSelected);
+ break;
+
+ case SETTING_BLOCK_POPUP:
+ SettingPresentationModel::GetInstance()->SetBlockPopUp(!settingInfo[SETTING_BLOCK_POPUP].isSelected);
+ break;
+
+ case SETTING_CLEAR_CACHE:
+ ClearCache();
+ break;
+
+ case SETTING_CLEAR_HISTORY:
+ ClearHistory();
+ break;
+
+ case SETTING_SHOW_SECURITY_WARNINGS:
+ SettingPresentationModel::GetInstance()->SetSecurityWarningsEnabled(settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected);
+ break;
+
+ case SETTING_ACCEPT_COOKIES:
+ SettingPresentationModel::GetInstance()->SetCookiesEnabled(settingInfo[SETTING_ACCEPT_COOKIES].isSelected);
+ break;
+
+ case SETTING_CLEAR_COOKIE_DATA:
+ ClearCookie();
+ break;
+
+ case SETTING_REMEMBER_FORM_DATA:
+ SettingPresentationModel::GetInstance()->SetRememberFormData(settingInfo[SETTING_REMEMBER_FORM_DATA].isSelected);
+ break;
+
+ case SETTING_CLEAR_FORM_DATA:
+ ClearFormData();
+ break;
+
+ case SETTING_CLEAR_PASSWORDS:
+ ClearPasswords();
+ break;
+
+ case SETTING_REMEMBER_PASSWORD:
+ SettingPresentationModel::GetInstance()->SetRememberPassword(settingInfo[SETTING_REMEMBER_PASSWORD].isSelected);
+ break;
+
+ case SETTING_SEARCH_ENGINE_YAHOO:
+ SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);
+ listView.UpdateList();
+ break;
+
+ case SETTING_SEARCH_ENGINE_NAVER:
+ SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText);
+ listView.UpdateList();
+ break;
+
+ case SETTING_SEARCH_ENGINE_GOOGLE:
+ SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText);
+ listView.UpdateList();
+ break;
+
+ case SETTING_RESET_TO_DEFAULT:
+ //OpenResetPopup();
+ ResetToDefault();
+ break;
+
+ default:
+ break;
+ }
+}
+
+void
+SettingForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
+{
+
+}
+
+GroupItem*
+SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
+{
+ result r = E_FAILURE;
+ String text(L"");
+ GroupItem* pItem = null;
+ const Color ITEM_TEXT_COLOR = CUSTOM_COLOR_SETTINGS_GROUPTITLE;
+
+ pItem = new(std::nothrow) GroupItem();
+ if (pItem == null)
+ {
+ return null;
+ }
+ r = pItem->Construct(Dimension(itemWidth, 46));
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+
+ switch (groupIndex)
+ {
+ case 0:
+ text = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); // IDS_HOMEPAGE
+ settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage();
+ break;
+
+ case 1:
+ text = CommonUtil::GetString(L"IDS_BR_MBODY_PAGE_CONTENT_SETTINGS"); // IDS_BR_MBODY_PAGE_CONTENT_SETTINGS
+ break;
+
+ case 2:
+ text = CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"); // IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB
+ break;
+
+ case 3:
+ text = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH"); // IDS_BR_BODY_SEARCH
+ break;
+
+ case 4:
+ text = L" ";
+ break;
+
+ default:
+ break;
+ }
+
+ pItem->SetElement(text, null);
+
+ AppLogDebug("background color set result %s", GetErrorMessage(r));
+
+ pItem->SetTextColor(ITEM_TEXT_COLOR);
+ return pItem;
+}
+
+ListItemBase*
+SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
+{
+ AppLog("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, itemWidth);
+
+ result r = E_SUCCESS;
+ int effectiveIndex = 0;
+ const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;
+ const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;
+ const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED;
+
+ for (int i = 0; i < groupIndex; i++)
+ effectiveIndex = effectiveIndex + pGroupItemCount[i];
+ effectiveIndex = effectiveIndex + itemIndex;
+ AppLogDebug("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
+
+ if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
+ {
+ SettingToggleCustomItem* pItem = new(std::nothrow) SettingToggleCustomItem();
+ r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
+ if(__pList != null)
+ {
+ __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
+ }
+
+ pItem->SetText(settingInfo[effectiveIndex].titleText);
+ pItem->Make();
+
+ return pItem;
+
+ }
+ else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
+ {
+ DropDownCustomItem* pItem = new(std::nothrow) DropDownCustomItem();
+ r = pItem->Construct(itemWidth);
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+
+/* Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,128);
+ Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
+
+ if (pNormalBackgroundBitmap != NULL)
+ {
+ pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
+ delete pNormalBackgroundBitmap;
+ }
+
+ if (pPressedBackgroundBitmap != NULL)
+ {
+ pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
+ delete pPressedBackgroundBitmap;
+ }*/
+
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
+
+ pItem->SetMainText(settingInfo[effectiveIndex].titleText);
+ 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)
+ {
+ pItem->SetSubText(CommonUtil::GetString(settingInfo[effectiveIndex].subText));
+ }
+ else
+ {
+ pItem->SetSubText(settingInfo[effectiveIndex].subText);
+ }
+ if (settingInfo[effectiveIndex].isOpen)
+ {
+ pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED);
+ }
+ else
+ {
+ pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED);
+ }
+ r = pItem->Make();
+ // if (pBitmap != null)
+ // pItem->AddElement(Rectangle(0, 0, 10, 128), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null);
+
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+
+ return pItem;
+ }
+ else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
+ {
+ RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem();
+ int parentIndex = 0;
+ for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
+ {
+ if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
+ break;
+ }
+ if (settingInfo[parentIndex].isOpen == false || (__isCurrentPageDisable == true && groupIndex == 0 && itemIndex == 1))
+ {
+ r = pItem->Construct(itemWidth, 0);
+ __pList->SetItemEnabled(groupIndex,itemIndex,false);
+ AppLogDebug("construct with height 0 %s", GetErrorMessage(r));
+ return pItem;
+ }
+ else
+ {
+ __pList->SetItemEnabled(groupIndex,itemIndex,true);
+ pItem->Construct(itemWidth, 112 + (__fontSize - 44));
+ }
+/*
+ Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
+ Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
+
+ if (pNormalBackgroundBitmap != NULL)
+ {
+ pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
+ delete pNormalBackgroundBitmap;
+ }
+
+ if (pPressedBackgroundBitmap != NULL)
+ {
+ pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
+ delete pPressedBackgroundBitmap;
+ }*/
+
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_RADIO_ITEM_BACKGROUND_COLOR);
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
+
+
+ pItem->SetText(settingInfo[effectiveIndex].titleText);
+ AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
+
+ //if (pBitmap != null)
+ // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
+
+// pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
+ __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected);
+ pItem->Make();
+
+ return pItem;
+ }
+ else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_NORMAL)
+ {
+ DefaultCustomItem* pItem = new(std::nothrow) DefaultCustomItem();
+
+ r = pItem->Construct(itemWidth, 112 + (__fontSize - 44));
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+
+
+// Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112);
+// Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112);
+//
+// if (pNormalBackgroundBitmap != NULL)
+// {
+// pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap);
+// delete pNormalBackgroundBitmap;
+// }
+//
+// if (pPressedBackgroundBitmap != NULL)
+// {
+// pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap);
+// delete pPressedBackgroundBitmap;
+// }
+
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR);
+ pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
+
+
+ pItem->SetText(settingInfo[effectiveIndex].titleText);
+
+ //if (pBitmap != null)
+ // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
+
+ r = pItem->Make();
+ if (IsFailed(r))
+ {
+ delete pItem;
+ return null;
+ }
+ return pItem;
+ }
+ else
+ {
+ return null;
+ }
+}
+
+bool
+SettingForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
+{
+ delete pItem;
+ pItem = null;
+ return true;
+}
+
+bool
+SettingForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+ pItem = null;
+ return true;
+}
+
+int
+SettingForm::GetGroupCount(void)
+{
+ return groupCount;
+}
+
+int
+SettingForm::GetItemCount(int groupIndex)
+{
+ AppLog(" SettingForm::GetItemCount --> groupIndex : %d,", groupIndex);
+ return pGroupItemCount[groupIndex];
+}
+
+void
+SettingForm::OnFormBackRequested(Form& source)
+{
+ AppLog("SettingForm::OnFormBackRequested entered");
+ String* pSelectedScene = NULL;
+ Object* value = NULL;
+ MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value);
+ pSelectedScene = (String*) value;
+ if (pSelectedScene)
+ {
+ SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+// delete pSelectedScene;
+// pSelectedScene = null;
+ }
+}
+
+void
+SettingForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case IDA_BUTTON_NO:
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ break;
+
+ case IDA_BUTTON_YES:
+ if(__pConfirmationPopup)
+ {
+ String message = L"";
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
+ SettingPresentationModel::GetInstance()->ClearCookie();
+ }
+ else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
+ SettingPresentationModel::GetInstance()->ClearFormData();
+ }
+ else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
+ SettingPresentationModel::GetInstance()->ClearPasswords();
+ }
+ else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
+ SettingPresentationModel::GetInstance()->ClearCache();
+ }
+ else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
+ HistoryPresentationModel::GetInstance()->ClearHistory();
+ }
+ else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_Q"))
+ {
+ message = CommonUtil::GetString(L"IDS_BR_SK_DONE");
+ SettingPresentationModel::GetInstance()->ResetRegistry();
+ InitializeSettingValues();
+ if(__pList != null)
+ {
+ __pList->UpdateList();
+ }
+ }
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+
+ NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
+ pNotification->SetText(message);
+ pNotification->SetPositionDiff(0);
+ pNotification->ShowNotification();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void
+SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
+{
+ Rectangle rect = GetClientAreaBounds();
+ if(__pList == null)
+ {
+ return;
+ }
+ __pList->SetBounds(rect.x,rect.y,rect.width-16,rect.height);
+ __pList->UpdateList();
+}
+
+SettingForm::SettingItemInfo::SettingItemInfo(void)
+{
+ titleText = L"";
+ subText = L"";
+ childCount = 0;
+ isOpen = false;
+ isSelected = false ;
+}
+void
+SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
+{
+ WindowInfo* pWindowInfo = null;
+ String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
+
+ pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo();
+
+ if (previousSceneId == IDSCN_EDIT_HOMEPAGE_VIEW)
+ {
+ if (pArgs != null)
+ {
+ String* pValue = NULL;
+ pValue = dynamic_cast<String*>(pArgs->GetAt(0));
+ if( pValue != NULL )
+ {
+ if (pValue->CompareTo(L"Done") == 0)
+ {
+ // SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE"));
+ }
+ else if (pValue->CompareTo(L"Cancel") == 0)
+ {
+ String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
+ if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = false;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = false;
+ SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
+
+ }
+ else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = true;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = false;
+ SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_BLANK_PAGE");
+ }
+ else
+ {
+ settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false;
+ settingInfo[SETTING_BLANK_PAGE].isSelected = false;
+ settingInfo[SETTING_CURRENT_PAGE].isSelected = false;
+ settingInfo[SETTING_FAVORITE_URL].isSelected = true;
+ }
+
+ }
+ }
+ }
+ }
+
+ if (pWindowInfo != null)
+ {
+ __currentURL.Clear();
+ __currentURL.Append(pWindowInfo->pageUrl);
+ AppLog("current url is %ls",__currentURL.GetPointer());
+
+ if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0)
+ {
+ if (pWindowInfo->pageUrl.CompareTo(L"") == 0)
+ {
+ //settingInfo[SETTING_FAVORITE_URL].titleText = CommonUtil::GetString(L"IDS_SET_HOMEPAGE");
+ settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org";
+ }
+ else
+ {
+ settingInfo[SETTING_FAVORITE_URL].titleText = pWindowInfo->pageUrl;
+ }
+ }
+ else
+ {
+ settingInfo[SETTING_FAVORITE_URL].titleText = SettingPresentationModel::GetInstance()->GetFavoriteUrl();
+ }
+ }
+
+ if (__pList != null)
+ {
+ __pList->UpdateList();
+ if (pWindowInfo && pWindowInfo->pageUrl.CompareTo(L"") == 0)
+ {
+ __isCurrentPageDisable = true;
+ AppLog("set item enabled is false");
+ __pList->SetItemEnabled(0, 1, false);
+ }
+ else
+ {
+ __isCurrentPageDisable = false;
+ AppLog("set item enabled is true");
+ __pList->SetItemEnabled(0, 1, true);
+ }
+ for(int grpindex = 0; grpindex < groupCount; grpindex++)
+ {
+ for(int index = 0; index < *(pGroupItemCount+groupCount); index++)
+ {
+ int effectiveIndex = 0;
+ for (int i = 0; i < grpindex; i++)
+ effectiveIndex = effectiveIndex + pGroupItemCount[i];
+ effectiveIndex = effectiveIndex + index;
+
+ if(effectiveIndex >= SETTING_MAX)
+ {
+ continue;
+ }
+ if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO )
+ {
+ __pList->SetItemChecked(grpindex, index, settingInfo[effectiveIndex].isSelected);
+ }
+ }
+ }
+ }
+ return;
+}
+
+void
+SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
+{
+ return;
+}
+
+void
+SettingForm::ClearHistory(void)
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}
+
+void
+SettingForm::ClearCache(void)
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}
+
+void
+SettingForm::ClearCookie(void)
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}
+
+void
+SettingForm::ClearFormData(void)
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_FORM_DATA_Q");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}
+
+void
+SettingForm::ClearPasswords(void)
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_ALL_SAVED_PASSWORDS_Q");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}
+
+
+void
+SettingForm::ResetToDefault()
+{
+ if(__pConfirmationPopup)
+ {
+ __pConfirmationPopup->SetShowState(false);
+ __pConfirmationPopup->Show();
+ delete __pConfirmationPopup;
+ __pConfirmationPopup = null;
+ }
+ String message = CommonUtil::GetString(L"IDS_BR_POP_ALL_SETTINGS_TO_DEFAULT_CONTINUE_Q");
+ if(!__pConfirmationPopup)
+ {
+ __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+ __pConfirmationPopup->Initialize();
+ __pConfirmationPopup->RemoveActionListener(*this);
+ __pConfirmationPopup->AddActionListener(*this);
+ __pConfirmationPopup->setMessage(message);
+ __pConfirmationPopup->Show();
+ }
+}