Fixed Nabi Issues 49466,55718,55225,52332
[apps/osp/Internet.git] / src / IntSettingForm.cpp
index 1fa28a1..9624508 100644 (file)
@@ -50,7 +50,7 @@ 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;
@@ -164,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();
@@ -229,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));
@@ -263,7 +263,7 @@ SettingForm::OnInitializing(void)
 
        bool isHwKeySupported = false;
 
-       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 )
        {
@@ -326,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();
                }
        }
@@ -344,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)
@@ -361,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);
@@ -396,19 +412,22 @@ 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.UpdateList();
+//                     listView.RefreshList(groupIndex, itemIndex, 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();
+//             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.UpdateList();
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+//             listView.UpdateList();
                break;
 
        case SETTING_FAVORITE_URL:
@@ -418,12 +437,14 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
 
        case SETTING_FIT_TO_WIDTH:
                SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_FIT_TO_WIDTH");
-               listView.UpdateList();
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+//             listView.UpdateList();
                break;
 
        case SETTING_READABLE:
                SettingPresentationModel::GetInstance()->SetDefaultView(L"IDS_BR_BODY_READABLE");
-               listView.UpdateList();
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+//             listView.UpdateList();
                break;
 
        case SETTING_RUN_JAVASCRIPT:
@@ -476,17 +497,20 @@ SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int gr
 
        case SETTING_SEARCH_ENGINE_YAHOO:
                SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText);
-               listView.UpdateList();
+//             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.UpdateList();
+//             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.UpdateList();
+//             listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
+//             listView.UpdateList();
                break;
 
        case SETTING_RESET_TO_DEFAULT:
@@ -546,6 +570,7 @@ SettingForm::CreateGroupItem(int groupIndex, int itemWidth)
 
        case 4:
                text = L" ";
+               __pList->SetItemEnabled(groupIndex,-1,false);
                break;
 
        default:
@@ -588,10 +613,19 @@ 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);
-               if(__pList != null)
-               {
-                       __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
-               }
+//             if(__pList != null)
+//             {
+//                     __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
+//             }
+
+               ArrayList *pList = new(std::nothrow) ArrayList();
+               pList->Construct();
+               Integer *pGroupIndex = new Integer(groupIndex);
+               Integer *pItemIndex = new Integer(itemIndex);
+               pList->Add(pGroupIndex);
+               pList->Add(pItemIndex);
+               AppLog("sending event UPDATE_LIST_COMPLETE");
+               SendUserEvent(UPDATE_LIST_COMPLETE,pList);
 
                pItem->SetText(settingInfo[effectiveIndex].titleText);
                pItem->Make();
@@ -704,7 +738,15 @@ SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                //      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);
+//             __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected);
+               ArrayList *pList = new(std::nothrow) ArrayList();
+               pList->Construct();
+               Integer *pGroupIndex = new Integer(groupIndex);
+               Integer *pItemIndex = new Integer(itemIndex);
+               pList->Add(pGroupIndex);
+               pList->Add(pItemIndex);
+               AppLog("sending event UPDATE_LIST_COMPLETE");
+               SendUserEvent(UPDATE_LIST_COMPLETE,pList);
                pItem->Make();
 
                return pItem;
@@ -863,10 +905,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;
 
@@ -879,12 +928,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)
@@ -985,7 +1040,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++)
                {
@@ -1148,3 +1210,42 @@ 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;
+               }
+       }
+       else if (requestId == UPDATE_LIST_COMPLETE)
+       {
+               AppLog("receiving event UPDATE_LIST_COMPLETE");
+               Integer *pGroupIndex = static_cast<Integer*>(pArgs->GetAt(0));
+               Integer *pItemIndex = static_cast<Integer*>(pArgs->GetAt(1));
+               int groupIndex = pGroupIndex->ToInt();
+               int itemIndex = pItemIndex->ToInt();
+
+               int effectiveIndex = 0;
+               for (int i = 0; i < groupIndex; i++)
+                       effectiveIndex = effectiveIndex + pGroupItemCount[i];
+               effectiveIndex = effectiveIndex + itemIndex;
+
+
+               if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO )
+               {
+                       AppLog("UPDATE_LIST_COMPLETE SetItemChecked %d, %d, %d",groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
+                       __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
+                       __pList->Invalidate(true);
+               }
+
+       }
+}
+