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