fixed issue 30677
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 74d4079..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";
@@ -129,6 +130,7 @@ static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
 
 MainForm::MainForm(void)
 {
+       __isLongPressedDone = false;
        __pAddressbar = null;
        //      __pMostVisitedSitesPanel = null;
        __pMostVisitedListView = null;
@@ -429,7 +431,7 @@ MainForm::InitWebControl()
        if (__pAddressbar == null || __pFooterPanel == null)
                return E_FAILURE;
 
-       const int Y_WEBCONTROL_POSITION = __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12;
+       const int Y_WEBCONTROL_POSITION = 0;
        __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
        if (__pMostVisitedListView)
        {
@@ -480,7 +482,6 @@ MainForm::InitWebControl()
                __pWebViewer->SetTextSearchListener(this);
        }
 
-       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
        AppLogDebug("MainForm :before return");
        Invalidate(true);
        AppLogDebug("MainForm::InitWebControl Exit");
@@ -547,20 +548,6 @@ MainForm::InitFooter(void)
                return E_FAILURE;
        }
 
-       /*pBackButton = static_cast< Button* >(GetControl(L"IDC_PAGEBACK_BUTTON", true));
-
-       if ( pBackButton == NULL )
-       {
-               return E_FAILURE;
-       }
-
-       pBookmarkButton = static_cast< Button* >(GetControl(L"IDC_BOOKMARK_BUTTON", true));
-
-       if ( pBookmarkButton == NULL )
-       {
-               return E_FAILURE;
-       }*/
-
        __pMoreButton = static_cast<Button*>(GetControl(L"IDC_MORE_BUTTON",true));
 
        if ( __pMoreButton == NULL )
@@ -568,13 +555,6 @@ MainForm::InitFooter(void)
                return E_FAILURE;
        }
 
-       /*__pNewWindowButton = static_cast< Button* >(GetControl(L"IDC_NEW_WINDOW",true));
-
-       if ( __pNewWindowButton == NULL )
-       {
-               return E_FAILURE;
-       }*/
-
        if (__pMultiWindowButton != null)
        {
                Bitmap* pBitmap = null;
@@ -608,40 +588,6 @@ MainForm::InitFooter(void)
                __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
        }
 
-
-       /*if (pBackButton)
-       {
-               Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK);
-               Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK_PRESS);
-               if (pBitmap != null)
-               {
-                       //                      pBitmap->Scale(Dimension(56,56));
-
-                       Point startPoint((pBackButton->GetWidth() - pBitmap->GetWidth())/2,(pBackButton->GetHeight() - pBitmap->GetHeight())/2 );
-                       AppLog("startPoint %d,%d pBitmap width height %d %d",startPoint.x,startPoint.y,pBitmap->GetWidth(),pBitmap->GetHeight());
-                       pBackButton->SetNormalBitmap(startPoint, *pBitmap);
-                       pBackButton->SetPressedBitmap(startPoint, *pPressedBitmap);
-                       delete pBitmap;
-               }
-               pBackButton->AddActionEventListener(*this);
-               pBackButton->SetActionId(IDA_BACKBTN_CLICKED);
-       }*/
-
-       /*if (pBookmarkButton)
-       {
-               Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK);
-               Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK_PRESS);
-               if (pBitmap != null)
-               {
-                       Point startPoint((pBookmarkButton->GetWidth() - pBitmap->GetWidth())/2,(pBookmarkButton->GetHeight() - pBitmap->GetHeight())/2 );
-                       pBookmarkButton->SetNormalBitmap(startPoint, *pBitmap);
-                       pBookmarkButton->SetPressedBitmap(startPoint, *pPressedBitmap);
-                       delete pBitmap;
-               }
-               pBookmarkButton->AddActionEventListener(*this);
-               pBookmarkButton->SetActionId(IDA_BOOKMARKBTN_CLICKED);
-       }*/
-
        if (__pMoreButton)
        {
                Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
@@ -659,48 +605,30 @@ MainForm::InitFooter(void)
        }
 
        //Add the editfield for url
-               __pFooterUrlField =  static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
-               if (__pFooterUrlField == NULL)
-               {
-                       AppLogDebug("__pFooterUrlField Control not found returning E_INVALID_KEY");
-                       return E_INVALID_KEY;
-               }
-
-               __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
-               __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
-               //__pFooterUrlField->AddFocusEventListener(*this);
-               __pFooterUrlField->AddKeypadEventListener(*this);
-
-       /*if (__pNewWindowButton)
+       __pFooterUrlField =  static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
+       if (__pFooterUrlField == NULL)
        {
-               Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW);
-               Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS);
-               if (pBitmap != null)
-               {
-                       Point startPoint((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 );
-                       __pNewWindowButton->SetNormalBitmap(startPoint, *pBitmap);
-                       __pNewWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
-                       delete pBitmap;
-               }
-               __pNewWindowButton->AddActionEventListener(*this);
-               __pNewWindowButton->SetActionId(IDA_NEWWINDOWBTN_CLICKED);
-               __pNewWindowButton->SetEnabled(true);
-               //              __pNewWindowButton->Invalidate(true);
-       }*/
+               return E_INVALID_KEY;
+       }
 
-       AppLog("checkingwindow count %d",MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount());
+       __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
+       __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
+       //__pFooterUrlField->AddFocusEventListener(*this);
+       __pFooterUrlField->AddKeypadEventListener(*this);
 
-       /*if (__pNewWindowButton != null && MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)
+       if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
        {
-               Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTROLBAR_ICON_CREATE_DISABLE);
-               if (pBitmap != null)
-               {
-                       Point startPoint = Point((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 );
-                       __pNewWindowButton->SetDisabledBitmap(startPoint,*pBitmap);
-                       delete pBitmap;
-               }
-               __pNewWindowButton->SetEnabled(false);
-       }*/
+               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
+       }
+       else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+       {
+               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"));
+       }
+       else
+       {
+               //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
+               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
+       }
 
        //Add the go Back Button
        __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
@@ -913,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;
                        }
@@ -938,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);
 
@@ -1265,21 +1192,14 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pMenu->SetShowState(false);
                __pMenu->Invalidate(false);
 
-               /*__adressPanelPosition.y = 0 ;
-
-               if (__pAddressbar != null && __pWebViewer != NULL)
-               {
-                       __webControlPosition.y = __pAddressbar->GetHeight();
-                       //__pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
-                       //__pAddressbar->Invalidate(true);
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
-                       __pWebViewer->Invalidate(true);
-               }*/
+               __pFindWordEditField->SetFocus();
+               /*
                if (__pWebViewer != null)
                {
                        // releasing the set block
                        __pWebViewer->ReleaseBlock();
                }
+               */
                ShowFindWordPanel(true);
        }
        break;
@@ -1462,7 +1382,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
                SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
        }
-               break;
+       break;
        case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
        {
 
@@ -1500,7 +1420,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        }
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
 
-                       if (__pMenu->GetItemCount() == 12)
+                       if (__pMenu->GetItemCount() == 9)
                        {
                                r = __pMenu->SetItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
                        }
@@ -1516,13 +1436,13 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                return ;
                        }
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
-                       if (__pMenu->GetItemCount() != 12)
+                       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)
@@ -1671,6 +1591,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pFindWordEditField->SetText(L"");
                __currentSearchStr = L"aaaaaabbbbbbccccccc";
                StartWordSearch();
+               __currentSearchStr = L"";
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
                __pFindWordPanel->Invalidate(true);
@@ -1829,15 +1750,15 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                if (__pAddressbar != null && __pWebViewer != NULL)
                {
                        __webControlPosition.y = __pAddressbar->GetHeight() - 12;
-                       __pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
-                       __pAddressbar->Invalidate(true);
-                       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12);
+                       //__pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
+                       //__pAddressbar->Invalidate(true);
+                       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
 
-                                       if(__pFooterPanel->GetShowState() == false)
-                                               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12)));
-                                       else
-                                               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-//                     __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
+                       if (__pFooterPanel->GetShowState() == false)
+                               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
+                       else
+                               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
+                       //                      __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
                        __pWebViewer->Invalidate(true);
                }
 
@@ -2061,7 +1982,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
        InitAddressbar();
 
        // hiding the address bar
-//     __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
+       //      __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
        __pAddressbar->SetShowState(false);
        if(__pWebViewer != null)
        {
@@ -2121,7 +2042,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
 
                if (__pAddressbar != null)
                {
-               //      __pAddressbar->UpdateFaviconBitmap(true);
+                       //      __pAddressbar->UpdateFaviconBitmap(true);
                }
 
        }
@@ -2136,7 +2057,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
 
                if (__pAddressbar != null)
                {
-               //      __pAddressbar->UpdateFaviconBitmap(false);
+                       //      __pAddressbar->UpdateFaviconBitmap(false);
                }
        }
 
@@ -2250,38 +2171,41 @@ MainForm::OnLoadingStarted(void)
                        }
                        else if(token.Contains("="))
                        {
-                       String *pKey = new String();
-                       String *pValue = new String();
-                       int index = -1;
-                       token.IndexOf("=", 0, index);
-                       if(index != -1)
-                       {
-                               token.SubString(0, index, *pKey);
-                               token.SubString(index + 1, *pValue);
-                               pMap->Add(pKey, pValue);
+                               String *pKey = new String();
+                               String *pValue = new String();
+                               int index = -1;
+                               token.IndexOf("=", 0, index);
+                               if(index != -1)
+                               {
+                                       token.SubString(0, index, *pKey);
+                                       token.SubString(index + 1, *pValue);
+                                       pMap->Add(pKey, pValue);
+                               }
                        }
                }
-       }
-       if(appId != "")
-       {
-               AppControl *pAppControl = null;
-               String operationId = L"http://tizen.org/appcontrol/operation/main";
-               pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
-               if(pAppControl)
-               {
-                       AppLog("Starting AppControl");
-                       result r = pAppControl->Start(null, null, pMap, null);
-                       AppLog("Result of Start %s", GetErrorMessage(r));
-               }
-               else
+               if(appId != "")
                {
-                       AppLogException("AppControl not found");
+                       AppControl *pAppControl = null;
+                       String operationId = L"http://tizen.org/appcontrol/operation/main";
+                       pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
+                       if(pAppControl)
+                       {
+                               AppLog("Starting AppControl");
+                               result r = pAppControl->Start(null, null, pMap, null);
+                               AppLog("Result of Start %s", GetErrorMessage(r));
+                       }
+                       else
+                       {
+                               AppLogException("AppControl not found");
+                       }
+                       return;
                }
-               return;
-       }
        }
        Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
-       __pAddressbar->SetFaviconBitmap(*pBitmap);
+       if(pBitmap != null)
+       {
+               __pAddressbar->SetFaviconBitmap(*pBitmap);
+       }
        delete pBitmap;
        if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
        {
@@ -2320,11 +2244,9 @@ MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
        AppLog("MainForm::OnKeypadWillOpen");
        if (__pAddressbar != null)
        {
-               OnAddressBarKeypadOpened(*__pAddressbar);
+               OnAddressBarKeypadWillOpen(*__pAddressbar);
        }
 
-       //__pAddressbar->SetAddressbarURLFocus();
-
 }
 
 void
@@ -2332,7 +2254,7 @@ MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
 {
        if(__pAddressbar != null)
        {
-               OnAddressBarKeypadClosed(*__pAddressbar, false);
+               OnAddressBarKeypadOpened(*__pAddressbar);
        }
 }
 
@@ -2347,6 +2269,13 @@ MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
 }
 
 void
+MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
+{
+       AppLog("KeypadBoundsChanged");
+       RelayoutControls(false);
+}
+
+void
 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
                const Tizen::Base::String& reason)
 {
@@ -2479,29 +2408,33 @@ void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
        {
                pFavIconBitmap->GetWidth();
                pFavIconBitmap->GetHeight();
-               AppLog("MainForm::OnFaviconReceived width = %d",pFavIconBitmap->GetWidth());
-               AppLog("MainForm::OnFaviconReceived height = %d",pFavIconBitmap->GetHeight());
        }
 }
 
 void
+MainForm::OnUrlValueChanged(Addressbar&)
+{
+       Invalidate(true);
+}
+
+void
 MainForm::OnUrlSubmitted(Addressbar& addBar)
 {
        AppLog("MainForm::OnUrlSubmitted");
        String url = addBar.GetUrl();
        AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
 
-       LoadUrl(url);
        __pFooterPanel->SetShowState(true);
-       __pFooterPanel->Invalidate(true);
-       RequestRedraw(true);
+//     __pAddressbar->SetShowState(false);
+//     RelayoutControls(false);
+       LoadUrl(url);
 }
 
 void
 MainForm::LoadUrl(String& url)
 {
        String encodedUrl;
-       UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+//     UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
        AppLogDebug("MainForm::LoadUrl enter");
 
        if (__pWebViewer != null)
@@ -2510,7 +2443,7 @@ MainForm::LoadUrl(String& url)
                __pWebViewer->Invalidate(true);
        }
 
-       if (encodedUrl.CompareTo(L"") == 0)
+       if (url.CompareTo(L"") == 0)
        {
                return;
        }
@@ -2534,17 +2467,17 @@ MainForm::LoadUrl(String& url)
        secondRegex.Construct(secondPattern, REGEX_CASELESS);
 
        // Match
-       ret = firstRegex.Match(encodedUrl, false); // This returns true value
-       flag = secondRegex.Match(encodedUrl, false);  // Checks whether URL typed is of type  abc.com (i.e without protocol in front of it)
+       ret = firstRegex.Match(url, false); // This returns true value
+       flag = secondRegex.Match(url, false);  // Checks whether URL typed is of type  abc.com (i.e without protocol in front of it)
 
        if (ret == true && __pWebViewer != null)
        {
-               __pWebViewer->LoadUrl(encodedUrl);
+               __pWebViewer->LoadUrl(url);
        }
        else if(__pWebViewer != null)
        {
                String tempUrl = L"http://";
-               tempUrl.Append(encodedUrl);
+               tempUrl.Append(url);
 
                if (flag == true)
                {
@@ -2552,6 +2485,7 @@ MainForm::LoadUrl(String& url)
                }
                else
                {
+                               UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
                        __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
                }
        }
@@ -2704,44 +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, __pMostVisitedListView->GetHeight()/*GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14*/));
-
-               if (__pMostVisitedListView != null)
-                       __pMostVisitedListView->Invalidate(true);
-       }
-       /*else if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
-       {
-               if (__pWebViewer != null && __pAddressbar != null && __pFooterPanel != null)
-               {
-                       AppLog("MainForm::OnAddressCancelledClicked 2");
-                       r = __pWebViewer->SetBounds(Rectangle(0,0__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, __webControlHeightGetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-                       if (r == E_SUCCESS)
-                       {
-                               AppLog("MainForm::OnAddressCancelledClicked success");
-                       }
-                       else
-                       {
-                               AppLog("MainForm::OnAddressCancelledClicked failure");
-                       }
-               }
-
-               int yOfWebViewer = __pWebViewer->GetY();
-               int heightOfWebViewer = __pWebViewer->GetHeight();
-               AppLog("MainForm::OnAddressCancelledClicked yOfWebViewer is %d",yOfWebViewer);
-               AppLog("MainForm::OnAddressCancelledClicked heightOfWebViewer is %d",heightOfWebViewer);
-
-               __pWebViewer->Invalidate(true);
-       }*/
-
        __pFooterPanel->SetShowState(true);
-       __pFooterPanel->Invalidate(false);
+       RelayoutControls(false);
 }
 
 void
@@ -2751,7 +2650,6 @@ MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
 
        if (__pAddressbar != null)
        {
-               //__curAddressBarMode = __pAddressbar->GetAddressbarMode();
                __curAddressBarMode = GetAddressbarMode();
        }
 
@@ -2774,129 +2672,51 @@ MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
                __adressPanelPosition.y = 0;
                if (__pAddressbar != null)
                {
-
-                       __webControlPosition.y = 0;//__pAddressbar->GetHeight() - 12;
-                       __pAddressbar->SetBounds(Rectangle(0,__pAddressbar->GetY() - __pAddressbar->GetHeight(),GetClientAreaBounds().width,__pAddressbar->GetHeight()));
+                       __webControlPosition.y = 0;
+                       __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
                        __pAddressbar->Invalidate(true);
                }
        }
-       if (__pWebViewer != null)
-       {
-               if(__pFooterPanel->GetShowState() == false)
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12)));
-               else
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-               __pWebViewer->Invalidate(true);
-       }
 }
 
 void
 MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
 {
-
-       if(__pFooterPanel != null)
-       {
-               String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
-               if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
-               {
-                       InitMostVisitedSitesView(GetOrientationStatus());
-               }
-               __pFooterPanel->SetShowState(footerState);
-               __pFooterPanel->Invalidate(false);
-       }
-
-
-
-       //AppLogDebug("MainForm::OnAddressBarKeypadClosed enterd");
-
-       if (__pWebViewer != null && __pFooterPanel != null)
-       {
-               AppLog("MainForm::OnAddressBarKeypadClosed GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-               __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-
-               if(__pFooterPanel->GetShowState() == false)
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
-               else
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-               __pWebViewer->Invalidate(false);
-               //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
-       }
-       if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
-               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
+       __pFooterPanel->SetShowState(true);
+       RelayoutControls(false);
 }
 
 void
 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
 {
-       AppLog("MainForm::OnAddressBarKeypadOpened");
-
-       if (__pFindWordPanel && __pFindWordPanel->GetShowState() == true)
+       if (__pFindWordControl && __pFindWordControl->GetShowState() == true)
        {
                __pAddressbar->SetShowState(false);
-               __pAddressbar->Invalidate(true);
        }
        else
        {
                if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
                {
-               __pAddressbar->SetShowState(true);
-               __pAddressbar->Invalidate(true);
-               __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
-               __pAddressbar->SetAddressbarURLFocus();
+                       __pAddressbar->SetShowState(true);
+                       __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
+                       __pAddressbar->SetAddressbarURLFocus();
                }
        }
 
-       // setting the
-       //__pAddressbar->SetBounds(__pAddressbar->GetX(), 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
-
-
-       if (__pMostVisitedListView && __pMostVisitedListView->GetShowState() == true)
-       {
-               AppLog("MainForm::OnAddressBarKeypadOpened 1");
-               if (__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
-                       __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, /*__pMostVisitedListView->GetHeight()*/GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
-               if(__pMostVisitedListView != null)
-               __pMostVisitedListView->Invalidate(true);
-       }
-       else if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
-       {
-               AppLog("MainForm::OnAddressBarKeypadOpened 2");
-               if (__pWebViewer != null && __pAddressbar != null && __pFooterPanel != null)
-                       __pWebViewer->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, /*__pWebViewer->GetHeight()*/GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
-               if(__pWebViewer != null)
-               __pWebViewer->Invalidate(true);
-       }
-
-       /*else
-               {
-                       if (__pWebViewer != null)
-                       {
-                               __pWebViewer->SetShowState(false);
-                               __pWebViewer->Invalidate(true);
-                       }
-
-                       __pMostVisitedListView->SetShowState(true);
-                       if (__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
-                               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, __pMostVisitedListView->GetHeight()GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
-                       if(__pMostVisitedListView != null)
-                               __pMostVisitedListView->Invalidate(true);
-
-               }*/
-
-
-       __pFooterPanel->SetShowState(false);
-       __pFooterPanel->Invalidate(true);
+       RelayoutControls(false);
 }
 
 void
 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
 {
        __pFooterPanel->SetShowState(false);
-       __pFooterPanel->Invalidate(false);
+}
+
+void
+MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
+{
+       AppLog("KeypadBoundsChanged");
+       RelayoutControls(false);
 }
 
 void
@@ -2913,11 +2733,8 @@ MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
        if (__pAddressbar != null && __pWebViewer != null)
        {
                SetUrl(__pWebViewer->GetUrl());
-               //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
-               //__pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn());
                __pAddressbar->Invalidate(true);
        }
-
 }
 
 void
@@ -2958,12 +2775,10 @@ MainForm::UpdateFavicon(void)
                        {
                                if (__pWindowInfo->pFavicon != NULL)
                                {
-                                       //                      delete __pWindowInfo->pFavicon;
                                        __pWindowInfo->pFavicon = null;
                                }
                                __pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
                                __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
-                               //bool isPrivateBrowsing = __pWebViewer->IsPrivateBrowsingEnabled();
 
                                __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
 
@@ -2975,10 +2790,12 @@ MainForm::UpdateFavicon(void)
                        }
                        else
                        {
-                               __pAddressbar->SetFaviconBitmap(*FaviconManager::GetInstance()->GetDefaultFaviconN());
+                               Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
+                               if(pDefaultBmp != null)
+                               {
+                                       __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
+                               }
                        }
-
-                       AppLogDebug("Favicon download requested: url: %ls", url.ToString().GetPointer());
                }
                delete tempPath;
        }
@@ -2999,8 +2816,7 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
        ShowFindWordPanel(false);
        AppLog("__pAddressbar->GetAddressbarURL() is %ls",__pAddressbar->GetAddressbarURL().GetPointer());
 
-        __pFooterUrlField->SetText(__pAddressbar->GetAddressbarURL());
-        __pFooterPanel->Invalidate(true);
+       __pFooterPanel->Invalidate(true);
 
        Uri uriInfo;
        uriInfo.SetUri(url);
@@ -3051,9 +2867,7 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
                        pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
                        if(pAppControl)
                        {
-                               AppLog("Starting AppControl");
                                result r = pAppControl->Start(null, null, pMap, null);
-                               AppLog("Result of Start %s", GetErrorMessage(r));
                        }
                        else
                        {
@@ -3104,61 +2918,61 @@ MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graph
 {
        AppLog("MainForm::OnWebPageBlockSelected");
        if (__pHitElementResult != null)
-               {
-                       delete __pHitElementResult;
-                       __pHitElementResult = null;
-               }
+       {
+               delete __pHitElementResult;
+               __pHitElementResult = null;
+       }
 
-               if (__pWebViewer != null)
-               {
-                       AppLog("MainForm::OnWebPageBlockSelected web not null");
-                       __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
-               }
+       if (__pWebViewer != null)
+       {
+               AppLog("MainForm::OnWebPageBlockSelected web not null");
+               __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
+       }
 
-               if (__pHitElementResult == null)
-               {
-                       return;
-               }
+       if (__pHitElementResult == null)
+       {
+               return;
+       }
 
-               if (__pHitElementResult->HasImage() != true)
-               {
-                       String tagName = __pHitElementResult->GetTagName();
-                       String type = __pHitElementResult->GetAttributeValue("type");
+       if (__pHitElementResult->HasImage() != true)
+       {
+               String tagName = __pHitElementResult->GetTagName();
+               String type = __pHitElementResult->GetAttributeValue("type");
 
-                       __currentSelectedStr.Clear();
-                       AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
-                       __currentSelectedStr = __pWebViewer->GetTextFromBlock();
-                       AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
+               __currentSelectedStr.Clear();
+               AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
+               __currentSelectedStr = __pWebViewer->GetTextFromBlock();
+               AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
 
-                       if ((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0)
-                       {
-                               AppLog("MainForm::OnWebPageBlockSelected show paste option");
+               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) && __isLongPressedDone == true)
+               {
+                       AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
-                               InitSelectTextContextMenu(endPoint,true);
-                               __pImageMenu->SetShowState(true);
-                               __pImageMenu->Show();
-                               __pImageMenu->Invalidate(true);
-                       }
-                       else /*if (__pHitElementResult->HasUrl() == true )*/
-                       {
-                               AppLog("MainForm::OnWebPageBlockSelected no paste option");
+                       InitSelectTextContextMenu(endPoint,true);
+                       __pImageMenu->SetShowState(true);
+                       __pImageMenu->Show();
+                       __pImageMenu->Invalidate(true);
+               }
+               else if(__isLongPressedDone == true)
+               {
+                       AppLog("MainForm::OnWebPageBlockSelected no paste option");
 
-                               if(__pHitElementResult->GetUrl().GetLength() > 0)
-                               {
-                                       __currentSelectedStr.Clear();
-                                       __currentSelectedStr = __pHitElementResult->GetUrl();
-                               }
-                               InitSelectTextContextMenu(endPoint,false);
-                               __pImageMenu->SetShowState(true);
-                               __pImageMenu->Show();
-                               __pImageMenu->Invalidate(true);
+                       if(__pHitElementResult->GetUrl().GetLength() > 0)
+                       {
+                               __currentSelectedStr.Clear();
+                               __currentSelectedStr = __pHitElementResult->GetUrl();
                        }
-
-                       AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
-                       AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
-                       AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
+                       InitSelectTextContextMenu(endPoint,false);
+                       __pImageMenu->SetShowState(true);
+                       __pImageMenu->Show();
+                       __pImageMenu->Invalidate(true);
                }
 
+               AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
+               AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
+               AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
+       }
+
 }
 
 void
@@ -3209,24 +3023,45 @@ MainForm::OnWebWindowCreateRequested(void)
 void
 MainForm::RelayoutControls(bool showAddressbar)
 {
-       if (showAddressbar == false)
+       __webControlPosition.y = 0;
+       __webControlHeight = GetClientAreaBounds().height;
+       AppLog("Client area height: %d", __webControlHeight);
+
+       AppLog("Client area height: %d", __webControlHeight);
+       if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
        {
-               __pAddressbar->SetShowState(false);
-               __pWebViewer->SetBounds(__pWebViewer->GetX(), 0, __pWebViewer->GetWidth(), __webControlHeight);
-               __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+               __webControlPosition.y += __pAddressbar->GetHeight();
+               __webControlHeight -= __pAddressbar->GetHeight();
+               __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
        }
-       else
+       else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
+       {
+               __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)
+       {
+               __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight);
+               __pWebViewer->Invalidate(false);
+       }
+       if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
        {
-               __pAddressbar->SetShowState(true);
-               __pWebViewer->SetBounds(__pWebViewer->GetX(), __pWebViewer->GetY(), __pWebViewer->GetWidth(), __webControlHeight);
-               __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
        }
-       RequestRedraw(true);
+
+       Invalidate(true);
 }
 
 void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
 {
-       if (__pFindWordPanel == null)
+       if (__pFindWordControl == null)
        {
                return;
        }
@@ -3236,6 +3071,14 @@ void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
                __pFindWordEditField->SetText(__currentSearchStr);
                //__pFindWordCountLabel->SetText(L"");
                __pFindWordCountLabel->SetText(L"0/0");
+               __pFindWordPanel->SetShowState(true);
+       }
+       else
+       {
+               if(__pFindWordControl != null)
+               {
+                       __pFindWordControl->SetShowState(false);
+               }
        }
 
        AppLog("MainForm::ShowFindWordPanel %d",show);
@@ -3253,18 +3096,7 @@ void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
                        __pFindWordEditField->HideKeypad();
        }
 
-       if (__pAddressbar != null)
-       {
-               __pAddressbar->SetBounds(__pAddressbar->GetX(), 0 - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
-               __pAddressbar->SetShowState(false);
-               __pAddressbar->Invalidate(true);
-       }
-       if (__pFindWordPanel != null)
-       {
-               __pFindWordPanel->SetShowState(show);
-               __pFindWordPanel->Invalidate(true);
-       }
-       Invalidate(true);
+       RelayoutControls(false);
 }
 
 void
@@ -3296,9 +3128,9 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
 
        if(totalCount == -1 || totalCount == 0)
        {
-               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),4,__pFindWordCountLabel->GetHeight());
+               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),64,__pFindWordCountLabel->GetHeight());
                __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
-               return;
+//             return;
        }
        else if(totalCount > 100)
        {
@@ -3336,7 +3168,7 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
        countStr.Append(L"/");
        countStr.Append(__maxOccurrances);
        __pFindWordCountLabel->SetText(countStr);
-//     __pFindWordCountLabel->SetShowState(true);
+       //      __pFindWordCountLabel->SetShowState(true);
        __pFindWordCountLabel->Invalidate(false);
 
        //FindNextWord(true);
@@ -3375,7 +3207,7 @@ MainForm::FindNextWord(bool next)
        countStr.Append(L"/");
        countStr.Append(__maxOccurrances);
        __pFindWordCountLabel->SetText(countStr);
-//     __pFindWordCountLabel->SetShowState(true);
+       //      __pFindWordCountLabel->SetShowState(true);
        __pFindWordCountLabel->Invalidate(false);
        if (__currentWordIndex >= __maxOccurrances)
        {
@@ -3402,7 +3234,7 @@ void
 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 {
        AppLog("MainForm::OnWebKeypadWillOpen");
-//     OnAddressBarKeypadOpened(*__pAddressbar);
+       //      OnAddressBarKeypadOpened(*__pAddressbar);
 }
 
 void
@@ -3412,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);
 }
 
@@ -3545,6 +3383,7 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
                }
+               __isLongPressedDone = true;
                __pWebViewer->SetBlockSelectionPosition(currentPosition);
 
 
@@ -3583,11 +3422,20 @@ 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)
        {
-
                widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
        }
        else
@@ -3595,58 +3443,12 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
                widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
        }
 
-       if (__pFindWordPanel != null && __pFindWordPanel->GetShowState() == true)
-       {
-               __pFindWordPanel->SetBounds(0,0,GetClientAreaBounds().width,__pFindWordPanel->GetHeight());
-               __pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight());
-               __pFindWordControl->SetShowState(true);
-               __pFindWordControl->Invalidate(true);
-               __pFindWordPanel->SetShowState(true);
-               __pFindWordPanel->Invalidate(true);
-       }
-
-       if (__pWebViewer != null && __pFooterPanel != null)
-       {
-               AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-               __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-
-               if(__pFooterPanel->GetShowState() == false)
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
-               else
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-               __pWebViewer->Invalidate(true);
-
-               //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
-       }
-       if (__pAddressbar != null)
-       {
-               if(__pAddressbar->GetShowState() == false)
-               {
-                       __pAddressbar->SetBounds(__pAddressbar->GetX(), 0 - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
-               }
-               else
-               {
-                       __pAddressbar->SetBounds(__pAddressbar->GetX(), 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
-               }
-               //__pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
-               //__pAddressbar->SetAddressbarMode(__pAddressbar->GetAddressbarMode());
-               SetAddressbarMode(GetAddressbarMode());
-       //      __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn());
-       }
-       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 /*&& __pFooterPanel->GetShowState() == true*/)
+       if (__pFooterPanel)
        {
                AppLog("__pFooterPanel->GetShowState() is true");
                InitFooter();
+               __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+               __pFooterPanel->Invalidate(true);
        }
        InitAddressbar();
 
@@ -3657,27 +3459,13 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
                __pMenu->Invalidate(true);
        }
 
-       if (__pFooterPanel)
-       {
-               __pFooterPanel->Invalidate(true);
-       }
        String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
        if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
        {
                InitMostVisitedSitesView(orientationStatus);
        }
 
-       if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
-       {
-               if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
-               {
-                       __pMostVisitedListView->SetBounds(__pAddressbar->GetX(),__pAddressbar->GetY()+__pAddressbar->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pAddressbar->GetHeight()- __pFooterPanel->GetHeight());
-               }
-               else if(__pAddressbar != null && __pAddressbar->GetShowState() == false)
-               {
-                       __pMostVisitedListView->SetBounds(__pAddressbar->GetX(),__pAddressbar->GetY()+__pAddressbar->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight());
-               }
-       }
+       RelayoutControls(false);
        if (__pArticleReaderPanel != null)
        {
                if (__pArticleReaderPanel->GetShowState() == true)
@@ -3715,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);
        }
 }
 
@@ -3873,6 +3663,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState());
                ShowFindWordPanel(__pFindWordPanel->GetShowState(), true);
        }
+       __isLongPressedDone = false;
 
        Touch touch;
        IList* pList = null;
@@ -3930,149 +3721,30 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
 void
 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
-       __pWebViewer->ReleaseBlock();
        __currentWordIndex = 0;
-       AppLog("Start MainForm::OnTouchMoved MoveUiControls");
-       if(__pFindWordPanel)
-       {
-               AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState());
-               ShowFindWordPanel(__pFindWordPanel->GetShowState(), true);
-       }
-
-       if (__pFindWordEditField != null)
-       {
-               __pFindWordEditField->HideKeypad();
-       }
-
-       /*if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
-       {
-               return;
-       }*/
-       if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
-       {
-               return;
-       }
-       static int Count=0;
-       Touch touch;
-       IList* pList = null;
-       pList = touch.GetTouchInfoListN(source);
-
-       if (pList != null)
-       {
-               int count = pList->GetCount();
-               if (count == 1)
-               {
-                       AppLogDebug("MainForm::OnTouchMoved count 1");
-                       TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
-
-                       if( pTouchInfo == NULL )
-                       {
-                               return;
-                       }
-                       pTouchInfo->position.y += __pWebViewer->GetY();
-                       AppLog("MainForm::OnTouchMoved MoveUiControls %d,%d",pTouchInfo->position.x,pTouchInfo->position.y);
-
-                       if (__isLoaded == false)
-                               return;
-
-                       __distanceMoved = pTouchInfo->position.y - __touchPoint1.y;
-                       __touchPoint1 = pTouchInfo->position;
-
-                       // move the address bar and web control according to distance moved
-                       MoveUiControls();
-               }
-               else if (count == 2)
-               {
-                       AppLogDebug("MainForm::OnTouchMoved count 2");
-
-                       if(Count == 10)
-                       {
-                               TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
-
-                               if( pTouchInfo == NULL )
-                               {
-                                       return;
-                               }
-                               Point firstPoint = pTouchInfo->position;
-
-                               pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
-                               if( pTouchInfo == NULL )
-                               {
-                                       return;
-                               }
-                               Point secondPoint = pTouchInfo->position;
-
-                               if (__touchPoint1 == Point(-1,-1) || __touchPoint2 == Point(-1,-1))
-                               {
-                                       __touchPoint1 = firstPoint;
-                                       __touchPoint2 = secondPoint;
-                                       delete pList;
-                                       return;
-                               }
-
-                               int currX1 = firstPoint.x;
-                               int currY1 = firstPoint.y;
-                               int currX2 = secondPoint.x;
-                               int currY2 = secondPoint.y;
-
-                               double prevDist = findDistance(__touchPoint1.x,__touchPoint1.y,__touchPoint2.x,__touchPoint2.y);
-                               double dist = findDistance(currX1, currY1, currX2, currY2);
-                               __distanceMoved = prevDist - dist;
-
-                               __touchPoint1 = firstPoint;
-                               __touchPoint2 = secondPoint;
-                               MoveUiControls();
-                               Count = 0;
-                       }
-               }
-               Count++;
-               delete pList;
-       }
+       __isLongPressedDone = false;
 
 }
 
 void
 MainForm::MoveUiControls()
 {
-       if(__pAddressbar == NULL || __pAddressbar->GetShowState() == false)
-       {
-               return;
-       }
-       __adressPanelPosition.y =  __adressPanelPosition.y + __distanceMoved;
-       if (__adressPanelPosition.y > 0)
-       {
-               __adressPanelPosition.y = 0;
-               __webControlPosition.y = __pAddressbar->GetHeight() - 12;
-       }
-       else if (__adressPanelPosition.y < (0-(__pAddressbar->GetHeight() - 12)))  // -12 is for the progress label
-       {
-               __adressPanelPosition.y = 0-(__pAddressbar->GetHeight() - 12);
-               __webControlPosition.y = 0;
-       }
-       else
-       {
-               __webControlPosition.y = __adressPanelPosition.y + (__pAddressbar->GetHeight() - 12);
-       }
-
-       AppLogDebug("__adressPanelPosition.y = %d, __webControlPosition.y = %d", __adressPanelPosition.y, __webControlPosition.y);
-
-       __pAddressbar->SetBounds(0,__adressPanelPosition.y,__pAddressbar->GetWidth(),__pAddressbar->GetHeight());
-       __pAddressbar->Invalidate(false);
-
-       if (__pWebViewer != NULL)
-       {
-               if(__pFooterPanel->GetShowState() == true)
-                       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-               else
-                       __webControlHeight = GetClientAreaBounds().height;
-               __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-               __pWebViewer->Invalidate(false);
-       }
 }
 
 void
 MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
 {
+       if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
+       {
+               if(__pFooterUrlField->GetTextLength() == 0)
+               {
+                       __pFooterUrlField->SetKeypadActionEnabled(false);
+               }
+               else
+               {
+                       __pFooterUrlField->SetKeypadActionEnabled(true);
+               }
+       }
        if (__pFindWordEditField != null)
        {
                __currentSearchStr = __pFindWordEditField->GetText();
@@ -4091,7 +3763,7 @@ MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
        else
        {
                __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
-                               StartWordSearch();
+               StartWordSearch();
                AppLogDebug("Enter something");
        }
 }
@@ -4131,15 +3803,20 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
 
        __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
        __pMostVisitedListView = new(std::nothrow) ListView();
-       if(__pFooterPanel->GetShowState() == false)
+
+       int height = GetClientAreaBounds().height;
+
+       if(__pFooterPanel->GetShowState() == true)
        {
-               r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, GetClientAreaBounds().height),true,false);
+               height = height - __pFooterPanel->GetHeight();
        }
-       else
+       if(__pAddressbar->GetShowState() == true)
        {
-               r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , GetClientAreaBounds().width, __webControlHeight),true,false);
+               height -= __pAddressbar->GetHeight();
        }
 
+       r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
+
        if (r != E_SUCCESS)
        {
                delete __pMostVisitedListView;
@@ -4150,12 +3827,6 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
        __pMostVisitedListView->AddListViewItemEventListener(*this);
        __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RECENTLY_VISITED_SITES"));
        AddControl(*__pMostVisitedListView);
-       AppLog("__pMostVisitedSitesPanel addcontrol %s",GetErrorMessage(r));
-       if(__pFooterPanel->GetShowState() == false)
-               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() + 14));
-       else
-               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
        __pMostVisitedListView->UpdateList();
 
        return E_SUCCESS;
@@ -4357,60 +4028,23 @@ void MainForm::SetAddressbarMode(AddressBarMode addMode)
        break;
        case ADDRESSBAR_MODE_READER:
        {
-               //      __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
-               //      __pSearchLabel->SetShowState(false);
-               //      __pFaviconLabel->SetShowState(true);
-               //      __pCancelBtn->SetShowState(false);
-               //      __pRefreshBtn->SetShowState(false);
                __pStopBtn->SetShowState(false);
-               //      __pReaderBtn->SetShowState(true);
-               //      __pReaderBtn->Invalidate(true);
-               //      __pGoForwardBtn->SetShowState(true);
-               //      __pGoBackBtn->SetShowState(true);
                __pClearBtn->SetShowState(false);
        }
        break;
        case ADDRESSBAR_MODE_LOADING:
        {
-               //      __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
-               //      __pSearchLabel->SetShowState(false);
-               //      __pFaviconLabel->SetShowState(true);
-               //      __pCancelBtn->SetShowState(false);
                __pRefreshBtn->SetShowState(false);
                __pStopBtn->SetShowState(true);
-               //      __pReaderBtn->SetShowState(false);
-               //      __pGoForwardBtn->SetShowState(true);
-               //      __pGoBackBtn->SetShowState(true);
                __pClearBtn->SetShowState(false);
        }
        break;
        case ADDRESSBAR_MODE_LOADING_COMPLETE:
        {
-               //      __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
-               //      __pCancelBtn->SetShowState(false);
-
-               if (__pFooterUrlField && __pFooterUrlField->GetText().IsEmpty() == false)
-               {
-                       //      __pSearchLabel->SetShowState(false);
-                       //      __pFaviconLabel->SetShowState(true);
-               }
-               else
-               {
-                       //      __pSearchLabel->SetShowState(true);
-                       //      __pFaviconLabel->SetShowState(false);
-               }
-
-               if (__pFooterUrlField != NULL)
-               {
-                       __pFooterUrlField->SetText(__displayUrl);
-                       __pFooterUrlField->HideKeypad();
-               }
+//             SetUrl(__pAddressbar->GetUrl());
 
                __pRefreshBtn->SetShowState(true);
                __pStopBtn->SetShowState(false);
-               //      __pReaderBtn->SetShowState(false);
-               //      __pGoForwardBtn->SetShowState(true);
-               //      __pGoBackBtn->SetShowState(true);
                __pClearBtn->SetShowState(false);
        }
        break;
@@ -4435,10 +4069,7 @@ AddressBarMode MainForm::GetAddressbarMode(void)
 
 void MainForm::SetUrl(const String& url)
 {
-
        __displayUrl = url;
-       String updatedDisplayUrl;
-       updatedDisplayUrl.Clear();
 
        if (__pFooterUrlField != NULL)
        {
@@ -4446,16 +4077,18 @@ void MainForm::SetUrl(const String& url)
                if (removedHttpUrl.IsEmpty() == false)
                {
                        __pFooterUrlField->SetText(removedHttpUrl);
+                       __pAddressbar->SetUrl(__displayUrl);
                }
                else
                {
                        __pFooterUrlField->SetText(__displayUrl);
+                       __pAddressbar->SetUrl(__displayUrl);
                }
 
                __pFooterUrlField->Invalidate(false);
+               __pAddressbar->Invalidate(true);
                __pFooterUrlField->SetCursorPosition(0);
        }
-
 }
 
 String