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
172 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
174 int res = PMINFO_R_OK;
176 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap());
177 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
180 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap.get());
181 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_metadata() failed. [%d]", res);
183 if (pMap->GetCount() <= 0)
188 return pMap.release();
192 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
198 _PackageAppInfoImpl::GetAppCategoryListN(void) const
202 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
204 int res = PMINFO_R_OK;
206 std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
207 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
210 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList.get());
211 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_category() failed. [%d]", res);
213 if (pList->GetCount() <= 0)
218 return pList.release();
222 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
228 _PackageAppInfoImpl::IsMenuIconVisible(void) const
230 return __launchingIconVisible;
234 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
236 __launchingIconVisible = visible;
241 _PackageAppInfoImpl::IsMainApp(void) const
247 _PackageAppInfoImpl::SetMainApp(bool mainApp)
254 _PackageAppInfoImpl::AddCategory(String* pCategory)
256 result r = E_SUCCESS;
257 r = __pAppCategoryList->Add(*pCategory);
258 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
264 _PackageAppInfoImpl::GetAppFeature(const String& key) const
266 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
272 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'",
273 key.GetPointer(), __appId.GetPointer());
275 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
277 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
278 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
280 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
281 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
283 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
284 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
286 while (pEnum->MoveNext() == E_SUCCESS)
288 pEnum->GetStringAt(0, value);
291 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
297 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
301 return pPackageAppInfo->__pPackageAppInfoImpl;
308 _PackageAppInfoImpl::Construct(const AppId& appId)
310 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
312 int res = PMINFO_R_OK;
313 char* pExePath = null;
314 char* pDisplayName = null;
315 char* pMenuIcon = null;
316 char* pSettingIcon = null;
317 char* pNotificationIcon = null;
318 bool mainApp = false;
319 bool menuIconVisible = false;
321 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
322 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
324 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
325 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
327 __fromDatabase = true;
331 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
332 if (res == PMINFO_R_OK)
334 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec(): exe = [%s]", pExePath);
336 String exePath(pExePath);
337 int startIndex = exePath.GetLength() - 1;
339 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
343 exePath.SubString(indexOf + 1, appName);
345 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
349 SysLog(NID_APP, "LastIndexOf is failed.");
354 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
357 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
358 if (res == PMINFO_R_OK)
360 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label(): displayName = [%s]", pDisplayName);
361 String displayName(pDisplayName);
362 SetAppDisplayName(displayName);
366 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
369 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
370 if (res == PMINFO_R_OK)
372 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon(): MenuIcon = [%s]", pMenuIcon);
373 String menuIcon(pMenuIcon);
374 SetAppMenuIconPath(menuIcon);
378 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
381 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
382 if (res == PMINFO_R_OK)
384 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon(): SettingIcon = [%s]", pSettingIcon);
385 String settingIcon(pSettingIcon);
386 SetAppSettingIconPath(settingIcon);
390 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
393 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
394 if (res == PMINFO_R_OK)
396 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon(): NotificationIcon = [%s]", pNotificationIcon);
397 String notificationIcon(pNotificationIcon);
398 SetAppNotificationIconPath(notificationIcon);
402 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
405 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
406 if (res == PMINFO_R_OK)
408 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp(): mainApp = [%d]", mainApp);
413 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
416 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
417 if (res == PMINFO_R_OK)
419 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay(): menuIconVisible = [%d]", menuIconVisible);
420 SetMenuIconVisible(!menuIconVisible);
424 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
431 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
433 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
435 SysLog(NID_APP, "Category = [%s]", pCategoryName);
436 ArrayList* pList = (ArrayList*) pUserData;
438 String* pCategory = new (std::nothrow) String (pCategoryName);
439 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
441 pList->Add(*pCategory);
447 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
449 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
450 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
451 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
453 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
455 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
456 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
457 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
463 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
464 : __launchingIconVisible(true)
466 , __fromDatabase(false)
467 , __pLaunchConditionImplList(null)
468 , __pNotificationImplList(null)
469 , __pAppFeatureImplList(null)
470 , __pDataControlImplList(null)
471 , __pAppControlImplList(null)
472 , __pAppCategoryList(null)
476 ,__pAppInfoHandle(null)
478 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
479 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
480 __pLaunchConditionImplList->Construct();
482 __pNotificationImplList = new (std::nothrow) ArrayList;
483 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
484 __pNotificationImplList->Construct();
486 __pAppFeatureImplList = new (std::nothrow) ArrayList;
487 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
488 __pAppFeatureImplList->Construct();
490 __pDataControlImplList = new (std::nothrow) ArrayList;
491 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
492 __pDataControlImplList->Construct();
494 __pAppControlImplList = new (std::nothrow) ArrayList;
495 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
496 __pAppControlImplList->Construct();
498 __pAppCategoryList = new (std::nothrow) ArrayList;
499 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
500 __pAppCategoryList->Construct();
502 __pNameList = new (std::nothrow) HashMap;
503 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
504 __pNameList->Construct();
508 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
510 __pLaunchConditionImplList->RemoveAll(true);
511 delete __pLaunchConditionImplList;
513 __pNotificationImplList->RemoveAll(true);
514 delete __pNotificationImplList;
516 __pAppFeatureImplList->RemoveAll(true);
517 delete __pAppFeatureImplList;
519 __pDataControlImplList->RemoveAll(true);
520 delete __pDataControlImplList;
522 __pAppControlImplList->RemoveAll(true);
523 delete __pAppControlImplList;
525 __pAppCategoryList->RemoveAll(true);
526 delete __pAppCategoryList;
528 __pNameList->RemoveAll(true);
531 if (__pAppInfoHandle)
533 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
536 if (File::IsFileExist(__appTempIconPath) == true)
538 File::Remove(__appTempIconPath);
543 _PackageAppInfoImpl::GetName(void) const
549 _PackageAppInfoImpl::SetName(const String& name)
556 _PackageAppInfoImpl::GetType(void) const
562 _PackageAppInfoImpl::SetType(const String& type)
569 _PackageAppInfoImpl::GetDefault(void) const
575 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
577 __default = defaultApp;
582 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
584 result r = E_SUCCESS;
586 DbStatement* pStmt = null;
587 DbEnumerator* pEnum = null;
590 ArrayList* pList = null;
592 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
594 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
595 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
597 pStmt = db.CreateStatementN(query);
598 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
599 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
601 pEnum = db.ExecuteStatementN(*pStmt);
604 pList = new (std::nothrow) ArrayList;
605 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
608 while (pEnum->MoveNext() == E_SUCCESS)
610 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
611 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
616 pEnum->GetStringAt(1, name);
617 pEnum->GetStringAt(2, value);
619 pLaunchConditionImpl->SetName(name);
620 pLaunchConditionImpl->SetValue(value);
622 pList->Add(*pLaunchConditionImpl);
633 _PackageAppInfoImpl::GetLaunchConditionList(void) const
635 return __pLaunchConditionImplList;
639 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
641 result r = E_SUCCESS;
642 r = __pLaunchConditionImplList->Add(launchConditionImpl);
643 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
649 _PackageAppInfoImpl::GetNotificationListN(void) const
651 result r = E_SUCCESS;
653 DbStatement* pStmt = null;
654 DbEnumerator* pEnum = null;
657 ArrayList* pList = null;
659 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
661 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
662 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
664 pStmt = db.CreateStatementN(query);
665 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
666 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
668 pEnum = db.ExecuteStatementN(*pStmt);
671 pList = new (std::nothrow) ArrayList;
672 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
675 while (pEnum->MoveNext() == E_SUCCESS)
677 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
678 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
683 pEnum->GetStringAt(1, name);
684 pEnum->GetStringAt(2, value);
686 pNotificationImpl->SetName(name);
687 pNotificationImpl->SetValue(value);
689 pList->Add(*pNotificationImpl);
700 _PackageAppInfoImpl::GetNotificationList(void) const
702 return __pNotificationImplList;
706 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
708 result r = E_SUCCESS;
709 r = __pNotificationImplList->Add(notificationImpl);
710 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
716 _PackageAppInfoImpl::GetAppFeatureListN(void) const
718 result r = E_SUCCESS;
720 DbStatement* pStmt = null;
721 DbEnumerator* pEnum = null;
724 ArrayList* pList = null;
726 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
728 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
729 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
731 pStmt = db.CreateStatementN(query);
732 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
733 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
735 pEnum = db.ExecuteStatementN(*pStmt);
738 pList = new (std::nothrow) ArrayList;
739 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
742 while (pEnum->MoveNext() == E_SUCCESS)
744 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
745 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
750 pEnum->GetStringAt(1, name);
751 pEnum->GetStringAt(2, value);
753 pAppFeatureImpl->SetName(name);
754 pAppFeatureImpl->SetValue(value);
756 pList->Add(*pAppFeatureImpl);
767 _PackageAppInfoImpl::GetAppFeatureList(void) const
769 return __pAppFeatureImplList;
772 HashMapT<String, _AppFeatureInfoImpl*>*
773 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
775 result r = E_SUCCESS;
777 DbEnumerator* pEnum = null;
780 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
782 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
784 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
785 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
787 const DbStatement* pStmt = db.CreateStatementN(query);
788 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
789 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
791 pEnum = db.ExecuteStatementN(*pStmt);
794 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
795 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
801 while (pEnum->MoveNext() == E_SUCCESS)
803 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
804 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
806 pEnum->GetStringAt(1, name);
807 pEnum->GetStringAt(2, value);
809 pAppFeatureImpl->SetName(name);
810 pAppFeatureImpl->SetValue(value);
812 pMap->Add(name, pAppFeatureImpl);
823 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
825 result r = E_SUCCESS;
826 r = __pAppFeatureImplList->Add(appFeatureImpl);
827 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
833 _PackageAppInfoImpl::GetDataControlListN(void) const
839 _PackageAppInfoImpl::GetDataControlList(void) const
841 return __pDataControlImplList;
845 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
847 result r = E_SUCCESS;
848 r = __pDataControlImplList->Add(*pDataControl);
849 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
855 _PackageAppInfoImpl::GetAppControlListN(void) const
861 _PackageAppInfoImpl::GetAppControlList(void) const
863 return __pAppControlImplList;
867 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
869 result r = E_SUCCESS;
870 r = __pAppControlImplList->Add(*pAppControl);
871 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
877 _PackageAppInfoImpl::GetPackageName(void) const
879 return __packageName;
883 _PackageAppInfoImpl::SetPackageName(const String& packageName)
885 __packageName = packageName;
890 _PackageAppInfoImpl::GetMainmenuIcon(void) const
892 return __mainmenuIcon;
896 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
898 __mainmenuIcon = mainmenuIcon;
903 _PackageAppInfoImpl::GetSettingIcon(void) const
905 return __settingIcon;
909 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
911 __settingIcon = setting;
916 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
918 return __quickpanelIcon;
922 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
924 __quickpanelIcon = quickpanelIcon;
929 _PackageAppInfoImpl::IsMainmenuVisible(void) const
931 return __launchingIconVisible;
935 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
937 __launchingIconVisible = visible;
942 _PackageAppInfoImpl::AddName(const String& language, const String& name)
944 result r = E_SUCCESS;
945 r = __pNameList->Add(language, name);
951 _PackageAppInfoImpl::GetNameList(void) const
957 _PackageAppInfoImpl::GetUniqueId(void) const
959 result r = E_SUCCESS;
961 DbStatement* pStmt = null;
962 DbEnumerator* pEnum = null;
966 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
968 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
969 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
971 pStmt = db.CreateStatementN(query);
972 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
973 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
975 pEnum = db.ExecuteStatementN(*pStmt);
978 if (pEnum->MoveNext() == E_SUCCESS)
980 pEnum->GetIntAt(0, uniqueId);
996 _PackageAppInfoImpl::GetPkgId(void) const
1002 _PackageAppInfoImpl::SetUniqueId(int id)
1009 _PackageAppInfoImpl::SetPkgId(int id)
1016 _PackageAppInfoImpl::GetAppFeature(void) const
1018 return __appFeature;
1022 _PackageAppInfoImpl::SetAppFeature(int feature)
1024 __appFeature = feature;
1028 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1033 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1039 _LaunchConditionInfoImpl::GetName(void) const
1045 _LaunchConditionInfoImpl::SetName(const String& name)
1052 _LaunchConditionInfoImpl::GetValue(void) const
1058 _LaunchConditionInfoImpl::SetValue(const String& value)
1064 _NotificationInfoImpl::_NotificationInfoImpl(void)
1069 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1075 _NotificationInfoImpl::GetName(void) const
1081 _NotificationInfoImpl::SetName(const String& name)
1088 _NotificationInfoImpl::GetValue(void) const
1094 _NotificationInfoImpl::SetValue(const String& value)
1100 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1105 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1111 _AppFeatureInfoImpl::GetName(void) const
1117 _AppFeatureInfoImpl::SetName(const String& name)
1124 _AppFeatureInfoImpl::GetValue(void) const
1130 _AppFeatureInfoImpl::SetValue(const String& value)
1136 _DataControlTypeImpl::_DataControlTypeImpl(void)
1141 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1147 _DataControlTypeImpl::GetType(void) const
1153 _DataControlTypeImpl::SetType(const String& type)
1160 _DataControlTypeImpl::GetAccess(void) const
1166 _DataControlTypeImpl::SetAccess(const String& access)
1172 _DataControlInfoImpl::_DataControlInfoImpl(void)
1173 : __pControlTypeList(null)
1175 __pControlTypeList = new (std::nothrow) ArrayList;
1176 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1177 __pControlTypeList->Construct();
1180 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1182 __pControlTypeList->RemoveAll(true);
1183 delete __pControlTypeList;
1187 _DataControlInfoImpl::GetProviderId(void) const
1189 return __providerId;
1193 _DataControlInfoImpl::SetProviderId(const String& providerId)
1195 __providerId = providerId;
1200 _DataControlInfoImpl::GetControlTypeList(void) const
1202 return __pControlTypeList;
1206 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1208 __pControlTypeList->Add(*pControlType);
1212 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1213 : __pUriScheme(null)
1219 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1221 delete __pUriScheme;
1226 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1228 return __pUriScheme;
1232 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1234 __pUriScheme = pUriScheme;
1239 _AppControlResolutionInfoImpl::GetMimeType(void) const
1245 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1247 __pMimeType = pMimeType;
1251 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1254 ,__pResolutionList(null)
1256 __pResolutionList = new (std::nothrow) ArrayList;
1257 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1258 __pResolutionList->Construct();
1261 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1263 __pResolutionList->RemoveAll(true);
1264 delete __pResolutionList;
1268 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1274 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1276 __uniqueId = uniqueId;
1281 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1283 return __appControlId;
1287 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1289 __appControlId = appControlId;
1294 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1296 return __operationId;
1300 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1302 __operationId = operationId;
1307 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1309 return __pResolutionList;
1313 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1315 result r = E_SUCCESS;
1316 r = __pResolutionList->Add(*pResolutionImpl);
1317 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1322 _AppControlInfoImpl::_AppControlInfoImpl(void)
1324 ,__pCapabilityList(null)
1326 __pCapabilityList = new (std::nothrow) ArrayList;
1327 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1328 __pCapabilityList->Construct();
1331 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1333 __pCapabilityList->RemoveAll(true);
1334 delete __pCapabilityList;
1338 _AppControlInfoImpl::GetUniqueId(void) const
1344 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1346 __uniqueId = uniqueId;
1351 _AppControlInfoImpl::GetProviderId(void) const
1353 return __providerId;
1357 _AppControlInfoImpl::SetProviderId(const String& providerId)
1359 __providerId = providerId;
1364 _AppControlInfoImpl::GetCategory(void) const
1370 _AppControlInfoImpl::SetCategory(const String& category)
1372 __category = category;
1377 _AppControlInfoImpl::GetCapabilityList(void) const
1379 return __pCapabilityList;
1383 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1385 result r = E_SUCCESS;
1386 r = __pCapabilityList->Add(*pCapability);
1387 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1392 } } } // Tizen::App::Package