Fixed Nabi Issues 52332,54256,54601,54130,54264,54471
[apps/osp/Internet.git] / src / IntEditHistoryListForm.cpp
index 514eb6a..6e24801 100644 (file)
@@ -27,7 +27,6 @@
 #include "IntEditHistoryListForm.h"
 #include "IntFaviconManager.h"
 #include "IntHistoryPresentationModel.h"
-#include "IntNotificationPanel.h"
 #include "IntSceneRegister.h"
 #include "IntTypes.h"
 
@@ -63,6 +62,8 @@ EditHistoryListForm::EditHistoryListForm(void)
 ,__selectedCount(0)
 ,__isNoHistoryPresent(true)
 ,__fontSize(44)
+,__pConfirmationPopup(null)
+,__pNotification(null)
 {
 }
 
@@ -94,7 +95,7 @@ EditHistoryListForm::OnInitializing(void)
        SetFormBackEventListener(this);
 
        AppLogDebug("EditHistoryListForm::OnInitializing");
-       SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
+//     SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
 
        __fontSize = CommonUtil::GetFontSize();
 
@@ -205,7 +206,16 @@ EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int act
                selectedText.Append(L"(");
                selectedText.Append(selectedCount);
                selectedText.Append(L")");*/
-               selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , selectedCount);
+
+               if (selectedCount >1)
+               {
+                       selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , selectedCount);
+               }
+               else
+               {
+                       selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , selectedCount);
+               }
+
                __selectedCount = selectedCount;
 
                __pSelectedLabel->SetText(selectedText);
@@ -213,7 +223,7 @@ EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int act
 
                if(__selectedCount > 0)
                {
-                       GetFooter()->SetItemEnabled(0, true);
+                       GetFooter()->SetItemEnabled(1, true);
                        GetFooter()->Invalidate(true);
                }
 
@@ -243,15 +253,42 @@ EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int act
                __selectedCount = 0;
                __pSelectedLabel->Invalidate(true);
 
-               GetFooter()->SetItemEnabled(0, false);
+               GetFooter()->SetItemEnabled(1, false);
                GetFooter()->Invalidate(true);
 
                __pListView->Invalidate(true);
        }
        break;
        case IDA_DELETE_HISTORY:
-       {
+               if(__pConfirmationPopup)
+               {
+                       delete __pConfirmationPopup;
+                       __pConfirmationPopup = null;
+               }
 
+               if (!__pConfirmationPopup)
+               {
+                       String closeWarning = CommonUtil::GetString(L"IDS_BR_SK3_DELETE");
+                       __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
+                       __pConfirmationPopup->Initialize();
+
+                       __pConfirmationPopup->RemoveActionListener(*this);
+                       __pConfirmationPopup->AddActionListener(*this);
+                       __pConfirmationPopup->setMessage(closeWarning);
+                       __pConfirmationPopup->Show();
+               }
+               break;
+       case IDA_BUTTON_NO:
+               if(__pConfirmationPopup)
+               {
+                       __pConfirmationPopup->SetShowState(false);
+                       __pConfirmationPopup->Show();
+                       delete __pConfirmationPopup;
+                       __pConfirmationPopup = null;
+               }
+               break;
+       case IDA_BUTTON_YES:
+       {
                ArrayList* pArrayList = new(std::nothrow) ArrayList();
                int itemCount = 0;
                int count = 0;
@@ -315,10 +352,10 @@ EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int act
 
                __pSelectAllCheck->SetSelected(false);
 
-               GetFooter()->SetItemEnabled(0,false);
+               GetFooter()->SetItemEnabled(1,false);
                GetFooter()->Invalidate(true);
                //selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
-       //      selectedText.Append(L"(0)");
+               //      selectedText.Append(L"(0)");
                selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , 0);
                __pSelectedLabel->SetText(selectedText);
                __selectedCount = 0;
@@ -328,10 +365,16 @@ EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int act
                        __pListView->UpdateList();
                }
 
-               NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
+               __pNotification = new (std::nothrow) NotificationPanel(*this);
                String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
-               pNotification->SetText(notification);
-               pNotification->ShowNotification();
+               __pNotification->SetText(notification);
+               __pNotification->ShowNotification();
+               if(__pConfirmationPopup)
+               {
+                       delete __pConfirmationPopup;
+                       __pConfirmationPopup = null;
+               }
+
        }
        break;
        case IDA_CANCEL:
@@ -364,6 +407,10 @@ EditHistoryListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                return;
        }
 
+       if( __pTimer != NULL)
+       {
+               __pTimer->Cancel();
+       }
        result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
        if (IsFailed(r))
        {
@@ -396,6 +443,7 @@ EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
        if ( pGroupItemClass->__pData == null || pGroupItemClass->__pData->GetCount() == 0)
        {
                r = pItem->Construct(Dimension(itemWidth, 0));
+               __pListView->SetItemEnabled(groupIndex, -1, false);
        }
        else
        {
@@ -468,7 +516,7 @@ EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
        if (pGroupItemClass->__titleText != L"Older")
        {
                text.Append(pGroupItemClass->__startTime.GetDay());
-               text.Append(L". ");
+               text.Append(L" ");
                strMonth = pGroupItemClass->__startTime.GetMonth();
                month = GetMonth(strMonth);
                text.Append(month);
@@ -482,7 +530,7 @@ EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
        {
                text.Append(L" - ");
                text.Append(pGroupItemClass->__endTime.GetDay());
-               text.Append(L". ");
+               text.Append(L" ");
                strMonth = pGroupItemClass->__endTime.GetMonth();
                month = GetMonth(strMonth);
                text.Append(month);
@@ -500,7 +548,7 @@ EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
 ListItemBase*
 EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
 {
-       AppLogDebug("EditHistoryListForm::CreateItem");
+       AppLogDebug("EditHistoryListForm::CreateItem groupIndex %d, itemIndex %d",groupIndex,itemIndex);
        result r = E_FAILURE;
        const int bookmarkBtnWidth = 64;
        String bitmapId;
@@ -553,7 +601,7 @@ EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                return null;
        }
 
-       pItem->AddElement(Rectangle(92, 68  + (__fontSize - 44), GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 52), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
+       pItem->AddElement(Rectangle(92, 68  + (__fontSize - 44), GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 52), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_LISTVIEW_TEXT,CUSTOM_COLOR_LISTVIEW_TEXT,true);
 
        return pItem;
 }
@@ -717,6 +765,7 @@ EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previou
        AppLogDebug("EditHistoryListForm::OnSceneActivatedN");
        int groupCount = 0;
        int count = 0;
+       String selectedText = L"";
 
        if(__pGroupData != null)
        {
@@ -741,7 +790,10 @@ EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previou
        }
        __pSelectAllCheck->SetSelected(false);
        __selectedCount = 0;
-       GetFooter()->SetItemEnabled(0, false);
+       selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
+       __pSelectedLabel->SetText(selectedText);
+       __pSelectedLabel->Invalidate(true);
+       GetFooter()->SetItemEnabled(1, false);
        Invalidate(true);
 }
 
@@ -776,15 +828,23 @@ EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::Grou
 
        if (__selectedCount == 0)
        {
-               GetFooter()->SetItemEnabled(0,false);
+               GetFooter()->SetItemEnabled(1,false);
        }
        else
        {
-               GetFooter()->SetItemEnabled(0,true);
+               GetFooter()->SetItemEnabled(1,true);
        }
        GetFooter()->Invalidate(true);
 
-       selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
+
+       if (__selectedCount >1)
+       {
+               selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __selectedCount);
+       }
+       else
+       {
+               selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
+       }
 
        __pSelectedLabel->SetText(selectedText);
        __pSelectedLabel->Invalidate(true);
@@ -841,7 +901,7 @@ EditHistoryListForm::GetMonth(int month)
                monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));;
                break;
        case 4:
-               monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));;
+               monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));;
                break;
        case 5:
                monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));;
@@ -1159,7 +1219,7 @@ EditHistoryListForm::CreateGroupItems(void)
        }
 
        pGroupItemClass = new(std::nothrow) GroupItemClass();
-       pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
+       pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
        pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
        pGroupItemClass->__endTime.AddDays(-1);
        pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1);
@@ -1181,6 +1241,9 @@ void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source,
        {
                __pListView->UpdateList();
        }
+
+       if(__pNotification)
+               __pNotification->SetShowState(false);
 }
 
 void
@@ -1193,3 +1256,19 @@ EditHistoryListForm::OnTimerExpired(Timer&  timer)
                pSceneManager->GoBackward(BackwardSceneTransition());
        }
 }
+
+void
+EditHistoryListForm::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;
+               }
+       }
+}