+ 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))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ }
+ if (pAllWindowList != null)
+ {
+ totalCount = pAllWindowList->GetCount();
+ }
+ for (int count = 0; count < totalCount; count++)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+ if (pWindowInfo == null)
+ {
+ 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))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
+ {
+ r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
+ if (IsFailed(r))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ r = pAllWindowList->RemoveAt(count, true);
+ __pWindowInfo = null;
+ if (IsFailed(r))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ if(count > 0)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
+ }
+ else
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+ }
+ if (pWindowInfo == null)
+ {
+ 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;
+ }
+ }
+ else
+ {
+ r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+ if (IsFailed(r))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
+ const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+
+ AppLog("MainForm::OnSceneActivatedN called");
+ String* pSelectedScene = NULL;
+ Object* pValue = NULL;
+ String* pUrl = null;
+ MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
+ pSelectedScene = (String*) pValue;
+
+ if (pSelectedScene != null)
+ {
+ delete pSelectedScene;
+ }
+ MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
+ String* selectedSceneID = new(std::nothrow) String(currentSceneId);
+ AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
+ AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer());
+
+ // setting the current scene ID
+ MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId);
+
+ MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID);
+
+ if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
+ {
+ __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
+ if(__pWindowInfo == null)
+ return;
+ // if(__pWindowInfo == null)
+ {
+ pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
+ }
+ }
+ else if ( pArgs != null && pArgs->GetCount() == 1)
+ {
+ __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
+ }
+
+ InitFooter();
+ InitAddressbar();
+
+ __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
+
+ // hiding the address bar
+ // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
+ __pAddressbar->SetShowState(false);
+// if(__pWebViewer != null)
+// {
+// __pWebViewer->Resume();
+// }
+
+ if(pUrl != null && pUrl->GetLength() > 0)
+ {
+ LoadUrl(*pUrl);
+ }
+ 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.Contains(IDSCN_MAIN_VIEW) == false)
+ {
+ LoadUrl(__pWindowInfo->pageUrl);
+ }
+ else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
+ {
+ LoadUrl(__pWindowInfo->pageUrl);
+ }
+ else if (__pWindowInfo->isJavascriptInitiated == true)
+ {
+ AppLog("Called");
+ InitWebControl();
+ __pWindowInfo->pCurrentWeb = __pWebViewer;
+ }
+ }
+
+ String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
+ AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
+ if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ {
+ InitMostVisitedSitesView(GetOrientationStatus());
+ }
+ else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ {
+ if(__pMostVisitedListView != null)
+ {
+ __pMostVisitedListView->SetShowState(false);
+ }
+ }
+
+ if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
+ {
+ String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
+
+ if (pBookmarkUrl == null)
+ return;
+ AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
+ //__pAddressbar->SetUrl(*pBookmarkUrl);
+ SetUrl(*pBookmarkUrl);
+
+ if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
+ __pWebViewer->LoadUrl(*pBookmarkUrl);
+ delete pBookmarkUrl;
+ }