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 IstInstallerApp.cpp
19 * @brief This file contains the declaration of InstallerApp Class,
20 * which provides basic features necessary to define an UiApp.
23 #include "IstInstallerApp.h"
24 #include "IstMainFrame.h"
25 #include "AppResourceId.h"
27 using namespace Tizen::App;
28 using namespace Tizen::App::Package;
29 using namespace Tizen::Base;
30 using namespace Tizen::Ui::Controls;
32 InstallerApp::InstallerApp(void)
33 : __pPackageInfo(null)
37 InstallerApp::~InstallerApp(void)
42 InstallerApp::CreateInstance(void)
44 return new (std::nothrow) InstallerApp();
47 const Tizen::App::Package::PackageInfo*
48 InstallerApp::GetPackageInfo(void) const
50 return __pPackageInfo;
54 InstallerApp::GetPackageFilePath(void) const
56 return __packageFilePath;
61 InstallerApp::OnAppInitializing(Tizen::App::AppRegistry& appRegistry)
63 AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this);
69 InstallerApp::OnAppInitialized(void)
71 MainFrame* pMainFrame = new (std::nothrow) MainFrame();
72 pMainFrame->Construct();
73 result r = AddFrame(*pMainFrame);
85 InstallerApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
91 InstallerApp::OnBackground(void)
98 InstallerApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId,
99 const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData)
103 const String* pFilePath = static_cast<const String*>(pExtraData->GetValue(String(L"http://tizen.org/appcontrol/data/notification")));
106 __packageFilePath = *pFilePath;
109 else if (!pUriData || !pUriData->StartsWith(L"file://", 0))
111 AppLogException("Invalid URI date.");
116 __packageFilePath = *pUriData;
117 __packageFilePath.Replace(L"file://", L"");
120 AppLogDebug("file path: %ls", __packageFilePath.GetPointer());
121 __pPackageInfo = PackageManager::GetInstance()->GetPackageInfoFromFileN(__packageFilePath);
122 AppLogExceptionIf(GetLastResult() != E_SUCCESS, "[%s] Failed to get package information - %ls", GetErrorMessage(GetLastResult()), __packageFilePath.GetPointer());