Fixed Nabi Issues: 53721,53372,53761,53768
[apps/osp/Internet.git] / src / IntSettingForm.cpp
index ac83cb3..62a905f 100644 (file)
@@ -42,13 +42,15 @@ 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)
+: __fontValue(0),__pResetPopup(null),__pWindowInfo(null) , __pConfirmationPopup(null),__pNotification(null)
 {
        __currentURL = L"";
        __pList = null;
@@ -162,7 +164,7 @@ SettingForm::InitializeSettingValues(void)
        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].titleText = CommonUtil::GetString(L"IDS_BR_OPT_LOAD_IMAGES");
        settingInfo[SETTING_DISPLAY_IMAGES].subText = L"";
        settingInfo[SETTING_DISPLAY_IMAGES].itemType = ITEM_TYPE_TOGGLE;
        settingInfo[SETTING_DISPLAY_IMAGES].isSelected = SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled();
@@ -227,7 +229,7 @@ SettingForm::InitializeSettingValues(void)
        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].titleText = L"Google";//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));
@@ -258,18 +260,10 @@ SettingForm::OnInitializing(void)
        SceneManager* pSceneManager = NULL;
 
        __fontSize = CommonUtil::GetFontSize();
-       InternetApp* pInternet = static_cast<InternetApp*> (Application::GetInstance());
 
        bool isHwKeySupported = false;
-       if(pInternet)
-       {
-               isHwKeySupported = pInternet->IsHwBackKeyExists();
-       }
 
-       if(isHwKeySupported)
-       {
-               SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
-       }
+       //SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
        __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST"));
        if ( __pList != NULL )
        {
@@ -279,12 +273,12 @@ SettingForm::OnInitializing(void)
                __pList->AddGroupedListViewItemEventListener(*this);
        }
 
-       pFooter = GetFooter();
-       if (pFooter)
-       {
-               AppLogDebug("setting back button");
-               pFooter->SetBackButtonEnabled(true);
-       }
+//     pFooter = GetFooter();
+//     if (pFooter)
+//     {
+//             AppLogDebug("setting back button");
+//             pFooter->SetBackButtonEnabled(true);
+//     }
        SetFormBackEventListener(this);
        AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
        pSceneManager = SceneManager::GetInstance();
@@ -332,11 +326,25 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
                                else
                                        break;
                        }
+/*
+                       listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+                       for(int iter = 0; iter < settingInfo[effectiveIndex].childCount; iter++)
+                       {
+                               listView.RefreshList(groupIndex, itemIndex + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
+                       }
+*/
                        listView.UpdateList();
                }
                else
                {
                        settingInfo[effectiveIndex].isOpen = false;
+/*
+                       listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+                       for(int iter = 0; iter < settingInfo[effectiveIndex].childCount; iter++)
+                       {
+                               listView.RefreshList(groupIndex, itemIndex + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
+                       }
+*/
                        listView.UpdateList();
                }
        }
@@ -350,6 +358,8 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
                }
                settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;
 
+//             listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex), LIST_REFRESH_TYPE_ITEM_MODIFY);
+//             listView.RefreshList(groupIndex, parentIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++)
                {
                        if (parentIndex + iter + 1 != effectiveIndex)
@@ -367,7 +377,7 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
                                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.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
                }
 //             listView.UpdateList();
                //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP);
@@ -402,6 +412,7 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
                        SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL);
                        settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL;
 //                     listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+//                     listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                        listView.UpdateList();
                }
                break;
@@ -409,11 +420,13 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
                //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.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
 
                break;
        case SETTING_MOST_VISITED_SITE:
                SettingPresentationModel::GetInstance()->SetHomepage(L"IDS_BR_BODY_MOST_VISITED_SITES");
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
@@ -424,11 +437,13 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
 
        case SETTING_FIT_TO_WIDTH:
                SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
        case SETTING_READABLE:
                SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
@@ -482,16 +497,19 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
 
        case SETTING_SEARCH_ENGINE_YAHOO:
                SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
        case SETTING_SEARCH_ENGINE_NAVER:
                SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText);
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
        case SETTING_SEARCH_ENGINE_GOOGLE:
                SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText);
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
                listView.UpdateList();
                break;
 
@@ -524,7 +542,7 @@ SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
        {
                return null;
        }
-       r = pItem->Construct(Dimension(itemWidth, 46));
+       r = pItem->Construct(Dimension(itemWidth, 76));
        if (IsFailed(r))
        {
                delete pItem;
@@ -551,7 +569,7 @@ SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
                break;
 
        case 4:
-               text = L"";
+               text = L" ";
                break;
 
        default:
@@ -664,8 +682,6 @@ SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        }
        else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
        {
-
-
                RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem();
                int parentIndex = 0;
                for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
@@ -676,11 +692,13 @@ SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                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));
                }
 /*
@@ -709,7 +727,8 @@ SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                //if (pBitmap != null)
                //      pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null);
 
-               pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
+//             pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
+               __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected);
                pItem->Make();
 
                return pItem;
@@ -744,6 +763,7 @@ SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                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)
@@ -867,10 +887,17 @@ SettingForm::OnActionPerformed(const Control& source, int actionId)
                        delete __pConfirmationPopup;
                        __pConfirmationPopup = null;
 
-                       NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
-                       pNotification->SetText(message);
-                       pNotification->SetPositionDiff(0);
-                       pNotification->ShowNotification();
+                       if (__pNotification != null)
+                       {
+                               RemoveControl(__pNotification);
+                               __pNotification = null;
+                       }
+                       __pNotification = new (std::nothrow) NotificationPanel(*this);
+
+                       //NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
+                       __pNotification->SetText(message);
+                       __pNotification->SetPositionDiff(0);
+                       __pNotification->ShowNotification();
                }
                break;
 
@@ -883,12 +910,18 @@ void
 SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
 {
        Rectangle rect = GetClientAreaBounds();
-       if(__pList == null)
+
+       if (__pNotification != null && __pNotification->GetShowState() == true)
+       {
+               __pNotification->OrientationChanged();
+       }
+
+       if (__pList == null)
        {
                return;
        }
        __pList->SetBounds(rect.x,rect.y,rect.width-16,rect.height);
-       __pList->UpdateList();
+//     __pList->UpdateList();//removed for issue 53768
 }
 
 SettingForm::SettingItemInfo::SettingItemInfo(void)
@@ -989,7 +1022,14 @@ SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                {
                        __isCurrentPageDisable = false;
                        AppLog("set item enabled is true");
-                       __pList->SetItemEnabled(0, 1, true);
+                       if (settingInfo[0].isOpen == false)
+                       {
+                               __pList->SetItemEnabled(0,1,false);
+                       }
+                       else
+                       {
+                               __pList->SetItemEnabled(0,1,true);
+                       }
                }
                for(int grpindex = 0; grpindex < groupCount; grpindex++)
                {
@@ -1023,6 +1063,13 @@ SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& ne
 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)
        {
@@ -1038,6 +1085,13 @@ SettingForm::ClearHistory(void)
 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)
        {
@@ -1053,6 +1107,13 @@ SettingForm::ClearCache(void)
 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)
        {
@@ -1068,6 +1129,13 @@ SettingForm::ClearCookie(void)
 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)
        {
@@ -1083,6 +1151,13 @@ SettingForm::ClearFormData(void)
 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)
        {
@@ -1099,6 +1174,13 @@ SettingForm::ClearPasswords(void)
 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)
        {
@@ -1110,3 +1192,19 @@ SettingForm::ResetToDefault()
                __pConfirmationPopup->Show();
        }
 }
+
+void
+SettingForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
+{
+       AppLog("receiving userevent for appcontrol %d",requestId);
+       if (requestId == APPCONTROL_LAUNCH_MAX_LIMIT_REACHED)
+       {
+               AppLog("receiving userevent for appcontrol %d ",requestId);
+               if(__pConfirmationPopup)
+               {
+                       __pConfirmationPopup->SetShowState(false);
+                       delete __pConfirmationPopup;
+                       __pConfirmationPopup = null;
+               }
+       }
+}