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 pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
475 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
476 : __launchingIconVisible(true)
478 , __fromDatabase(false)
479 , __pLaunchConditionImplList(null)
480 , __pNotificationImplList(null)
481 , __pAppFeatureImplList(null)
482 , __pDataControlImplList(null)
483 , __pAppControlImplList(null)
484 , __pAppCategoryList(null)
488 ,__pAppInfoHandle(null)
490 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
491 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
492 __pLaunchConditionImplList->Construct();
494 __pNotificationImplList = new (std::nothrow) ArrayList;
495 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
496 __pNotificationImplList->Construct();
498 __pAppFeatureImplList = new (std::nothrow) ArrayList;
499 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
500 __pAppFeatureImplList->Construct();
502 __pDataControlImplList = new (std::nothrow) ArrayList;
503 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
504 __pDataControlImplList->Construct();
506 __pAppControlImplList = new (std::nothrow) ArrayList;
507 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
508 __pAppControlImplList->Construct();
510 __pAppCategoryList = new (std::nothrow) ArrayList;
511 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
512 __pAppCategoryList->Construct();
514 __pNameList = new (std::nothrow) HashMap;
515 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
516 __pNameList->Construct();
520 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
522 __pLaunchConditionImplList->RemoveAll(true);
523 delete __pLaunchConditionImplList;
525 __pNotificationImplList->RemoveAll(true);
526 delete __pNotificationImplList;
528 __pAppFeatureImplList->RemoveAll(true);
529 delete __pAppFeatureImplList;
531 __pDataControlImplList->RemoveAll(true);
532 delete __pDataControlImplList;
534 __pAppControlImplList->RemoveAll(true);
535 delete __pAppControlImplList;
537 __pAppCategoryList->RemoveAll(true);
538 delete __pAppCategoryList;
540 __pNameList->RemoveAll(true);
543 if (__pAppInfoHandle)
545 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
548 if (File::IsFileExist(__appTempIconPath) == true)
550 File::Remove(__appTempIconPath);
555 _PackageAppInfoImpl::GetName(void) const
561 _PackageAppInfoImpl::SetName(const String& name)
568 _PackageAppInfoImpl::GetType(void) const
574 _PackageAppInfoImpl::SetType(const String& type)
581 _PackageAppInfoImpl::GetDefault(void) const
587 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
589 __default = defaultApp;
594 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
596 result r = E_SUCCESS;
598 DbStatement* pStmt = null;
599 DbEnumerator* pEnum = null;
602 ArrayList* pList = null;
604 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
606 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
607 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
609 pStmt = db.CreateStatementN(query);
610 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
611 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
613 pEnum = db.ExecuteStatementN(*pStmt);
616 pList = new (std::nothrow) ArrayList;
617 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
620 while (pEnum->MoveNext() == E_SUCCESS)
622 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
623 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
628 pEnum->GetStringAt(1, name);
629 pEnum->GetStringAt(2, value);
631 pLaunchConditionImpl->SetName(name);
632 pLaunchConditionImpl->SetValue(value);
634 pList->Add(*pLaunchConditionImpl);
645 _PackageAppInfoImpl::GetLaunchConditionList(void) const
647 return __pLaunchConditionImplList;
651 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
653 result r = E_SUCCESS;
654 r = __pLaunchConditionImplList->Add(launchConditionImpl);
655 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
661 _PackageAppInfoImpl::GetNotificationListN(void) const
663 result r = E_SUCCESS;
665 DbStatement* pStmt = null;
666 DbEnumerator* pEnum = null;
669 ArrayList* pList = null;
671 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
673 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
674 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
676 pStmt = db.CreateStatementN(query);
677 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
678 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
680 pEnum = db.ExecuteStatementN(*pStmt);
683 pList = new (std::nothrow) ArrayList;
684 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
687 while (pEnum->MoveNext() == E_SUCCESS)
689 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
690 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
695 pEnum->GetStringAt(1, name);
696 pEnum->GetStringAt(2, value);
698 pNotificationImpl->SetName(name);
699 pNotificationImpl->SetValue(value);
701 pList->Add(*pNotificationImpl);
712 _PackageAppInfoImpl::GetNotificationList(void) const
714 return __pNotificationImplList;
718 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
720 result r = E_SUCCESS;
721 r = __pNotificationImplList->Add(notificationImpl);
722 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
728 _PackageAppInfoImpl::GetAppFeatureListN(void) const
730 result r = E_SUCCESS;
732 DbStatement* pStmt = null;
733 DbEnumerator* pEnum = null;
736 ArrayList* pList = null;
738 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
740 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
741 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
743 pStmt = db.CreateStatementN(query);
744 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
745 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
747 pEnum = db.ExecuteStatementN(*pStmt);
750 pList = new (std::nothrow) ArrayList;
751 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
754 while (pEnum->MoveNext() == E_SUCCESS)
756 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
757 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
762 pEnum->GetStringAt(1, name);
763 pEnum->GetStringAt(2, value);
765 pAppFeatureImpl->SetName(name);
766 pAppFeatureImpl->SetValue(value);
768 pList->Add(*pAppFeatureImpl);
779 _PackageAppInfoImpl::GetAppFeatureList(void) const
781 return __pAppFeatureImplList;
784 HashMapT<String, _AppFeatureInfoImpl*>*
785 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
787 result r = E_SUCCESS;
789 DbEnumerator* pEnum = null;
792 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
794 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
796 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
797 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
799 const DbStatement* pStmt = db.CreateStatementN(query);
800 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
801 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
803 pEnum = db.ExecuteStatementN(*pStmt);
806 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
807 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
813 while (pEnum->MoveNext() == E_SUCCESS)
815 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
816 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
818 pEnum->GetStringAt(1, name);
819 pEnum->GetStringAt(2, value);
821 pAppFeatureImpl->SetName(name);
822 pAppFeatureImpl->SetValue(value);
824 pMap->Add(name, pAppFeatureImpl);
835 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
837 result r = E_SUCCESS;
838 r = __pAppFeatureImplList->Add(appFeatureImpl);
839 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
845 _PackageAppInfoImpl::GetDataControlListN(void) const
851 _PackageAppInfoImpl::GetDataControlList(void) const
853 return __pDataControlImplList;
857 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
859 result r = E_SUCCESS;
860 r = __pDataControlImplList->Add(*pDataControl);
861 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
867 _PackageAppInfoImpl::GetAppControlListN(void) const
873 _PackageAppInfoImpl::GetAppControlList(void) const
875 return __pAppControlImplList;
879 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
881 result r = E_SUCCESS;
882 r = __pAppControlImplList->Add(*pAppControl);
883 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
889 _PackageAppInfoImpl::GetPackageName(void) const
891 return __packageName;
895 _PackageAppInfoImpl::SetPackageName(const String& packageName)
897 __packageName = packageName;
902 _PackageAppInfoImpl::GetMainmenuIcon(void) const
904 return __mainmenuIcon;
908 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
910 __mainmenuIcon = mainmenuIcon;
915 _PackageAppInfoImpl::GetSettingIcon(void) const
917 return __settingIcon;
921 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
923 __settingIcon = setting;
928 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
930 return __quickpanelIcon;
934 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
936 __quickpanelIcon = quickpanelIcon;
941 _PackageAppInfoImpl::IsMainmenuVisible(void) const
943 return __launchingIconVisible;
947 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
949 __launchingIconVisible = visible;
954 _PackageAppInfoImpl::AddName(const String& language, const String& name)
956 result r = E_SUCCESS;
957 r = __pNameList->Add(language, name);
963 _PackageAppInfoImpl::GetNameList(void) const
969 _PackageAppInfoImpl::GetUniqueId(void) const
971 result r = E_SUCCESS;
973 DbStatement* pStmt = null;
974 DbEnumerator* pEnum = null;
978 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
980 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
981 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
983 pStmt = db.CreateStatementN(query);
984 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
985 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
987 pEnum = db.ExecuteStatementN(*pStmt);
990 if (pEnum->MoveNext() == E_SUCCESS)
992 pEnum->GetIntAt(0, uniqueId);
1008 _PackageAppInfoImpl::GetPkgId(void) const
1014 _PackageAppInfoImpl::SetUniqueId(int id)
1021 _PackageAppInfoImpl::SetPkgId(int id)
1028 _PackageAppInfoImpl::GetAppFeature(void) const
1030 return __appFeature;
1034 _PackageAppInfoImpl::SetAppFeature(int feature)
1036 __appFeature = feature;
1040 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1045 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1051 _LaunchConditionInfoImpl::GetName(void) const
1057 _LaunchConditionInfoImpl::SetName(const String& name)
1064 _LaunchConditionInfoImpl::GetValue(void) const
1070 _LaunchConditionInfoImpl::SetValue(const String& value)
1076 _NotificationInfoImpl::_NotificationInfoImpl(void)
1081 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1087 _NotificationInfoImpl::GetName(void) const
1093 _NotificationInfoImpl::SetName(const String& name)
1100 _NotificationInfoImpl::GetValue(void) const
1106 _NotificationInfoImpl::SetValue(const String& value)
1112 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1117 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1123 _AppFeatureInfoImpl::GetName(void) const
1129 _AppFeatureInfoImpl::SetName(const String& name)
1136 _AppFeatureInfoImpl::GetValue(void) const
1142 _AppFeatureInfoImpl::SetValue(const String& value)
1148 _DataControlTypeImpl::_DataControlTypeImpl(void)
1153 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1159 _DataControlTypeImpl::GetType(void) const
1165 _DataControlTypeImpl::SetType(const String& type)
1172 _DataControlTypeImpl::GetAccess(void) const
1178 _DataControlTypeImpl::SetAccess(const String& access)
1184 _DataControlInfoImpl::_DataControlInfoImpl(void)
1185 : __pControlTypeList(null)
1187 __pControlTypeList = new (std::nothrow) ArrayList;
1188 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1189 __pControlTypeList->Construct();
1192 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1194 __pControlTypeList->RemoveAll(true);
1195 delete __pControlTypeList;
1199 _DataControlInfoImpl::GetProviderId(void) const
1201 return __providerId;
1205 _DataControlInfoImpl::SetProviderId(const String& providerId)
1207 __providerId = providerId;
1212 _DataControlInfoImpl::GetControlTypeList(void) const
1214 return __pControlTypeList;
1218 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1220 __pControlTypeList->Add(*pControlType);
1224 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1225 : __pUriScheme(null)
1231 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1233 delete __pUriScheme;
1238 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1240 return __pUriScheme;
1244 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1246 __pUriScheme = pUriScheme;
1251 _AppControlResolutionInfoImpl::GetMimeType(void) const
1257 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1259 __pMimeType = pMimeType;
1263 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1266 ,__pResolutionList(null)
1268 __pResolutionList = new (std::nothrow) ArrayList;
1269 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1270 __pResolutionList->Construct();
1273 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1275 __pResolutionList->RemoveAll(true);
1276 delete __pResolutionList;
1280 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1286 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1288 __uniqueId = uniqueId;
1293 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1295 return __appControlId;
1299 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1301 __appControlId = appControlId;
1306 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1308 return __operationId;
1312 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1314 __operationId = operationId;
1319 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1321 return __pResolutionList;
1325 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1327 result r = E_SUCCESS;
1328 r = __pResolutionList->Add(*pResolutionImpl);
1329 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1334 _AppControlInfoImpl::_AppControlInfoImpl(void)
1336 ,__pCapabilityList(null)
1338 __pCapabilityList = new (std::nothrow) ArrayList;
1339 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1340 __pCapabilityList->Construct();
1343 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1345 __pCapabilityList->RemoveAll(true);
1346 delete __pCapabilityList;
1350 _AppControlInfoImpl::GetUniqueId(void) const
1356 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1358 __uniqueId = uniqueId;
1363 _AppControlInfoImpl::GetProviderId(void) const
1365 return __providerId;
1369 _AppControlInfoImpl::SetProviderId(const String& providerId)
1371 __providerId = providerId;
1376 _AppControlInfoImpl::GetCategory(void) const
1382 _AppControlInfoImpl::SetCategory(const String& category)
1384 __category = category;
1389 _AppControlInfoImpl::GetCapabilityList(void) const
1391 return __pCapabilityList;
1395 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1397 result r = E_SUCCESS;
1398 r = __pCapabilityList->Add(*pCapability);
1399 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1404 } } } // Tizen::App::Package