Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 5cf43d7..47908fd 100644 (file)
@@ -25,6 +25,8 @@
 #include <FMedia.h>
 #include <FUi.h>
 #include <FContent.h>
+#include <FShell.h>
+//#include <FShellNotificationManager.h>
 
 #include "IntBookmarkData.h"
 #include "IntBookmarkPresentationModel.h"
@@ -44,6 +46,7 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Io;
 using namespace Tizen::Locales;
 using namespace Tizen::Media;
+using namespace Tizen::Shell;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Content;
@@ -141,9 +144,10 @@ static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
 static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
 static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
 
+static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
 MainForm::MainForm(void)
 {
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
        __pHistory = null;
        __pAddressbar = null;
        //      __pMostVisitedSitesPanel = null;
@@ -209,7 +213,7 @@ MainForm::MainForm(void)
        __pStopBtn = null;
        __pClearBtn = null;
        __pReaderBtn = null;
-       __isWebKeypadOpened = false;
+       __isKeypadOpened = false;
        __fontSize = 44;
        __pNotification = null;
 }
@@ -246,6 +250,11 @@ MainForm::~MainForm(void)
                delete __pHitElementResult;
                __pHitElementResult = null;
        }
+       if(__pOptionMenu)
+       {
+               delete __pOptionMenu;
+               __pOptionMenu = null;
+       }
 
        String* pSelectedScene = NULL;
        Object* pValue = NULL;
@@ -262,10 +271,9 @@ MainForm::~MainForm(void)
 bool
 MainForm::Initialize(void)
 {
-       InternetApp* pInternet = static_cast<InternetApp*> (Application::GetInstance());
-       Construct(L"IDL_FORM_HW_KEY");
+       Construct(L"IDL_FORM");
 
-//     SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER);
+//     SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
        return true;
 }
 
@@ -314,6 +322,7 @@ MainForm::OnInitializing(void)
        __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
        __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
        SetFormMenuEventListener(this);
+       AppLog("SetFormMenuEventListener result %s",GetErrorMessage(GetLastResult()));
        return E_SUCCESS;
 }
 
@@ -571,6 +580,7 @@ MainForm::InitFooter(void)
 
 
        SetFormBackEventListener(this);
+       AppLog("SetFormBackEventListener result  %s",GetErrorMessage(GetLastResult()));
        if (__pMultiWindowButton != null)
        {
                Bitmap* pBitmap = null;
@@ -602,6 +612,11 @@ MainForm::InitFooter(void)
 
                __pMultiWindowButton->AddActionEventListener(*this);
                __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
+               if(pPressedBitmap)
+               {
+                       delete pPressedBitmap;
+                       pPressedBitmap = null;
+               }
        }
 
        if (__pMoreButton)
@@ -631,6 +646,7 @@ MainForm::InitFooter(void)
        __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
        __pFooterUrlField->AddKeypadEventListener(*this);
        __pFooterUrlField->SetPropagatedTouchEventListener(this);
+       __pFooterUrlField->AddFocusEventListener(*this);
 
        if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
        {
@@ -638,7 +654,7 @@ MainForm::InitFooter(void)
        }
        else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
        {
-               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"));
+               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
        }
        else
        {
@@ -739,6 +755,7 @@ MainForm::InitOptionMenu()
 
        if (__pOptionMenu != null)
        {
+               __pOptionMenu->SetFocusable(true);
                __pOptionMenu->Invalidate(true);
                return r;
        }
@@ -747,6 +764,7 @@ MainForm::InitOptionMenu()
        r = __pOptionMenu->Construct();
        TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
 
+       __pOptionMenu->SetFocusable(true);
        isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
 
 
@@ -791,6 +809,10 @@ result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
                delete __pImageMenu;
                __pImageMenu = null;
        }
+       if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
+       {
+               p.y = p.y + 54;
+       }
 
        __pImageMenu = new (std::nothrow) ContextMenu();
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
@@ -803,6 +825,7 @@ result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
        __pImageMenu->SetMaxVisibleItemsCount(4);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 }
@@ -820,8 +843,8 @@ MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
                __pImageMenu = null;
        }
 
-       if(__pAddressbar->GetShowState() == true)
-               p.y = p.y + __pAddressbar->GetHeight();
+//     if(__pAddressbar->GetShowState() == true)
+//             p.y = p.y + __pAddressbar->GetHeight();
        if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
        {
                p.y = p.y + 54;
@@ -831,14 +854,15 @@ MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
        TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
 
-       r = __pImageMenu->AddItem("Open in new window"/*CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE")*/,IDA_HYPERLINK_OPEN_CLICKED);
-       r = __pImageMenu->AddItem("Copy link URL"/*CommonUtil::GetString(L"IDS_DLNA_BODY_SHARE_IMAGE_ABB")*/,IDA_HYPERLINK_COPY_LINK_CLICKED);
+       r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
+       r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
        //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
        r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
 
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
@@ -887,13 +911,12 @@ MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOpt
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
 }
 
-
-
 result
 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
 {
@@ -937,6 +960,7 @@ MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPa
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
@@ -969,6 +993,11 @@ MainForm::InitFindWordPanel(void)
                                delete pBitmap;
                        }
                }
+               if(__pAddressbar)
+                       __pAddressbar->SetShowState(false);
+
+               if(__isKeypadOpened == false)
+                       __pFooterPanel->SetShowState(true);
                return r;
        }
 
@@ -1107,6 +1136,7 @@ MainForm::InitFindWordPanel(void)
        __pFindWordEditField->AddTextEventListener(*this);
        __pFindWordEditField->AddKeypadEventListener(*this);
        __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
+       __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
 
        __pFindWordEditFieldRightToLeft = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true));
        if (__pFindWordEditFieldRightToLeft == null)
@@ -1117,7 +1147,13 @@ MainForm::InitFindWordPanel(void)
        __pFindWordEditFieldRightToLeft->AddTextEventListener(*this);
        __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
        __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
+       __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
+
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
 
+       if(__isKeypadOpened == false)
+               __pFooterPanel->SetShowState(true);
        return r;
 }
 
@@ -1153,7 +1189,7 @@ MainForm::CreateItem (int index, int itemWidth)
        if (pageURL.GetLength() == 0)
        {
                String nourl;
-               pAppResource->GetString(L"IDS_BR_BODY_ABOUT_C_BLANK", nourl);
+               pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
                pageURL = L"<"+ nourl +">";
 
        }
@@ -1187,7 +1223,7 @@ MainForm::CreateItem (int index, int itemWidth)
        if ( pListIconImage != NULL)
        {
                listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28  + (__fontSize - 44)/2 , 72, 72);
-               pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 60  + (__fontSize - 44));
+               pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72  + (__fontSize - 44));
                pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
 
 
@@ -1269,6 +1305,7 @@ MainForm::GetItemCount (void)
 void
 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
 {
+       AppLog("MainForm::OnListViewContextItemStateChanged called");
        if(__pMostVisitedSites != null)
        {
                History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
@@ -1314,16 +1351,29 @@ MainForm::OnTerminating(void)
        if(__pWebViewer)
        {
                __pWebViewer->RemoveTouchEventListener(*this);
+               __pWebViewer->SetWebUiEventListenerF(null);
+               __pWebViewer->SetWebKeypadEventListener(null);
+               __pWebViewer->SetTextSearchListener(null);
        }
 
-       if(__pItemContext)
+
+       if (__pItemContext)
        {
                delete __pItemContext;
        }
-       if(__pItemContextLandscape)
+       if (__pItemContextLandscape)
        {
                delete __pItemContextLandscape;
        }
+       if (__pSaveImage)
+       {
+               delete __pSaveImage;
+       }
+       if (__pMostVisitedSites)
+       {
+               __pMostVisitedSites->RemoveAll(true);
+               delete __pMostVisitedSites;
+       }
        return r;
 }
 
@@ -1337,6 +1387,11 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        {
        case IDA_BACKBTN_CLICKED:
        {
+               if(__pImageMenu && __pImageMenu->GetShowState() == true)
+               {
+                       AppLog("Hiding the menu");
+                       __pImageMenu->SetShowState(false);
+               }
                if (__pWebViewer && __pWebViewer->CanGoBack())
                {
                        __pWebViewer->GoBack();
@@ -1347,6 +1402,21 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
+                               RemoveOrientationEventListener(*this);
+
+                               if(__pAddressbar)
+                               {
+                                       __pAddressbar->SetAddressbarEventListener(null);
+                               }
+
+                               if(__pWebViewer)
+                               {
+                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                       __pWebViewer->SetTextSearchListener(null);
+                                       __pWebViewer->SetLoadingListener(null);
+                               }
                                r = pApp->Terminate();
                                if (IsFailed(r))
                                {
@@ -1371,6 +1441,21 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
+                                       RemoveOrientationEventListener(*this);
+
+                                       if(__pAddressbar)
+                                       {
+                                               __pAddressbar->SetAddressbarEventListener(null);
+                                       }
+
+                                       if(__pWebViewer)
+                                       {
+                                               __pWebViewer->RemoveTouchEventListener(*this);
+                                               __pWebViewer->SetWebUiEventListenerF(null);
+                                               __pWebViewer->SetWebKeypadEventListener(null);
+                                               __pWebViewer->SetTextSearchListener(null);
+                                               __pWebViewer->SetLoadingListener(null);
+                                       }
                                        r = pApp->Terminate();
                                        if (IsFailed(r))
                                        {
@@ -1391,6 +1476,21 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
+                                               RemoveOrientationEventListener(*this);
+
+                                               if(__pAddressbar)
+                                               {
+                                                       __pAddressbar->SetAddressbarEventListener(null);
+                                               }
+
+                                               if(__pWebViewer)
+                                               {
+                                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                                       __pWebViewer->SetTextSearchListener(null);
+                                                       __pWebViewer->SetLoadingListener(null);
+                                               }
                                                r = pApp->Terminate();
                                                if (IsFailed(r))
                                                {
@@ -1429,6 +1529,22 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                                        pApp = UiApp::GetInstance();
                                                        if (pApp != null)
                                                        {
+
+                                                               RemoveOrientationEventListener(*this);
+
+                                                               if(__pAddressbar)
+                                                               {
+                                                                       __pAddressbar->SetAddressbarEventListener(null);
+                                                               }
+
+                                                               if(__pWebViewer)
+                                                               {
+                                                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                                                       __pWebViewer->SetTextSearchListener(null);
+                                                                       __pWebViewer->SetLoadingListener(null);
+                                                               }
                                                                r = pApp->Terminate();
                                                                return;
                                                        }
@@ -1476,7 +1592,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
                {
                        __pFindWordEditField->SetFocus();
-                       __pFindWordCountLabel->SetShowState(false);
+//                     __pFindWordCountLabel->SetShowState(false);
                }
                else
                {
@@ -1593,14 +1709,14 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 
                                if(__pNotification != null)
                                {
-                                       delete __pNotification;
+                                       RemoveControl(__pNotification);
                                        __pNotification = null;
                                }
                                __pNotification = new (std::nothrow) NotificationPanel(*this);
                                if (__pNotification != null)
                                {
                                        __pNotification->SetText(message);
-                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
+                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
                                        __pNotification->ShowNotification();
                                }
                        }
@@ -1623,14 +1739,14 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                delete pBookmark;
                                if(__pNotification != null)
                                {
-                                       delete __pNotification;
+                                       RemoveControl(__pNotification);
                                        __pNotification = null;
                                }
                                __pNotification = new (std::nothrow) NotificationPanel(*this);
                                if (__pNotification != null)
                                {
                                        __pNotification->SetText(message);
-                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
+                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
                                        __pNotification->ShowNotification();
                                        pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
                                }
@@ -1649,7 +1765,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        break;
        case IDA_PRINT_CLICKED:
        {
-               r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//data//test.pdf");
+               r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//shared//data//test.pdf");
                AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
 
                AppLog("RequestPrint called!");
@@ -1668,7 +1784,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        String fileCount = L"service_print_files_count";
                        String countVal = L"1";
                        String fileFolder= L"service_print_files_folder_name";
-                       String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//data";
+                       String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//shared//data";
 
                        map.Add(&fileCount, &countVal);
                        map.Add(&fileFolder, &folderVal);
@@ -1934,7 +2050,8 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pFindWordCountLabel->SetText(L"0/0");
                __pWebViewer->SearchText(L"aaaabbbbcccc",true);
                AppLog("akjshdasd 1");
-               __pFooterPanel->SetShowState(true);
+               if(__isKeypadOpened == false)
+                       __pFooterPanel->SetShowState(true);
                ShowFindWordPanel(false);
        }
        break;
@@ -1968,7 +2085,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __currentSearchStr = L"";
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
-               __pFindWordCountLabel->SetShowState(false);
+//             __pFindWordCountLabel->SetShowState(false);
                __pFindWordControl->Invalidate(true);
        }
        break;
@@ -1981,7 +2098,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __currentSearchStr = L"";
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
-               __pFindWordCountLabelRightToLeft->SetShowState(false);
+//             __pFindWordCountLabelRightToLeft->SetShowState(false);
                __pFindWordControl->Invalidate(true);
        }
        break;
@@ -2060,7 +2177,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        delete pBuffer;
                        if(__pNotification != null)
                        {
-                               delete __pNotification;
+                               RemoveControl(__pNotification);
                                __pNotification = null;
                        }
                        __pNotification = new NotificationPanel(*this);
@@ -2355,6 +2472,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                {
                        String idElement = __pHitElementResult->GetAttributeValue(L"id");
                        String nameElement = __pHitElementResult->GetAttributeValue(L"name");
+                       String tagElement  = __pHitElementResult->GetTagName();
                        AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
 
                        String script;
@@ -2378,6 +2496,16 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                script.Append(*pString);
                                script.Append("\");");
                        }
+                       else//adding for twitter post page
+                       {
+                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   document.getElementsByTagName(myField)[0].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 {    document.getElementsByTagName(myField)[0].value += myValue;   }  } ";
+                               script.Append("insertAtCursor(document.getElementsByTagName('");
+                               script.Append(tagElement);
+                               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;
@@ -2458,6 +2586,11 @@ void
 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
 {
        result r = E_FAILURE;
+       if(__pImageMenu && __pImageMenu->GetShowState() == true)
+       {
+               AppLog("Hiding the menu");
+               __pImageMenu->SetShowState(false);
+       }
        if (__pWebViewer && __pWebViewer->CanGoBack())
        {
                __pWebViewer->GoBack();
@@ -2468,6 +2601,21 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                pApp = UiApp::GetInstance();
                if (pApp != null)
                {
+                       RemoveOrientationEventListener(*this);
+
+                       if(__pAddressbar)
+                       {
+                               __pAddressbar->SetAddressbarEventListener(null);
+                       }
+
+                       if(__pWebViewer)
+                       {
+                               __pWebViewer->RemoveTouchEventListener(*this);
+                               __pWebViewer->SetWebUiEventListenerF(null);
+                               __pWebViewer->SetWebKeypadEventListener(null);
+                               __pWebViewer->SetTextSearchListener(null);
+                               __pWebViewer->SetLoadingListener(null);
+                       }
                        r = pApp->Terminate();
                        if (IsFailed(r))
                        {
@@ -2492,6 +2640,21 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
+                               RemoveOrientationEventListener(*this);
+
+                               if(__pAddressbar)
+                               {
+                                       __pAddressbar->SetAddressbarEventListener(null);
+                               }
+
+                               if(__pWebViewer)
+                               {
+                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                       __pWebViewer->SetTextSearchListener(null);
+                                       __pWebViewer->SetLoadingListener(null);
+                               }
                                r = pApp->Terminate();
                                if (IsFailed(r))
                                {
@@ -2512,6 +2675,21 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
+                                       RemoveOrientationEventListener(*this);
+
+                                       if(__pAddressbar)
+                                       {
+                                               __pAddressbar->SetAddressbarEventListener(null);
+                                       }
+
+                                       if(__pWebViewer)
+                                       {
+                                               __pWebViewer->RemoveTouchEventListener(*this);
+                                               __pWebViewer->SetWebUiEventListenerF(null);
+                                               __pWebViewer->SetWebKeypadEventListener(null);
+                                               __pWebViewer->SetTextSearchListener(null);
+                                               __pWebViewer->SetLoadingListener(null);
+                                       }
                                        r = pApp->Terminate();
                                        if (IsFailed(r))
                                        {
@@ -2550,6 +2728,21 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                                                pApp = UiApp::GetInstance();
                                                if (pApp != null)
                                                {
+                                                       RemoveOrientationEventListener(*this);
+
+                                                       if(__pAddressbar)
+                                                       {
+                                                               __pAddressbar->SetAddressbarEventListener(null);
+                                                       }
+
+                                                       if(__pWebViewer)
+                                                       {
+                                                               __pWebViewer->RemoveTouchEventListener(*this);
+                                                               __pWebViewer->SetWebUiEventListenerF(null);
+                                                               __pWebViewer->SetWebKeypadEventListener(null);
+                                                               __pWebViewer->SetTextSearchListener(null);
+                                                               __pWebViewer->SetLoadingListener(null);
+                                                       }
                                                        r = pApp->Terminate();
                                                        return;
                                                }
@@ -2630,7 +2823,11 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
        }
        else if(__pWindowInfo != null)
        {
-               if(__pWindowInfo->pageUrl.GetLength() > 0 &&previousSceneId != IDSCN_BRIGHTNESS && previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId != IDSCN_MAIN_VIEW)
+               if(__pWindowInfo->pageUrl.GetLength() > 0 &&previousSceneId != IDSCN_BRIGHTNESS && previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId.Contains(IDSCN_MAIN_VIEW) == false)
+               {
+                       LoadUrl(__pWindowInfo->pageUrl);
+               }
+               else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
                {
                        LoadUrl(__pWindowInfo->pageUrl);
                }
@@ -2717,6 +2914,7 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                delete pBitmap;
        }
 
+       RelayoutControls(false);
        AppLog("ABC: OnSceneActivatedN started exit");
 
 }
@@ -2760,6 +2958,9 @@ MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
        WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
        WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
        delete pCanvas;
+       delete pWebCanvas;
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
        AppLog("Coming here");
 }
 
@@ -2912,6 +3113,7 @@ void
 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
 {
        AppLog("XYZ::MainForm::OnKeypadOpened");
+       __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
 
 }
@@ -2920,6 +3122,7 @@ void
 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
 {
        AppLog("XYZ::MainForm::OnKeypadClosed");
+       __isKeypadOpened = false;
        __pFooterPanel->SetShowState(true);
        RelayoutControls(true);
 }
@@ -2954,6 +3157,13 @@ MainForm::OnLoadingCompleted(void)
        {
                return;
        }
+
+       if(__pImageMenu && __pImageMenu->GetShowState())
+       {
+               __pImageMenu->SetShowState(false);
+               __pImageMenu->Invalidate(true);
+       }
+
        if (__pWebViewer->CanGoForward())
        {
                //__pAddressbar->SetForwardButtonEnabled(true);
@@ -3114,6 +3324,7 @@ void
 MainForm::OnEstimatedProgress(int progress)
 {
        AppLogDebug("MainForm::OnEstimatedProgress entered");
+
        if (progress < DEFAULT_PROGRESS_PERCENTAGE)
                progress = DEFAULT_PROGRESS_PERCENTAGE;
        //if(__pAddressbar)
@@ -3228,6 +3439,56 @@ MainForm::LoadUrl(String& url)
 }
 
 void
+MainForm::OnFocusGained(const Tizen::Ui::Control& source)
+{
+       AppLog("MainForm::OnFocusGained");
+       if(__pFooterPanel)
+       {
+               __pFooterPanel->SetShowState(false);
+       }
+
+       if(__pAddressbar)
+       {
+               __pAddressbar->SetShowState(true);
+               __pAddressbar->SetAddressbarURLFocus();
+       }
+       if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
+       {
+               __currentSearchStr = L"";
+               __currentWordIndex = 0;
+               __maxOccurrances = 0;
+
+               if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
+               {
+                       __pFindWordEditField->SetText(L"");
+                       __pFindWordEditField->HideKeypad();
+                       __pFindWordControl->SetShowState(false);
+                       __pFindWordCountLabel->SetText(L"0/0");
+               }
+               else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
+               {
+                       __pFindWordEditFieldRightToLeft->SetText(L"");
+                       __pFindWordEditFieldRightToLeft->HideKeypad();
+                       __pFindWordControl->SetShowState(false);
+                       __pFindWordCountLabelRightToLeft->SetText(L"0/0");
+               }
+
+               __pFindWordNext->SetEnabled(false);
+               __pFindWordPrev->SetEnabled(false);
+
+               __pWebViewer->SearchText(L"aaaabbbbcccc",true);
+               __pFindWordControl->SetShowState(false);
+       }
+       RelayoutControls(false);
+}
+
+void
+MainForm::OnFocusLost(const Tizen::Ui::Control& source)
+{
+       AppLog("MainForm::OnFocusLost called");
+}
+
+void
 MainForm::OnStopClicked(Addressbar& addBar)
 {
        AppLogDebug("MainForm::OnStopClicked called");
@@ -3243,8 +3504,13 @@ MainForm::OnStopClicked(Addressbar& addBar)
 void
 MainForm::OnBackClicked(/*const Addressbar& addBar*/)
 {
-//     AppLog("MainForm::OnBackClicked");
+       //      AppLog("MainForm::OnBackClicked");
        result r = E_FAILURE;
+       if(__pImageMenu && __pImageMenu->GetShowState() == true)
+       {
+               AppLog("Hiding the menu");
+               __pImageMenu->SetShowState(false);
+       }
 
        if (__pWebViewer && __pWebViewer->CanGoBack())
        {
@@ -3256,6 +3522,24 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                pApp = UiApp::GetInstance();
                if (pApp != null)
                {
+
+                       RemoveOrientationEventListener(*this);
+
+                       if(__pAddressbar)
+                       {
+                               __pAddressbar->SetAddressbarEventListener(null);
+                       }
+
+                       if(__pWebViewer)
+                       {
+                               __pWebViewer->RemoveTouchEventListener(*this);
+                               __pWebViewer->SetWebUiEventListenerF(null);
+                               __pWebViewer->SetWebKeypadEventListener(null);
+                               __pWebViewer->SetTextSearchListener(null);
+                               __pWebViewer->SetLoadingListener(null);
+                       }
+
+
                        r = pApp->Terminate();
                        if (IsFailed(r))
                        {
@@ -3280,6 +3564,23 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
+                               RemoveOrientationEventListener(*this);
+
+                               if(__pAddressbar)
+                               {
+                                       __pAddressbar->SetAddressbarEventListener(null);
+                               }
+
+                               if(__pWebViewer)
+                               {
+                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                       __pWebViewer->SetTextSearchListener(null);
+                                       __pWebViewer->SetLoadingListener(null);
+                               }
+
+
                                r = pApp->Terminate();
                                if (IsFailed(r))
                                {
@@ -3300,6 +3601,23 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
+                                       RemoveOrientationEventListener(*this);
+
+                                       if(__pAddressbar)
+                                       {
+                                               __pAddressbar->SetAddressbarEventListener(null);
+                                       }
+
+                                       if(__pWebViewer)
+                                       {
+                                               __pWebViewer->RemoveTouchEventListener(*this);
+                                               __pWebViewer->SetWebUiEventListenerF(null);
+                                               __pWebViewer->SetWebKeypadEventListener(null);
+                                               __pWebViewer->SetTextSearchListener(null);
+                                               __pWebViewer->SetLoadingListener(null);
+                                       }
+
+
                                        r = pApp->Terminate();
                                        if (IsFailed(r))
                                        {
@@ -3336,6 +3654,23 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
+                                               RemoveOrientationEventListener(*this);
+
+                                               if(__pAddressbar)
+                                               {
+                                                       __pAddressbar->SetAddressbarEventListener(null);
+                                               }
+
+                                               if(__pWebViewer)
+                                               {
+                                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                                       __pWebViewer->SetTextSearchListener(null);
+                                                       __pWebViewer->SetLoadingListener(null);
+                                               }
+
+
                                                r = pApp->Terminate();
                                                return;
                                        }
@@ -3346,6 +3681,23 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
+                                               RemoveOrientationEventListener(*this);
+
+                                               if(__pAddressbar)
+                                               {
+                                                       __pAddressbar->SetAddressbarEventListener(null);
+                                               }
+
+                                               if(__pWebViewer)
+                                               {
+                                                       __pWebViewer->RemoveTouchEventListener(*this);
+                                                       __pWebViewer->SetWebUiEventListenerF(null);
+                                                       __pWebViewer->SetWebKeypadEventListener(null);
+                                                       __pWebViewer->SetTextSearchListener(null);
+                                                       __pWebViewer->SetLoadingListener(null);
+                                               }
+
+
                                                r = pApp->Terminate();
                                                return;
                                        }
@@ -3407,15 +3759,6 @@ MainForm::OnAddressBarFocusLost(const Addressbar& addBar, bool addressbarKeyPadS
        int Height = GetClientAreaBounds().height;
        AppLog("MainForm::OnAddressBarFocusLost height is %d",Height);
 
-       if(__pAddressbar)
-               __pAddressbar->SetShowState(false);
-
-               if (__pFooterPanel != null && addressbarKeyPadState == false)
-               {
-                       AppLog("akjshdasd 3");
-                       __pFooterPanel->SetShowState(true);
-               }
-
        RelayoutControls(false);
 }
 
@@ -3581,6 +3924,11 @@ MainForm::UpdateFavicon(void)
                                        __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
                                }
                        }
+                       if(pBitmap)
+                       {
+                               delete pBitmap;
+                               pBitmap = null;
+                       }
                }
                delete tempPath;
        }
@@ -3596,11 +3944,11 @@ MainForm::UpdateFavicon(void)
 
 }
 
-
 bool
 MainForm::OnLoadingRequested(const Tizen::Base::String& url,
                Tizen::Web::Controls::WebNavigationType type)
 {
+       AppLog("urlk %ls",url.GetPointer());
        // when load new page if find word panel is open its show state is false
        if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
        {
@@ -3616,8 +3964,6 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
                RelayoutControls(false);
        }
 
-
-
        __pFooterPanel->Invalidate(true);
 
        Uri uriInfo;
@@ -3688,10 +4034,11 @@ MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
        return Tizen::Web::Controls::WEB_DECISION_CONTINUE;
 }
 
-
 void
 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
 {
+       if(__isLongPressedDone == false)
+               return;
        AppLog("MainForm::OnWebPageBlockSelected");
        if (__pHitElementResult != null)
        {
@@ -3704,11 +4051,11 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                AppLog("MainForm::OnWebPageBlockSelected web not null");
                __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
 
-               if(GetLastResult() == E_INVALID_ARG)
+               if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
                {
                        AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
                        __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
-                       if(GetLastResult() == E_INVALID_ARG)
+                       if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
                        {
                                __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
                        }
@@ -3737,7 +4084,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                {
                        AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
-                       InitSelectTextContextMenuF(endPoint,true);
+                       InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
                        __pImageMenu->SetShowState(true);
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
@@ -3751,7 +4098,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                                __currentSelectedStr.Clear();
                                __currentSelectedStr = __pHitElementResult->GetUrl();
                        }
-                       InitSelectTextContextMenuF(endPoint,false);
+                       InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
                        __pImageMenu->SetShowState(true);
                        __pImageMenu->Show();
                        __pImageMenu->Invalidate(true);
@@ -3845,6 +4192,7 @@ MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
                else
                {
                        __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight + 12);
+                       AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
                        __pWebViewer->Invalidate(false);
                }
        }
@@ -3884,7 +4232,7 @@ MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
                        __pFindWordPanelRightToLeft->SetShowState(true);
 
                        __pFindWordClear->SetShowState(false);
-                       __pFindWordCountLabel->SetShowState(false);
+//                     __pFindWordCountLabel->SetShowState(false);
                        __pFindWordEditField->SetShowState(false);
 
                        __pFindWordClearRightToLeft->SetShowState(true);
@@ -4124,7 +4472,7 @@ void
 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 {
        AppLog("xyz::MainForm::OnWebKeypadWillOpen");
-       __isWebKeypadOpened = true;
+       __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
        //      OnAddressBarKeypadOpened(*__pAddressbar);
 }
@@ -4132,6 +4480,7 @@ MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 void
 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
 {
+       __isKeypadOpened = true;
        AppLog("xyz::MainForm::OnWebKeypadOpened");
 
        if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
@@ -4179,7 +4528,7 @@ MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
        __pFooterPanel->SetShowState(true);
 //     OnAddressBarKeypadClosed(*__pAddressbar);
        RelayoutControls(false);
-       __isWebKeypadOpened = false;
+       __isKeypadOpened = false;
 }
 
 void
@@ -4216,6 +4565,11 @@ MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPositi
 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
        AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
+       if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
+       {
+               AppLog("Returning because of more than one touch point.");
+               return;
+       }
        __longPressPoint = currentPosition;
 
        if (__pHitElementResult != null)
@@ -4237,7 +4591,8 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
 
        if (__pHitElementResult->HasImage() == true)
        {
-               InitImageContextMenu(currentPosition);
+               if(__pWebViewer != null)
+                       InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
                __pImageMenu->SetShowState(true);
                __pImageMenu->Show();
                __pImageMenu->Invalidate(true);
@@ -4255,7 +4610,7 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
                {
                        AppLog(null);
                }
-               InitImageLinkContextMenu(currentPosition);
+               InitImageLinkContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
                __pImageMenu->SetShowState(true);
                __pImageMenu->Show();
                __pImageMenu->Invalidate(true);
@@ -4275,13 +4630,13 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
 
 
 
-               //__isLongPressedDone = true;
+               __isLongPressedDone = true;
                result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
-               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) && innerHtml.GetLength() == 0 /*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.CompareTo(L"") == 0 && r == E_INVALID_ARG)
+               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) && innerHtml.GetLength() == 0  && type.CompareTo(L"submit") !=0/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.CompareTo(L"") == 0 && r == E_INVALID_ARG)
                {
                        AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
-                       InitSelectTextContextMenu(currentPosition,true, true);
+                       InitSelectTextContextMenu(Point(currentPosition.x , currentPosition.y + __pWebViewer->GetY()),true, true);
                        if(__pImageMenu)
                        {
                                __pImageMenu->SetShowState(true);
@@ -4304,6 +4659,10 @@ MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphic
        {
                __pAddressbar->SetShowState(false);
        }
+       if(__pFooterPanel && __isKeypadOpened == false)
+       {
+               __pFooterPanel->SetShowState(true);
+       }
 
        // Not reuired now.
        /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
@@ -4355,13 +4714,14 @@ MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEven
                __pWebViewer->SearchText(L"aaaabbbbcccc",true);
                __pFindWordControl->SetShowState(false);
        }
+       AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
        if(__pAddressbar->GetShowState() == false)
        {
                __pAddressbar->SetAddressbarURLFocus();
                __pFooterPanel->SetShowState(false);
        }
 
-       return true;
+       return false;
 }
 
 bool
@@ -4399,7 +4759,8 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
 {
        AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
        int widthContextItem = 0;
-
+       if(__pFindWordCountLabel)
+               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
        // As per the platform engineer comment removed this line
        /*if(__pWebViewer != null)
        {
@@ -4409,6 +4770,20 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
 
 //     if(__pFindWordControl != null)
 //             ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
+
+       if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
+       {
+               if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
+               {
+                       AppLog(" Orientation landscape");
+                       __pOptionMenu->SetMaxVisibleItemsCount(5);
+               }
+               else
+               {
+                       AppLog(" Orientation potrait");
+                       __pOptionMenu->SetMaxVisibleItemsCount(6);
+               }
+       }
        if(__pNotification && __pNotification->GetShowState() == true)
        {
                __pNotification->SetShowState(false);
@@ -4446,8 +4821,8 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
        }
 
 
-       if(__pOptionMenu != null)
-               __pOptionMenu->SetShowState(false);
+//     if(__pOptionMenu != null)
+//             __pOptionMenu->SetShowState(false);
 
        if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
        {
@@ -4735,7 +5110,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
 //             ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
        }
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
 
 
 
@@ -4788,7 +5163,15 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                pList->RemoveAll(true);
                delete pList;
        }
-//     RelayoutControls(false);
+       if(__pAddressbar)
+       {
+               __pAddressbar->SetShowState(false);
+       }
+       if(__pFooterPanel && __isKeypadOpened == false)
+       {
+               __pFooterPanel->SetShowState(true);
+       }
+       RelayoutControls(false);
        return;
 }
 
@@ -4796,7 +5179,7 @@ void
 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
 //     __currentWordIndex = 0;
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
 
 }
 
@@ -4828,7 +5211,10 @@ MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
                }
                else
                {
-                       __pFindWordCountLabel->SetShowState(false);
+//                     __pFindWordCountLabel->SetShowState(false);
+                       __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
+                       __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
+
                }
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
@@ -4927,7 +5313,7 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
        }
        __pMostVisitedListView->SetItemProvider(*this);
        __pMostVisitedListView->AddListViewItemEventListener(*this);
-       __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RECENTLY_VISITED_SITES"));
+       __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_VISITED_SITES"));
        AddControl(__pMostVisitedListView);
        __pMostVisitedListView->UpdateList();
 
@@ -5000,10 +5386,35 @@ void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
        contentPath.Append(imageName);
        contentPath.Append(".jpg");
        contentId = contentManager.CreateContent(*aBuffer, contentPath);
+       ShowIndicatorNotification(L"Download Complete",contentPath);
        AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
 }
 
 void
+MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
+{
+       AppLogDebug("ENTER");
+
+       NotificationRequest request;
+       request.SetAlertText(messageText);
+       request.SetTitleText(L"");
+       request.SetAppMessage(contentPath);
+       request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
+       request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
+       Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+       String homePath = pApp->GetAppRootPath();
+       String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
+       AppLog("The iconPath is : %ls", homePath.GetPointer());
+       request.SetIconFilePath(iconPath);
+
+       Tizen::Shell::NotificationManager notiMgr;
+       notiMgr.Construct();
+       notiMgr.Notify(request);
+       AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
+       return;
+}
+
+void
 MainForm::SetForwardButtonEnabled(bool isEnabled)
 {
        __pGoForwardBtn->SetEnabled(isEnabled);
@@ -5164,82 +5575,6 @@ MainForm::ReaderClicked()
        return;
 
 
-       int bodyWidth = ((double)(GetClientAreaBounds().width))*0.73;
-
-       CreateReaderPanel();
-       AppLogDebug("MainScene::ReaderClicked entered");
-
-
-       /*if (__pArticleReaderPanel)
-       {
-               AppLogDebug("showstate true for reader panel");
-               __pArticleReaderPanel->SetShowState(true);
-               __pArticleReaderPanel->Show();
-       }*/
-       int xPos = __pArticleReaderPanel->GetX();
-       int yPos = __pArticleReaderPanel->GetY();
-       AppLog("ReaderClicked() xPos = %d",xPos);
-       AppLog("ReaderClicked() yPos = %d",yPos);
-
-       if (__pReaderData == null)
-       {
-               return;
-       }
-
-       String loadData = L"<html>\
-                                       <head>\
-                                       <meta name='viewport' content='width=device-width*0.73,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'>\
-                                       <style>\
-                                       h1\
-                                       {\
-                                       font-weight:bold;\
-                                       background-color: transparent;\
-                                       }\
-                                       div\
-                                       {\
-                                       display: block;\
-                                       }\
-                                       p\
-                                       {\
-                                       display: block; \
-                                       }\
-                                       img\
-                                       {\
-                                       margin-left:auto;\
-                                       margin-right:auto;\
-                                       }\
-                                       \
-                                       \
-                                       </style>\
-                                       </head>\
-                                       <body style='width:'";
-       loadData.Append(bodyWidth);
-       loadData.Append(L"px'>");
-       AppLogDebug("data->GetLength %d",__pReaderData->GetLength());
-       loadData.Append(*__pReaderData);
-       loadData.Append(L"</body></html>");
-
-       ByteBuffer buf ;
-       buf.Construct(loadData.GetLength());
-       AppLogDebug("data->GetLength %d",loadData.GetLength());
-       for (int z=0;z<loadData.GetLength();z++)
-       {
-               mchar b;
-               loadData.GetCharAt(z,b);
-               buf.SetByte((byte)b);
-       }
-
-       buf.Flip();
-       if (__pWebReader != null)
-       {
-               __pWebReader->LoadData(L"",buf,L"text/html");
-               AppLogDebug("LoadData result %s",GetErrorMessage(GetLastResult()));
-       }
-       else
-       {
-               AppLogDebug("cannot LoadData __pWebReader is null");
-       }
-
 }
 
 void MainForm::SetAddressbarMode(AddressBarMode addMode)
@@ -5364,6 +5699,10 @@ MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IL
                {
                        __pWebViewer->Pause();
                }
+               if(__pImageMenu)
+               {
+                       __pImageMenu->SetShowState(false);
+               }
                if(__pAddressbar != null)
                {
                        __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
@@ -5391,8 +5730,8 @@ MainForm::AddressBarCancelledClicked(const Addressbar& addBar)
        if (__pAddressbar)
                __pAddressbar->SetShowState(false);
 
-       //AppLog("akjshdasd 5");
-       //__pFooterPanel->SetShowState(true);
+       AppLog("akjshdasd 5");
+       __pFooterPanel->SetShowState(true);
 
        if(__pWebViewer)
                __pWebViewer->SetFocus();
@@ -5413,21 +5752,35 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
 {
        AppLog("MainForm::OnFormMenuRequested called");
        InitOptionMenu();
-       if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
+       if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
        {
                int bookmarkCount=0;
                bool exist = false;
                String url=L"";
                url=__pWindowInfo->pageUrl;
+               AppLog("MainForm::OnFormMenuRequested url %ls",url.GetPointer());
                result r = E_SUCCESS;
                Bitmap* pBitmap = null;
-
-               r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
-               if (IsFailed(r))
-               {
-                       AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
-                       return;
-               }
+               String lastChar = L"";
+//             if(url.SubString(url.GetLength()-1,lastChar));
+//             if(lastChar == L"/")
+//             {
+//                     bool exist1 = false;
+//                     bool exist2 = false;
+//                     r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist1);
+//                     url.SubString(0,url.GetLength() - 1,url);
+//                     r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist2);
+//                     exist = exist1 | exist2;
+//             }
+//             else
+//             {
+                       r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
+                       if (IsFailed(r))
+                       {
+                               AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
+                               return;
+                       }
+//             }
                if ( exist == true)
                {
                        pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
@@ -5478,7 +5831,12 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
                delete pBitmap;
        }
        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
-       __pOptionMenu->SetShowState(true);
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
+       SetFocus();
+       __pFooterPanel->SetShowState(true);
+       result r = __pOptionMenu->SetShowState(true);
+       AppLog("ajsghd %s",GetErrorMessage(r));
        __pOptionMenu->Invalidate(true);
        __pOptionMenu->Show();