+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+ 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)
+ {
+ r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+ if (IsFailed(r))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (pWindowInfo && 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)
+ {
+ r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+ return;
+ }
+ }
+ else
+ {
+ if(pWindowInfo != null)
+ r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+ if (IsFailed(r))
+ {
+ AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+ return;
+ }
+ }
+ break;
+ }
+// else if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == false)
+// {
+// UiApp* pApp = null;
+// pApp = UiApp::GetInstance();
+// if (pApp != null)
+// {
+// r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+// if (IsFailed(r))
+// {
+// AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+// return;
+// }
+// }
+// }
+ }
+ }
+ }
+ AppLog("MainForm::OnFormBackRequested exit");
+}
+
+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();
+
+ FloatRectangle footerPanelBounds = FloatRectangle(0.0f, (GetClientAreaBoundsF().height) - __pFooterPanel->GetHeightF(), GetClientAreaBoundsF().width, __pFooterPanel->GetHeightF());
+ __pFooterPanel->SetBounds(CoordinateSystem::AlignToDevice(footerPanelBounds));
+
+ // 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);
+ __pWindowInfo->isAppcontrolTriggered = false;
+ }
+ else if (__pWindowInfo->isJavascriptInitiated == true && __pWindowInfo->isFirstLaunch == true)
+ {
+ __pWindowInfo->isFirstLaunch = false;
+ AppLog("Called");
+ InitWebControl();
+ __pWindowInfo->pCurrentWeb = __pWebViewer;
+ if(__pWindowInfo->pageUrl.GetLength() > 0)
+ LoadUrl(__pWindowInfo->pageUrl);
+ }
+ }
+