Fixed Nabi issues N_SE-50613, N_SE-49431, N_SE-50779, N_SE-50601, N_SE-50559
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 911ae38..072e148 100644 (file)
@@ -68,8 +68,8 @@ static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_pres
 static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
 static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
 static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
-static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
-static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
+static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP =L"00_icon_favorite_off_74x74.png";
+static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"00_icon_favorite_on_74x74.png";
 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
 static const wchar_t* IDS_APPID = L"AppID";
 static const wchar_t* IDS_KEY = L"key";
@@ -985,6 +985,10 @@ MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPa
                p.y = p.y + 50;
                direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
        }
+       else if(__pWebViewer != null && (p.y > (__pWebViewer->GetHeight() + __pWebViewer->GetY())))
+       {
+               p.y = __pWebViewer->GetHeight() + __pWebViewer->GetY();
+       }
        else
        {
                if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
@@ -2571,7 +2575,8 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 //             LoadUrl(url);
                if (__pWebViewer != null && __pAddressbar != null)
                {
-                       __pWebViewer->Reload();
+                       LoadUrl(url);
+                       //__pWebViewer->Reload();
                        SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
                }
 
@@ -2949,11 +2954,14 @@ MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
                pCanvas->DrawBitmap(Point(0,0),*pBitmap);
                delete pBitmap;
        }
-       if(__pWebViewer != null && __pWindowInfo != null)
+       if(__pWebViewer != null && __pWindowInfo != null && __pWindowInfo->pWebCanvasBitmap != null)
                pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
 
        WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
-       WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+       if (__pFooterPanel)
+       {
+               WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+       }
        delete pCanvas;
        delete pWebCanvas;
        if(__pAddressbar)
@@ -4104,6 +4112,97 @@ MainForm::OnWebWindowCreateRequested(void)
        return pNewWindowInfo->pCurrentWeb;
 }
 
+void MainForm::OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source)
+{
+       AppLog("OnWebWindowCloseRequested");
+       ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       WindowInfo* pWindowInfo = null;
+       WindowInfo* pNewWindowInfo = null;
+       int totalCount = 0;
+       UiApp* pApp = null;
+       result r = E_FAILURE;
+
+       if (pAllWindowList != null)
+       {
+               totalCount = pAllWindowList->GetCount();
+       }
+
+       for (int count = 0; count < totalCount; count++)
+       {
+               pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+               if (pSceneManager != null && pWindowInfo != null && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID)
+               {
+                       r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
+                       if (IsFailed(r))
+                       {
+                               AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
+                               return;
+                       }
+
+                       r = pAllWindowList->RemoveAt(count, true);
+
+                       if(count > 0)
+                       {
+                               pNewWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
+                       }
+                       else if(pAllWindowList->GetCount() > 0)
+                       {
+                               pNewWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+                       }
+                       else
+                       {
+                               WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
+
+                               if (pNewWindowInfo == null)
+                               {
+                                       return;
+                               }
+                               result r = E_SUCCESS;
+                               SceneManager* pSceneManager = SceneManager::GetInstance();
+                               if (pSceneManager == NULL)
+                               {
+                                       return;
+                               }
+                               ArrayList* pArgList = new(std::nothrow) ArrayList();
+                               if (pArgList == NULL)
+                               {
+                                       return;
+                               }
+                               r = pArgList->Construct();
+                               if (r == E_SUCCESS)
+                               {
+                                       pArgList->Add(*pNewWindowInfo);
+                                       result r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
+                                       if (pArgList != null)
+                                       {
+                                               delete pArgList;
+                                               pArgList = null;
+                                       }
+                                       if(IsFailed(r))
+                                       {
+                                               AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
+                                               return;
+                                       }
+                               }
+
+                               pApp = UiApp::GetInstance();
+                               if (pApp != null)
+                               {
+                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+                                       return;
+                               }
+
+                       }
+                       r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+
+                       __pWindowInfo = null;
+                       break;
+               }
+       }
+
+}
+
 void
 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
 {
@@ -4283,7 +4382,7 @@ 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 <= 9)
        {
                if (__pFindWordCountLabel)
                {
@@ -4294,7 +4393,7 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
                        __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
                }
        }
-       else if(totalCount > 100)
+       else if(totalCount >= 100)
        {
                if (__pFindWordCountLabel)
                {