Fixed Nabi Issues N_SE-56966,56735
[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.1 (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
90 result
91 SceneRegister::RegisterNewMainView(const Tizen::Base::String& sceneID, const Tizen::Base::String& FormID)
92 {
93         result r = E_SUCCESS;
94         static const wchar_t* PANEL_BLANK = L"";
95         SceneManager* pSceneManager = SceneManager::GetInstance();
96
97         if (pSceneManager == null)
98         {
99                 return E_FAILURE;
100         }
101
102         r = pSceneManager->RegisterScene(sceneID, FormID, PANEL_BLANK);
103
104         if (GetLastResult() != E_SUCCESS)
105         {
106                 AppLogDebug("fail Not registered");
107         }
108         else
109         {
110                 AppLogDebug("success registered");
111         }
112         return r;
113 }
114
115 result
116 SceneRegister::DestroyAndUnRegisterScene(const String& sceneID)
117 {
118         result r = E_SUCCESS;
119         SceneManager* pSceneManager = SceneManager::GetInstance();
120
121         if (pSceneManager == null)
122         {
123                 return E_FAILURE;
124         }
125         pSceneManager->UnregisterScene(sceneID);
126         pSceneManager->DestroyScene(sceneID);
127         return r;
128 }