Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 4bc10dc..611f135 100644 (file)
@@ -611,6 +611,11 @@ MainForm::InitFooter(void)
 
                __pMultiWindowButton->AddActionEventListener(*this);
                __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
+               if(pPressedBitmap)
+               {
+                       delete pPressedBitmap;
+                       pPressedBitmap = null;
+               }
        }
 
        if (__pMoreButton)
@@ -640,6 +645,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)
        {
@@ -1326,8 +1332,12 @@ MainForm::OnTerminating(void)
        if(__pWebViewer)
        {
                __pWebViewer->RemoveTouchEventListener(*this);
+               __pWebViewer->SetWebUiEventListenerF(null);
+               __pWebViewer->SetWebKeypadEventListener(null);
+               __pWebViewer->SetTextSearchListener(null);
        }
 
+
        if (__pItemContext)
        {
                delete __pItemContext;
@@ -1358,6 +1368,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();
@@ -1368,6 +1383,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))
                                {
@@ -1392,6 +1422,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))
                                        {
@@ -1412,6 +1457,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))
                                                {
@@ -1450,6 +1510,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;
                                                        }
@@ -1621,7 +1697,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                if (__pNotification != null)
                                {
                                        __pNotification->SetText(message);
-                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
+                                       __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
                                        __pNotification->ShowNotification();
                                }
                        }
@@ -1651,7 +1727,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                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);
                                }
@@ -1955,7 +2031,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(__isWebKeypadOpened == false)
+                       __pFooterPanel->SetShowState(true);
                ShowFindWordPanel(false);
        }
        break;
@@ -2479,6 +2556,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();
@@ -2489,6 +2571,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))
                        {
@@ -2513,6 +2610,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))
                                {
@@ -2533,6 +2645,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))
                                        {
@@ -2571,6 +2698,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;
                                                }
@@ -3265,6 +3407,27 @@ MainForm::LoadUrl(String& url)
 }
 
 void
+MainForm::OnFocusGained(const Tizen::Ui::Control& source)
+{
+       if(__pFooterPanel)
+       {
+               __pFooterPanel->SetShowState(false);
+       }
+
+       if(__pAddressbar)
+       {
+               __pAddressbar->SetShowState(true);
+       }
+       RelayoutControls(false);
+}
+
+void
+MainForm::OnFocusLost(const Tizen::Ui::Control& source)
+{
+
+}
+
+void
 MainForm::OnStopClicked(Addressbar& addBar)
 {
        AppLogDebug("MainForm::OnStopClicked called");
@@ -3280,8 +3443,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())
        {
@@ -3293,6 +3461,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))
                        {
@@ -3317,6 +3503,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))
                                {
@@ -3337,6 +3540,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))
                                        {
@@ -3373,6 +3593,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;
                                        }
@@ -3383,6 +3620,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;
                                        }
@@ -3444,15 +3698,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);
 }
 
@@ -3618,6 +3863,11 @@ MainForm::UpdateFavicon(void)
                                        __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
                                }
                        }
+                       if(pBitmap)
+                       {
+                               delete pBitmap;
+                               pBitmap = null;
+                       }
                }
                delete tempPath;
        }
@@ -4166,6 +4416,7 @@ MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 void
 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
 {
+       __isWebKeypadOpened = true;
        AppLog("xyz::MainForm::OnWebKeypadOpened");
 
        if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
@@ -4344,6 +4595,10 @@ MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphic
        {
                __pAddressbar->SetShowState(false);
        }
+       if(__pFooterPanel && __isWebKeypadOpened == false)
+       {
+               __pFooterPanel->SetShowState(true);
+       }
 
        // Not reuired now.
        /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
@@ -4830,7 +5085,13 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                delete pList;
        }
        if(__pAddressbar)
+       {
                __pAddressbar->SetShowState(false);
+       }
+       if(__pFooterPanel && __isWebKeypadOpened == false)
+       {
+               __pFooterPanel->SetShowState(true);
+       }
        RelayoutControls(false);
        return;
 }
@@ -4970,7 +5231,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();
 
@@ -5383,8 +5644,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();