Fixed Nabi Issues: 53721,53372,53761,53768
[apps/osp/Internet.git] / src / IntEditBookmarkListForm.cpp
index 488f442..ff69d4d 100644 (file)
@@ -44,7 +44,8 @@ using namespace Tizen::Ui::Scenes;
 
 static const wchar_t* IDB_ICON_FOLDER_OPEN = L"I01_icon_folder_open.png";
 static const wchar_t* IDB_ITEM = L"edit_item.png";
-static const wchar_t* IDB_RIGHT_ARROW = L"I01_right_arrow.png";
+static const wchar_t* IDB_RIGHT_ARROW = L"00_circle_bg_ef.png";
+static const wchar_t* IDB_RIGHT_ARROW_PRESS = L"00_circle_bg_ef_press.png";
 
 
 const int EditBookmarkListForm::IDA_BUTTON_CHECKED = 101;
@@ -73,6 +74,7 @@ EditBookmarkListForm::EditBookmarkListForm(void)
        __pCheckButton = null;
        __pConfirmationPopup = null;
        __pSelectedList = null;
+       __fontSize = 44;
 }
 
 EditBookmarkListForm::~EditBookmarkListForm(void)
@@ -115,6 +117,7 @@ EditBookmarkListForm::OnInitializing(void)
                pSceneManager->AddSceneEventListener(IDSCN_EDIT_BOOKMARK_LIST, *this);
        }
 
+       __fontSize = CommonUtil::GetFontSize();
        Header* pHeader = GetHeader();
 
        if (pHeader == NULL)
@@ -190,6 +193,33 @@ EditBookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int ac
        switch (actionId)
        {
        case IDA_DELETEITEM_CLICKED:
+               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:
        {
                String labelString;
                int count = 0;
@@ -280,7 +310,11 @@ EditBookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int ac
                pNotification->SetText(notification);
                pNotification->ShowNotification();
 
-
+               if(__pConfirmationPopup)
+               {
+                       delete __pConfirmationPopup;
+                       __pConfirmationPopup = null;
+               }
                if( __pListview->GetItemCount() == 0)
                {
                        __pTimer->Start(1000);
@@ -317,7 +351,14 @@ EditBookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int ac
                GetFooter()->SetItemEnabled(0,true);
                GetFooter()->Invalidate(true);
 
-               labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() ,__pListview->GetItemCount());
+               if(__pListview->GetItemCount() >1)
+               {
+                       labelString.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __pListview->GetItemCount());
+               }
+               else
+               {
+                       labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __pListview->GetItemCount());
+               }
 
                __selectedItemCount = 0;
 
@@ -414,32 +455,31 @@ EditBookmarkListForm::CreateItem(int index, int itemWidth)
        }
        if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER)
        {
-               r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+               r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112 - 44 + __fontSize), style);
                TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::CreateItem contruct item failed  %s",GetErrorMessage(r));
 
                pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_FOLDER_OPEN);
 
                if (pBitmap != null)
                {
-                       pItem->AddElement(Rectangle(16, 26, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
+                       pItem->AddElement(Rectangle(16, 26+(__fontSize - 44)/2, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
                        delete pBitmap;
                }
 
-               pItem->AddElement(Rectangle(92, 8, width_Title/*__pListview->GetWidth() - 92 - 80*/, 112), IDA_FORMAT_FOLDER, pBookMark->GetBookmarkTitle(), true);
-
+               pItem->AddElement(Rectangle(92, 8, width_Title/*__pListview->GetWidth() - 92 - 80*/, 112 + (__fontSize - 44)), IDA_FORMAT_FOLDER, pBookMark->GetBookmarkTitle(),__fontSize, CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
 
                pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ITEM);
 
                if (pBitmap != null)
                {
-                       pItem->AddElement(Rectangle(GetClientAreaBounds().width - 92 - 80, 20, 60, 60), IDA_FORMAT_BITMAP, *pBitmap, null, null);
+                       pItem->AddElement(Rectangle(GetClientAreaBounds().width - 92 - 80, 20 + (__fontSize - 44)/2, 60, 60), IDA_FORMAT_BITMAP, *pBitmap, null, null);
                        pItem->SetElementSelectionEnabled(IDA_FORMAT_BITMAP, true);
                        delete pBitmap;
                }
        }
        else
        {
-               r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128), style);
+               r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128 + (__fontSize - 44)), style);
                TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::CreateItem contruct item failed  %s",GetErrorMessage(r));
 
                pBitmap = pBookMark->GetFavIconBitmap();
@@ -449,19 +489,21 @@ EditBookmarkListForm::CreateItem(int index, int itemWidth)
                        pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
                }
 
-               pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
+               pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
                delete pBitmap;
 
-               pItem->AddElement(Rectangle(104, 10, width_Title, itemHeight - height_Url), IDA_FORMAT_SITE, pBookMark->GetBookmarkTitle(), true);
-               pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
+               pItem->AddElement(Rectangle(104, 10, width_Title, itemHeight - height_Url + (__fontSize - 44)), IDA_FORMAT_SITE, pBookMark->GetBookmarkTitle(),__fontSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
+               pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url + (__fontSize - 44), width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_GREY,CUSTOM_COLOR_LISTVIEW_TEXT,CUSTOM_COLOR_LISTVIEW_TEXT,true);
 
                //pBitmap = AppResource::GetInstance()->GetBitmapN("I01_picker_arrow_right.png");
                pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_RIGHT_ARROW);
-               if (pBitmap != null)
+               Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_RIGHT_ARROW_PRESS);
+               if (pBitmap != null && pPressedBitmap != null)
                {
-                       pItem->AddElement(Rectangle(GetClientAreaBounds().width - 92 - 84, 32, 64, 64), IDA_FORMAT_BITMAP, *pBitmap, null, null);
+                       pItem->AddElement(Rectangle(GetClientAreaBounds().width - 92 - 84-4, 32 + (__fontSize - 44)/2-4, 72, 72), IDA_FORMAT_BITMAP, *pBitmap, pPressedBitmap, null);
                        pItem->SetElementSelectionEnabled(IDA_FORMAT_BITMAP, true);
                        delete pBitmap;
+                       delete pPressedBitmap;
                }
        }
        return pItem;
@@ -689,7 +731,14 @@ EditBookmarkListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView&
                labelString.Append(__selectedItemCount);
                labelString.Append(L")");*/
 
-               labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedItemCount);
+               if(__selectedItemCount >1)
+               {
+                       labelString.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __selectedItemCount);
+               }
+               else
+               {
+                       labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedItemCount);
+               }
 
                __pInfoLabel->SetText(labelString);
                __pInfoPanel->Draw();
@@ -772,6 +821,10 @@ EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const Sc
        __pListview->UpdateList();
 
        count = __pListview->GetItemCount();
+       if(count == 0)
+       {
+               __pTimer->Start(1000);
+       }
 
        for(int index = 0 ; index < count ; index++)
        {
@@ -792,8 +845,6 @@ EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const Sc
                }
                pBookmarkId->Append(pBookMark->GetBookmarkId());
 
-               AppLog("BookmarkId: %ls", pBookmarkId->GetPointer());
-
                if(__pSelectedList->Contains(*pBookmarkId))
                {
                        __pListview->SetItemChecked(index,true);
@@ -803,15 +854,24 @@ EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const Sc
                {
                        __pListview->SetItemChecked(index,false);
                }
+               if (pBookmarkId)
+               {
+                       delete pBookmarkId;
+                       pBookmarkId = null;
+               }
        }
 
+       //if(previousSceneId == IDSCN_ADD_BOOKMARK)
+       //      return;
 
-       /*labelString.Append(CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED"));
-       labelString.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
-       labelString.Append(L"(");
-       labelString.Append(__selectedItemCount);
-       labelString.Append(L")");*/
-       labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedItemCount);
+       if(__selectedItemCount >1)
+       {
+               labelString.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __selectedItemCount);
+       }
+       else
+       {
+               labelString.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedItemCount);
+       }
 
        __pInfoLabel->SetText(labelString);
 
@@ -834,11 +894,8 @@ EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const Sc
        {
                __pCheckButton->SetSelected(true);
        }
-       __pInfoPanel->Draw();
-       __pInfoPanel->Show();
-
+       
        Invalidate(true);
-
 }
 
 void
@@ -855,6 +912,7 @@ EditBookmarkListForm::OnFormBackRequested(Form& source)
        if ( __pTimer != NULL)
        {
                __pTimer->Cancel();
+               delete __pTimer;
        }
 
        if (pSceneManager != null)
@@ -943,3 +1001,19 @@ EditBookmarkListForm::OnTimerExpired(Timer&  timer)
                }
        }
 }
+
+void
+EditBookmarkListForm::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;
+               }
+       }
+}