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 StMainMenuForm.cpp
19 * @brief This is the implementation file for MainMenuForm class.
23 #include "StAppSettingManager.h"
24 #include "StBluetoothPresentationModel.h"
25 #include "StMainMenuForm.h"
26 #include "StNfcPresentationModel.h"
27 #include "StResourceManager.h"
28 #include "StSettingScenesList.h"
31 using namespace Tizen::App;
32 using namespace Tizen::App::Package;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Io;
38 using namespace Tizen::Net::Bluetooth;
39 using namespace Tizen::System;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
44 //static const int W_RESIZE_LABEL_GAP = 110;
46 static const int H_GROUP_FONT_SIZE_GIANT = 146;
47 static const int H_GROUP_FONT_SIZE_HUGE = 128;
48 static const int H_GROUP_FONT_SIZE_LARGE = 110;
49 static const int H_GROUP_FONT_SIZE_DEFAULT = 80;
50 static const int H_GROUP_TITLE_TEXT = (H_GROUP_INDEX_TITLE_TEXT / 4);
51 static const int MAIN_RELATIVE_LAYOUT_RIGHT_MARGIN = 60;
53 static const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE = L"http://tizen.org/appcontrol/operation/configure";
54 static const wchar_t* APPCONTROL_PROVIDER_ID_PHONE = L"tizen.phone";
55 static const wchar_t* APPCONTROL_PROVIDER_ID_ACCOUNT = L"ZsnYtAdjl2.Account";
57 static const wchar_t* ID_RELATIVE_SETTING_XML_FILE_PATH = L"/setting/setting.xml";
58 static const wchar_t* ID_APPLICATION_DEFAULT_FOLDER_PATH = L"/opt/apps/";
60 static const int ID_GROUP_CONNECTIVITY = 0;
61 static const int ID_ITEM_CONNECTIVITY_WIFI = 0;
62 static const int ID_ITEM_CONNECTIVITY_BLUETOOTH = 1;
63 static const int ID_ITEM_CONNECTIVITY_NETWORK = 2;
64 static const int ID_ITEM_CONNECTIVITY_NFC = 3;
65 static const int ID_GROUP_CONNECTIVITY_ITEM_COUNT = 4;
67 //static const int ID_GROUP_MODE = 1;
68 //static const int ID_ITEM_MODE_FLIGHT_MODE = 0;
69 //static const int ID_GROUP_MODE_ITEM_COUNT = 1;
71 static const int ID_GROUP_PERSONAL = 1;
72 static const int ID_ITEM_PERSONAL_HOME_SCREEN = 0;
73 static const int ID_ITEM_PERSONAL_LOCK_SCREEN = 1;
74 static const int ID_ITEM_PERSONAL_ACCOUNTS = 2;
75 static const int ID_ITEM_PERSONAL_PRIVACY = 3;
76 static const int ID_GROUP_PERSONAL_ITEM_COUNT = 4;
78 static const int ID_GROUP_DEVICE = 2;
79 static const int ID_ITEM_DEVICE_DISPLAY = 0;
80 static const int ID_ITEM_DEVICE_SOUND = 1;
81 static const int ID_ITEM_DEVICE_LOCATION = 2;
82 static const int ID_ITEM_DEVICE_CALL_SETTING = 3;
83 static const int ID_ITEM_DEVICE_ACCESSIBILITY = 6;
84 static const int ID_ITEM_DEVICE_DATE_TIME = 4;
85 static const int ID_ITEM_DEVICE_LANGUAGE_KEYBOARD = 5;
86 static const int ID_GROUP_DEVICE_ITEM_COUNT = 6;
88 static const int ID_GROUP_SYSTEM = 3;
89 static const int ID_ITEM_SYSTEM_MANAGE_APPLICATION = 0;
90 static const int ID_ITEM_SYSTEM_DEVELOPER_OPTION = 2;
91 static const int ID_ITEM_SYSTEM_ABOUT_PHONE = 1;
92 static const int ID_GROUP_SYSTEM_ITEM_COUNT = 2;
94 static const int ID_GROUP_APPSETTING = 4;
95 static const int ID_GROUP_NO_APPSETTING = 4;
96 static const int ID_MAIN_MENU_DEFAULT_COUNT = 1;
99 //IFlightModeSetValueAsyncResultListener::OnResultReceivedForSetValueAsync(const Tizen::Base::String& key, result r)
101 // AppLogDebug("key(%ls) r(%s)", key.GetPointer(), GetErrorMessage(r));
104 MainMenuForm::MainMenuForm(void)
105 : __pDownloadAppIdKeyList(null)
106 , __pAppIdHashMap(null)
107 , __pAppIconPathHashMap(null)
108 // , __pFlightModeSetValueAsyncResultListener(null)
112 MainMenuForm::~MainMenuForm(void)
117 MainMenuForm::CreateFooter(void)
119 Footer* pFooter = GetFooter();
122 pFooter->SetBackButton();
123 pFooter->AddActionEventListener(*this);
127 MainMenuForm::OnInitializing(void)
129 AppLogDebug("ENTER");
131 CreateHeader(ResourceManager::GetString(L"IDS_COM_BODY_SETTINGS"));
134 SetAppIdListFromPackageManager();
140 MainMenuForm::OnTerminating(void)
142 RemoveAllDownLoadAppIdKeyList();
143 RemoveAllAppIdList();
150 MainMenuForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
152 Header* pHeader = GetHeader();
153 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_SETTINGS"));
155 RemoveAllDownLoadAppIdKeyList();
156 SetAppIdListFromPackageManager();
158 __pTableView->UpdateTableView();
160 // bool flightModeEnableStatus = false;
161 // if (SettingInfo::GetValue(SETTING_INFO_KEY_NETWORK_FLIGHTMODE, flightModeEnableStatus) == E_SUCCESS)
163 // __pTableView->SetItemChecked(ID_GROUP_MODE, ID_ITEM_MODE_FLIGHT_MODE, flightModeEnableStatus);
168 MainMenuForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
173 MainMenuForm::GetGroupCount(void)
175 int groupItemCount = ID_GROUP_NO_APPSETTING;
176 if (GetDownLoadAppCount() > 0)
178 groupItemCount = ID_GROUP_APPSETTING + ID_MAIN_MENU_DEFAULT_COUNT;
181 return groupItemCount;
185 MainMenuForm::GetItemCount(int groupIndex)
187 AppLogDebug("ENTER");
193 case ID_GROUP_CONNECTIVITY:
195 itemCount = ID_GROUP_CONNECTIVITY_ITEM_COUNT;
199 // case ID_GROUP_MODE:
201 // itemCount = ID_GROUP_MODE_ITEM_COUNT;
205 case ID_GROUP_DEVICE:
207 itemCount = ID_GROUP_DEVICE_ITEM_COUNT;
211 case ID_GROUP_PERSONAL:
213 itemCount = ID_GROUP_PERSONAL_ITEM_COUNT;
217 case ID_GROUP_SYSTEM:
219 itemCount = ID_GROUP_SYSTEM_ITEM_COUNT;
223 case ID_GROUP_APPSETTING:
225 itemCount = GetDownLoadAppCount();
237 MainMenuForm::CreateGroupItem(int groupIndex, int itemWidth)
239 AppLogDebug("ENTER");
241 int itemHeight = H_GROUP_INDEX_DEFAULT;
242 LabelTextStyle style = LABEL_TEXT_STYLE_BOLD;
243 Rectangle itemRectangle;
245 Label* pLabel = null;
246 int fontSize = GetFontSize();
250 case ID_GROUP_CONNECTIVITY:
252 groupText = ResourceManager::GetString(L"IDS_ST_BODY_CONNECTIVITY");
256 // case ID_GROUP_MODE:
258 // groupText = ResourceManager::GetString(L"IDS_ST_BODY_MODE");
262 case ID_GROUP_PERSONAL:
264 groupText = ResourceManager::GetString(L"IDS_ST_BODY_PERSONAL");
268 case ID_GROUP_DEVICE:
270 groupText = ResourceManager::GetString(L"IDS_ST_BODY_DEVICE");
274 case ID_GROUP_SYSTEM:
276 groupText = ResourceManager::GetString(L"IDS_ST_BODY_SYSTEM");
280 case ID_GROUP_APPSETTING:
282 groupText = ResourceManager::GetString(L"IDS_ST_BODY_DOWNLOADED_APPLICATIONS");
290 TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
292 itemRectangle.x = X_GROUP_ITEM_DEFAULT_LABEL;
293 itemRectangle.y = H_GROUP_TITLE_TEXT;
294 itemRectangle.width = itemWidth - itemRectangle.x;
296 if (fontSize == FONT_MAIN_TEXT_SIZE_GIANT)
298 itemHeight = itemRectangle.height = H_GROUP_FONT_SIZE_GIANT;
300 else if (fontSize == FONT_MAIN_TEXT_SIZE_HUGE)
302 itemHeight = itemRectangle.height = H_GROUP_FONT_SIZE_HUGE;
304 else if (fontSize == FONT_MAIN_TEXT_SIZE_LARGE)
306 itemHeight = itemRectangle.height = H_GROUP_FONT_SIZE_LARGE;
310 itemHeight = itemRectangle.height = H_GROUP_FONT_SIZE_DEFAULT;
313 RelativeLayout relativeLayout;
314 relativeLayout.Construct();
316 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
317 pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
319 pLabel = new (std::nothrow) Label();
320 pLabel->Construct(itemRectangle, groupText);
321 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
322 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
323 pLabel->SetTextConfig(fontSize, style);
324 pLabel->SetTextColor(COLOR_GROUP_TITLE_TEXT);
326 pItem->AddControl(*pLabel);
327 relativeLayout.SetMargin(*pLabel, itemRectangle.x, 0, 0, 0);
328 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
329 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
330 pItem->SetEnabled(false);
336 MainMenuForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
338 AppLogDebug("group[%d] item[%d]", groupIndex, itemIndex);
340 int fontSize = GetFontSize();
342 unsigned int itemHeight = 0;
343 bool isDrawBitmapIcon = true;
344 Rectangle itemRectIcon;
345 Rectangle itemRectLabel;
346 Rectangle itemRectSecondLabel;
348 String itemTextTwoLine;
349 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
350 Bitmap* pBitmap = null;
351 Label* pLabel = null;
353 itemHeight = H_GROUP_ITEM_DEFAULT_LABEL;
354 ItemTypeIconAndOneLine(itemRectIcon, itemRectLabel);
358 case ID_GROUP_CONNECTIVITY:
362 case ID_ITEM_CONNECTIVITY_WIFI:
364 pBitmap = ResourceManager::GetBitmapN(IDB_WIFI);
365 itemText = ResourceManager::GetString(L"IDS_ST_BODY_WI_FI");
369 case ID_ITEM_CONNECTIVITY_BLUETOOTH:
371 ItemTypeIconAndOneLine(itemRectIcon, itemRectLabel);
372 itemHeight = itemRectLabel.height;
374 pBitmap = ResourceManager::GetBitmapN(IDB_BLUETOOTH);
375 itemText = ResourceManager::GetString(L"IDS_ST_BODY_BLUETOOTH");
379 case ID_ITEM_CONNECTIVITY_NETWORK:
381 pBitmap = ResourceManager::GetBitmapN(IDB_NETWORK);
382 itemText = ResourceManager::GetString(L"IDS_ST_BODY_NETWORK");
386 case ID_ITEM_CONNECTIVITY_NFC:
388 ItemTypeIconAndOneLine(itemRectIcon, itemRectLabel);
389 itemHeight = (itemRectLabel.height + itemRectSecondLabel.height);
391 pBitmap = ResourceManager::GetBitmapN(IDB_NFC);
392 itemText = ResourceManager::GetString(L"IDS_NFC_BODY_NFC");
402 // case ID_GROUP_MODE:
404 // style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
405 // itemRectLabel.width -= W_RESIZE_LABEL_GAP;
406 // pBitmap = ResourceManager::GetBitmapN(IDB_FLIGHT_MODE);
407 // itemText = ResourceManager::GetString(L"IDS_ST_BODY_FLIGHT_MODE");
411 case ID_GROUP_PERSONAL:
415 case ID_ITEM_PERSONAL_HOME_SCREEN:
417 pBitmap = ResourceManager::GetBitmapN(IDB_HOME_SCREEN);
418 itemText = ResourceManager::GetString(L"IDS_ST_HEADER_HOME_SCREEN");
422 case ID_ITEM_PERSONAL_LOCK_SCREEN:
424 pBitmap = ResourceManager::GetBitmapN(IDB_LOCK_SCREEN);
425 itemText = ResourceManager::GetString(L"IDS_ST_BODY_LOCK_SCREEN");
429 case ID_ITEM_PERSONAL_ACCOUNTS:
431 pBitmap = ResourceManager::GetBitmapN(IDB_ACCOUNTS);
432 itemText = ResourceManager::GetString(L"IDS_COM_BODY_ACCOUNTS");
436 case ID_ITEM_PERSONAL_PRIVACY:
438 pBitmap = ResourceManager::GetBitmapN(IDB_PRIVACY);
439 itemText = ResourceManager::GetString(L"IDS_COM_BODY_PRIVACY");
449 case ID_GROUP_DEVICE:
453 case ID_ITEM_DEVICE_DISPLAY:
455 pBitmap = ResourceManager::GetBitmapN(IDB_DISPLAY);
456 itemText = ResourceManager::GetString(L"IDS_ST_BODY_DISPLAY");
460 case ID_ITEM_DEVICE_SOUND:
462 pBitmap = ResourceManager::GetBitmapN(IDB_SOUND);
463 itemText = ResourceManager::GetString(L"IDS_ST_BODY_SOUNDS");
467 case ID_ITEM_DEVICE_LOCATION:
469 pBitmap = ResourceManager::GetBitmapN(IDB_LOCATION);
470 itemText = ResourceManager::GetString(L"IDS_ST_BODY_LOCATIONS");
474 case ID_ITEM_DEVICE_CALL_SETTING:
476 pBitmap = ResourceManager::GetBitmapN(IDB_PHONE);
477 itemText = ResourceManager::GetString(L"IDS_CST_BODY_CALL_SETTINGS");
481 case ID_ITEM_DEVICE_ACCESSIBILITY:
483 pBitmap = ResourceManager::GetBitmapN(IDB_ACCESSIBILITY);
484 itemText = ResourceManager::GetString(L"IDS_ST_BODY_ACCESSIBILITY");
488 case ID_ITEM_DEVICE_DATE_TIME:
490 pBitmap = ResourceManager::GetBitmapN(IDB_DATE_AND_TIME);
491 itemText = ResourceManager::GetString(L"IDS_ST_BODY_DATE_AND_TIME");
495 case ID_ITEM_DEVICE_LANGUAGE_KEYBOARD:
497 pBitmap = ResourceManager::GetBitmapN(IDB_LANGUAGE_KEYBOARD);
498 itemText = ResourceManager::GetString(L"IDS_ST_BODY_LANGUAGE_AND_KEYBOARD");
508 case ID_GROUP_SYSTEM:
512 case ID_ITEM_SYSTEM_MANAGE_APPLICATION:
514 pBitmap = ResourceManager::GetBitmapN(IDB_MANAGE_APPLICATION);
515 itemText = ResourceManager::GetString(L"IDS_ST_BODY_MANAGE_APPLICATIONS");
519 case ID_ITEM_SYSTEM_DEVELOPER_OPTION:
521 pBitmap = ResourceManager::GetBitmapN(IDB_DEVELOPER_OPTION);
522 itemText = ResourceManager::GetString(L"IDS_ST_BODY_DEVELOPER_OPTIONS");
526 case ID_ITEM_SYSTEM_ABOUT_PHONE:
528 pBitmap = ResourceManager::GetBitmapN(IDB_ABOUT_PHONE);
529 itemText = ResourceManager::GetString(L"IDS_ST_BODY_ABOUT_PHONE");
539 case ID_GROUP_APPSETTING:
541 String appIdKey = GetDownLoadAppIdKeyAt(itemIndex);
542 String iconPath = GetAppSettingIconPathFromAppIdListAt(appIdKey);
544 itemText = GetDownLoadAppNameAt(itemIndex);
546 if (iconPath.IsEmpty() == true)
548 pBitmap = ResourceManager::GetBitmapN(IDB_DEFAULT_ICON);
552 pBitmap = ResourceManager::GetApplicationBitmapN(iconPath);
561 TableViewItem* pItem = new (std::nothrow) TableViewItem();
565 RelativeLayout relativeLayout;
566 relativeLayout.Construct();
568 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight), style);
569 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
571 if (isDrawBitmapIcon)
573 pLabel = new (std::nothrow) Label();
574 pLabel->Construct(itemRectIcon, L"");
575 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
576 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
577 pLabel->SetBackgroundBitmap(*pBitmap);
579 pItem->AddControl(*pLabel);
582 pLabel = new (std::nothrow) Label();
583 pLabel->Construct(itemRectLabel, itemText);
584 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
585 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
586 pLabel->SetTextColor(COLOR_MAIN_TEXT);
588 pItem->AddControl(*pLabel);
589 relativeLayout.SetMargin(*pLabel, itemRectLabel.x, MAIN_RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
590 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
591 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
598 MainMenuForm::GetAppSettingIconPathFromAppIdListAt(Tizen::Base::String& id)
602 if (__pAppIconPathHashMap)
604 if (__pAppIconPathHashMap->ContainsKey(id) == true)
606 iconPath = *(static_cast<String*>(__pAppIconPathHashMap->GetValue((id))));
613 MainMenuForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
615 AppLogDebug("ENTER");
624 MainMenuForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
626 AppLogDebug("ENTER");
635 MainMenuForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
637 SceneManager* pSceneManager = SceneManager::GetInstance();
638 AppAssert(pSceneManager);
640 ArrayList* pArgs = null;
641 const wchar_t* pSceneName = null;
643 AppLogDebug("Group(%d) index(%d)", groupIndex, itemIndex);
647 case ID_GROUP_CONNECTIVITY:
649 pSceneName = GroupConnectivitySceneConnect(__currentTableViewList, itemIndex, status);
653 // case ID_GROUP_MODE:
655 // if (itemIndex == ID_ITEM_MODE_FLIGHT_MODE)
657 // bool flightModeStatus = tableView.IsItemChecked(groupIndex, itemIndex);
658 // if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
660 // flightModeStatus = (!(flightModeStatus));
663 // SetIFlightModeSetValueAsyncResultListener();
664 // if (SettingInfo::SetValueAsyncForPrivilegedKey(SETTING_INFO_KEY_NETWORK_FLIGHTMODE, flightModeStatus, __pFlightModeSetValueAsyncResultListener) == E_SUCCESS)
666 // tableView.SetItemChecked(groupIndex, itemIndex, flightModeStatus);
667 // AppLogDebug("flightmode(%d) GetLastResult(%s)", flightModeStatus, GetErrorMessage(GetLastResult()));
671 // AppLogDebug("flightmode(%d) GetLastResult(%s)", flightModeStatus, GetErrorMessage(GetLastResult()));
677 case ID_GROUP_PERSONAL:
679 pSceneName = GroupPersonalSceneConnect(__currentTableViewList, itemIndex, status);
681 if ((itemIndex != ID_ITEM_PERSONAL_HOME_SCREEN)
682 && (itemIndex != ID_ITEM_PERSONAL_LOCK_SCREEN))
687 pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
690 AppLogDebug("pArgs is null");
694 result r = pArgs->Construct();
697 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
703 case ID_ITEM_PERSONAL_HOME_SCREEN:
705 pArgs->Add(*(new (std::nothrow) String(Integer::ToString(itemIndex))));
709 case ID_ITEM_PERSONAL_LOCK_SCREEN:
711 pArgs->Add(*(new (std::nothrow) String(Integer::ToString(itemIndex))));
718 case ID_GROUP_DEVICE:
720 pSceneName = GroupDeviceSceneConnect(__currentTableViewList, itemIndex, status);
724 case ID_GROUP_SYSTEM:
726 pSceneName = GroupSystemSceneConnect(__currentTableViewList, itemIndex, status);
730 case ID_GROUP_APPSETTING:
732 String appIdKey = GetDownLoadAppIdKeyAt(itemIndex);
733 if (appIdKey.IsEmpty() == true)
735 AppLogDebug("GetDownLoadAppIdKeyAt[%d] fail", itemIndex);
739 String appSettingFilepath = GetAppSettingFilePathFromAppIdListAt(appIdKey);
740 if (appSettingFilepath.IsEmpty() == true)
742 AppLogDebug("GetAppSettingFilePathFromAppIdListAt[%ls] fail", appIdKey.GetPointer());
746 pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
749 AppLogDebug("pArgs is null");
753 result r = pArgs->Construct();
756 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
760 pArgs->Add(*(new (std::nothrow) String(appIdKey)));
761 pArgs->Add(*(new (std::nothrow) String(appSettingFilepath)));
763 pSceneName = IDSCN_XML_PARSER;
771 if (pSceneName != IDSCN_NULL)
773 AppLogDebug("pSceneName[%ls]", pSceneName);
774 pSceneManager->GoForward(ForwardSceneTransition(pSceneName, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
779 MainMenuForm::SetDownLoadAppIdKeyList(void)
781 RemoveAllDownLoadAppIdKeyList();
783 if (__pAppIdHashMap == null)
785 AppLogDebug("__pAppIdHashMap is null");
789 __pDownloadAppIdKeyList = __pAppIdHashMap->GetKeysN();
790 if (__pDownloadAppIdKeyList == null)
792 AppLogDebug("__pDownloadAppIdKeyList is null");
800 MainMenuForm::RemoveAllDownLoadAppIdKeyList(void)
802 if (__pDownloadAppIdKeyList != null)
804 __pDownloadAppIdKeyList->RemoveAll();
805 delete __pDownloadAppIdKeyList;
806 __pDownloadAppIdKeyList = null;
811 MainMenuForm::SetAppIdListFromPackageManager(void)
813 RemoveAllAppIdList();
815 __pAppIdHashMap = new (std::nothrow) HashMap();
816 if (__pAppIdHashMap == null)
818 AppLogDebug("__pAppIdHashMap is null");
822 result r = __pAppIdHashMap->Construct();
825 AppLogDebug("Construct fail [%s]", GetErrorMessage(GetLastResult()));
826 RemoveAllAppIdList();
830 __pAppIconPathHashMap = new (std::nothrow) HashMap();
831 if (__pAppIconPathHashMap == null)
833 AppLogDebug("__pAppIconPathHashMap is null");
836 r = __pAppIconPathHashMap->Construct();
839 AppLogDebug("Construct fail [%s]", GetErrorMessage(GetLastResult()));
840 RemoveAllAppIdList();
845 PackageManager* pPackageManager = PackageManager::GetInstance();
846 if (pPackageManager == null)
848 AppLogDebug("pPackageManager is null");
849 RemoveAllAppIdList();
853 pList = pPackageManager->GetPackageInfoListN();
856 AppLogDebug("pList is null");
857 RemoveAllAppIdList();
861 IEnumerator* pEnumerator = pList->GetEnumeratorN();
862 if (pEnumerator == null)
864 AppLogDebug("pEnumerator is null");
867 RemoveAllAppIdList();
871 bool isFindXml = false;
872 UiApp* pApp = UiApp::GetInstance();
875 while (pEnumerator->MoveNext() == E_SUCCESS)
877 PackageInfo* pPackage = static_cast<PackageInfo*>(pEnumerator->GetCurrent());
878 if (pPackage != null && pPackage->GetType() == PACKAGE_TYPE_TPK)
880 String path(ID_APPLICATION_DEFAULT_FOLDER_PATH);
881 path.Append(pPackage->GetId());
883 path.Append(ID_RELATIVE_SETTING_XML_FILE_PATH);
885 if ((File::IsFileExist(path) == true)
886 && (!pApp->GetAppId().Contains(pPackage->GetId())))
888 String key(pPackage->GetDisplayName());
890 key.Append(pPackage->GetId());
892 String currentAppId = pPackage->GetMainAppId();
893 PackageAppInfo* pPackageInfo = static_cast<PackageAppInfo*>(pPackage->GetPackageAppInfoN(currentAppId));
894 String iconPath = pPackageInfo->GetAppMenuIconPath();
896 __pAppIdHashMap->Add(*(new (std::nothrow) String(key)), *(new (std::nothrow) String(path)));
897 __pAppIconPathHashMap->Add(*(new (std::nothrow) String(key)), *(new (std::nothrow) String(iconPath)));
905 if (isFindXml == false)
907 RemoveAllAppIdList();
911 r = SetDownLoadAppIdKeyList();
914 RemoveAllDownLoadAppIdKeyList();
915 RemoveAllAppIdList();
923 MainMenuForm::RemoveAllAppIdList(void)
925 if (__pAppIdHashMap != null)
927 __pAppIdHashMap->RemoveAll();
928 delete __pAppIdHashMap;
929 __pAppIdHashMap = null;
932 if (__pAppIconPathHashMap != null)
934 __pAppIconPathHashMap->RemoveAll();
935 delete __pAppIconPathHashMap;
936 __pAppIconPathHashMap = null;
941 MainMenuForm::GetAppSettingFilePathFromAppIdListAt(Tizen::Base::String key)
943 String appSettingFilePath;
944 if (__pAppIdHashMap == null)
946 AppLogDebug("__pAppIdHashMap is null");
947 return appSettingFilePath;
951 result r = __pAppIdHashMap->ContainsKey(key, isFind);
952 if ((isFind == false)
957 AppLogDebug("key[%ls] is not found", key.GetPointer());
961 AppLogDebug("ContainsKey fail [%s]", GetErrorMessage(r));
963 return appSettingFilePath;
966 String* pValue = static_cast<String*>(__pAppIdHashMap->GetValue(key));
969 AppLogDebug("pValue is null");
970 return appSettingFilePath;
973 appSettingFilePath.Append(*pValue);
974 return appSettingFilePath;
978 MainMenuForm::GetDownLoadAppNameAt(unsigned int index)
981 if (__pDownloadAppIdKeyList == null)
983 AppLogDebug("__pDownloadAppIdKeyList is null");
987 String* pAppKey = static_cast<String*>(__pDownloadAppIdKeyList->GetAt(index));
990 AppLogDebug("pAppKey is null");
994 StringTokenizer stringTokenizer(*pAppKey, L":");
995 result r = stringTokenizer.GetNextToken(appName);
998 AppLogDebug("GetNextToken fail[%s]",GetErrorMessage(r));
1006 MainMenuForm::GetDownLoadAppIdKeyAt(unsigned int index)
1009 if (__pDownloadAppIdKeyList == null)
1011 AppLogDebug("__pDownloadAppIdKeyList is null");
1015 String* pAppKey = static_cast<String*>(__pDownloadAppIdKeyList->GetAt(index));
1016 if (pAppKey == null)
1018 AppLogDebug("pAppKey is null");
1022 appIdKey.Append(*pAppKey);
1028 MainMenuForm::GetDownLoadAppCount(void)
1030 unsigned int downLoadAppCount = 0;
1031 if (__pDownloadAppIdKeyList == null)
1033 AppLogDebug("__pDownloadAppIdKeyList is null");
1034 return downLoadAppCount;
1037 downLoadAppCount = __pDownloadAppIdKeyList->GetCount();
1038 return downLoadAppCount;
1042 MainMenuForm::GroupConnectivitySceneConnect(int viewMode, int itemIndex, Tizen::Ui::Controls::TableViewItemStatus status)
1044 const wchar_t* pScene = null;
1048 case ID_ITEM_CONNECTIVITY_WIFI:
1050 // if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1052 pScene = IDSCN_WIFI;
1057 case ID_ITEM_CONNECTIVITY_BLUETOOTH:
1059 // if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1061 pScene = IDSCN_BLUETOOTH;
1066 case ID_ITEM_CONNECTIVITY_NETWORK:
1068 pScene = IDSCN_NETWORK;
1072 case ID_ITEM_CONNECTIVITY_NFC:
1080 pScene = IDSCN_NULL;
1089 MainMenuForm::GroupPersonalSceneConnect (int viewMode, int itemIndex, Tizen::Ui::Controls::TableViewItemStatus status)
1091 const wchar_t* pScene = null;
1095 case ID_ITEM_PERSONAL_HOME_SCREEN:
1097 pScene = IDSCN_WALLPAPER_ALBUM_LIST;
1101 case ID_ITEM_PERSONAL_LOCK_SCREEN:
1103 pScene = IDSCN_WALLPAPER_ALBUM_LIST;
1107 case ID_ITEM_PERSONAL_ACCOUNTS:
1109 pScene = IDSCN_NULL;
1111 FindAppControlScene(itemIndex);
1115 case ID_ITEM_PERSONAL_PRIVACY:
1117 pScene = IDSCN_PRIVACY;
1123 pScene = IDSCN_NULL;
1131 MainMenuForm::GroupDeviceSceneConnect(int viewMode, int itemIndex, Tizen::Ui::Controls::TableViewItemStatus status)
1133 const wchar_t* pScene = null;
1137 case ID_ITEM_DEVICE_DISPLAY:
1139 pScene = IDSCN_DISPLAY;
1143 case ID_ITEM_DEVICE_SOUND:
1145 pScene = IDSCN_SOUNDS;
1149 case ID_ITEM_DEVICE_LOCATION:
1151 pScene = IDSCN_LOCATION;
1155 case ID_ITEM_DEVICE_CALL_SETTING:
1157 pScene = IDSCN_NULL;
1159 FindAppControlScene(itemIndex);
1163 case ID_ITEM_DEVICE_ACCESSIBILITY:
1165 pScene = IDSCN_ACCESSIBILITY;
1169 case ID_ITEM_DEVICE_DATE_TIME:
1171 pScene = IDSCN_DATE_TIME;
1175 case ID_ITEM_DEVICE_LANGUAGE_KEYBOARD:
1177 pScene = IDSCN_LOCALE;
1183 pScene = IDSCN_NULL;
1191 MainMenuForm::GroupSystemSceneConnect(int viewMode, int itemIndex, Tizen::Ui::Controls::TableViewItemStatus status)
1193 const wchar_t* pScene = null;
1197 case ID_ITEM_SYSTEM_MANAGE_APPLICATION:
1199 pScene = IDSCN_MANAGE_APPLICATION;
1203 case ID_ITEM_SYSTEM_DEVELOPER_OPTION:
1205 pScene = IDSCN_DEVELOPER_OPTION;
1209 case ID_ITEM_SYSTEM_ABOUT_PHONE:
1211 pScene = IDSCN_PHONE_INFO;
1217 pScene = IDSCN_NULL;
1225 MainMenuForm::FindAppControlScene(int itemIndex)
1228 String operationId = APPCONTROL_OPERATION_ID_CONFIGURE;
1230 ArrayList* pDataList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1232 pDataList->Construct();
1236 case ID_ITEM_PERSONAL_ACCOUNTS:
1238 providerId = APPCONTROL_PROVIDER_ID_ACCOUNT;
1242 case ID_ITEM_DEVICE_CALL_SETTING:
1244 providerId = APPCONTROL_PROVIDER_ID_PHONE;
1252 if (providerId != L"")
1254 AppControl* pAppControl = AppManager::FindAppControlN(providerId, operationId);
1258 pAppControl->Start(pDataList, null);
1268 MainMenuForm::GetDefaultGroupItemHeight(void)
1270 return H_GROUP_INDEX_NO_TITLE_DEFAULT;
1274 MainMenuForm::GetDefaultItemHeight(void)
1276 return H_GROUP_ITEM_DEFAULT;
1280 MainMenuForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
1285 MainMenuForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1290 MainMenuForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1295 MainMenuForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1300 MainMenuForm::OnResultReceivedForSetValueAsync(const Tizen::Base::String& key, result r)
1302 AppLogDebug("ENTER");
1306 //MainMenuForm::SetIFlightModeSetValueAsyncResultListener(void)
1308 // __pFlightModeSetValueAsyncResultListener = new (std::nothrow) IFlightModeSetValueAsyncResultListener();
1312 MainMenuForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
1318 MainMenuForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1320 if (requestId == FRFRESH_REQUEST_EVENT)
1324 RemoveAllDownLoadAppIdKeyList();
1325 SetAppIdListFromPackageManager();
1326 __pTableView->UpdateTableView();
1330 pArgs->RemoveAll(true);