fixed issue 30677
[apps/osp/Internet.git] / src / IntMainForm.cpp
index a5868d8..5672b5f 100644 (file)
@@ -53,6 +53,7 @@ using namespace Tizen::Web;
 using namespace Tizen::Web::Controls;
 
 static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
+static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
 static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
 static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
@@ -840,10 +841,9 @@ MainForm::InitFindWordPanel(void)
                AppLogDebug("Findword panel already initialized");
                if (__pFindWordBgLabel != null)
                {
-                       Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+                       Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
                        if (pBitmap != null)
                        {
-                               AppLogDebug("InitFindWordPanel: Coming here");
                                __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
                                delete pBitmap;
                        }
@@ -865,9 +865,9 @@ MainForm::InitFindWordPanel(void)
                AppLogException("There is some problem in the xml file. Please check.");
                return E_FAILURE;
        }
-       __pFindWordPanel->AddControl(*__pFindWordControl);
+       AddControl(*__pFindWordControl);
        __pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight());
-       SetControlAlwaysOnTop(*__pFindWordPanel,true);
+       SetControlAlwaysOnTop(*__pFindWordControl,true);
        __pFindWordPanel->SetShowState(false);
        __pFindWordPanel->Invalidate(false);
 
@@ -1193,11 +1193,13 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pMenu->Invalidate(false);
 
                __pFindWordEditField->SetFocus();
+               /*
                if (__pWebViewer != null)
                {
                        // releasing the set block
                        __pWebViewer->ReleaseBlock();
                }
+               */
                ShowFindWordPanel(true);
        }
        break;
@@ -1434,13 +1436,13 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                return ;
                        }
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
-                       if (__pMenu->GetItemCount() != 9)
+                       if (__pMenu->GetItemCount() != 8)
                        {
                                __pMenu->InsertItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADDTOBOOKMARK_CLICKED);
 
-                               __pMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
-                               __pMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
-                               __pMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
+//                             __pMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
+                               __pMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
+                               __pMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
                                __pMenu->SetMaxVisibleItemsCount(6);
                        }
                        if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
@@ -2636,21 +2638,9 @@ MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
 {
        result r = E_SUCCESS;
        // hiding the address bar
-       __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
        __pAddressbar->SetShowState(false);
-
-       if (__pMostVisitedListView != null && __pMostVisitedListView->GetShowState() == true)
-       {
-               AppLog("MainForm::OnAddressCancelledClicked 1");
-               if (__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
-                       __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
-
-               if (__pMostVisitedListView != null)
-                       __pMostVisitedListView->Invalidate(true);
-       }
-
        __pFooterPanel->SetShowState(true);
-       __pFooterPanel->Invalidate(false);
+       RelayoutControls(false);
 }
 
 void
@@ -2699,7 +2689,7 @@ MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
 void
 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
 {
-       if (__pFindWordPanel && __pFindWordPanel->GetShowState() == true)
+       if (__pFindWordControl && __pFindWordControl->GetShowState() == true)
        {
                __pAddressbar->SetShowState(false);
        }
@@ -3035,22 +3025,26 @@ MainForm::RelayoutControls(bool showAddressbar)
 {
        __webControlPosition.y = 0;
        __webControlHeight = GetClientAreaBounds().height;
+       AppLog("Client area height: %d", __webControlHeight);
 
        AppLog("Client area height: %d", __webControlHeight);
        if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
        {
                __webControlPosition.y += __pAddressbar->GetHeight();
                __webControlHeight -= __pAddressbar->GetHeight();
+               __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
        }
-       else if(__pFindWordPanel != null && __pFindWordPanel->GetShowState() == true)
+       else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
        {
-               __webControlPosition.y += __pFindWordPanel->GetHeight();
-               __webControlHeight -= __pFindWordPanel->GetHeight();
+               __webControlPosition.y += __pFindWordControl->GetHeight();
+               __webControlHeight -= __pFindWordControl->GetHeight();
+               __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
        }
 
        if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true)
        {
                __webControlHeight -= __pFooterPanel->GetHeight();
+               __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
        }
        if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
        {
@@ -3058,14 +3052,16 @@ MainForm::RelayoutControls(bool showAddressbar)
                __pWebViewer->Invalidate(false);
        }
        if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
+       {
                __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
+       }
 
        Invalidate(true);
 }
 
 void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
 {
-       if (__pFindWordPanel == null)
+       if (__pFindWordControl == null)
        {
                return;
        }
@@ -3079,9 +3075,9 @@ void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
        }
        else
        {
-               if(__pFindWordPanel != null)
+               if(__pFindWordControl != null)
                {
-                       __pFindWordPanel->SetShowState(false);
+                       __pFindWordControl->SetShowState(false);
                }
        }
 
@@ -3248,18 +3244,24 @@ MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
        if (__pWebViewer != null && __pFooterPanel != null)
        {
                AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-
-               //              __pFooterPanel->SetShowState(false);
-               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
-
-
-               //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
+               if(__pAddressbar != null)
+               {
+                       __pAddressbar->SetShowState(false);
+               }
+               if(__pFindWordControl != null)
+               {
+                       __pFindWordControl->SetShowState(false);
+               }
+               __pFooterPanel->SetShowState(false);
+               __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
        }
+       Invalidate(true);
 }
 
 void
 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
 {
+       __pFooterPanel->SetShowState(true);
        OnAddressBarKeypadClosed(*__pAddressbar);
 }
 
@@ -3420,6 +3422,16 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
                delete pBitmap;
        }
 
+       if (__pFindWordBgLabel != null)
+       {
+               Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+               if (pBitmap != null)
+               {
+                       __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
+                       delete pBitmap;
+               }
+       }
+
        if(__pMenu != null)
                __pMenu->SetShowState(false);
        if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
@@ -3431,16 +3443,6 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
                widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
        }
 
-       if (__pFindWordBgLabel != null)
-       {
-               //              __pFindWordBgLabel->SetSize(GetClientAreaBounds().width,GetClientAreaBounds().height);
-               Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
-               if (pBitmap != null)
-               {
-                       __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
-                       delete pBitmap;
-               }
-       }
        if (__pFooterPanel)
        {
                AppLog("__pFooterPanel->GetShowState() is true");
@@ -3501,9 +3503,11 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
                }
        }
        Invalidate(true);
-       if(__pAddressbar != null)
+       
+    if (__pAddressbar != null)
        {
-               __pAddressbar->OrientationChanged();
+               int width = GetClientAreaBounds().width;
+               __pAddressbar->OrientationChanged(width);
        }
 }