2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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 StManageApplicationInfoForm.cpp
19 * @brief This is the implementation file for ManageApplicationInfoForm class.
22 #include "StManageApplicationInfoForm.h"
23 #include "StResourceManager.h"
26 using namespace Tizen::App;
27 using namespace Tizen::App::Package;
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::System;
32 using namespace Tizen::Ui;
33 using namespace Tizen::Ui::Controls;
34 using namespace Tizen::Ui::Scenes;
36 static const int ID_GROUP_APPLICATION_NAME = 0;
37 static const int ID_GROUP_APPLICATION_NAME_ITEM_COUNT = 2;
38 static const int ID_ITEM_APPLICATION_NAME = 0;
39 static const int ID_ITEM_APPLICATION_COMMAND_BUTTON = 1;
41 static const int ID_GROUP_APPLICATION_SIZE = 1;
42 static const int ID_GROUP_APPLICATION_SIZE_ITEM_COUNT = 3;
43 static const int ID_ITEM_APPLICATION_SIZE = 1;
44 static const int ID_ITEM_APPLICATION_DATA_SIZE = 2;
46 static const int ID_GROUP_APPLICATION_CLEAR_DEFAULT = 2;
47 static const int ID_GROUP_APPLICATION_CLEAR_DEFAULT_ITEM_COUNT = 1;
49 static const int ID_GROUP_APPLICATION_CLEAR_DEFAULT_HELP = 3;
51 static const int ID_GROUP_APPLICATION_DETAIL = 4;
53 static const int ID_TOTAL_GROUP_COUNT = 2;
55 static const int IDA_FORCE_STOP = 300;
56 static const int IDA_UNINSTALL = 310;
57 static const int IDA_UNINSTALL_CONFIRM_OK = 320;
58 static const int IDA_UNINSTALL_CONFIRM_CANCEL = 330;
60 static const int Y_ALERT_POPUP_CLIENT_RECT_DEFAULT = 160;
61 static const int X_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT = 20;
62 static const int Y_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT = 20;
63 static const int H_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT = 340;
64 static const int W_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT = 690;
65 static const int X_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT = 12;
66 static const int Y_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT = 360;
67 static const int W_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT = 310;
68 static const int H_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT = 80;
69 static const int X_ALERT_POPUP_ITEM_RECT_RHS_BUTTON_RESIZE = 20;
70 static const int ALERT_POPUP_LABEL_FONT_SIZE = 40;
72 static const int W_ALERT_POPUP_CLIENT_RECT_DEFAULT = 700;
73 static const int H_ALERT_POPUP_CLIENT_RECT_DEFAULT = 550;
75 static const int COMMAND_BUTTON_GAP = 20;
76 static const int APPLICATION_NAME_MARGIN_GAP = 100;
77 static const int APPLICATION_NAME_SECOND_CONTROL = 1;
79 static const int KILOBYTE_TO_MEGABYTE = 1024;
80 static const int MEGABYTE_TO_GIGABYTE = 1024;
84 DATA_TYPE_APPLICATION_NAME = 0,
85 DATA_TYPE_APPLICATION_ICON_PATH,
86 DATA_TYPE_APPLICATION_UNINSTALLABLE,
87 DATA_TYPE_APPLICATION_SIZE,
88 DATA_TYPE_APPLICATION_DATA_SIZE,
89 DATA_TYPE_APPLICATION_ID,
90 DATA_TYPE_APPLICATION_PACKAGE_ID,
95 UNINSTALL_POPUP_OKCANCEL = 0,
96 UNINSTALL_POPUP_PROGRESS,
99 ManageApplicationInfoForm::ManageApplicationInfoForm(void)
100 : __applicationData(null)
101 , __pPackageManager(null)
102 , __uninstallConfirmPopup(null)
103 , __pProgressPopup(null)
107 ManageApplicationInfoForm::~ManageApplicationInfoForm(void)
112 ManageApplicationInfoForm::CreateFooter(void)
114 Footer* pFooter = GetFooter();
117 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
118 pFooter->AddActionEventListener(*this);
120 SetFormBackEventListener(this);
124 ManageApplicationInfoForm::OnInitializing(void)
126 CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_APPLICATION_INFO"));
129 __pPackageManager = PackageManager::GetInstance();
131 if (__pPackageManager)
133 __pPackageManager->AddPackageInstallationEventListener(*this);
136 AppLogDebug("ENTER");
142 ManageApplicationInfoForm::OnTerminating(void)
144 if (__pPackageManager)
146 __pPackageManager->RemovePackageInstallationEventListener(*this);
148 delete __applicationData;
150 DeleteUninstallPopup();
153 SetFormBackEventListener(null);
154 RemoveOrientationEventListener(*this);
159 ManageApplicationInfoForm::GroupItemEnable(int groupIndex, bool setEnableStatus)
161 int itemCount = __pTableView->GetItemCountAt(groupIndex);
163 for (int i = 0; i< itemCount; i++)
165 __pTableView->SetItemEnabled(groupIndex, i, setEnableStatus);
170 ManageApplicationInfoForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
174 __applicationData = static_cast<ArrayList*>(pArgs->GetItemsN(0, pArgs->GetCount()));
176 __pTableView->UpdateTableView();
178 GroupItemEnable(ID_GROUP_APPLICATION_SIZE, false);
179 GroupItemEnable(ID_GROUP_APPLICATION_CLEAR_DEFAULT, false);
180 GroupItemEnable(ID_GROUP_APPLICATION_DETAIL, false);
185 ManageApplicationInfoForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
190 ManageApplicationInfoForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
192 SceneManager* pSceneManager = SceneManager::GetInstance();
193 AppAssert(pSceneManager);
195 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
199 ManageApplicationInfoForm::GetGroupCount(void)
201 // Temporary code due to the UI Framework defect
202 if (!__applicationData)
207 AppLogDebug("ENTER");
208 return ID_TOTAL_GROUP_COUNT;
212 ManageApplicationInfoForm::GetItemCount(int groupIndex)
214 // Temporary code due to the UI Framework defect
215 if (!__applicationData)
224 case ID_GROUP_APPLICATION_NAME:
226 itemCount = ID_GROUP_APPLICATION_NAME_ITEM_COUNT;
230 case ID_GROUP_APPLICATION_SIZE:
232 itemCount = ID_GROUP_APPLICATION_SIZE_ITEM_COUNT;
236 case ID_GROUP_APPLICATION_CLEAR_DEFAULT:
238 case ID_GROUP_APPLICATION_DETAIL:
240 itemCount = ID_GROUP_APPLICATION_CLEAR_DEFAULT_ITEM_COUNT;
248 AppLogDebug("GetItemCount %d", itemCount);
254 ManageApplicationInfoForm::CreateGroupItem(int groupIndex, int itemWidth)
256 AppLogDebug("ENTER");
258 int itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
259 int yItemOffset = H_GROUP_INDEX_HELP_TEXT_TOP_GAP;
260 LabelTextStyle style = LABEL_TEXT_STYLE_NORMAL;
261 Rectangle itemRectangle;
263 Label* pLabel = null;
265 TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
267 itemRectangle.x = X_GROUP_ITEM_DEFAULT_LABEL;
268 itemRectangle.y = yItemOffset;
269 itemRectangle.width = itemWidth;
270 itemRectangle.height = itemHeight;
272 if (groupIndex == ID_GROUP_APPLICATION_CLEAR_DEFAULT_HELP)
275 itemRectangle.height = itemHeight = H_GROUP_ITEM_DEFAULT;
276 groupText = ResourceManager::GetString(L"IDS_ST_BODY_YOU_HAVE_SELECTED_TO_LAUNCH_THIS_APPLICATION_BY_DEFAULT_FOR_SOME_ACTIONS");
279 RelativeLayout relativeLayout;
280 relativeLayout.Construct();
282 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
283 pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
285 pLabel = new (std::nothrow) Label();
286 pLabel->Construct(itemRectangle, groupText);
287 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
288 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
289 pLabel->SetTextConfig(FONT_MAIN_TEXT_SIZE_SMALL, style);
290 pLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
292 pItem->AddControl(pLabel);
293 pItem->SetEnabled(false);
294 relativeLayout.SetMargin(*pLabel, itemRectangle.x, 0, 0, 0);
295 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
296 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
302 ManageApplicationInfoForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
304 AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
306 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
308 bool isItemSubText = false;
309 bool isBitmapSet = false;
310 bool isCommandButton = false;
311 Rectangle itemIconRectangle;
312 Rectangle itemMainRectangle;
313 Rectangle itemSubRectangle;
315 int itemHeight = H_ITEM_TYPE_1_LABEL;
317 Bitmap* pBitmap = null;
318 Button* pStopButton = null;
319 Button* pUninstallButton = null;
320 Label* pLabel = null;
321 Label* pBitmapLabel = null;
326 int fontSize = GetFontSize();
327 TableViewItem* pItem = new (std::nothrow) TableViewItem();
329 ItemTypeOneLine(itemMainRectangle);
330 itemHeight = itemMainRectangle.height;
334 case ID_GROUP_APPLICATION_NAME:
338 case ID_ITEM_APPLICATION_NAME:
340 isItemSubText = true;
345 String bitmapPath = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_ICON_PATH)));
346 pBitmap = ResourceManager::GetApplicationBitmapN(bitmapPath);
350 pBitmap = ResourceManager::GetBitmapN(IDB_DEFAULT_ICON);
354 ItemTypeIconAndTwoLine(itemIconRectangle, itemMainRectangle, itemSubRectangle, fontSize);
355 itemHeight = (itemMainRectangle.height + itemSubRectangle.height);
356 itemMainText = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_NAME)));
357 sizeData = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_SIZE)));
358 Double::Parse(sizeData, appSize);
359 sizeData = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_DATA_SIZE)));
360 Double::Parse(sizeData, dataSize);
362 if (((appSize+dataSize) / KILOBYTE_TO_MEGABYTE) >= 1)
364 itemSubText = Double::ToString(((appSize+dataSize) / KILOBYTE_TO_MEGABYTE));
365 itemSubText.Append(L" MB");
369 itemSubText = Double::ToString(((appSize+dataSize)));
370 itemSubText.Append(L" KB");
377 isCommandButton = true;
384 case ID_GROUP_APPLICATION_SIZE:
388 double totalSize = 0;
391 isItemSubText = true;
393 ItemTypeTwoLine(itemMainRectangle, itemSubRectangle, fontSize);
394 itemHeight = (itemMainRectangle.height + itemSubRectangle.height);
398 case ID_ITEM_APPLICATION_SIZE:
400 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_APPLICATION");
401 tmpDataSize = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_SIZE)));
403 Double::Parse(tmpDataSize, appSize);
408 case ID_ITEM_APPLICATION_DATA_SIZE:
410 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_DATA");
411 tmpDataSize = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_DATA_SIZE)));
413 Double::Parse(tmpDataSize, dataSize);
414 totalSize = dataSize;
420 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_TOTAL");
421 tmpDataSize = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_SIZE)));
422 Double::Parse(tmpDataSize, appSize);
423 tmpDataSize = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_DATA_SIZE)));
424 Double::Parse(tmpDataSize, dataSize);
426 totalSize = (appSize + dataSize);
431 if ((totalSize / KILOBYTE_TO_MEGABYTE) >= 1)
433 itemSubText = Double::ToString((totalSize / KILOBYTE_TO_MEGABYTE));
434 itemSubText.Append(L" MB");
438 itemSubText = Double::ToString((totalSize));
439 itemSubText.Append(L" KB");
444 case ID_GROUP_APPLICATION_CLEAR_DEFAULT:
446 ItemTypeOneLine(itemMainRectangle);
447 itemHeight = itemMainRectangle.height;
449 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_CLEAR_DEFAULTS");
453 case ID_GROUP_APPLICATION_DETAIL:
455 ItemTypeOneLine(itemMainRectangle);
456 itemHeight = itemMainRectangle.height;
458 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_MORE_DETAILS");
466 RelativeLayout relativeLayout;
467 relativeLayout.Construct();
469 if (isCommandButton == true)
474 bool isMenuIconVisible = false;
475 itemMainRectangle.height -= (H_ITEM_TYPE_1_LABEL / DIVIDE_BY_TWO);
477 pItem->Construct(Dimension(itemWidth, itemMainRectangle.height), style);
478 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
480 Rectangle stopButtonRect;
481 Rectangle uninstallButtonRect;
483 stopButtonRect = itemMainRectangle;
484 stopButtonRect.x = stopButtonRect.x + COMMAND_BUTTON_GAP;
485 stopButtonRect.width = (itemWidth / DIVIDE_BY_TWO) - 2 * COMMAND_BUTTON_GAP;
487 uninstallButtonRect = itemMainRectangle;
488 uninstallButtonRect.x = (itemWidth / DIVIDE_BY_TWO) + COMMAND_BUTTON_GAP;
489 uninstallButtonRect.width = (itemWidth / DIVIDE_BY_TWO) - 2 * COMMAND_BUTTON_GAP;
491 pStopButton = new (std::nothrow) Button();
492 pStopButton->Construct(stopButtonRect, ResourceManager::GetString(L"IDS_ST_BUTTON_FORCE_STOP"));
493 pStopButton->SetActionId(IDA_FORCE_STOP);
495 SettingInfo::GetValue(SETTING_INFO_KEY_SCREEN_TYPE_HOME, homeAppId);
496 SettingInfo::GetValue(SETTING_INFO_KEY_SCREEN_TYPE_LOCK, lockAppId);
498 appId = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_ID)));
499 AppManager* pAppManager = AppManager::GetInstance();
501 if(__pPackageManager)
503 PackageAppInfo* pPackageAppInfo = __pPackageManager->GetPackageAppInfoN(appId);
506 isMenuIconVisible = pPackageAppInfo->IsMenuIconVisible();
507 delete pPackageAppInfo;
511 if (pAppManager->IsRunning(appId) == false || appId == homeAppId || appId == lockAppId || !isMenuIconVisible)
513 pStopButton->SetEnabled(false);
516 pStopButton->AddActionEventListener(*this);
518 String uninstallable = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_UNINSTALLABLE)));
520 pUninstallButton = new (std::nothrow) Button();
521 pUninstallButton->Construct(uninstallButtonRect, ResourceManager::GetString(L"IDS_ST_BUTTON_UNINSTALL"));
523 if (uninstallable.Equals(L"0", true) || appId == homeAppId || appId == lockAppId)
525 pUninstallButton->SetEnabled(false);
526 pItem->SetEnabled(false);
528 pUninstallButton->SetActionId(IDA_UNINSTALL);
529 pUninstallButton->AddActionEventListener(*this);
531 pItem->AddControl(pStopButton);
532 pItem->AddControl(pUninstallButton);
533 pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
534 pItem->SetIndividualSelectionEnabled(pStopButton, true);
535 pItem->SetIndividualSelectionEnabled(pUninstallButton, true);
539 pItem->Construct(Dimension(itemWidth, itemHeight), style);
540 pItem->SetBackgroundColor(COLOR_ID_WHITE, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
542 if (isBitmapSet == true)
544 pBitmapLabel = new (std::nothrow) Label();
545 pBitmapLabel->Construct(itemIconRectangle, L"");
546 pBitmapLabel->SetBackgroundBitmap(*pBitmap);
547 pItem->AddControl(pBitmapLabel);
550 pLabel = new (std::nothrow) Label();
551 pLabel->Construct(itemMainRectangle, itemMainText);
552 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
553 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
554 pLabel->SetTextColor(COLOR_MAIN_TEXT);
556 pItem->AddControl(pLabel);
557 relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, 0, 0, 0);
559 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
560 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
562 if (isItemSubText == true)
564 pLabel = new (std::nothrow) Label();
565 pLabel->Construct(itemSubRectangle, itemSubText);
566 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
567 pLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
568 pLabel->SetTextColor(COLOR_SUB_TEXT);
570 pItem->AddControl(pLabel);
572 relativeLayout.SetMargin(*pLabel, itemSubRectangle.x, 0, 0, 0);
573 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
574 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
581 ManageApplicationInfoForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
583 AppLogDebug("ENTER");
592 ManageApplicationInfoForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
594 AppLogDebug("ENTER");
603 ManageApplicationInfoForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
605 AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
609 ManageApplicationInfoForm::GetDefaultGroupItemHeight(void)
611 return H_GROUP_INDEX_NO_TITLE_DEFAULT;
615 ManageApplicationInfoForm::GetDefaultItemHeight(void)
617 return H_GROUP_ITEM_DEFAULT;
621 ManageApplicationInfoForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
626 ManageApplicationInfoForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
630 case ID_GROUP_APPLICATION_NAME:
632 if (itemIndex == ID_ITEM_APPLICATION_NAME)
634 Label* pLabel = static_cast<Label*>(pItem->GetControl(APPLICATION_NAME_SECOND_CONTROL));
635 Rectangle rect = pLabel->GetBounds();
636 Rectangle clientRect = GetClientAreaBounds();
637 rect.width = clientRect.width - APPLICATION_NAME_MARGIN_GAP;
638 pLabel->SetBounds(rect);
640 pItem->Invalidate(false);
642 else if (itemIndex == ID_ITEM_APPLICATION_COMMAND_BUTTON)
645 bool isMenuIconVisible = false;
646 Rectangle pItemRect = pItem->GetBounds();
647 Rectangle clientRect = GetClientAreaBounds();
649 Button* pStopButton = static_cast<Button*>(pItem->GetControl(0));
650 Button* pUninstallButton = static_cast<Button*>(pItem->GetControl(1));
652 pStopButton->SetBounds(COMMAND_BUTTON_GAP, 0, (clientRect.width / DIVIDE_BY_TWO - 2 * COMMAND_BUTTON_GAP), pItemRect.height);
653 pUninstallButton->SetBounds((clientRect.width / DIVIDE_BY_TWO) + COMMAND_BUTTON_GAP, 0, (clientRect.width / DIVIDE_BY_TWO - 2 * COMMAND_BUTTON_GAP), pItemRect.height);
655 SettingInfo::GetValue(SETTING_INFO_KEY_SCREEN_TYPE_HOME, homeAppId);
657 String appId = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_ID)));
658 AppManager* pAppManager = AppManager::GetInstance();
660 if(__pPackageManager)
662 PackageAppInfo* pPackageAppInfo = __pPackageManager->GetPackageAppInfoN(appId);
665 isMenuIconVisible = pPackageAppInfo->IsMenuIconVisible();
666 delete pPackageAppInfo;
670 if (pAppManager->IsRunning(appId) == false || appId == homeAppId || !isMenuIconVisible)
672 pStopButton->SetEnabled(false);
676 pStopButton->SetEnabled(true);
679 pStopButton->Invalidate(false);
680 pUninstallButton->Invalidate(false);
691 ManageApplicationInfoForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
696 ManageApplicationInfoForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
701 ManageApplicationInfoForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
703 if (__pTableView == null)
705 AppLogDebug("__pTableView is null");
708 __pTableView->RefreshItem(ID_GROUP_APPLICATION_NAME, ID_ITEM_APPLICATION_NAME, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
709 __pTableView->RefreshItem(ID_GROUP_APPLICATION_NAME, ID_ITEM_APPLICATION_COMMAND_BUTTON, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
714 ManageApplicationInfoForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
720 String appId = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_ID)));
721 AppManager* pAppManager = AppManager::GetInstance();
723 if (pAppManager->IsRunning(appId) == true)
725 if (pAppManager->TerminateApplication(appId) == E_SUCCESS)
727 Button* pStopButton = static_cast<Button*>(&const_cast<Control&>(source));
728 pStopButton->SetEnabled(false);
730 AppLogDebug("TerminateApplication Result [%s]", GetErrorMessage(GetLastResult()));
734 AppLogDebug("[%ls] is not running", appId.GetPointer());
741 CreateUninstallPopup();
742 ShowUninstallPopup(UNINSTALL_POPUP_OKCANCEL);
746 case IDA_UNINSTALL_CONFIRM_OK:
748 String packageId = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_PACKAGE_ID)));
749 __pPackageManager->UninstallPackage (packageId, null);
751 HideUninstallPopup(UNINSTALL_POPUP_OKCANCEL);
752 ShowUninstallPopup(UNINSTALL_POPUP_PROGRESS);
756 case IDA_UNINSTALL_CONFIRM_CANCEL:
758 HideUninstallPopup(UNINSTALL_POPUP_OKCANCEL);
768 ManageApplicationInfoForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
772 __pTableView->RefreshItem(ID_GROUP_APPLICATION_NAME, ID_ITEM_APPLICATION_COMMAND_BUTTON, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
777 ManageApplicationInfoForm::OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult)
779 HideUninstallPopup(UNINSTALL_POPUP_PROGRESS);
781 SceneManager* pSceneManager = SceneManager::GetInstance();
782 AppAssert(pSceneManager);
784 ArrayList* pUninstallationResult = new (std::nothrow) ArrayList(SingleObjectDeleter);
785 pUninstallationResult->Construct();
786 String *pApplicationName = static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_NAME));
787 if (pApplicationName)
789 pUninstallationResult->Add(new (std::nothrow) String(*pApplicationName));
791 pUninstallationResult->Add(new (std::nothrow) String(Boolean::ToString(uninstallationResult)));
793 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pUninstallationResult);
797 ManageApplicationInfoForm::CreateUninstallPopup(void)
800 Label* pLabel = null;
801 Button* pOkButton = null;
802 Button* pCancelButton = null;
803 String applicationName = *(static_cast<String*>(__applicationData->GetAt(DATA_TYPE_APPLICATION_NAME)));
805 Rectangle clientRect = GetClientAreaBounds();
806 Rectangle itemRectLabel;
807 Rectangle itemRectLhsButton;
808 Rectangle itemRectRhsButton;
811 clientRect.y = Y_ALERT_POPUP_CLIENT_RECT_DEFAULT;
812 clientRect.width = W_ALERT_POPUP_CLIENT_RECT_DEFAULT;
813 clientRect.height = H_ALERT_POPUP_CLIENT_RECT_DEFAULT;
815 itemRectLabel.x = X_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT;
816 itemRectLabel.y = Y_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT;
817 itemRectLabel.width = W_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT;
818 itemRectLabel.height = H_ALERT_POPUP_ITEM_RECT_LABEL_DEFAULT;
820 itemRectLhsButton.x = X_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT + itemRectLabel.x;
821 itemRectLhsButton.y = Y_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT;
822 itemRectLhsButton.width = W_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT;
823 itemRectLhsButton.height = H_ALERT_POPUP_ITEM_RECT_LHS_BUTTON_DEFAULT;
825 itemRectRhsButton = itemRectLhsButton;
826 itemRectRhsButton.x = itemRectLhsButton.x + itemRectLhsButton.width + X_ALERT_POPUP_ITEM_RECT_RHS_BUTTON_RESIZE;
828 Dimension bounds = Dimension(clientRect.width, clientRect.height);
830 __uninstallConfirmPopup = new (std::nothrow) Popup();
831 __uninstallConfirmPopup->Construct(true, bounds);
832 __uninstallConfirmPopup->SetTitleText(applicationName);
833 __uninstallConfirmPopup->SetPropagatedKeyEventListener(this);
835 String descriptionText = ResourceManager::GetString(L"IDS_SAPPS_POP_ARE_YOU_SURE_Q");
837 pLabel = new (std::nothrow) Label();
838 pLabel->Construct(itemRectLabel, descriptionText);
839 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
840 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
841 pLabel->SetTextConfig(ALERT_POPUP_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
843 __uninstallConfirmPopup->AddControl(pLabel);
845 buttonText = ResourceManager::GetString(L"IDS_ST_BUTTON_UNINSTALL");
846 pOkButton = new (std::nothrow) Button();
847 pOkButton->Construct(itemRectRhsButton, buttonText);
848 pOkButton->SetActionId(IDA_UNINSTALL_CONFIRM_OK);
850 __uninstallConfirmPopup->AddControl(pOkButton);
852 buttonText = ResourceManager::GetString(L"IDS_COM_SK_NO");
854 pCancelButton = new (std::nothrow) Button();
855 pCancelButton->Construct(itemRectLhsButton, buttonText);
856 pCancelButton->SetActionId(IDA_UNINSTALL_CONFIRM_CANCEL);
858 __uninstallConfirmPopup->AddControl(pCancelButton);
860 pOkButton->AddActionEventListener(*this);
861 pCancelButton->AddActionEventListener(*this);
863 __pProgressPopup = new (std::nothrow) ProgressPopup();
864 __pProgressPopup->Construct(false, false);
865 __pProgressPopup->SetTitleText(applicationName);
866 __pProgressPopup->SetBounds(clientRect);
868 descriptionText = ResourceManager::GetString(L"IDS_ST_BUTTON_UNINSTALL");
869 descriptionText.Append(L"....");
870 __pProgressPopup->SetText(descriptionText);
876 ManageApplicationInfoForm::ShowUninstallPopup(int popupType)
880 case UNINSTALL_POPUP_OKCANCEL:
882 __uninstallConfirmPopup->SetShowState(true);
883 __uninstallConfirmPopup->Show();
887 case UNINSTALL_POPUP_PROGRESS:
889 __pProgressPopup->SetShowState(true);
890 __pProgressPopup->Show();
900 ManageApplicationInfoForm::HideUninstallPopup(int popupType)
904 case UNINSTALL_POPUP_OKCANCEL:
906 if (__uninstallConfirmPopup)
908 __uninstallConfirmPopup->SetShowState(false);
909 __uninstallConfirmPopup->Invalidate(true);
914 case UNINSTALL_POPUP_PROGRESS:
916 if (__pProgressPopup)
918 __pProgressPopup->SetShowState(false);
919 __pProgressPopup->Invalidate(true);
930 ManageApplicationInfoForm::DeleteUninstallPopup(void)
932 if (__uninstallConfirmPopup)
934 delete __uninstallConfirmPopup;
935 __uninstallConfirmPopup = null;
938 if (__pProgressPopup)
940 delete __pProgressPopup;
941 __pProgressPopup = null;
946 ManageApplicationInfoForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
952 ManageApplicationInfoForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
954 if (__uninstallConfirmPopup && __uninstallConfirmPopup->GetShowState() == true && (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC))
956 HideUninstallPopup(UNINSTALL_POPUP_OKCANCEL);
963 ManageApplicationInfoForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
969 ManageApplicationInfoForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)