2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FAppPkg_PackageAppInfoImpl.cpp
19 * @brief This is the implementation for the _PackageAppInfoImpl class.
25 #include <unique_ptr.h>
27 #include <pkgmgr-info.h>
29 #include <FAppPkgPackageManager.h>
30 #include <FAppPkgPackageAppInfo.h>
31 #include <FBaseSysLog.h>
32 #include <FIoDatabase.h>
33 #include <FIoDbEnumerator.h>
34 #include <FIoDbStatement.h>
36 #include <FIoDirectory.h>
37 #include <FBase_StringConverter.h>
39 #include "FAppPkg_PackageManagerImpl.h"
40 #include "FApp_AppResourceImpl.h"
41 #include "FApp_TemplateUtil.h"
43 using namespace Tizen::Base;
44 using namespace Tizen::Base::Collection;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
48 namespace Tizen { namespace App { namespace Package
52 _PackageAppInfoImpl::GetAppId(void) const
58 _PackageAppInfoImpl::SetAppId(const AppId& appId)
65 _PackageAppInfoImpl::GetAppName(void) const
71 _PackageAppInfoImpl::SetAppName(const String& appName)
78 _PackageAppInfoImpl::GetAppDisplayName(void) const
80 return __appDiplayName;
84 _PackageAppInfoImpl::SetAppDisplayName(const String& appDiplayName)
86 __appDiplayName = appDiplayName;
91 _PackageAppInfoImpl::GetAppMenuIconPath(void) const
97 _PackageAppInfoImpl::SetAppMenuIconPath(const String& iconPath)
99 __appIconPath = iconPath;
104 _PackageAppInfoImpl::GetAppSettingIconPath(void) const
106 return __appSettingIconPath;
110 _PackageAppInfoImpl::SetAppSettingIconPath(const Tizen::Base::String& appSettingIcon)
112 __appSettingIconPath = appSettingIcon;
117 _PackageAppInfoImpl::GetAppNotificationIconPath(void) const
119 return __appNotificationIconPath;
123 _PackageAppInfoImpl::SetAppNotificationIconPath(const String& notificationIconPath)
125 __appNotificationIconPath = notificationIconPath;
130 _PackageAppInfoImpl::GetAppTempIconPath(void) const
132 return __appTempIconPath;
136 _PackageAppInfoImpl::SetAppTempIconPath(const String& tempIconPath)
138 __appTempIconPath = tempIconPath;
143 _PackageAppInfoImpl::GetAppMenuIconN(void) const
145 Bitmap* pBitmap = null;
150 SysTryReturn(NID_APP, __appIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "appIconPath() is empty.");
152 iconPath = __appIconPath;
156 SysTryReturn(NID_APP, __appTempIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "__appTempIconPath() is empty.");
158 iconPath = __appTempIconPath;
161 SysLog(NID_APP, "iconPath = [%ls]", iconPath.GetPointer());
163 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
169 _PackageAppInfoImpl::GetAppMetadataListN(void) const
173 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
175 int res = PMINFO_R_OK;
177 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap());
178 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
181 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap.get());
182 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_metadata() failed. [%d]", res);
184 if (pMap->GetCount() <= 0)
189 return pMap.release();
193 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
199 _PackageAppInfoImpl::GetAppCategoryListN(void) const
203 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
205 int res = PMINFO_R_OK;
207 std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
208 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
211 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList.get());
212 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_category() failed. [%d]", res);
214 if (pList->GetCount() <= 0)
219 return pList.release();
223 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
229 _PackageAppInfoImpl::IsMenuIconVisible(void) const
231 return __launchingIconVisible;
235 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
237 __launchingIconVisible = visible;
242 _PackageAppInfoImpl::IsMainApp(void) const
248 _PackageAppInfoImpl::SetMainApp(bool mainApp)
255 _PackageAppInfoImpl::AddCategory(String* pCategory)
257 result r = E_SUCCESS;
258 r = __pAppCategoryList->Add(*pCategory);
259 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
265 _PackageAppInfoImpl::GetAppFeature(const String& key) const
267 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
273 query.Format(1024, L"SELECT AppFeature.VALUE FROM AppInfo, AppFeature WHERE AppFeature.ID = AppInfo.UNIQUE_ID and AppFeature.NAME = '%ls' and AppInfo.PACKAGE_NAME = '%ls'",
274 key.GetPointer(), __appId.GetPointer());
276 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
278 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
279 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
281 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
282 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
284 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
285 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
287 while (pEnum->MoveNext() == E_SUCCESS)
289 pEnum->GetStringAt(0, value);
292 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
298 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
302 return pPackageAppInfo->__pPackageAppInfoImpl;
309 _PackageAppInfoImpl::Construct(const AppId& appId)
311 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
313 int res = PMINFO_R_OK;
314 char* pExePath = null;
315 char* pDisplayName = null;
316 char* pMenuIcon = null;
317 char* pSettingIcon = null;
318 char* pNotificationIcon = null;
319 bool mainApp = false;
320 bool menuIconVisible = false;
322 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
323 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
325 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
326 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
328 __fromDatabase = true;
332 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
333 if (res == PMINFO_R_OK)
335 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec(): exe = [%s]", pExePath);
337 String exePath(pExePath);
338 int startIndex = exePath.GetLength() - 1;
340 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
344 exePath.SubString(indexOf + 1, appName);
346 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
350 SysLog(NID_APP, "LastIndexOf is failed.");
355 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
358 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
359 if (res == PMINFO_R_OK)
361 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label(): displayName = [%s]", pDisplayName);
362 String displayName(pDisplayName);
363 SetAppDisplayName(displayName);
367 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
370 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
371 if (res == PMINFO_R_OK)
373 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon(): MenuIcon = [%s]", pMenuIcon);
374 String menuIcon(pMenuIcon);
375 SetAppMenuIconPath(menuIcon);
379 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
382 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
383 if (res == PMINFO_R_OK)
385 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon(): SettingIcon = [%s]", pSettingIcon);
386 String settingIcon(pSettingIcon);
387 SetAppSettingIconPath(settingIcon);
391 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
394 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
395 if (res == PMINFO_R_OK)
397 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon(): NotificationIcon = [%s]", pNotificationIcon);
398 String notificationIcon(pNotificationIcon);
399 SetAppNotificationIconPath(notificationIcon);
403 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
406 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
407 if (res == PMINFO_R_OK)
409 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp(): mainApp = [%d]", mainApp);
414 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
417 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
418 if (res == PMINFO_R_OK)
420 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay(): menuIconVisible = [%d]", menuIconVisible);
421 SetMenuIconVisible(!menuIconVisible);
425 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
432 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
434 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
436 SysLog(NID_APP, "Category = [%s]", pCategoryName);
437 ArrayList* pList = (ArrayList*) pUserData;
439 String* pCategory = new (std::nothrow) String (pCategoryName);
440 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
442 pList->Add(*pCategory);
448 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
450 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
451 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
452 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
454 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
456 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
457 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
458 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
464 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
465 : __launchingIconVisible(true)
467 , __fromDatabase(false)
468 , __pLaunchConditionImplList(null)
469 , __pNotificationImplList(null)
470 , __pAppFeatureImplList(null)
471 , __pDataControlImplList(null)
472 , __pAppControlImplList(null)
473 , __pAppCategoryList(null)
477 ,__pAppInfoHandle(null)
479 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
480 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
481 __pLaunchConditionImplList->Construct();
483 __pNotificationImplList = new (std::nothrow) ArrayList;
484 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
485 __pNotificationImplList->Construct();
487 __pAppFeatureImplList = new (std::nothrow) ArrayList;
488 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
489 __pAppFeatureImplList->Construct();
491 __pDataControlImplList = new (std::nothrow) ArrayList;
492 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
493 __pDataControlImplList->Construct();
495 __pAppControlImplList = new (std::nothrow) ArrayList;
496 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
497 __pAppControlImplList->Construct();
499 __pAppCategoryList = new (std::nothrow) ArrayList;
500 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
501 __pAppCategoryList->Construct();
503 __pNameList = new (std::nothrow) HashMap;
504 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
505 __pNameList->Construct();
509 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
511 __pLaunchConditionImplList->RemoveAll(true);
512 delete __pLaunchConditionImplList;
514 __pNotificationImplList->RemoveAll(true);
515 delete __pNotificationImplList;
517 __pAppFeatureImplList->RemoveAll(true);
518 delete __pAppFeatureImplList;
520 __pDataControlImplList->RemoveAll(true);
521 delete __pDataControlImplList;
523 __pAppControlImplList->RemoveAll(true);
524 delete __pAppControlImplList;
526 __pAppCategoryList->RemoveAll(true);
527 delete __pAppCategoryList;
529 __pNameList->RemoveAll(true);
532 if (__pAppInfoHandle)
534 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
537 if (File::IsFileExist(__appTempIconPath) == true)
539 File::Remove(__appTempIconPath);
541 String tmp(L"/tmp/__icon/");
542 Directory::Remove(tmp, true);
547 _PackageAppInfoImpl::GetName(void) const
553 _PackageAppInfoImpl::SetName(const String& name)
560 _PackageAppInfoImpl::GetType(void) const
566 _PackageAppInfoImpl::SetType(const String& type)
573 _PackageAppInfoImpl::GetDefault(void) const
579 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
581 __default = defaultApp;
586 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
588 result r = E_SUCCESS;
590 DbStatement* pStmt = null;
591 DbEnumerator* pEnum = null;
594 ArrayList* pList = null;
596 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
598 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
599 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
601 pStmt = db.CreateStatementN(query);
602 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
603 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
605 pEnum = db.ExecuteStatementN(*pStmt);
608 pList = new (std::nothrow) ArrayList;
609 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
612 while (pEnum->MoveNext() == E_SUCCESS)
614 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
615 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
620 pEnum->GetStringAt(1, name);
621 pEnum->GetStringAt(2, value);
623 pLaunchConditionImpl->SetName(name);
624 pLaunchConditionImpl->SetValue(value);
626 pList->Add(*pLaunchConditionImpl);
637 _PackageAppInfoImpl::GetLaunchConditionList(void) const
639 return __pLaunchConditionImplList;
643 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
645 result r = E_SUCCESS;
646 r = __pLaunchConditionImplList->Add(launchConditionImpl);
647 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
653 _PackageAppInfoImpl::GetNotificationListN(void) const
655 result r = E_SUCCESS;
657 DbStatement* pStmt = null;
658 DbEnumerator* pEnum = null;
661 ArrayList* pList = null;
663 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
665 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
666 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
668 pStmt = db.CreateStatementN(query);
669 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
670 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
672 pEnum = db.ExecuteStatementN(*pStmt);
675 pList = new (std::nothrow) ArrayList;
676 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
679 while (pEnum->MoveNext() == E_SUCCESS)
681 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
682 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
687 pEnum->GetStringAt(1, name);
688 pEnum->GetStringAt(2, value);
690 pNotificationImpl->SetName(name);
691 pNotificationImpl->SetValue(value);
693 pList->Add(*pNotificationImpl);
704 _PackageAppInfoImpl::GetNotificationList(void) const
706 return __pNotificationImplList;
710 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
712 result r = E_SUCCESS;
713 r = __pNotificationImplList->Add(notificationImpl);
714 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
720 _PackageAppInfoImpl::GetAppFeatureListN(void) const
722 result r = E_SUCCESS;
724 DbStatement* pStmt = null;
725 DbEnumerator* pEnum = null;
728 ArrayList* pList = null;
730 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
732 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
733 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
735 pStmt = db.CreateStatementN(query);
736 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
737 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
739 pEnum = db.ExecuteStatementN(*pStmt);
742 pList = new (std::nothrow) ArrayList;
743 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
746 while (pEnum->MoveNext() == E_SUCCESS)
748 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
749 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
754 pEnum->GetStringAt(1, name);
755 pEnum->GetStringAt(2, value);
757 pAppFeatureImpl->SetName(name);
758 pAppFeatureImpl->SetValue(value);
760 pList->Add(*pAppFeatureImpl);
771 _PackageAppInfoImpl::GetAppFeatureList(void) const
773 return __pAppFeatureImplList;
776 HashMapT<String, _AppFeatureInfoImpl*>*
777 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
779 result r = E_SUCCESS;
781 DbEnumerator* pEnum = null;
784 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
786 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
788 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
789 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
791 const DbStatement* pStmt = db.CreateStatementN(query);
792 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
793 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
795 pEnum = db.ExecuteStatementN(*pStmt);
798 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
799 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
805 while (pEnum->MoveNext() == E_SUCCESS)
807 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
808 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
810 pEnum->GetStringAt(1, name);
811 pEnum->GetStringAt(2, value);
813 pAppFeatureImpl->SetName(name);
814 pAppFeatureImpl->SetValue(value);
816 pMap->Add(name, pAppFeatureImpl);
827 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
829 result r = E_SUCCESS;
830 r = __pAppFeatureImplList->Add(appFeatureImpl);
831 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
837 _PackageAppInfoImpl::GetDataControlListN(void) const
843 _PackageAppInfoImpl::GetDataControlList(void) const
845 return __pDataControlImplList;
849 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
851 result r = E_SUCCESS;
852 r = __pDataControlImplList->Add(*pDataControl);
853 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
859 _PackageAppInfoImpl::GetAppControlListN(void) const
865 _PackageAppInfoImpl::GetAppControlList(void) const
867 return __pAppControlImplList;
871 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
873 result r = E_SUCCESS;
874 r = __pAppControlImplList->Add(*pAppControl);
875 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
881 _PackageAppInfoImpl::GetPackageName(void) const
883 return __packageName;
887 _PackageAppInfoImpl::SetPackageName(const String& packageName)
889 __packageName = packageName;
894 _PackageAppInfoImpl::GetMainmenuIcon(void) const
896 return __mainmenuIcon;
900 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
902 __mainmenuIcon = mainmenuIcon;
907 _PackageAppInfoImpl::GetSettingIcon(void) const
909 return __settingIcon;
913 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
915 __settingIcon = setting;
920 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
922 return __quickpanelIcon;
926 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
928 __quickpanelIcon = quickpanelIcon;
933 _PackageAppInfoImpl::IsMainmenuVisible(void) const
935 return __launchingIconVisible;
939 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
941 __launchingIconVisible = visible;
946 _PackageAppInfoImpl::AddName(const String& language, const String& name)
948 result r = E_SUCCESS;
949 r = __pNameList->Add(language, name);
955 _PackageAppInfoImpl::GetNameList(void) const
961 _PackageAppInfoImpl::GetUniqueId(void) const
963 result r = E_SUCCESS;
965 DbStatement* pStmt = null;
966 DbEnumerator* pEnum = null;
970 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
972 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
973 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
975 pStmt = db.CreateStatementN(query);
976 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
977 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
979 pEnum = db.ExecuteStatementN(*pStmt);
982 if (pEnum->MoveNext() == E_SUCCESS)
984 pEnum->GetIntAt(0, uniqueId);
1000 _PackageAppInfoImpl::GetPkgId(void) const
1006 _PackageAppInfoImpl::SetUniqueId(int id)
1013 _PackageAppInfoImpl::SetPkgId(int id)
1020 _PackageAppInfoImpl::GetAppFeature(void) const
1022 return __appFeature;
1026 _PackageAppInfoImpl::SetAppFeature(int feature)
1028 __appFeature = feature;
1032 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1037 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1043 _LaunchConditionInfoImpl::GetName(void) const
1049 _LaunchConditionInfoImpl::SetName(const String& name)
1056 _LaunchConditionInfoImpl::GetValue(void) const
1062 _LaunchConditionInfoImpl::SetValue(const String& value)
1068 _NotificationInfoImpl::_NotificationInfoImpl(void)
1073 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1079 _NotificationInfoImpl::GetName(void) const
1085 _NotificationInfoImpl::SetName(const String& name)
1092 _NotificationInfoImpl::GetValue(void) const
1098 _NotificationInfoImpl::SetValue(const String& value)
1104 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1109 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1115 _AppFeatureInfoImpl::GetName(void) const
1121 _AppFeatureInfoImpl::SetName(const String& name)
1128 _AppFeatureInfoImpl::GetValue(void) const
1134 _AppFeatureInfoImpl::SetValue(const String& value)
1140 _DataControlTypeImpl::_DataControlTypeImpl(void)
1145 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1151 _DataControlTypeImpl::GetType(void) const
1157 _DataControlTypeImpl::SetType(const String& type)
1164 _DataControlTypeImpl::GetAccess(void) const
1170 _DataControlTypeImpl::SetAccess(const String& access)
1176 _DataControlInfoImpl::_DataControlInfoImpl(void)
1177 : __pControlTypeList(null)
1179 __pControlTypeList = new (std::nothrow) ArrayList;
1180 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1181 __pControlTypeList->Construct();
1184 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1186 __pControlTypeList->RemoveAll(true);
1187 delete __pControlTypeList;
1191 _DataControlInfoImpl::GetProviderId(void) const
1193 return __providerId;
1197 _DataControlInfoImpl::SetProviderId(const String& providerId)
1199 __providerId = providerId;
1204 _DataControlInfoImpl::GetControlTypeList(void) const
1206 return __pControlTypeList;
1210 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1212 __pControlTypeList->Add(*pControlType);
1216 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1217 : __pUriScheme(null)
1223 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1225 delete __pUriScheme;
1230 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1232 return __pUriScheme;
1236 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1238 __pUriScheme = pUriScheme;
1243 _AppControlResolutionInfoImpl::GetMimeType(void) const
1249 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1251 __pMimeType = pMimeType;
1255 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1258 ,__pResolutionList(null)
1260 __pResolutionList = new (std::nothrow) ArrayList;
1261 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1262 __pResolutionList->Construct();
1265 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1267 __pResolutionList->RemoveAll(true);
1268 delete __pResolutionList;
1272 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1278 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1280 __uniqueId = uniqueId;
1285 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1287 return __appControlId;
1291 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1293 __appControlId = appControlId;
1298 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1300 return __operationId;
1304 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1306 __operationId = operationId;
1311 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1313 return __pResolutionList;
1317 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1319 result r = E_SUCCESS;
1320 r = __pResolutionList->Add(*pResolutionImpl);
1321 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1326 _AppControlInfoImpl::_AppControlInfoImpl(void)
1328 ,__pCapabilityList(null)
1330 __pCapabilityList = new (std::nothrow) ArrayList;
1331 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1332 __pCapabilityList->Construct();
1335 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1337 __pCapabilityList->RemoveAll(true);
1338 delete __pCapabilityList;
1342 _AppControlInfoImpl::GetUniqueId(void) const
1348 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1350 __uniqueId = uniqueId;
1355 _AppControlInfoImpl::GetProviderId(void) const
1357 return __providerId;
1361 _AppControlInfoImpl::SetProviderId(const String& providerId)
1363 __providerId = providerId;
1368 _AppControlInfoImpl::GetCategory(void) const
1374 _AppControlInfoImpl::SetCategory(const String& category)
1376 __category = category;
1381 _AppControlInfoImpl::GetCapabilityList(void) const
1383 return __pCapabilityList;
1387 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1389 result r = E_SUCCESS;
1390 r = __pCapabilityList->Add(*pCapability);
1391 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1396 } } } // Tizen::App::Package