2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FAppPkg_PackageAppInfoImpl.cpp
18 * @brief This is the implementation for the _PackageAppInfoImpl class.
24 #include <unique_ptr.h>
26 #include <pkgmgr-info.h>
28 #include <FAppPkgPackageManager.h>
29 #include <FAppPkgPackageAppInfo.h>
30 #include <FBaseSysLog.h>
31 #include <FIoDatabase.h>
32 #include <FIoDbEnumerator.h>
33 #include <FIoDbStatement.h>
35 #include <FIoDirectory.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 if (__appIconPath.IsEmpty() == true)
154 iconPath = __appIconPath;
158 if (__appTempIconPath.IsEmpty() == true)
163 iconPath = __appTempIconPath;
166 SysLog(NID_APP, "iconPath = [%ls]", iconPath.GetPointer());
168 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
174 _PackageAppInfoImpl::GetAppMetadataListN(void) const
178 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
180 int res = PMINFO_R_OK;
182 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap());
183 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
186 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap.get());
187 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_metadata() failed. [%d]", res);
189 if (pMap->GetCount() <= 0)
194 return pMap.release();
198 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
204 _PackageAppInfoImpl::GetAppCategoryListN(void) const
208 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
210 int res = PMINFO_R_OK;
212 std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
213 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
216 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList.get());
217 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_category() failed. [%d]", res);
219 if (pList->GetCount() <= 0)
224 return pList.release();
228 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
234 _PackageAppInfoImpl::IsMenuIconVisible(void) const
236 return __launchingIconVisible;
240 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
242 __launchingIconVisible = visible;
247 _PackageAppInfoImpl::IsMainApp(void) const
253 _PackageAppInfoImpl::SetMainApp(bool mainApp)
260 _PackageAppInfoImpl::AddCategory(String* pCategory)
262 result r = E_SUCCESS;
263 r = __pAppCategoryList->Add(*pCategory);
264 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
270 _PackageAppInfoImpl::GetAppFeature(const String& key) const
272 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
278 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'",
279 key.GetPointer(), __appId.GetPointer());
281 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
283 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
284 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
286 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
287 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
289 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
290 if ((GetLastResult() == E_SUCCESS) && (pEnum == null))
294 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
296 while (pEnum->MoveNext() == E_SUCCESS)
298 pEnum->GetStringAt(0, value);
301 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
307 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
311 return pPackageAppInfo->__pPackageAppInfoImpl;
318 _PackageAppInfoImpl::Construct(const AppId& appId)
320 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
322 int res = PMINFO_R_OK;
323 char* pExePath = null;
324 char* pDisplayName = null;
325 char* pMenuIcon = null;
326 char* pSettingIcon = null;
327 char* pNotificationIcon = null;
328 bool mainApp = false;
329 bool menuIconVisible = false;
331 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
332 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
334 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
335 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
337 __fromDatabase = true;
341 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
342 if (res == PMINFO_R_OK)
344 String exePath(pExePath);
345 int startIndex = exePath.GetLength() - 1;
347 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
351 exePath.SubString(indexOf + 1, appName);
353 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
357 SysLog(NID_APP, "LastIndexOf is failed.");
362 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
365 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
366 if (res == PMINFO_R_OK)
368 String displayName(pDisplayName);
369 SetAppDisplayName(displayName);
373 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
376 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
377 if (res == PMINFO_R_OK)
379 String menuIcon(pMenuIcon);
380 SetAppMenuIconPath(menuIcon);
384 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
387 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
388 if (res == PMINFO_R_OK)
390 String settingIcon(pSettingIcon);
391 SetAppSettingIconPath(settingIcon);
395 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
398 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
399 if (res == PMINFO_R_OK)
401 String notificationIcon(pNotificationIcon);
402 SetAppNotificationIconPath(notificationIcon);
406 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
409 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
410 if (res == PMINFO_R_OK)
416 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
419 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
420 if (res == PMINFO_R_OK)
422 SetMenuIconVisible(!menuIconVisible);
426 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
429 SysLog(NID_APP, "exe = [%s], displayName = [%s], mainApp = [%d], menuIconVisible = [%d]", pExePath, pDisplayName, mainApp, menuIconVisible);
435 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
437 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
439 SysLog(NID_APP, "Category = [%s]", pCategoryName);
440 ArrayList* pList = (ArrayList*) pUserData;
442 String* pCategory = new (std::nothrow) String (pCategoryName);
443 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
445 pList->Add(*pCategory);
451 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
453 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
454 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
455 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
457 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
459 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
460 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
461 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
467 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
468 : __launchingIconVisible(true)
470 , __fromDatabase(false)
471 , __pLaunchConditionImplList(null)
472 , __pNotificationImplList(null)
473 , __pAppFeatureImplList(null)
474 , __pDataControlImplList(null)
475 , __pAppControlImplList(null)
476 , __pAppCategoryList(null)
480 ,__pAppInfoHandle(null)
482 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
483 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
484 __pLaunchConditionImplList->Construct();
486 __pNotificationImplList = new (std::nothrow) ArrayList;
487 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
488 __pNotificationImplList->Construct();
490 __pAppFeatureImplList = new (std::nothrow) ArrayList;
491 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
492 __pAppFeatureImplList->Construct();
494 __pDataControlImplList = new (std::nothrow) ArrayList;
495 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
496 __pDataControlImplList->Construct();
498 __pAppControlImplList = new (std::nothrow) ArrayList;
499 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
500 __pAppControlImplList->Construct();
502 __pAppCategoryList = new (std::nothrow) ArrayList;
503 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
504 __pAppCategoryList->Construct();
506 __pNameList = new (std::nothrow) HashMap;
507 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
508 __pNameList->Construct();
512 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
514 __pLaunchConditionImplList->RemoveAll(true);
515 delete __pLaunchConditionImplList;
517 __pNotificationImplList->RemoveAll(true);
518 delete __pNotificationImplList;
520 __pAppFeatureImplList->RemoveAll(true);
521 delete __pAppFeatureImplList;
523 __pDataControlImplList->RemoveAll(true);
524 delete __pDataControlImplList;
526 __pAppControlImplList->RemoveAll(true);
527 delete __pAppControlImplList;
529 __pAppCategoryList->RemoveAll(true);
530 delete __pAppCategoryList;
532 __pNameList->RemoveAll(true);
535 if (__pAppInfoHandle)
537 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
540 if (File::IsFileExist(__appTempIconPath) == true)
542 File::Remove(__appTempIconPath);
544 String tmp(L"/tmp/__icon/");
545 Directory::Remove(tmp, true);
550 _PackageAppInfoImpl::GetName(void) const
556 _PackageAppInfoImpl::SetName(const String& name)
563 _PackageAppInfoImpl::GetType(void) const
569 _PackageAppInfoImpl::SetType(const String& type)
576 _PackageAppInfoImpl::GetDefault(void) const
582 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
584 __default = defaultApp;
589 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
591 result r = E_SUCCESS;
593 DbStatement* pStmt = null;
594 DbEnumerator* pEnum = null;
597 ArrayList* pList = null;
599 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
601 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
602 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
604 pStmt = db.CreateStatementN(query);
605 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
606 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
608 pEnum = db.ExecuteStatementN(*pStmt);
611 pList = new (std::nothrow) ArrayList;
612 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
615 while (pEnum->MoveNext() == E_SUCCESS)
617 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
618 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
623 pEnum->GetStringAt(1, name);
624 pEnum->GetStringAt(2, value);
626 pLaunchConditionImpl->SetName(name);
627 pLaunchConditionImpl->SetValue(value);
629 pList->Add(*pLaunchConditionImpl);
640 _PackageAppInfoImpl::GetLaunchConditionList(void) const
642 return __pLaunchConditionImplList;
646 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
648 result r = E_SUCCESS;
649 r = __pLaunchConditionImplList->Add(launchConditionImpl);
650 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
656 _PackageAppInfoImpl::GetNotificationListN(void) const
658 result r = E_SUCCESS;
660 DbStatement* pStmt = null;
661 DbEnumerator* pEnum = null;
664 ArrayList* pList = null;
666 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
668 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
669 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
671 pStmt = db.CreateStatementN(query);
672 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
673 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
675 pEnum = db.ExecuteStatementN(*pStmt);
678 pList = new (std::nothrow) ArrayList;
679 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
682 while (pEnum->MoveNext() == E_SUCCESS)
684 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
685 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
690 pEnum->GetStringAt(1, name);
691 pEnum->GetStringAt(2, value);
693 pNotificationImpl->SetName(name);
694 pNotificationImpl->SetValue(value);
696 pList->Add(*pNotificationImpl);
707 _PackageAppInfoImpl::GetNotificationList(void) const
709 return __pNotificationImplList;
713 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
715 result r = E_SUCCESS;
716 r = __pNotificationImplList->Add(notificationImpl);
717 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
723 _PackageAppInfoImpl::GetAppFeatureListN(void) const
725 result r = E_SUCCESS;
727 DbStatement* pStmt = null;
728 DbEnumerator* pEnum = null;
731 ArrayList* pList = null;
733 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
735 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
736 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
738 pStmt = db.CreateStatementN(query);
739 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
740 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
742 pEnum = db.ExecuteStatementN(*pStmt);
745 pList = new (std::nothrow) ArrayList;
746 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
749 while (pEnum->MoveNext() == E_SUCCESS)
751 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
752 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
757 pEnum->GetStringAt(1, name);
758 pEnum->GetStringAt(2, value);
760 pAppFeatureImpl->SetName(name);
761 pAppFeatureImpl->SetValue(value);
763 pList->Add(*pAppFeatureImpl);
774 _PackageAppInfoImpl::GetAppFeatureList(void) const
776 return __pAppFeatureImplList;
779 HashMapT<String, _AppFeatureInfoImpl*>*
780 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
782 result r = E_SUCCESS;
784 DbEnumerator* pEnum = null;
787 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
789 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
791 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
792 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
794 const DbStatement* pStmt = db.CreateStatementN(query);
795 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
796 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
798 pEnum = db.ExecuteStatementN(*pStmt);
801 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
802 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
808 while (pEnum->MoveNext() == E_SUCCESS)
810 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
811 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
813 pEnum->GetStringAt(1, name);
814 pEnum->GetStringAt(2, value);
816 pAppFeatureImpl->SetName(name);
817 pAppFeatureImpl->SetValue(value);
819 pMap->Add(name, pAppFeatureImpl);
830 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
832 result r = E_SUCCESS;
833 r = __pAppFeatureImplList->Add(appFeatureImpl);
834 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
840 _PackageAppInfoImpl::GetDataControlListN(void) const
846 _PackageAppInfoImpl::GetDataControlList(void) const
848 return __pDataControlImplList;
852 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
854 result r = E_SUCCESS;
855 r = __pDataControlImplList->Add(*pDataControl);
856 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
862 _PackageAppInfoImpl::GetAppControlListN(void) const
868 _PackageAppInfoImpl::GetAppControlList(void) const
870 return __pAppControlImplList;
874 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
876 result r = E_SUCCESS;
877 r = __pAppControlImplList->Add(*pAppControl);
878 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
884 _PackageAppInfoImpl::GetPackageName(void) const
886 return __packageName;
890 _PackageAppInfoImpl::SetPackageName(const String& packageName)
892 __packageName = packageName;
897 _PackageAppInfoImpl::GetMainmenuIcon(void) const
899 return __mainmenuIcon;
903 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
905 __mainmenuIcon = mainmenuIcon;
910 _PackageAppInfoImpl::GetSettingIcon(void) const
912 return __settingIcon;
916 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
918 __settingIcon = setting;
923 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
925 return __quickpanelIcon;
929 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
931 __quickpanelIcon = quickpanelIcon;
936 _PackageAppInfoImpl::IsMainmenuVisible(void) const
938 return __launchingIconVisible;
942 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
944 __launchingIconVisible = visible;
949 _PackageAppInfoImpl::AddName(const String& language, const String& name)
951 result r = E_SUCCESS;
952 r = __pNameList->Add(language, name);
958 _PackageAppInfoImpl::GetNameList(void) const
964 _PackageAppInfoImpl::GetUniqueId(void) const
966 result r = E_SUCCESS;
968 DbStatement* pStmt = null;
969 DbEnumerator* pEnum = null;
973 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
975 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
976 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
978 pStmt = _PackageManagerImpl::CreateStatementN(db, query);
979 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
980 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
982 pEnum = _PackageManagerImpl::ExecuteStatementN(db, pStmt);
985 if (pEnum->MoveNext() == E_SUCCESS)
987 pEnum->GetIntAt(0, uniqueId);
1003 _PackageAppInfoImpl::GetPkgId(void) const
1009 _PackageAppInfoImpl::SetUniqueId(int id)
1016 _PackageAppInfoImpl::SetPkgId(int id)
1023 _PackageAppInfoImpl::GetAppFeature(void) const
1025 return __appFeature;
1029 _PackageAppInfoImpl::SetAppFeature(int feature)
1031 __appFeature = feature;
1035 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1040 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1046 _LaunchConditionInfoImpl::GetName(void) const
1052 _LaunchConditionInfoImpl::SetName(const String& name)
1059 _LaunchConditionInfoImpl::GetValue(void) const
1065 _LaunchConditionInfoImpl::SetValue(const String& value)
1071 _NotificationInfoImpl::_NotificationInfoImpl(void)
1076 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1082 _NotificationInfoImpl::GetName(void) const
1088 _NotificationInfoImpl::SetName(const String& name)
1095 _NotificationInfoImpl::GetValue(void) const
1101 _NotificationInfoImpl::SetValue(const String& value)
1107 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1112 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1118 _AppFeatureInfoImpl::GetName(void) const
1124 _AppFeatureInfoImpl::SetName(const String& name)
1131 _AppFeatureInfoImpl::GetValue(void) const
1137 _AppFeatureInfoImpl::SetValue(const String& value)
1143 _DataControlTypeImpl::_DataControlTypeImpl(void)
1148 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1154 _DataControlTypeImpl::GetType(void) const
1160 _DataControlTypeImpl::SetType(const String& type)
1167 _DataControlTypeImpl::GetAccess(void) const
1173 _DataControlTypeImpl::SetAccess(const String& access)
1179 _DataControlInfoImpl::_DataControlInfoImpl(void)
1180 : __pControlTypeList(null)
1182 __pControlTypeList = new (std::nothrow) ArrayList;
1183 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1184 __pControlTypeList->Construct();
1187 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1189 __pControlTypeList->RemoveAll(true);
1190 delete __pControlTypeList;
1194 _DataControlInfoImpl::GetProviderId(void) const
1196 return __providerId;
1200 _DataControlInfoImpl::SetProviderId(const String& providerId)
1202 __providerId = providerId;
1207 _DataControlInfoImpl::GetControlTypeList(void) const
1209 return __pControlTypeList;
1213 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1215 __pControlTypeList->Add(*pControlType);
1219 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1220 : __pUriScheme(null)
1226 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1228 delete __pUriScheme;
1233 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1235 return __pUriScheme;
1239 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1241 __pUriScheme = pUriScheme;
1246 _AppControlResolutionInfoImpl::GetMimeType(void) const
1252 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1254 __pMimeType = pMimeType;
1258 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1261 ,__pResolutionList(null)
1263 __pResolutionList = new (std::nothrow) ArrayList;
1264 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1265 __pResolutionList->Construct();
1268 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1270 __pResolutionList->RemoveAll(true);
1271 delete __pResolutionList;
1275 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1281 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1283 __uniqueId = uniqueId;
1288 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1290 return __appControlId;
1294 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1296 __appControlId = appControlId;
1301 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1303 return __operationId;
1307 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1309 __operationId = operationId;
1314 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1316 return __pResolutionList;
1320 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1322 result r = E_SUCCESS;
1323 r = __pResolutionList->Add(*pResolutionImpl);
1324 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1329 _AppControlInfoImpl::_AppControlInfoImpl(void)
1331 ,__pCapabilityList(null)
1333 __pCapabilityList = new (std::nothrow) ArrayList;
1334 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1335 __pCapabilityList->Construct();
1338 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1340 __pCapabilityList->RemoveAll(true);
1341 delete __pCapabilityList;
1345 _AppControlInfoImpl::GetUniqueId(void) const
1351 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1353 __uniqueId = uniqueId;
1358 _AppControlInfoImpl::GetProviderId(void) const
1360 return __providerId;
1364 _AppControlInfoImpl::SetProviderId(const String& providerId)
1366 __providerId = providerId;
1371 _AppControlInfoImpl::GetCategory(void) const
1377 _AppControlInfoImpl::SetCategory(const String& category)
1379 __category = category;
1384 _AppControlInfoImpl::GetCapabilityList(void) const
1386 return __pCapabilityList;
1390 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1392 result r = E_SUCCESS;
1393 r = __pCapabilityList->Add(*pCapability);
1394 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1399 } } } // Tizen::App::Package