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 <FBase_StringConverter.h>
38 #include "FAppPkg_PackageManagerImpl.h"
39 #include "FApp_AppResourceImpl.h"
40 #include "FApp_TemplateUtil.h"
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Collection;
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Io;
47 namespace Tizen { namespace App { namespace Package
51 _PackageAppInfoImpl::GetAppId(void) const
57 _PackageAppInfoImpl::SetAppId(const AppId& appId)
64 _PackageAppInfoImpl::GetAppName(void) const
70 _PackageAppInfoImpl::SetAppName(const String& appName)
77 _PackageAppInfoImpl::GetAppDisplayName(void) const
79 return __appDiplayName;
83 _PackageAppInfoImpl::SetAppDisplayName(const String& appDiplayName)
85 __appDiplayName = appDiplayName;
90 _PackageAppInfoImpl::GetAppMenuIconPath(void) const
96 _PackageAppInfoImpl::SetAppMenuIconPath(const String& iconPath)
98 __appIconPath = iconPath;
103 _PackageAppInfoImpl::GetAppSettingIconPath(void) const
105 return __appSettingIconPath;
109 _PackageAppInfoImpl::SetAppSettingIconPath(const Tizen::Base::String& appSettingIcon)
111 __appSettingIconPath = appSettingIcon;
116 _PackageAppInfoImpl::GetAppNotificationIconPath(void) const
118 return __appNotificationIconPath;
122 _PackageAppInfoImpl::SetAppNotificationIconPath(const String& notificationIconPath)
124 __appNotificationIconPath = notificationIconPath;
129 _PackageAppInfoImpl::GetAppTempIconPath(void) const
131 return __appTempIconPath;
135 _PackageAppInfoImpl::SetAppTempIconPath(const String& tempIconPath)
137 __appTempIconPath = tempIconPath;
142 _PackageAppInfoImpl::GetAppMenuIconN(void) const
144 Bitmap* pBitmap = null;
149 SysTryReturn(NID_APP, __appIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "appIconPath() is empty.");
151 iconPath = __appIconPath;
155 SysTryReturn(NID_APP, __appTempIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "__appTempIconPath() is empty.");
157 iconPath = __appTempIconPath;
160 SysLog(NID_APP, "iconPath = [%ls]", iconPath.GetPointer());
162 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
168 _PackageAppInfoImpl::GetAppMetadataListN(void) const
170 HashMap* pMap = null;
174 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
176 result r = E_SUCCESS;
177 int res = PMINFO_R_OK;
179 pMap = new (std::nothrow) HashMap();
180 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
183 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap);
184 if (res != PMINFO_R_OK)
186 SysLog(NID_APP, "pkgmgrinfo_appinfo_foreach_metadata() is failed. result = [%d]", res);
189 pMap->RemoveAll(true);
197 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
204 _PackageAppInfoImpl::GetAppCategoryListN(void) const
206 ArrayList* pList = null;
210 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
212 result r = E_SUCCESS;
213 int res = PMINFO_R_OK;
215 pList = new (std::nothrow) ArrayList();
216 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
219 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList);
220 if (res != PMINFO_R_OK)
222 SysLog(NID_APP, "pkgmgrinfo_appinfo_foreach_category() is failed. result = [%d]", res);
225 pList->RemoveAll(true);
234 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
241 _PackageAppInfoImpl::IsMenuIconVisible(void) const
243 return __launchingIconVisible;
247 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
249 __launchingIconVisible = visible;
254 _PackageAppInfoImpl::IsMainApp(void) const
260 _PackageAppInfoImpl::SetMainApp(bool mainApp)
267 _PackageAppInfoImpl::AddCategory(String* pCategory)
269 result r = E_SUCCESS;
270 r = __pAppCategoryList->Add(*pCategory);
271 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
277 _PackageAppInfoImpl::GetAppFeature(const String& key) const
279 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
285 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'",
286 key.GetPointer(), __appId.GetPointer());
288 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
290 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
291 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
293 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
294 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
296 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
297 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
299 while (pEnum->MoveNext() == E_SUCCESS)
301 pEnum->GetStringAt(0, value);
304 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
310 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
314 return pPackageAppInfo->__pPackageAppInfoImpl;
321 _PackageAppInfoImpl::Construct(const AppId& appId)
323 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
325 int res = PMINFO_R_OK;
326 char* pExePath = null;
327 char* pDisplayName = null;
328 char* pMenuIcon = null;
329 char* pSettingIcon = null;
330 char* pNotificationIcon = null;
331 bool mainApp = false;
332 bool menuIconVisible = false;
334 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
335 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
337 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
338 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], appId = [%s]", res, pAppId.get());
340 __fromDatabase = true;
344 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
345 if (res == PMINFO_R_OK)
347 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec(): exe = [%s]", pExePath);
349 String exePath(pExePath);
350 int startIndex = exePath.GetLength() - 1;
352 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
356 exePath.SubString(indexOf + 1, appName);
358 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
362 SysLog(NID_APP, "LastIndexOf is failed.");
367 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
370 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
371 if (res == PMINFO_R_OK)
373 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label(): displayName = [%s]", pDisplayName);
374 String displayName(pDisplayName);
375 SetAppDisplayName(displayName);
379 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
382 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
383 if (res == PMINFO_R_OK)
385 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon(): MenuIcon = [%s]", pMenuIcon);
386 String menuIcon(pMenuIcon);
387 SetAppMenuIconPath(menuIcon);
391 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
394 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
395 if (res == PMINFO_R_OK)
397 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon(): SettingIcon = [%s]", pSettingIcon);
398 String settingIcon(pSettingIcon);
399 SetAppSettingIconPath(settingIcon);
403 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
406 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
407 if (res == PMINFO_R_OK)
409 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon(): NotificationIcon = [%s]", pNotificationIcon);
410 String notificationIcon(pNotificationIcon);
411 SetAppNotificationIconPath(notificationIcon);
415 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
418 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
419 if (res == PMINFO_R_OK)
421 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp(): mainApp = [%d]", mainApp);
426 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
429 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
430 if (res == PMINFO_R_OK)
432 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay(): menuIconVisible = [%d]", menuIconVisible);
433 SetMenuIconVisible(!menuIconVisible);
437 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
444 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
446 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
448 SysLog(NID_APP, "Category = [%s]", pCategoryName);
449 ArrayList* pList = (ArrayList*) pUserData;
451 String* pCategory = new (std::nothrow) String (pCategoryName);
452 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
454 pList->Add(*pCategory);
460 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
462 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
463 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
464 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
466 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
468 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
469 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
470 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
476 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
477 : __launchingIconVisible(true)
479 , __fromDatabase(false)
480 , __pLaunchConditionImplList(null)
481 , __pNotificationImplList(null)
482 , __pAppFeatureImplList(null)
483 , __pDataControlImplList(null)
484 , __pAppControlImplList(null)
485 , __pAppCategoryList(null)
489 ,__pAppInfoHandle(null)
491 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
492 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
493 __pLaunchConditionImplList->Construct();
495 __pNotificationImplList = new (std::nothrow) ArrayList;
496 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
497 __pNotificationImplList->Construct();
499 __pAppFeatureImplList = new (std::nothrow) ArrayList;
500 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
501 __pAppFeatureImplList->Construct();
503 __pDataControlImplList = new (std::nothrow) ArrayList;
504 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
505 __pDataControlImplList->Construct();
507 __pAppControlImplList = new (std::nothrow) ArrayList;
508 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
509 __pAppControlImplList->Construct();
511 __pAppCategoryList = new (std::nothrow) ArrayList;
512 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
513 __pAppCategoryList->Construct();
515 __pNameList = new (std::nothrow) HashMap;
516 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
517 __pNameList->Construct();
521 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
523 __pLaunchConditionImplList->RemoveAll(true);
524 delete __pLaunchConditionImplList;
526 __pNotificationImplList->RemoveAll(true);
527 delete __pNotificationImplList;
529 __pAppFeatureImplList->RemoveAll(true);
530 delete __pAppFeatureImplList;
532 __pDataControlImplList->RemoveAll(true);
533 delete __pDataControlImplList;
535 __pAppControlImplList->RemoveAll(true);
536 delete __pAppControlImplList;
538 __pAppCategoryList->RemoveAll(true);
539 delete __pAppCategoryList;
541 __pNameList->RemoveAll(true);
544 if (__pAppInfoHandle)
546 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
549 if (File::IsFileExist(__appTempIconPath) == true)
551 File::Remove(__appTempIconPath);
556 _PackageAppInfoImpl::GetName(void) const
562 _PackageAppInfoImpl::SetName(const String& name)
569 _PackageAppInfoImpl::GetType(void) const
575 _PackageAppInfoImpl::SetType(const String& type)
582 _PackageAppInfoImpl::GetDefault(void) const
588 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
590 __default = defaultApp;
595 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
597 result r = E_SUCCESS;
599 DbStatement* pStmt = null;
600 DbEnumerator* pEnum = null;
603 ArrayList* pList = null;
605 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
607 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
608 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
610 pStmt = db.CreateStatementN(query);
611 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
612 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
614 pEnum = db.ExecuteStatementN(*pStmt);
617 pList = new (std::nothrow) ArrayList;
618 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
621 while (pEnum->MoveNext() == E_SUCCESS)
623 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
624 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
629 pEnum->GetStringAt(1, name);
630 pEnum->GetStringAt(2, value);
632 pLaunchConditionImpl->SetName(name);
633 pLaunchConditionImpl->SetValue(value);
635 pList->Add(*pLaunchConditionImpl);
646 _PackageAppInfoImpl::GetLaunchConditionList(void) const
648 return __pLaunchConditionImplList;
652 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
654 result r = E_SUCCESS;
655 r = __pLaunchConditionImplList->Add(launchConditionImpl);
656 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
662 _PackageAppInfoImpl::GetNotificationListN(void) const
664 result r = E_SUCCESS;
666 DbStatement* pStmt = null;
667 DbEnumerator* pEnum = null;
670 ArrayList* pList = null;
672 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
674 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
675 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
677 pStmt = db.CreateStatementN(query);
678 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
679 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
681 pEnum = db.ExecuteStatementN(*pStmt);
684 pList = new (std::nothrow) ArrayList;
685 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
688 while (pEnum->MoveNext() == E_SUCCESS)
690 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
691 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
696 pEnum->GetStringAt(1, name);
697 pEnum->GetStringAt(2, value);
699 pNotificationImpl->SetName(name);
700 pNotificationImpl->SetValue(value);
702 pList->Add(*pNotificationImpl);
713 _PackageAppInfoImpl::GetNotificationList(void) const
715 return __pNotificationImplList;
719 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
721 result r = E_SUCCESS;
722 r = __pNotificationImplList->Add(notificationImpl);
723 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
729 _PackageAppInfoImpl::GetAppFeatureListN(void) const
731 result r = E_SUCCESS;
733 DbStatement* pStmt = null;
734 DbEnumerator* pEnum = null;
737 ArrayList* pList = null;
739 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
741 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
742 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
744 pStmt = db.CreateStatementN(query);
745 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
746 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
748 pEnum = db.ExecuteStatementN(*pStmt);
751 pList = new (std::nothrow) ArrayList;
752 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
755 while (pEnum->MoveNext() == E_SUCCESS)
757 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
758 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
763 pEnum->GetStringAt(1, name);
764 pEnum->GetStringAt(2, value);
766 pAppFeatureImpl->SetName(name);
767 pAppFeatureImpl->SetValue(value);
769 pList->Add(*pAppFeatureImpl);
780 _PackageAppInfoImpl::GetAppFeatureList(void) const
782 return __pAppFeatureImplList;
785 HashMapT<String, _AppFeatureInfoImpl*>*
786 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
788 result r = E_SUCCESS;
790 DbEnumerator* pEnum = null;
793 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
795 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
797 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
798 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
800 const DbStatement* pStmt = db.CreateStatementN(query);
801 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
802 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
804 pEnum = db.ExecuteStatementN(*pStmt);
807 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
808 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
814 while (pEnum->MoveNext() == E_SUCCESS)
816 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
817 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
819 pEnum->GetStringAt(1, name);
820 pEnum->GetStringAt(2, value);
822 pAppFeatureImpl->SetName(name);
823 pAppFeatureImpl->SetValue(value);
825 pMap->Add(name, pAppFeatureImpl);
836 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
838 result r = E_SUCCESS;
839 r = __pAppFeatureImplList->Add(appFeatureImpl);
840 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
846 _PackageAppInfoImpl::GetDataControlListN(void) const
852 _PackageAppInfoImpl::GetDataControlList(void) const
854 return __pDataControlImplList;
858 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
860 result r = E_SUCCESS;
861 r = __pDataControlImplList->Add(*pDataControl);
862 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
868 _PackageAppInfoImpl::GetAppControlListN(void) const
874 _PackageAppInfoImpl::GetAppControlList(void) const
876 return __pAppControlImplList;
880 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
882 result r = E_SUCCESS;
883 r = __pAppControlImplList->Add(*pAppControl);
884 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
890 _PackageAppInfoImpl::GetPackageName(void) const
892 return __packageName;
896 _PackageAppInfoImpl::SetPackageName(const String& packageName)
898 __packageName = packageName;
903 _PackageAppInfoImpl::GetMainmenuIcon(void) const
905 return __mainmenuIcon;
909 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
911 __mainmenuIcon = mainmenuIcon;
916 _PackageAppInfoImpl::GetSettingIcon(void) const
918 return __settingIcon;
922 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
924 __settingIcon = setting;
929 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
931 return __quickpanelIcon;
935 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
937 __quickpanelIcon = quickpanelIcon;
942 _PackageAppInfoImpl::IsMainmenuVisible(void) const
944 return __launchingIconVisible;
948 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
950 __launchingIconVisible = visible;
955 _PackageAppInfoImpl::AddName(const String& language, const String& name)
957 result r = E_SUCCESS;
958 r = __pNameList->Add(language, name);
964 _PackageAppInfoImpl::GetNameList(void) const
970 _PackageAppInfoImpl::GetUniqueId(void) const
972 result r = E_SUCCESS;
974 DbStatement* pStmt = null;
975 DbEnumerator* pEnum = null;
979 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
981 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
982 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
984 pStmt = db.CreateStatementN(query);
985 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
986 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
988 pEnum = db.ExecuteStatementN(*pStmt);
991 if (pEnum->MoveNext() == E_SUCCESS)
993 pEnum->GetIntAt(0, uniqueId);
1000 r = E_OBJ_NOT_FOUND;
1009 _PackageAppInfoImpl::GetPkgId(void) const
1015 _PackageAppInfoImpl::SetUniqueId(int id)
1022 _PackageAppInfoImpl::SetPkgId(int id)
1029 _PackageAppInfoImpl::GetAppFeature(void) const
1031 return __appFeature;
1035 _PackageAppInfoImpl::SetAppFeature(int feature)
1037 __appFeature = feature;
1041 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1046 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1052 _LaunchConditionInfoImpl::GetName(void) const
1058 _LaunchConditionInfoImpl::SetName(const String& name)
1065 _LaunchConditionInfoImpl::GetValue(void) const
1071 _LaunchConditionInfoImpl::SetValue(const String& value)
1077 _NotificationInfoImpl::_NotificationInfoImpl(void)
1082 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1088 _NotificationInfoImpl::GetName(void) const
1094 _NotificationInfoImpl::SetName(const String& name)
1101 _NotificationInfoImpl::GetValue(void) const
1107 _NotificationInfoImpl::SetValue(const String& value)
1113 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1118 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1124 _AppFeatureInfoImpl::GetName(void) const
1130 _AppFeatureInfoImpl::SetName(const String& name)
1137 _AppFeatureInfoImpl::GetValue(void) const
1143 _AppFeatureInfoImpl::SetValue(const String& value)
1149 _DataControlTypeImpl::_DataControlTypeImpl(void)
1154 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1160 _DataControlTypeImpl::GetType(void) const
1166 _DataControlTypeImpl::SetType(const String& type)
1173 _DataControlTypeImpl::GetAccess(void) const
1179 _DataControlTypeImpl::SetAccess(const String& access)
1185 _DataControlInfoImpl::_DataControlInfoImpl(void)
1186 : __pControlTypeList(null)
1188 __pControlTypeList = new (std::nothrow) ArrayList;
1189 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1190 __pControlTypeList->Construct();
1193 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1195 __pControlTypeList->RemoveAll(true);
1196 delete __pControlTypeList;
1200 _DataControlInfoImpl::GetProviderId(void) const
1202 return __providerId;
1206 _DataControlInfoImpl::SetProviderId(const String& providerId)
1208 __providerId = providerId;
1213 _DataControlInfoImpl::GetControlTypeList(void) const
1215 return __pControlTypeList;
1219 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1221 __pControlTypeList->Add(*pControlType);
1225 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1226 : __pUriScheme(null)
1232 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1234 delete __pUriScheme;
1239 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1241 return __pUriScheme;
1245 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1247 __pUriScheme = pUriScheme;
1252 _AppControlResolutionInfoImpl::GetMimeType(void) const
1258 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1260 __pMimeType = pMimeType;
1264 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1267 ,__pResolutionList(null)
1269 __pResolutionList = new (std::nothrow) ArrayList;
1270 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1271 __pResolutionList->Construct();
1274 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1276 __pResolutionList->RemoveAll(true);
1277 delete __pResolutionList;
1281 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1287 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1289 __uniqueId = uniqueId;
1294 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1296 return __appControlId;
1300 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1302 __appControlId = appControlId;
1307 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1309 return __operationId;
1313 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1315 __operationId = operationId;
1320 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1322 return __pResolutionList;
1326 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1328 result r = E_SUCCESS;
1329 r = __pResolutionList->Add(*pResolutionImpl);
1330 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1335 _AppControlInfoImpl::_AppControlInfoImpl(void)
1337 ,__pCapabilityList(null)
1339 __pCapabilityList = new (std::nothrow) ArrayList;
1340 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1341 __pCapabilityList->Construct();
1344 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1346 __pCapabilityList->RemoveAll(true);
1347 delete __pCapabilityList;
1351 _AppControlInfoImpl::GetUniqueId(void) const
1357 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1359 __uniqueId = uniqueId;
1364 _AppControlInfoImpl::GetProviderId(void) const
1366 return __providerId;
1370 _AppControlInfoImpl::SetProviderId(const String& providerId)
1372 __providerId = providerId;
1377 _AppControlInfoImpl::GetCategory(void) const
1383 _AppControlInfoImpl::SetCategory(const String& category)
1385 __category = category;
1390 _AppControlInfoImpl::GetCapabilityList(void) const
1392 return __pCapabilityList;
1396 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1398 result r = E_SUCCESS;
1399 r = __pCapabilityList->Add(*pCapability);
1400 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1405 } } } // Tizen::App::Package