2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file StSettingsApp.cpp
19 * @brief This is the implementation file for SettingsApp class.
22 #include "StMainFrame.h"
23 #include "StSettingsApp.h"
24 #include "StSettingScenesList.h"
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::System;
31 using namespace Tizen::Ui;
32 using namespace Tizen::Ui::Controls;
33 using namespace Tizen::Ui::Scenes;
35 static const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE_LOCATION = L"http://tizen.org/appcontrol/operation/configure/location";
36 static const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE_BLUETOOTH_VISIBILITY = L"http://tizen.org/appcontrol/operation/configure/bluetooth/visibility";
37 static const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE_FONT_TYPE = L"http://tizen.org/appcontrol/operation/configure/font/type";
38 static const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE_FONT_SIZE = L"http://tizen.org/appcontrol/operation/configure/font/size";
40 typedef struct _catetory_list {
42 const wchar_t* sceneName;
45 enum _appControlExtraKey
47 APPCONTROL_EXTRA_KEY_LOCATION_GPS = 0,
48 APPCONTROL_EXTRA_KEY_LOCATION_WPS,
49 APPCONTROL_EXTRA_KEY_BLUETOOTH_VISIBILITY,
50 APPCONTROL_EXTRA_KEY_FONT_TYPE,
51 APPCONTROL_EXTRA_KEY_FONT_SIZE,
52 APPCONTROL_EXTRA_KEY_MAX
55 CATEGORY_LIST extraDataKeyList[APPCONTROL_EXTRA_KEY_MAX] = {
56 { L"http://tizen.org/appcontrol/data/location/gps", IDSCN_LOCATION },
57 { L"http://tizen.org/appcontrol/data/location/wps", IDSCN_LOCATION },
58 { L"http://tizen.org/appcontrol/data/bluetooth/visibility", IDSCN_BLUETOOTH },
59 { L"http://tizen.org/appcontrol/data/font/type", IDSCN_FONT },
60 { L"http://tizen.org/appcontrol/data/font/size", IDSCN_FONT }
63 SettingsApp::SettingsApp(void)
64 : __initialSceneId(IDSCN_MAIN_MENU)
70 SettingsApp::~SettingsApp(void)
75 SettingsApp::CreateInstance(void)
77 return new (std::nothrow) SettingsApp();
81 SettingsApp::OnAppInitializing(AppRegistry& appRegistry)
83 AppControlProviderManager* pProviderManager = AppControlProviderManager::GetInstance();
84 pProviderManager->SetAppControlProviderEventListener(this);
90 SettingsApp::OnAppInitialized(void)
92 MainFrame* pSettingsFrame = new (std::nothrow) MainFrame();
93 pSettingsFrame->Construct();
94 AddFrame(*pSettingsFrame);
100 SettingsApp::OnAppWillTerminate(void)
106 SettingsApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
108 AppControlProviderManager* pProviderManager = AppControlProviderManager::GetInstance();
109 pProviderManager->SetAppControlProviderEventListener(null);
115 SettingsApp::OnForeground(void)
117 AppLogDebug("Foreground");
118 Form* pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
119 pCurrentForm->SendUserEvent(REFRESH_REQUEST_EVENT, null);
123 SettingsApp::OnBackground(void)
125 AppLogDebug("Background");
126 Form* pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
127 pCurrentForm->SendUserEvent(BACK_GROUND_EVENT, null);
131 SettingsApp::OnLowMemory(void)
133 AppLogDebug("LowMemory");
137 SettingsApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
139 AppLogDebug("BatteryLevelChanged");
143 SettingsApp::OnScreenOn(void)
145 AppLogDebug("ScreenOn");
149 SettingsApp::OnScreenOff(void)
151 AppLogDebug("ScreenOff");
155 SettingsApp::GetRequestId(void)
160 Tizen::Ui::Scenes::SceneId
161 SettingsApp::GetInitialSceneId(void)
163 return __initialSceneId;
166 Tizen::Base::Collection::IList*
167 SettingsApp::GetArguments(void)
173 SettingsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData,
174 const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData)
176 AppLogDebug("ENTER");
177 if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE_LOCATION) == 0)
179 AppLogDebug("operationId[%ls]", operationId.GetPointer());
181 const wchar_t* pSceneName = null;
182 ArrayList* pArgs = new (std::nothrow) ArrayList();
185 pSceneName = extraDataKeyList[APPCONTROL_EXTRA_KEY_LOCATION_GPS].sceneName;
186 pArgs->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/location/gps"));
188 if (pSceneName == null)
196 __initialSceneId = pSceneName;
199 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE_BLUETOOTH_VISIBILITY) == 0)
201 AppLogDebug("operationId[%ls]", operationId.GetPointer());
202 const wchar_t* pSceneName = null;
203 ArrayList* pArgs = new (std::nothrow) ArrayList();
206 pSceneName = extraDataKeyList[APPCONTROL_EXTRA_KEY_BLUETOOTH_VISIBILITY].sceneName;
207 pArgs->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/visibility"));
209 if (pSceneName == null)
217 __initialSceneId = pSceneName;
220 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE_FONT_TYPE) == 0)
222 const wchar_t* pSceneName = null;
223 ArrayList* pArgs = new (std::nothrow) ArrayList();
226 pSceneName = extraDataKeyList[APPCONTROL_EXTRA_KEY_FONT_TYPE].sceneName;
227 pArgs->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/font/type"));
229 if (pSceneName == null)
237 __initialSceneId = pSceneName;
240 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE_FONT_SIZE) == 0)
242 const wchar_t* pSceneName = null;
243 ArrayList* pArgs = new (std::nothrow) ArrayList();
246 pSceneName = extraDataKeyList[APPCONTROL_EXTRA_KEY_FONT_TYPE].sceneName;
247 pArgs->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/font/size"));
249 if (pSceneName == null)
257 __initialSceneId = pSceneName;
262 if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/main"))
264 AppLogDebug("operationId is not main terminate");