Fixed Nabi Issues: N_SE-36915,36669,36866,36575,36735,36766
[apps/osp/Internet.git] / src / IntSceneRegister.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file:    IntSceneRegister.cpp
20  *@brief:       This header file contains the declarations of the %lsceneRegister class.
21  *
22  */
23
24 #include <FUi.h>
25
26 #include "IntSceneRegister.h"
27 #include "IntFormFactory.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Ui::Scenes;
32
33 const wchar_t* IDSCN_MAIN_VIEW = L"ScnMainMenu";
34 const wchar_t* IDSCN_BOOKMARK_VIEW = L"ScnBookmark";
35 const wchar_t* IDSCN_HISTORY_LIST = L"ScnHistory";
36 const wchar_t* IDSCN_FIND_WORD = L"ScnFindWord";
37 const wchar_t* IDSCN_EDIT_HISTORY_LIST = L"ScnEditHistory";
38 const wchar_t* IDSCN_SETTINGS_CLEAR_PRIVATE_DATA = L"ScnSettingsClearPrivateData";
39 const wchar_t* IDSCN_MULTIPLE_WINDOW = L"ScnMultipleWindow";
40 const wchar_t* IDSCN_MULTIPLE_WINDOW_GRID = L"ScnMultipleWindowGrid";
41 const wchar_t* IDSCN_SETTINGS = L"ScnSettings";
42 const wchar_t* IDSCN_ADD_BOOKMARK = L"ScnAddBookmark";
43 const wchar_t* IDSCN_ARTICLE_READER = L"ScnArticleReader";
44 const wchar_t* IDSCN_EDIT_BOOKMARK_LIST = L"ScnEditBookmarkList";
45 const wchar_t* IDSCN_CREATE_BOOKMARK_FOLDER = L"ScnCreateBookmarkFolder";
46 const wchar_t* IDSCN_FONT_SIZE = L"ScnFontSize";
47 const wchar_t* IDSCN_EDIT_HOMEPAGE_VIEW = L"ScnEditHomePage";
48 const wchar_t* IDSCN_BRIGHTNESS = L"ScnBrightness";
49
50 SceneRegister::SceneRegister(void)
51 {
52
53 }
54
55 SceneRegister::~SceneRegister(void)
56 {
57
58 }
59
60 void
61 SceneRegister::RegisterAllScenes(void)
62 {
63         static const wchar_t* PANEL_BLANK = L"";
64         static FormFactory formFactory;
65         SceneManager* pSceneManager = SceneManager::GetInstance();
66
67         if (pSceneManager == null)
68         {
69                 return;
70         }
71         pSceneManager->RegisterFormFactory(formFactory);
72
73         pSceneManager->RegisterScene(IDSCN_BOOKMARK_VIEW, IDL_FORM_BOOKMARK_LIST_SCENE, PANEL_BLANK);
74         pSceneManager->RegisterScene(IDSCN_HISTORY_LIST, IDL_FORM_HISTORY_LIST_SCENE, PANEL_BLANK);
75         pSceneManager->RegisterScene(IDSCN_FIND_WORD, IDL_FORM_FIND_WORD_SCENE, PANEL_BLANK);
76         pSceneManager->RegisterScene(IDSCN_EDIT_HISTORY_LIST, IDL_FORM_EDIT_HISTORY_LIST_SCENE, PANEL_BLANK);
77         pSceneManager->RegisterScene(IDSCN_SETTINGS_CLEAR_PRIVATE_DATA, IDL_FORM_SETTINGS_CLEAR_PRIVATE_DATA_SCENE, PANEL_BLANK);
78         pSceneManager->RegisterScene(IDSCN_MULTIPLE_WINDOW, IDL_FORM_MULTIPLE_WINDOW_SCENE, PANEL_BLANK);
79         pSceneManager->RegisterScene(IDSCN_SETTINGS, IDL_FORM_SETTINGS_SCENE, PANEL_BLANK);
80         pSceneManager->RegisterScene(IDSCN_ADD_BOOKMARK, IDL_FORM_ADD_BOOKMARK_SCENE, PANEL_BLANK);
81         pSceneManager->RegisterScene(IDSCN_ARTICLE_READER, IDL_FORM_ARTICLE_READER_SCENE, PANEL_BLANK);
82         pSceneManager->RegisterScene(IDSCN_EDIT_BOOKMARK_LIST, IDL_FORM_EDIT_BOOKMARK_LIST_SCENE, PANEL_BLANK);
83         pSceneManager->RegisterScene(IDSCN_CREATE_BOOKMARK_FOLDER, IDL_FORM_CREATE_BOOKMARK_FOLDER_SCENE, PANEL_BLANK);
84         pSceneManager->RegisterScene(IDSCN_FONT_SIZE, IDL_FORM_FONT_SIZE_SCENE, PANEL_BLANK);
85         pSceneManager->RegisterScene(IDSCN_EDIT_HOMEPAGE_VIEW, IDL_FORM_EDIT_HOME_PAGE_SCENE, PANEL_BLANK);
86         pSceneManager->RegisterScene(IDSCN_BRIGHTNESS, IDL_FORM_BRIGHTNESS_SCENE, PANEL_BLANK);
87 }
88
89 result
90 SceneRegister::RegisterNewMainView(const Tizen::Base::String& sceneID, const Tizen::Base::String& FormID)
91 {
92         result r = E_SUCCESS;
93         static const wchar_t* PANEL_BLANK = L"";
94         SceneManager* pSceneManager = SceneManager::GetInstance();
95
96         if (pSceneManager == null)
97         {
98                 return E_FAILURE;
99         }
100
101         r = pSceneManager->RegisterScene(sceneID, FormID, PANEL_BLANK);
102
103         if (GetLastResult() != E_SUCCESS)
104         {
105                 AppLogDebug("fail Not registered");
106         }
107         else
108         {
109                 AppLogDebug("success registered");
110         }
111         return r;
112 }
113
114 result
115 SceneRegister::DestroyAndUnRegisterScene(const String& sceneID)
116 {
117         result r = E_SUCCESS;
118         SceneManager* pSceneManager = SceneManager::GetInstance();
119
120         if (pSceneManager == null)
121         {
122                 return E_FAILURE;
123         }
124         pSceneManager->UnregisterScene(sceneID);
125         pSceneManager->DestroyScene(sceneID);
126         return r;
127 }