2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
18 * @file HmHomeItemInfo.cpp
19 * @brief Keeps implementation of the HomeItemInfo
20 * Implements the HomeItemInfo class, it keeps the information of all the applications installed.
24 #include <FGraphics.h>
25 #include "HmHomeItemInfo.h"
28 using namespace Tizen::App;
29 using namespace Tizen::App::Package;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Graphics;
34 HomeItemInfo::HomeItemInfo(void)
35 : __isVisibleInMainMenu(false)
36 , __isUninstallable(false)
41 // No implementation needed
45 HomeItemInfo::~HomeItemInfo(void)
47 // No implementation needed
51 HomeItemInfo::GetAppId(void) const
53 // returns application id
58 HomeItemInfo::GetApplicationIcon(void) const
60 // returns the application icon
65 HomeItemInfo::GetAppName(void) const
67 // returns the name of the application
72 HomeItemInfo::GetIconPath(void) const
74 // returns the path of the application icon
79 HomeItemInfo::GetPackageId(void) const
86 HomeItemInfo::GetPositionInHomeScreen(int& pageNumber, int& position) const
88 pageNumber = __pageNumber;
89 position = __position;
94 HomeItemInfo::Initialize(PackageAppInfo* pPackAppInfo, PackageInfo* pPackInfo)
96 TryReturn(pPackAppInfo != null && pPackInfo != null, E_INVALID_ARG, "Invalid arguments");
100 __isVisibleInMainMenu = pPackAppInfo->IsMenuIconVisible();
102 if (__isVisibleInMainMenu)
104 // gets the path of the icon if icon is available
105 String appIconPath = pPackAppInfo->GetAppMenuIconPath();
107 // sets the icon path if icon path is not empty
108 if (!appIconPath.IsEmpty() && !appIconPath.Equals(L"(null)", true))
110 __appIconPath = appIconPath;
112 // // sets the icon path if icon path is empty temporarily.
115 // __appIconPath = IDB_DEFAULT_APP_ICON;
118 // gets the application id
119 AppId appId = pPackAppInfo->GetAppId();
120 // sets the application Id
121 if (!appId.IsEmpty())
126 // gets the application name
127 String appName = pPackAppInfo->GetAppDisplayName();
128 // sets the application name
129 if (!appName.IsEmpty())
135 __isUninstallable = pPackInfo->IsUninstallable();
136 __packageId = pPackInfo->GetId();
142 HomeItemInfo::IsUnistallable(void) const
144 // returns true if application is uninstallable else false
145 return __isUninstallable;
149 HomeItemInfo::IsVisibleInMainMenu(void) const
151 // returns true if application icon can be shown in home else false
152 return __isVisibleInMainMenu;
156 HomeItemInfo::SetApplicationIcon(Bitmap* pAppIconBitmap)
158 // sets the icon for the application
159 if (__pAppIcon != null)
164 __pAppIcon = pAppIconBitmap;
169 HomeItemInfo::SetApplicationName(String& newAppName)
171 __appName = newAppName;
175 HomeItemInfo::SetItemIndex(int newIndex)
177 __position = newIndex;
181 HomeItemInfo::SetPositionInHomeScreen(int pageNumber, int position)
183 // sets the position of the application icon
184 __pageNumber = pageNumber;
185 __position = position;