Change the application name
[platform/framework/native/certificate-selector.git] / src / CertificateSelectorApp.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 /**
19  * @file        CertificateSelectorApp.cpp
20  * @brief       This is the implementation for the %CertificateSelectorApp class.
21  */
22
23 #include <unique_ptr.h>
24 #include <FAppAppRegistry.h>
25 #include <FAppAppControlProviderManager.h>
26 #include <FBaseLog.h>
27 #include "CertificateSelectorFrame.h"
28 #include "CertificateSelectorApp.h"
29
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::System;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
35
36 CertificateSelectorApp::CertificateSelectorApp(void)
37         : __reqId(-1)
38 {
39 }
40
41 CertificateSelectorApp::~CertificateSelectorApp(void)
42 {
43 }
44
45 UiApp*
46 CertificateSelectorApp::CreateInstance(void)
47 {
48         return new CertificateSelectorApp();
49 }
50
51 bool
52 CertificateSelectorApp::OnAppInitializing(AppRegistry& appRegistry)
53 {
54         result r = E_SUCCESS;
55
56         r = Tizen::App::AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this);
57         return true;
58 }
59
60 bool
61 CertificateSelectorApp::OnAppInitialized(void)
62 {
63         result r = E_SUCCESS;
64
65         std::unique_ptr<CertificateSelectorFrame> pCertificateSelectorFrame(new (std::nothrow) CertificateSelectorFrame());
66         TryReturnResult(pCertificateSelectorFrame, false, E_OUT_OF_MEMORY
67                 , "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
68
69         r = pCertificateSelectorFrame->Construct();
70         TryReturnResult(!IsFailed(r), false, r, "[%s] Propagating.", GetErrorMessage(r));
71
72         pCertificateSelectorFrame->SetName(L"CertificateSelector");
73
74         AppAssertf(__reqId > -1, "The request ID is invalid.");
75         pCertificateSelectorFrame->SetRequestId(__reqId);
76
77         r = AddFrame(*(pCertificateSelectorFrame.release()));
78         TryReturnResult(!IsFailed(r), false, r, "[%s] Propagating.", GetErrorMessage(r));
79
80         return true;
81 }
82
83 bool
84 CertificateSelectorApp::OnAppWillTerminate(void)
85 {
86         return true;
87 }
88
89
90 bool
91 CertificateSelectorApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
92 {
93         return true;
94 }
95
96 void
97 CertificateSelectorApp::OnForeground(void)
98 {
99 }
100
101 void
102 CertificateSelectorApp::OnBackground(void)
103 {
104 }
105
106 void
107 CertificateSelectorApp::OnLowMemory(void)
108 {
109 }
110
111 void
112 CertificateSelectorApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
113 {
114 }
115
116 void
117 CertificateSelectorApp::OnScreenOn(void)
118 {
119 }
120
121 void
122 CertificateSelectorApp::OnScreenOff(void)
123 {
124 }
125
126 void
127 CertificateSelectorApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData)
128 {
129         AppLog("The current value of the request ID is %d.", reqId);
130         __reqId = reqId;
131 }