fixed issue 30677
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 9c3e043..5672b5f 100644 (file)
@@ -52,6 +52,8 @@ using namespace Tizen::System;
 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";
@@ -67,6 +69,8 @@ static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.
 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
 static const wchar_t* IDS_APPID = L"AppID";
+static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
+static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
 
 const int IDA_BACKBTN_CLICKED = 101;
 const int IDA_BOOKMARKBTN_CLICKED = 102;
@@ -83,6 +87,13 @@ const int IDA_READER_CLOSE_CLICKED = 112;
 const int IDA_SMALLFONT_BTN_CLICKED = 113;
 const int IDA_LARGEFONT_BTN_CLICKED = 114;
 const int IDA_BRIGHTNESS_BTN_CLICKED = 115;
+const int IDA_HISTORY_CLICKED = 116;
+const int IDA_ADD_TO_BOOKMARKBTN_CLICKED = 117;
+const int IDA_ADD_TO_HOME_CLICKED = 118;
+const int IDA_SAVED_PAGES_CLICKED = 119;
+const int IDA_DESKTOP_VIEW_CLICKED = 120;
+const int IDA_SAVE_CLICKED = 121;
+
 const int IDA_FINDWORD_SEARCH_CLICKED = 201;
 const int IDA_FINDWORD_NEXT_CLICKED = 202;
 const int IDA_FINDWORD_PREV_CLICKED = 203;
@@ -98,6 +109,13 @@ const int IDA_COPY_TEXT_CLICKED = 210;
 const int IDA_PASTE_TEXT_CLICKED = 211;
 const int IDA_FIND_TEXT__CLICKED = 212;
 const int IDA_SHARE_TEXT_CLICKED = 213;
+
+const int IDA_GO_BACK = 214;
+const int IDA_GO_FORWARD = 215;
+const int IDA_REFRESH_BTN_CLICKED = 216;
+const int IDA_STOP_BTN_CLICKED = 217;
+const int IDA_CLEAR_URL = 218;
+
 const int DEFAULT_PROGRESS_PERCENTAGE = 10;
 
 const int MainForm::IDA_FORMAT_BITMAP = 500;
@@ -112,6 +130,7 @@ static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
 
 MainForm::MainForm(void)
 {
+       __isLongPressedDone = false;
        __pAddressbar = null;
        //      __pMostVisitedSitesPanel = null;
        __pMostVisitedListView = null;
@@ -131,6 +150,9 @@ MainForm::MainForm(void)
        __pFindWordPrev = null;
        __previousZoomLevel = 1.0;
        __pSaveImage = null;
+       __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
+       __displayUrl = L"";
+       __editTextUrl = L"";
        __currentSearchStr = L"";
        __currentSelectedStr = L"";
        __maxOccurrances = 0;
@@ -138,6 +160,9 @@ MainForm::MainForm(void)
        __distanceMoved = 0;
        __isLoaded = false;
        __inputEventToBeSupressed = false;
+       __isLoadingData = false;
+       __isLoadingCompleted = false;
+       __progressPercentage = 0;
        __touchPoint1 = Point(-1,-1);
        __touchPoint2 = Point(-1,-1);
        __pWebReader = null;
@@ -145,7 +170,7 @@ MainForm::MainForm(void)
        __pReaderData = null;
        __pPopUp = null;
        __pReaderCloseBtn = null;
-       __pNewWindowButton = null;
+       //__pNewWindowButton = null;
        __pMoreButton = null;
        __pMultiWindowButton = null;
        __pArticleReaderPanel = null;
@@ -155,6 +180,14 @@ MainForm::MainForm(void)
        __prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
        __curAddressBarMode = ADDRESSBAR_MODE_INVALID;
        __pMostVisitedSites = null;
+       __pFooterUrlField = null;
+       __pGoBackBtn = null;
+       __pGoForwardBtn = null;
+       __pRefreshBtn = null;
+       __pProgressbarLabel = null;
+       __pFooterLabel = null;
+       __pStopBtn = null;
+       __pClearBtn = null;
 }
 
 MainForm::~MainForm(void)
@@ -204,6 +237,8 @@ MainForm::Initialize(void)
 result
 MainForm::OnInitializing(void)
 {
+       AppLog("get client area width = %d",GetClientAreaBounds().width);
+       AppLog("get client area height = %d",GetClientAreaBounds().height);
        const int WIDTH_CONTEXT_MENU_BUTTON = 336;
        const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
 
@@ -244,6 +279,26 @@ MainForm::OnInitializing(void)
                delete pBitmapPressed;
        }
 
+       __pItemContextLandscape= new(std::nothrow) ListContextItem();
+       __pItemContextLandscape->Construct();
+       pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE,HEIGHT_CONTEXT_MENU_BUTTON);
+       pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE, HEIGHT_CONTEXT_MENU_BUTTON);
+
+       if (pBitmapNormal != null && pBitmapPressed != null)
+       {
+               __pItemContextLandscape->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed);
+       }
+
+       if (pBitmapNormal != null)
+       {
+               delete pBitmapNormal;
+       }
+
+       if (pBitmapPressed != null)
+       {
+               delete pBitmapPressed;
+       }
+
        return E_SUCCESS;
 }
 
@@ -376,8 +431,8 @@ MainForm::InitWebControl()
        if (__pAddressbar == null || __pFooterPanel == null)
                return E_FAILURE;
 
-       const int Y_WEBCONTROL_POSITION = __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12;
-       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - Y_WEBCONTROL_POSITION;
+       const int Y_WEBCONTROL_POSITION = 0;
+       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
        if (__pMostVisitedListView)
        {
                __pMostVisitedListView->SetShowState(false);
@@ -427,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");
@@ -474,23 +528,22 @@ MainForm::InitFooter(void)
 
        SetControlAlwaysOnTop(*__pFooterPanel, true);
 
-       __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
-
-       if ( __pMultiWindowButton == NULL )
+       __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
+       if ( __pFooterLabel == NULL )
        {
                return E_FAILURE;
        }
-
-       pBackButton = static_cast< Button* >(GetControl(L"IDC_PAGEBACK_BUTTON", true));
-
-       if ( pBackButton == NULL )
+       //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
+       Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
+       if (pBitmap != null)
        {
-               return E_FAILURE;
+               __pFooterLabel->SetBackgroundBitmap(*pBitmap);
+               delete pBitmap;
        }
 
-       pBookmarkButton = static_cast< Button* >(GetControl(L"IDC_BOOKMARK_BUTTON", true));
+       __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
 
-       if ( pBookmarkButton == NULL )
+       if ( __pMultiWindowButton == NULL )
        {
                return E_FAILURE;
        }
@@ -502,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;
@@ -542,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);
@@ -590,40 +602,94 @@ MainForm::InitFooter(void)
                }
                __pMoreButton->AddActionEventListener(*this);
                __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
+       }
 
+       //Add the editfield for url
+       __pFooterUrlField =  static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
+       if (__pFooterUrlField == NULL)
+       {
+               return E_INVALID_KEY;
        }
 
+       __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
+       __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
+       //__pFooterUrlField->AddFocusEventListener(*this);
+       __pFooterUrlField->AddKeypadEventListener(*this);
 
-       if (__pNewWindowButton)
+       if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
        {
-               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);
+               __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"));
        }
 
-       AppLog("checkingwindow count %d",MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount());
+       //Add the go Back Button
+       __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
+       if (__pGoBackBtn == NULL)
+       {
+               AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
+       }
+       __pGoBackBtn->SetActionId(IDA_GO_BACK);
+       __pGoBackBtn->AddActionEventListener(*this);
 
-       if (__pNewWindowButton != null && MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)
+       //Add the go forward Button
+       __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
+       if (__pGoForwardBtn == NULL)
        {
-               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);
+               AppLogDebug("Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
+       }
+       __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
+       __pGoForwardBtn->AddActionEventListener(*this);
+       __pGoForwardBtn->SetEnabled(false);
+
+       __pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
+       if (__pRefreshBtn == NULL)
+       {
+               AppLogDebug("Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
+       }
+
+       __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
+       __pRefreshBtn->AddActionEventListener(*this);
+       __pRefreshBtn->SetShowState(true);
+
+       //Add the backround label for displaying progressbar
+       __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
+       if (__pProgressbarLabel == NULL)
+       {
+               AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
+       }
+       __pProgressbarLabel->SetShowState(false);
+
+       __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
+       if (__pStopBtn == NULL)
+       {
+               AppLogDebug("Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
        }
+       __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
+       __pStopBtn->AddActionEventListener(*this);
+       __pStopBtn->SetShowState(false);
+
+       __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
+       if (__pClearBtn == NULL)
+       {
+               AppLogDebug("Control not found returning E_INVALID_KEY");
+               return E_INVALID_KEY;
+       }
+       __pClearBtn->SetActionId(IDA_CLEAR_URL);
+       __pClearBtn->AddActionEventListener(*this);
+       __pClearBtn->SetShowState(false);
 
        //      __pFooterPanel->Invalidate(true);
        AppLogDebug("MainForm::InitFooter exit");
@@ -661,14 +727,19 @@ MainForm::InitContextMenu(Point& p)
                pBitmap  = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
        }
 
+       r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
+
        if ( pBitmap != NULL)
        {
                __pMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"), IDA_PRIVATEON_CLICKED,*pBitmap);
                delete pBitmap;
        }
+       r = __pMenu->AddItem(L"History"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_HISTORY_CLICKED);
        r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
        r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
-       __pMenu->SetMaxVisibleItemsCount(3);
+
+
+       __pMenu->SetMaxVisibleItemsCount(6);
        __pMenu->SetShowState(false);
        __pMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pMenu, true);
@@ -770,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;
                        }
@@ -795,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);
 
@@ -932,17 +1002,14 @@ MainForm::CreateItem (int index, int itemWidth)
                return NULL;
        }
 
-       if (pHistory->GetFaviconId().GetLength() > 0)
-       {
-               String bitmapId = pHistory->GetFaviconId();
-               Bitmap* pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId);
 
-               if ( pBitmap != NULL)
-               {
-                       pListIconImage = new Bitmap();
-                       pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
-                       delete pBitmap;
-               }
+       Bitmap* pBitmap = pHistory->GetFavIconBitmap();
+
+       if ( pBitmap != NULL)
+       {
+               pListIconImage = new Bitmap();
+               pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
+               delete pBitmap;
        }
 
        if(pListIconImage == null)
@@ -980,11 +1047,24 @@ MainForm::CreateItem (int index, int itemWidth)
        }
 
 
-       if ( __pItemContext!= NULL)
+       if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
        {
-               if (pItem != null)
+               if ( __pItemContext!= NULL)
+               {
+                       if (pItem != null)
+                       {
+                               pItem->SetContextItem(__pItemContext);
+                       }
+               }
+       }
+       else
+       {
+               if ( __pItemContextLandscape!= NULL)
                {
-                       pItem->SetContextItem(__pItemContext);
+                       if (pItem != null)
+                       {
+                               pItem->SetContextItem(__pItemContextLandscape);
+                       }
                }
        }
        if( pListIconImage != NULL)
@@ -1053,6 +1133,10 @@ MainForm::OnTerminating(void)
        {
                delete __pItemContext;
        }
+       if(__pItemContextLandscape)
+       {
+               delete __pItemContextLandscape;
+       }
        return r;
 }
 
@@ -1108,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() - 12;
-                       __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;
@@ -1249,13 +1326,18 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 
                                pBookmark->SetBookmarkTitle(title);
                                pBookmark->SetUrl(url);
+                               if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
+                               {
+                                       pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
+                               }
                                String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
                                pBookmark->SetFaviconId(id);
-                               r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
+                               //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
+                               r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
                                delete pBookmark;
 
                                NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
-                               if(pNotification != null)
+                               if (pNotification != null)
                                {
                                        pNotification->SetText(message);
                                        pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
@@ -1265,7 +1347,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        }
                        if (pBitmap != null)
                        {
-                               r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+                               r = __pMenu->SetItemAt(0,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
                                delete pBitmap;
                        }
                }
@@ -1296,18 +1378,23 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        }
        break;
        case IDA_BOOKMARKBTN_CLICKED:
-
+       {
                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:
+       {
 
+       }
+       break;
        case IDA_MOREBTN_CLICKED:
        {
                AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 1");
                Point p = Point(__pMoreButton->GetX() + __pMoreButton->GetWidth() / 2, GetClientAreaBounds().y + GetClientAreaBounds().height - __pMoreButton->GetHeight());
                AppLog("Anchot pos: %d %d", p.x, p.y);
                InitContextMenu(p);
-               if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
+               if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
                {
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 2");
                        int bookmarkCount=0;
@@ -1333,13 +1420,13 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        }
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
 
-                       if (__pMenu->GetItemCount() == 6)
+                       if (__pMenu->GetItemCount() == 9)
                        {
-                               r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+                               r = __pMenu->SetItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
                        }
                        else
                        {
-                               r = __pMenu->InsertItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+                               r = __pMenu->InsertItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
                        }
 
                        if (IsFailed(r))
@@ -1349,10 +1436,13 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                return ;
                        }
                        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
-                       if (__pMenu->GetItemCount() != 6)
+                       if (__pMenu->GetItemCount() != 8)
                        {
-                               __pMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
-                               __pMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
+                               __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(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)
@@ -1374,9 +1464,28 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pMenu->Invalidate(true);
                __pMenu->Show();
        }
+       break;
+       case IDA_HISTORY_CLICKED:
+       {
+               AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
+               SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+       }
+       break;
+       case IDA_SAVED_PAGES_CLICKED:
+       {
+
+       }
+       break;
+       case IDA_DESKTOP_VIEW_CLICKED:
+       {
 
+       }
        break;
+       case IDA_SAVE_CLICKED:
+       {
 
+       }
+       break;
        case IDA_MULTIWINDOWBTN_CLICKED:
        {
                result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
@@ -1445,8 +1554,9 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        __pBlankPanel = null;
                        __pArticleReaderLabel = null;
                }
-               if (__pAddressbar)
-                       __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+               //if (__pAddressbar)
+               //      __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+               SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
        }
        break;
        case IDA_FINDWORD_CANCEL_CLICKED:
@@ -1481,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);
@@ -1639,9 +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);
-                       __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
+                       //__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));
                        __pWebViewer->Invalidate(true);
                }
 
@@ -1724,13 +1841,27 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                if (pString != null)
                {
                        String idElement = __pHitElementResult->GetAttributeValue(L"id");
+                       String nameElement = __pHitElementResult->GetAttributeValue(L"name");
                        AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
-                       String script = L"function insertAtCursor(myField, myValue) {   if (document.selection) {               myField.focus();                sel = document.selection.createRange();                 sel.text = myValue;     }               else if (myField.selectionStart || myField.selectionStart == '0'){              var startPos = myField.selectionStart;          var endPos = myField.selectionEnd;              myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);          } else {                        myField.value += myValue;               }       } insertAtCursor(";
-                       script.Append(idElement);
-                       script.Append(",");
-                       script.Append("\"");
-                       script.Append(*pString);
-                       script.Append("\");");
+                       String script = L"function insertAtCursor(myField, myValue) {   if (document.selection) {               myField.focus();                sel = document.selection.createRange();                 sel.text = myValue;     }               else if (myField.selectionStart || myField.selectionStart == '0'){              var startPos = myField.selectionStart;          var endPos = myField.selectionEnd;              myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);          } else {                        myField.value += myValue;               }       } ";
+                       if(idElement.GetLength() != 0)
+                       {
+                               script.Append("insertAtCursor(");
+                               script.Append(idElement);
+                               script.Append(",");
+                               script.Append("\"");
+                               script.Append(*pString);
+                               script.Append("\");");
+                       }
+                       else if (nameElement.GetLength() != 0)
+                       {
+                               script.Append("insertAtCursor(document.getElementsByName('");
+                               script.Append(nameElement);
+                               script.Append("')[0],");
+                               script.Append("\"");
+                               script.Append(*pString);
+                               script.Append("\");");
+                       }
                        AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
                        String* pStr = __pWebViewer->EvaluateJavascriptN(script);
                        delete pStr;
@@ -1738,6 +1869,59 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                delete pItem;
        }
        break;
+       case IDA_GO_BACK:
+       {
+               OnBackClicked();
+       }
+       break;
+       case IDA_GO_FORWARD:
+       {
+               OnForwardClicked();
+       }
+       break;
+       case IDA_REFRESH_BTN_CLICKED:
+       {
+               __isLoadingCompleted = false;
+               __isLoadingData = true;
+               __progressPercentage = 0;
+               __displayUrl = __pFooterUrlField->GetText();
+
+               String url = __pFooterUrlField->GetText();
+               AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
+               LoadUrl(url);
+
+               //OnUrlSubmitted();
+               UpdateProgressBitmap();
+       }
+       break;
+       case IDA_STOP_BTN_CLICKED:
+       {
+               __isLoadingCompleted = false;
+               __isLoadingData = false;
+               __progressPercentage = 0;
+               __pFooterUrlField->HideKeypad();
+               __displayUrl = __pFooterUrlField->GetText();
+
+               if (__pWebViewer)
+               {
+                       //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+                       SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+                       __pWebViewer->StopLoading();
+                       RequestRedraw(true);
+               }
+
+               UpdateProgressBitmap();
+       }
+       break;
+       case IDA_CLEAR_URL:
+       {
+               if (__pFooterUrlField->GetText().IsEmpty() == false)
+               {
+                       //__displayUrl = __pUrlField->GetText();
+                       __pFooterUrlField->Clear();
+               }
+       }
+       break;
        default:
                break;
        }
@@ -1797,6 +1981,9 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
        InitFooter();
        InitAddressbar();
 
+       // hiding the address bar
+       //      __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
+       __pAddressbar->SetShowState(false);
        if(__pWebViewer != null)
        {
                __pWebViewer->Resume();
@@ -1834,7 +2021,8 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                if (pBookmarkUrl == null)
                        return;
                AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
-               __pAddressbar->SetUrl(*pBookmarkUrl);
+               //__pAddressbar->SetUrl(*pBookmarkUrl);
+               SetUrl(*pBookmarkUrl);
 
                if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
                        __pWebViewer->LoadUrl(*pBookmarkUrl);
@@ -1854,7 +2042,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
 
                if (__pAddressbar != null)
                {
-                       __pAddressbar->UpdateFaviconBitmap(true);
+                       //      __pAddressbar->UpdateFaviconBitmap(true);
                }
 
        }
@@ -1869,7 +2057,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
 
                if (__pAddressbar != null)
                {
-                       __pAddressbar->UpdateFaviconBitmap(false);
+                       //      __pAddressbar->UpdateFaviconBitmap(false);
                }
        }
 
@@ -1983,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))
        {
@@ -2024,11 +2215,13 @@ MainForm::OnLoadingStarted(void)
                MoveUiControls();
        }
 
-       __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+       //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+       SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
        if (__pWebViewer)
        {
                AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
-               __pAddressbar->SetUrl(__pWebViewer->GetUrl());
+               //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
+               SetUrl(__pWebViewer->GetUrl());
                if (__pWindowInfo != NULL)
                {
                        __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
@@ -2048,21 +2241,41 @@ MainForm::OnLoadingCanceled(void)
 void
 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
 {
+       AppLog("MainForm::OnKeypadWillOpen");
+       if (__pAddressbar != null)
+       {
+               OnAddressBarKeypadWillOpen(*__pAddressbar);
+       }
+
+}
+
+void
+MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
+{
        if(__pAddressbar != null)
        {
                OnAddressBarKeypadOpened(*__pAddressbar);
        }
 }
 
+
 void
-MainForm::OnKeypadClosed(Tizen::Ui::Control& source){
-       if(__pAddressbar != null)
+MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
+{
+       if (__pAddressbar != null)
        {
                OnAddressBarKeypadClosed(*__pAddressbar);
        }
 }
 
 void
+MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
+{
+       AppLog("KeypadBoundsChanged");
+       RelayoutControls(false);
+}
+
+void
 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
                const Tizen::Base::String& reason)
 {
@@ -2072,6 +2285,7 @@ MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
 void
 MainForm::OnLoadingCompleted(void)
 {
+       AppLog("MainForm::OnLoadingCompleted start");
        DateTime date;
        result r = E_SUCCESS;
 
@@ -2086,26 +2300,27 @@ MainForm::OnLoadingCompleted(void)
        }
        if (__pWebViewer->CanGoForward())
        {
-               __pAddressbar->SetForwardButtonEnabled(true);
+               //__pAddressbar->SetForwardButtonEnabled(true);
+               SetForwardButtonEnabled(true);
        }
        else
        {
-               __pAddressbar->SetForwardButtonEnabled(false);
+               //__pAddressbar->SetForwardButtonEnabled(false);
+               SetForwardButtonEnabled(false);
        }
 
-       if (__pWebViewer->CanGoBack())
-       {
-               __pAddressbar->SetBackButtonEnabled(true);
-       }
-       else
-       {
-               __pAddressbar->SetBackButtonEnabled(false);
-       }
-       if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
+       /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
        {
                __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
 
-               __pAddressbar->UpdateProgress(0);
+               //__pAddressbar->UpdateProgress(0);
+               UpdateProgress(0);
+       }*/
+
+       if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
+       {
+               SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+               UpdateProgress(0);
        }
 
        AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
@@ -2124,10 +2339,25 @@ MainForm::OnLoadingCompleted(void)
                        AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
                }
                pHistory->SetVisitedTime(date);
-               String id = "";
+               /*String id = "";
                if(__pWindowInfo)
                        id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
-               pHistory->SetFaviconId(id);
+               pHistory->SetFaviconId(id);*/
+
+               if (__pWebViewer != null)
+               {
+                       AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
+
+                       Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
+                       if (pTempBitmap != null)
+                       {
+                               AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
+                               pHistory->SetFavIconBitmap(*pTempBitmap);
+                       }
+
+                       AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
+               }
+
                Canvas* pCanvas = __pWebViewer->GetCanvasN();
                Bitmap* pBitmap = new(std::nothrow) Bitmap();
                if ( pCanvas != null &&  pCanvas != null && pBitmap != null)
@@ -2136,7 +2366,14 @@ MainForm::OnLoadingCompleted(void)
                        pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
                        pHistory->SetThumbnail(pBitmap);
                }
-               HistoryPresentationModel::GetInstance()->SaveHistory(*pHistory);
+               Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
+               if(pFavIcon)
+               {
+                       pHistory->SetFavIconBitmap(*pFavIcon);
+                       delete pFavIcon;
+               }
+
+               HistoryPresentationModel::GetInstance()->SaveTempHistory(*pHistory);
                delete pHistory;
        }
        else
@@ -2148,6 +2385,7 @@ MainForm::OnLoadingCompleted(void)
                // temperary fixed (webpage can be not loaded)
                UpdateFavicon();
        }
+       AppLog("MainForm::OnLoadingCompleted done");
 }
 
 void
@@ -2156,25 +2394,55 @@ MainForm::OnEstimatedProgress(int progress)
        AppLogDebug("MainForm::OnEstimatedProgress entered");
        if (progress < DEFAULT_PROGRESS_PERCENTAGE)
                progress = DEFAULT_PROGRESS_PERCENTAGE;
-       if(__pAddressbar)
-               __pAddressbar->UpdateProgress(progress);
+       //if(__pAddressbar)
+       //      __pAddressbar->UpdateProgress(progress);
+       UpdateProgress(progress);
 }
 
-void
-MainForm::OnUrlSubmitted(Addressbar& addBar)
+void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
 {
-       String url = addBar.GetUrl();
-       LoadUrl(url);
-       __pFooterPanel->SetShowState(true);
-       __pFooterPanel->Invalidate(true);
-       RequestRedraw(true);
+       AppLog("MainForm::OnFaviconReceived");
+       Bitmap* pFavIconBitmap = __pWebViewer->GetFaviconN();
+
+       if (pFavIconBitmap != null)
+       {
+               pFavIconBitmap->GetWidth();
+               pFavIconBitmap->GetHeight();
+       }
 }
 
 void
-MainForm::LoadUrl(String& url)
+MainForm::OnUrlValueChanged(Addressbar&)
 {
-       AppLogDebug("MainForm::LoadUrl enter");
-
+       Invalidate(true);
+}
+
+void
+MainForm::OnUrlSubmitted(Addressbar& addBar)
+{
+       AppLog("MainForm::OnUrlSubmitted");
+       String url = addBar.GetUrl();
+       AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
+
+       __pFooterPanel->SetShowState(true);
+//     __pAddressbar->SetShowState(false);
+//     RelayoutControls(false);
+       LoadUrl(url);
+}
+
+void
+MainForm::LoadUrl(String& url)
+{
+       String encodedUrl;
+//     UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+       AppLogDebug("MainForm::LoadUrl enter");
+
+       if (__pWebViewer != null)
+       {
+               __pWebViewer->SetShowState(true);
+               __pWebViewer->Invalidate(true);
+       }
+
        if (url.CompareTo(L"") == 0)
        {
                return;
@@ -2217,12 +2485,14 @@ MainForm::LoadUrl(String& url)
                }
                else
                {
-                       __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(url));
+                               UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+                       __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
                }
        }
        if (__pAddressbar != null)
        {
-               __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+               //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+               SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
        }
 
        AppLogDebug("MainForm::LoadUrl exit");
@@ -2237,7 +2507,8 @@ MainForm::OnStopClicked(Addressbar& addBar)
        AppLogDebug("MainForm::OnStopClicked called");
        if (__pWebViewer)
        {
-               __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+               //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+               SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
                __pWebViewer->StopLoading();
                RequestRedraw(true);
        }
@@ -2325,21 +2596,34 @@ MainForm::OnReaderClicked(const Addressbar& addBar)
 }
 
 void
-MainForm::OnBackClicked(const Addressbar& addBar)
+MainForm::OnBackClicked(/*const Addressbar& addBar*/)
 {
-       if (__pWebViewer == null)
-               return;
+       AppLog("MainForm::OnBackClicked");
+       result r = E_FAILURE;
 
-       if (__pWebViewer->CanGoBack())
+       if (__pWebViewer != null && __pWebViewer->CanGoBack())
        {
                __pWebViewer->GoBack();
        }
-
+       else
+       {
+               UiApp* pApp = null;
+               pApp = UiApp::GetInstance();
+               if(pApp != null)
+               {
+                       r = pApp->Terminate();
+                       if (IsFailed(r))
+                       {
+                               return;
+                       }
+               }
+       }
 }
 
 void
-MainForm::OnForwardClicked(const Addressbar& addBar)
+MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
 {
+       AppLog("MainForm::OnForwardClicked");
        if (__pWebViewer == null)
                return;
 
@@ -2352,18 +2636,21 @@ MainForm::OnForwardClicked(const Addressbar& addBar)
 void
 MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
 {
+       result r = E_SUCCESS;
+       // hiding the address bar
+       __pAddressbar->SetShowState(false);
        __pFooterPanel->SetShowState(true);
-       __pFooterPanel->Invalidate(false);
+       RelayoutControls(false);
 }
 
 void
-MainForm::OnAddressBarModeChanged(const Addressbar& addBar)
+MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
 {
        __prevAddressBarMode = __curAddressBarMode;
 
        if (__pAddressbar != null)
        {
-               __curAddressBarMode = __pAddressbar->GetAddressbarMode();
+               __curAddressBarMode = GetAddressbarMode();
        }
 
        if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
@@ -2378,68 +2665,58 @@ MainForm::OnAddressBarModeChanged(const Addressbar& addBar)
                if (__pWebViewer != null)
                {
                        __pWebViewer->StopLoading();
-
                }
-
        }
-       if (__pWebViewer != null)
+       else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
        {
-               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);
+               __adressPanelPosition.y = 0;
+               if (__pAddressbar != null)
+               {
+                       __webControlPosition.y = 0;
+                       __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
+                       __pAddressbar->Invalidate(true);
+               }
        }
 }
 
 void
-MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
 {
+       __pFooterPanel->SetShowState(true);
+       RelayoutControls(false);
+}
 
-       if(__pFooterPanel != null)
+void
+MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
+{
+       if (__pFindWordControl && __pFindWordControl->GetShowState() == true)
        {
-               String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
-               if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
-               {
-                       InitMostVisitedSitesView(GetOrientationStatus());
-               }
-               __pFooterPanel->SetShowState(true);
-               __pFooterPanel->Invalidate(false);
+               __pAddressbar->SetShowState(false);
        }
-
-
-
-       //AppLogDebug("MainForm::OnAddressBarKeypadClosed enterd");
-
-       if (__pWebViewer != null && __pFooterPanel != null)
+       else
        {
-               AppLog("MainForm::OnAddressBarKeypadClosed GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-               __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->Invalidate(false);
-               //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
+               if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
+               {
+                       __pAddressbar->SetShowState(true);
+                       __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
+                       __pAddressbar->SetAddressbarURLFocus();
+               }
        }
-       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));
 
+       RelayoutControls(false);
 }
 
 void
-MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
 {
        __pFooterPanel->SetShowState(false);
-       __pFooterPanel->Invalidate(false);
 }
 
 void
-MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
 {
-       __pFooterPanel->SetShowState(false);
-       __pFooterPanel->Invalidate(false);
+       AppLog("KeypadBoundsChanged");
+       RelayoutControls(false);
 }
 
 void
@@ -2455,11 +2732,9 @@ MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
        }
        if (__pAddressbar != null && __pWebViewer != null)
        {
-               __pAddressbar->SetUrl(__pWebViewer->GetUrl());
-               __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn());
+               SetUrl(__pWebViewer->GetUrl());
                __pAddressbar->Invalidate(true);
        }
-
 }
 
 void
@@ -2500,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);
 
@@ -2517,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;
        }
@@ -2539,6 +2814,9 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
 {
        // when load new page if find word panel is open its show state is false
        ShowFindWordPanel(false);
+       AppLog("__pAddressbar->GetAddressbarURL() is %ls",__pAddressbar->GetAddressbarURL().GetPointer());
+
+       __pFooterPanel->Invalidate(true);
 
        Uri uriInfo;
        uriInfo.SetUri(url);
@@ -2589,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
                        {
@@ -2603,7 +2879,8 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
 
        if (__pWebViewer && __pAddressbar)
        {
-               AppLog("__pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
+               __pAddressbar->SetShowState(false);
+               /*AppLog("__pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
                __pAddressbar->SetUrl(__pWebViewer->GetUrl());
                __pAddressbar->UpdateProgress(DEFAULT_PROGRESS_PERCENTAGE);
 
@@ -2621,7 +2898,7 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
                        }
                        __pWindowInfo->pFavicon = FaviconManager::GetInstance()->GetDefaultFaviconN();
 
-               }
+               }*/
 
                __pAddressbar->Invalidate(true);
        }
@@ -2640,7 +2917,6 @@ void
 MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint)
 {
        AppLog("MainForm::OnWebPageBlockSelected");
-
        if (__pHitElementResult != null)
        {
                delete __pHitElementResult;
@@ -2650,7 +2926,7 @@ MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graph
        if (__pWebViewer != null)
        {
                AppLog("MainForm::OnWebPageBlockSelected web not null");
-               __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
+               __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
        }
 
        if (__pHitElementResult == null)
@@ -2664,18 +2940,20 @@ MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graph
                String type = __pHitElementResult->GetAttributeValue("type");
 
                __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)
+               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) && __isLongPressedDone == true)
                {
                        AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
-                       InitSelectTextContextMenu(startPoint,true);
+                       InitSelectTextContextMenu(endPoint,true);
                        __pImageMenu->SetShowState(true);
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
                }
-               else if (__pHitElementResult->HasUrl() == true || __currentSelectedStr.GetLength() > 0)
+               else if(__isLongPressedDone == true)
                {
                        AppLog("MainForm::OnWebPageBlockSelected no paste option");
 
@@ -2684,7 +2962,7 @@ MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graph
                                __currentSelectedStr.Clear();
                                __currentSelectedStr = __pHitElementResult->GetUrl();
                        }
-                       InitSelectTextContextMenu(startPoint,false);
+                       InitSelectTextContextMenu(endPoint,false);
                        __pImageMenu->SetShowState(true);
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
@@ -2694,6 +2972,7 @@ MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graph
                AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
                AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
        }
+
 }
 
 void
@@ -2744,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)
        {
-               __pAddressbar->SetShowState(true);
-               __pWebViewer->SetBounds(__pWebViewer->GetX(), __pWebViewer->GetY(), __pWebViewer->GetWidth(), __webControlHeight);
-               __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+               __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight);
+               __pWebViewer->Invalidate(false);
+       }
+       if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
+       {
+               __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;
        }
@@ -2771,14 +3071,24 @@ 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);
        if (show && !isTouchPressed)
        {
                if (__pFindWordEditField)
+               {
+                       __pFindWordEditField->SetFocus();
                        __pFindWordEditField->ShowKeypad();
+               }
        }
        else
        {
@@ -2786,17 +3096,7 @@ void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
                        __pFindWordEditField->HideKeypad();
        }
 
-       if (__pAddressbar != null)
-       {
-               __pAddressbar->SetShowState(!show);
-               __pAddressbar->Invalidate(true);
-       }
-       if (__pFindWordPanel != null)
-       {
-               __pFindWordPanel->SetShowState(show);
-               __pFindWordPanel->Invalidate(true);
-       }
-       Invalidate(true);
+       RelayoutControls(false);
 }
 
 void
@@ -2826,18 +3126,18 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
        AppLog("MainForm::OnTextFound totalCount %d",totalCount);
        AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
 
-/*     if(totalCount == -1 || totalCount == 0)
+       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)
        {
                __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
                __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
        }
-*/
+
        __maxOccurrances = totalCount;
        __currentWordIndex = currentOrdinal;
 
@@ -2868,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);
@@ -2907,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)
        {
@@ -2933,7 +3233,8 @@ MainForm::FindNextWord(bool next)
 void
 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 {
-       OnAddressBarKeypadOpened(*__pAddressbar);
+       AppLog("MainForm::OnWebKeypadWillOpen");
+       //      OnAddressBarKeypadOpened(*__pAddressbar);
 }
 
 void
@@ -2943,20 +3244,24 @@ MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
        if (__pWebViewer != null && __pFooterPanel != null)
        {
                AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-               __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, 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);
 }
 
@@ -3024,7 +3329,8 @@ MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPositi
                AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
                if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
                {
-                       __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
+                       //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
+                       SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
                }
                delete[] pScript;
        }
@@ -3077,8 +3383,11 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
                }
+               __isLongPressedDone = true;
                __pWebViewer->SetBlockSelectionPosition(currentPosition);
 
+
+
        }
        __inputEventToBeSupressed = true;
 }
@@ -3103,89 +3412,43 @@ MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphic
 void
 MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
 {
-        int widthContextItem = 0;
-
-        if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
-        {
+       AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
+       int widthContextItem = 0;
 
-                widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
-        }
-        else
-        {
-                widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
-        }
-
-       if( __pItemContext != NULL)
+       Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
+       if (pBitmap != null && __pFooterLabel != null)
        {
-               delete __pItemContext;
-               __pItemContext = null;
-
-       }
-
-       __pItemContext= new(std::nothrow) ListContextItem();
-       __pItemContext->Construct();
-       Bitmap* pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", widthContextItem,HEIGHT_CONTEXT_MENU_BUTTON);
-       Bitmap* pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", widthContextItem, HEIGHT_CONTEXT_MENU_BUTTON);
-
-       if (pBitmapNormal != null && pBitmapPressed != null)
-       {
-               __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed);
-       }
-
-       if (pBitmapNormal != null)
-       {
-               delete pBitmapNormal;
-       }
-
-       if (pBitmapPressed != null)
-       {
-               delete pBitmapPressed;
-       }
-
-
-       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);
+               __pFooterLabel->SetBackgroundBitmap(*pBitmap);
+               delete pBitmap;
        }
 
-       if (__pWebViewer != null && __pFooterPanel != null)
-       {
-               AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
-               __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->Invalidate(true);
-
-               //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
-       }
-       if (__pAddressbar != null)
-       {
-               __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
-               __pAddressbar->SetAddressbarMode(__pAddressbar->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());
+               Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
                if (pBitmap != null)
                {
                        __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
                        delete pBitmap;
                }
        }
-       if (__pFooterPanel /*&& __pFooterPanel->GetShowState() == true*/)
+
+       if(__pMenu != null)
+               __pMenu->SetShowState(false);
+       if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+       {
+               widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
+       }
+       else
+       {
+               widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
+       }
+
+       if (__pFooterPanel)
        {
                AppLog("__pFooterPanel->GetShowState() is true");
                InitFooter();
+               __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+               __pFooterPanel->Invalidate(true);
        }
        InitAddressbar();
 
@@ -3196,22 +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)
-       {
-               __pMostVisitedListView->SetBounds(__pAddressbar->GetX(),__pAddressbar->GetY()+__pAddressbar->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pAddressbar->GetHeight()- __pFooterPanel->GetHeight());
-       }
-
-       AppLog("OnOrientationChanged 0");
+       RelayoutControls(false);
        if (__pArticleReaderPanel != null)
        {
                if (__pArticleReaderPanel->GetShowState() == true)
@@ -3249,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);
        }
 }
 
@@ -3407,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;
@@ -3420,7 +3677,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                        TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
                        __touchPoint1 = pTouchInfo->position;
 
-                       if (__pAddressbar != null)
+                       /*if (__pAddressbar != null)
                        {
                                if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
                                {
@@ -3432,6 +3689,14 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                                }
 
                                __pAddressbar->Invalidate(true);
+                       }*/
+                       if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
+                       {
+                               if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
+                               {
+                                       //__pAddressbar->SaveAddressbarEditText();
+                               }
+                               SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
                        }
                }
                else if (count == 2)
@@ -3456,144 +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)
 {
-       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;
-       }
-       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;
-       }
+       __currentWordIndex = 0;
+       __isLongPressedDone = false;
 
 }
 
 void
 MainForm::MoveUiControls()
 {
-       __adressPanelPosition.y =  __adressPanelPosition.y + __distanceMoved;
-       if(__pAddressbar == NULL)
-       {
-               return;
-       }
-
-       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() - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12);
-               else
-                       __webControlHeight = GetClientAreaBounds().height - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12);
-               __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();
@@ -3612,7 +3763,7 @@ MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
        else
        {
                __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
-                               StartWordSearch();
+               StartWordSearch();
                AppLogDebug("Enter something");
        }
 }
@@ -3650,17 +3801,22 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
 
        HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
 
-       __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12);
+       __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,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , 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;
@@ -3671,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,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() + 14));
-       else
-               __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
        __pMostVisitedListView->UpdateList();
 
        return E_SUCCESS;
@@ -3741,3 +3891,216 @@ void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
        contentId = contentManager.CreateContent(*aBuffer, contentPath);
        AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
 }
+
+void
+MainForm::SetForwardButtonEnabled(bool isEnabled)
+{
+       __pGoForwardBtn->SetEnabled(isEnabled);
+       __pGoBackBtn->Invalidate(true);
+}
+
+void
+MainForm::SetBackButtonEnabled(bool isEnabled)
+{
+       __pGoBackBtn->SetEnabled(isEnabled);
+       __pGoBackBtn->Invalidate(true);
+}
+
+void
+MainForm::UpdateProgress(int percentage)
+{
+       __progressPercentage = percentage;
+       if (percentage == 0 || percentage == 100)
+       {
+               __isLoadingData = false;
+               if (percentage == 100)
+               {
+                       __isLoadingCompleted = true;
+                       __progressPercentage = 0;
+               }
+               else
+               {
+                       __isLoadingCompleted = false;
+               }
+       }
+       else
+       {
+               __isLoadingData = true;
+       }
+       UpdateProgressBitmap();
+}
+
+int
+MainForm::GetProgress(void)
+{
+       return __progressPercentage;
+}
+
+void
+MainForm::UpdateProgressBitmap(void)
+{
+       result r = E_SUCCESS;
+       if (__pProgressbarLabel == null)
+               return;
+       int w = __pProgressbarLabel->GetWidth();
+       int h = __pProgressbarLabel->GetHeight();
+       Canvas canvas;
+       int progressWidth = 0;
+       Bitmap* pRetBitmap = null;
+
+       if (__progressPercentage == 0 || __progressPercentage == 100)
+       {
+               __pProgressbarLabel->SetShowState(false);
+               __pProgressbarLabel->Invalidate(false);
+               return;
+       }
+       else
+       {
+               __pProgressbarLabel->SetShowState(true);
+               __pProgressbarLabel->Invalidate(false);
+       }
+
+       r = canvas.Construct(Rectangle(0, 0, w, h));
+
+       if (r != E_SUCCESS)
+       {
+               AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
+               return;
+       }
+
+       canvas.Clear();
+       Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
+
+       if (pBgBmp != null)
+       {
+               pBgBmp->Scale(Dimension(w, h));
+               canvas.DrawBitmap(Point(0,0), *pBgBmp);
+               delete pBgBmp;
+       }
+
+       progressWidth = (double) (w) * __progressPercentage / 100;
+       AppLogDebug("progressWidth: %d", progressWidth);
+       Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
+
+       if (pProgressBmp != null)
+       {
+               pProgressBmp->Scale(Dimension(progressWidth, h));
+               canvas.DrawBitmap(Point(0,0), *pProgressBmp);
+               delete pProgressBmp;
+       }
+
+       pRetBitmap = new (std::nothrow) Bitmap();
+
+       if (pRetBitmap == null)
+       {
+               AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
+               return;
+       }
+
+       pRetBitmap->Construct(canvas, canvas.GetBounds());
+
+       if (__pProgressbarLabel != null && pRetBitmap != null)
+       {
+               __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
+               __pProgressbarLabel->Invalidate(false);
+       }
+
+       if (pRetBitmap != null)
+       {
+               delete pRetBitmap;
+               pRetBitmap = null;
+       }
+       return;
+}
+
+void MainForm::SetAddressbarMode(AddressBarMode addMode)
+{
+       AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
+
+       __currentAddMode = addMode;
+
+       switch(addMode)
+       {
+       case ADDRESSBAR_MODE_INVALID:
+       {
+               // do nothing
+       }
+       break;
+       case ADDRESSBAR_MODE_READER:
+       {
+               __pStopBtn->SetShowState(false);
+               __pClearBtn->SetShowState(false);
+       }
+       break;
+       case ADDRESSBAR_MODE_LOADING:
+       {
+               __pRefreshBtn->SetShowState(false);
+               __pStopBtn->SetShowState(true);
+               __pClearBtn->SetShowState(false);
+       }
+       break;
+       case ADDRESSBAR_MODE_LOADING_COMPLETE:
+       {
+//             SetUrl(__pAddressbar->GetUrl());
+
+               __pRefreshBtn->SetShowState(true);
+               __pStopBtn->SetShowState(false);
+               __pClearBtn->SetShowState(false);
+       }
+       break;
+       case ADDRESSBAR_MODE_EDIT:
+       {
+               __pRefreshBtn->SetShowState(false);
+               __pStopBtn->SetShowState(false);
+               __pClearBtn->SetShowState(true);
+       }
+       break;
+       }
+
+       Invalidate(true);
+
+       OnAddressBarModeChanged();
+}
+
+AddressBarMode MainForm::GetAddressbarMode(void)
+{
+       return __currentAddMode;
+}
+
+void MainForm::SetUrl(const String& url)
+{
+       __displayUrl = url;
+
+       if (__pFooterUrlField != NULL)
+       {
+               String removedHttpUrl = RemoveHttpTextFromDisplayURL();
+               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
+MainForm::RemoveHttpTextFromDisplayURL(void)
+{
+       bool isHttpText = __displayUrl.Contains(L"http://");
+       String updatedDisplayUrl;
+       updatedDisplayUrl.Clear();
+
+       if (isHttpText == true)
+       {
+               __displayUrl.SubString(7,updatedDisplayUrl);
+       }
+       return updatedDisplayUrl;
+}