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.
23 #include "MfFolderNavigationPresentationModel.h"
24 #include "MfTopLevelFolderFileListForm.h"
26 #include "MfSceneRegister.h"
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Graphics;
32 using namespace Tizen::System;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
35 using namespace Tizen::Ui::Scenes;
38 TopLevelFolderFileListForm::TopLevelFolderFileListForm(void)
42 , __pExternalStorage(null)
43 , __pExternalStoragePress(null)
46 , __pMemoryCardPress(null)
47 , __pItemContext(null)
49 , __pCategoryIconPanel(null)
51 __appControlRequest = false;
57 TopLevelFolderFileListForm::~TopLevelFolderFileListForm(void)
59 DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD,*this);
60 if (__pFolderList != null)
62 __pFolderList->RemoveAll(true);
68 TopLevelFolderFileListForm::Initialize(void)
70 Form::Construct(L"IDL_MAIN_FORM");
75 TopLevelFolderFileListForm::OnInitializing(void)
78 int xPos = 0, yPos = 0;
79 Point bitmapLocation(0, 0);
81 String headerDisplayText;
83 String contextItemText;
84 String deviceSateSdCard;
85 String mounted = sdCardStatusMounted;
86 String unmounted = sdCardStatusUnmounted;
89 String externalStorage;
91 AppResource* pAppResource = null;
93 Header* pHeader = null;
94 Footer* pFormFooter = null;
95 pAppResource = UiApp::App::GetInstance()->GetAppResource();
97 if (pAppResource != null)
99 pAppResource->GetString(L"IDS_COM_BODY_MY_FILES", headerDisplayText);
100 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
101 pAppResource->GetString(L"IDS_MF_SK_DETAILS", contextItemText);
102 pAppResource->GetString(L"IDS_MF_TAB_PHONE", phoneStorage);
103 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
104 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
106 __pPhone = pAppResource->GetBitmapN(IDB_PHONE_ICON);
107 __pMemoryCard = pAppResource->GetBitmapN(IDB_SDCARD_ICON_TOP_LEVEL);
109 __pExternalStorage = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON);
110 __pExternalStoragePress = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON_PRESSED);
112 __pPhonePress = pAppResource->GetBitmapN(IDB_PHONE_ICON_PRESSED);
113 __pMemoryCardPress = pAppResource->GetBitmapN(IDB_SDCARD_ICON_PRESSED);
116 String* phonetext = new (std::nothrow) String(phoneStorage);
118 __pFolderList = new (std::nothrow) ArrayList();
119 //TryCatch(__pFolderList != null, , "MfMyFilesApp::Failed to Allocate memory to pTabList!");
120 __pFolderList->Construct();
122 __pFolderList->Add(phonetext);
124 pHeader = GetHeader();
127 pHeader-> SetTitleText(headerDisplayText);
130 pFormFooter = GetFooter();
131 __pCategoryIconPanel = static_cast< Panel* >(GetControl("IDC_CATEGORY_ICON_PANEL", true));
132 _extensionKeyName.Append(L"ExtensionVisibility");
134 //Call the InitializeAppRegistry() method to define the keys used throughout the application.
135 InitializeAppRegistry();
137 FooterItem footerItemSearch;
140 __pItemContext = new (std::nothrow) ListContextItem();
141 __pItemContext->Construct();
142 __pItemContext->AddElement(IDA_CONTEXT_ITEM_DETAIL, contextItemText);
144 footerItemSearch.Construct(IDA_CONTEXT_MENU_BTN_SEARCH);
145 footerItemSearch.SetText(buttonSearch);
147 if (pFormFooter != null)
149 pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
150 pFormFooter->AddItem(footerItemSearch);
151 pFormFooter->GetPosition(xPos, yPos);
154 _pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_LABEL_DISPLAY_PATH"));
155 if (_pLabelDisplayPath != null)
157 _pLabelDisplayPath->SetShowState(false);
159 CreateCategoryPanel();
162 //Initialize the itemprovider class for the listview inside the popup
163 if (_pCustomListViewForPopup == null)
165 _pCustomListViewForPopup = new (std::nothrow) CustomListViewForPopup();
167 //TryCatch(_pCustomListViewForPopup != null, , "MfMyFilesApp::ListView For Popup not created!");
169 _pCustomListViewForPopup->SetEventListener(this);
171 if (pFormFooter != null)
173 pFormFooter->AddActionEventListener(*this);
174 pFormFooter->Invalidate(true);
175 pFormFooter->SetBackButton();
176 SetFormBackEventListener(this);
179 _pLongPressGestureDetector = new (std::nothrow) TouchLongPressGestureDetector();
180 _pLongPressGestureDetector->Construct();
182 _pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_TOP_MOST_FORM"));
183 if (_pIconListView != null)
185 _pIconListView->AddIconListViewItemEventListener(*this);
186 _pIconListView->SetItemProvider(*this);
187 _pIconListView->AddTouchEventListener(*this);
188 _pIconListView->SetShowState(false);
191 _pListView = static_cast< ListView* >(GetControl("IDC_LISTVIEW_TEMP_FORM"));
192 if (_pListView != null)
194 _pListView->AddListViewItemEventListener(*this);
195 _pListView->SetShowState(true);
196 _pListView->SetItemProvider(*this);
203 TopLevelFolderFileListForm::OnTerminating(void)
205 result r = E_SUCCESS;
207 delete __pMemoryCard;
209 delete __pExternalStorage;
210 delete __pExternalStoragePress;
212 delete __pPhonePress;
213 delete __pMemoryCardPress;
214 delete __pItemContext;
219 TopLevelFolderFileListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
221 AppRegistry* pAppRegistry = null;
222 String viewStyleKeyName(L"ListDisplayType");
224 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
226 SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
227 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
230 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
232 pAppRegistry->Get(viewStyleKeyName, _flagViewAsStatus);
233 // TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
235 __appControlRequest = ((MyFilesApp*) Application::GetInstance())->IsAppControlMode();
237 if (__appControlRequest == true) //if (pArgs != null)
239 _flagViewAsStatus = VIEW_TYPE_AS_NORMAL_LIST;
240 _pFooter = GetFooter();
242 _pListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
243 _pIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
245 if (_pLabelDisplayPath != null)
247 _pLabelDisplayPath->SetShowState(false);
250 if (_pFooter != null)
252 _pFooter->RemoveAllItems();
253 _pFooter->RemoveAllButtons();
254 _pFooter->SetBackButton();
256 __pCategoryIconPanel->SetShowState(false);
261 SetCurrentDirectoryFlag(true);
263 if (_pLabelDisplayPath != null)
265 _pLabelDisplayPath->SetShowState(true);
267 __appControlRequest = false;
272 TopLevelFolderFileListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
274 __appControlRequest = false;
275 DeviceManager::RemoveAllDeviceEventListeners();
277 if (_pIconListView != null)
279 _pIconListView->RemoveGestureDetector(_pLongPressGestureDetector);
282 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(null);
287 TopLevelFolderFileListForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
289 ComponentType currentDeviceType = COMPONENT_TYPE_NONE;
291 String mounted = sdCardStatusMounted;
292 String unmounted = sdCardStatusUnmounted;
293 String inserted = usbDeviceStatusInserted;
294 String removed = usbDeviceStatusRemoved;
296 String sdCardStorage;
297 String externalStorage;
299 String* pSdCard = null;
300 String* pExternalStorage = null;
302 AppResource* pAppResource = null;
304 pAppResource = UiApp::App::GetInstance()->GetAppResource();
306 if (pAppResource != null)
308 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);
309 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
313 if (_pIconListViewContextMenu != null)
315 _pIconListViewContextMenu->SetShowState(false);
322 currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
323 __listItemCount = __pFolderList->GetCount();
324 if (state == mounted)
326 pSdCard = new (std::nothrow) String(sdCardStorage);
327 __pFolderList->Add(pSdCard);
330 else if (state == unmounted && __listItemCount > 1)
332 __pFolderList->RemoveAt(__listItemCount - 1);
335 __listItemCount = __pFolderList->GetCount();
341 currentDeviceType = COMPONENT_TYPE_USB;
343 if (state == inserted)
345 pExternalStorage = new (std::nothrow) String(externalStorage);
346 __pFolderList->Add(pExternalStorage);
348 else if (state == removed)
350 __pFolderList->RemoveAt(__listItemCount - 1);
352 __listItemCount = __pFolderList->GetCount();
364 _pListView->UpdateList();
365 _pIconListView->UpdateList();
370 TopLevelFolderFileListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
374 result r = E_SUCCESS;
375 Integer currentFileType;
376 AppResource* pAppResource = null;
377 ArrayList *pArgs = null;
383 SceneManager* pSceneManager = SceneManager::GetInstance();
384 pAppResource = UiApp::GetInstance()->GetAppResource();
385 if (pAppResource != null)
387 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
388 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
389 pAppResource->GetString(L"IDS_MF_BODY_SOUNDS", sounds);
390 pAppResource->GetString(L"IDS_MF_BODY_VIDEOS", videos);
391 pAppResource->GetString(L"IDS_MF_BODY_IMAGES", images);
392 pAppResource->GetString(L"IDS_MF_BODY_DOCUMENT", document);
393 pAppResource->GetString(L"IDS_MF_BODY_OTHERS", others);
399 case IDA_BUTTON_IMAGE:
401 currentFileType = FILE_TYPE_IMAGE_TYPE;
404 pArgs = new (std::nothrow) ArrayList();
407 pArgs->Add(new (std::nothrow) Integer(currentFileType));
408 pArgs->Add(new (std::nothrow) String(images));
410 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
415 case IDA_BUTTON_VIDEO:
417 currentFileType = FILE_TYPE_VIDEO_TYPE;
420 pArgs = new (std::nothrow) ArrayList();
423 pArgs->Add(new (std::nothrow) Integer(currentFileType));
424 pArgs->Add(new (std::nothrow) String(videos));
425 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
429 case IDA_BUTTON_SOUND:
431 currentFileType = FILE_TYPE_AUDIO_TYPE;
434 pArgs = new (std::nothrow) ArrayList();
437 pArgs->Add(new (std::nothrow) Integer(currentFileType));
438 pArgs->Add(new (std::nothrow) String(sounds));
439 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
443 case IDA_BUTTON_DOCUMENT:
445 currentFileType = FILE_TYPE_DOCUMENT_TYPE;
448 pArgs = new (std::nothrow) ArrayList();
451 pArgs->Add(new (std::nothrow) Integer(currentFileType));
452 pArgs->Add(new (std::nothrow) String(document));
453 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
457 case IDA_BUTTON_OTHERS:
459 currentFileType = FILE_TYPE_OTHER_TYPE;
463 pArgs = new (std::nothrow) ArrayList();
467 pArgs->Add(new (std::nothrow) Integer(currentFileType));
468 pArgs->Add(new (std::nothrow) String(others));
469 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
473 case IDA_CONTEXT_MENU_BTN_SEARCH:
475 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_NONE);
481 SubBaseOnActionPerformed(source, actionId);
488 TopLevelFolderFileListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
490 switch (orientationStatus)
492 case ORIENTATION_STATUS_PORTRAIT:
494 if (_pLabelDisplayPath != null)
496 _pLabelDisplayPath->SetShowState(true);
501 case ORIENTATION_STATUS_LANDSCAPE:
503 if (_pLabelDisplayPath != null)
505 _pLabelDisplayPath->SetShowState(false);
519 TopLevelFolderFileListForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus status)
526 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
527 filePath = FolderNavigationPresentationModel::GetMediaPath();
528 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
531 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
532 filePath = FolderNavigationPresentationModel::GetSdCardPath();
533 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
537 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
538 filePath = FolderNavigationPresentationModel::GetUsbPath();
539 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
543 LoadDetailForm(filePath);
548 TopLevelFolderFileListForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
550 ArrayList* pArgs = null;
551 pArgs = new (std::nothrow) ArrayList();
559 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
560 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
562 fileName.Append(defaultPhoneBody);
565 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
566 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
568 fileName.Append(defaultSdCardBody);
571 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
572 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
574 fileName.Append(defaultExternalStorageBody);
580 if (__appControlRequest == false)
582 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
586 pArgs->Add(&fileName);
587 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
592 TopLevelFolderFileListForm::CreateItem(int index, int itemWidth)
597 String externalStorage;
601 CustomItem* pItem = new CustomItem();
602 AppResource* pAppResource = null;
603 pAppResource = UiApp::GetInstance()->GetAppResource();
604 if (pAppResource != null)
606 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", memoryCard);
608 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
612 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
614 pItem->Construct(Dimension(itemWidth, H_ITEM_LISTVIEW), style);
620 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);
626 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);
633 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);
641 tempStr = static_cast<String*>(__pFolderList->GetAt(index));
644 titleText.Append(*tempStr);
646 pItem->AddElement(Rectangle(W_LISTVIEW_ITEM_BITMAP + 2 * X_LISTVIEW, (H_ITEM_LISTVIEW - H_LISTVIEW_ITEM_TITLE) /2, itemWidth - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW), H_LISTVIEW_ITEM_TITLE), IDA_FORMAT_STRING, titleText, true);
647 pItem->SetContextItem(__pItemContext);
652 TopLevelFolderFileListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
663 TopLevelFolderFileListForm::GetItemCount(void)
665 return __listItemCount;
670 TopLevelFolderFileListForm::OnFormBackRequested(Form& source)
672 SceneManager* pSceneManager = SceneManager::GetInstance();
673 if (CheckSearchHistory() == true)
675 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
679 MyFilesApp* pApp = (MyFilesApp*) Application::GetInstance();
681 if (__appControlRequest)
683 ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();
684 ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_CANCELED);
696 TopLevelFolderFileListForm::InitializeAppRegistry(void)
698 AppLogDebug("ENTER");
699 // 3 keys: ViewStyle, SortBy, Show/Hide File Extension
700 result r = E_SUCCESS;
702 AppRegistry* pAppRegistry = null;
703 String viewStyleKeyName(L"ListDisplayType");
704 ViewType viewStyle = VIEW_TYPE_AS_NORMAL_LIST;
706 String sortbyKeyName(L"SortBy");
707 SortByType sortStyle = SORT_BY_TYPE_DATE_RECENT;
709 String timeFormatKeyName(L"TimeFormat");
710 String timeFormatSettingSelected;
712 String timeFormatSettingKey = L"http://tizen.org/setting/locale.date_time.format";
713 TimeFormat timeFormatSelected = TIME_FORMAT_NONE;
715 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
717 SettingInfo::GetValue(timeFormatSettingKey, timeFormatSettingSelected);
719 r = pAppRegistry->Add(viewStyleKeyName, viewStyle);
722 r = pAppRegistry->Save();
725 r = pAppRegistry->Add(_extensionKeyName, _showExtension);
728 r = pAppRegistry->Save();
731 r = pAppRegistry->Add(sortbyKeyName, sortStyle);
734 r = pAppRegistry->Save();
737 if (timeFormatSettingSelected.CompareTo(IDB_DATETIME_24HR) == 0)
739 timeFormatSelected = TIME_FORMAT_24_HOUR;
741 else if (timeFormatSettingSelected.CompareTo(IDB_DATETIME_12HR) == 0)
743 timeFormatSelected = TIME_FORMAT_12_HOUR;
745 r = pAppRegistry->Add(timeFormatKeyName, timeFormatSelected);
749 r = pAppRegistry->Save();
751 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
755 TopLevelFolderFileListForm::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId ¤tSceneId,
756 const Tizen::Ui::Scenes::SceneId &nextSceneId)
758 //Empty Implementation.
762 TopLevelFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,
763 const Tizen::Ui::Scenes::SceneId ¤tSceneId)
765 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
767 String deviceSateSdCard;
768 String mounted = sdCardStatusMounted;
769 String unmounted = sdCardStatusUnmounted;
770 AppControlState currentState;
773 String deviceSateUSBStorage;
774 String inserted = usbDeviceStatusInserted;
775 String removed = usbDeviceStatusRemoved;
776 String externalStorage;
777 String* pExternalStorage = null;
780 String sdCardStorage;
783 String* pSDCard = null;
785 FooterItem footerItemSearch;
787 int footerItemCount = 0;
788 DeviceManager::GetState(StorageCard, deviceSateSdCard);
790 DeviceManager::GetState(UsbClient, deviceSateUSBStorage);
793 AppResource* pAppResource = null;
795 pAppResource = UiApp::App::GetInstance()->GetAppResource();
797 if (pAppResource != null)
799 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);
801 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
803 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
805 FolderNavigationPresentationModel::SetCurrentFilePath(L"");
806 __listItemCount = __pFolderList->GetCount();
808 if (deviceSateSdCard == mounted && __listItemCount < 2)
810 pSDCard = new (std::nothrow) String(sdCardStorage);
812 __pFolderList->Add(pSDCard);
814 else if (deviceSateSdCard == unmounted && __listItemCount > 1)
816 __pFolderList->RemoveAt(__listItemCount - 1, true);
820 if (deviceSateUSBStorage == inserted)
822 pExternalStorage = new (std::nothrow) String(externalStorage);
823 __pFolderList->Add(pExternalStorage);
825 else if (deviceSateUSBStorage == removed && __listItemCount > 1)
827 __pFolderList->RemoveAt(__listItemCount - 1);
831 __listItemCount = __pFolderList->GetCount();
834 _pFooter = GetFooter();
835 currentState = ((MyFilesApp*) Application::GetInstance())->GetCurrentState();
837 if (currentState != APPCONTROL_STATE_SELECTED)
839 if (CheckSearchHistory())
841 if (_pFooter != null)
843 _pFooter->RemoveItemAt(0);
844 _pFooter->Invalidate(true);
849 if (_pFooter != null)
851 footerItemCount = _pFooter->GetItemCount();
853 if (footerItemCount != 1)
855 footerItemSearch.Construct(IDA_CONTEXT_MENU_BTN_SEARCH);
856 footerItemSearch.SetText(buttonSearch);
857 _pFooter->AddItem(footerItemSearch);
858 _pFooter->Invalidate(true);
865 _pLongPressGestureDetector->AddLongPressGestureEventListener(*this);
866 if (_pIconListView != null)
868 _pIconListView->AddGestureDetector(*_pLongPressGestureDetector);
874 TopLevelFolderFileListForm::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
877 if (__appControlRequest == false)
882 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
883 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
886 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
887 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
891 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
892 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
896 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
901 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM));
905 Tizen::Ui::Controls::IconListViewItem*
906 TopLevelFolderFileListForm::CreateItem(int index)
911 IconListViewItem* pItem = null;
912 pItem = new (std::nothrow) IconListViewItem();
914 tempStr = static_cast<String*>(__pFolderList->GetAt(index));
917 titleText.Append(*tempStr);
923 pItem->Construct(*__pPhone, &titleText,__pPhonePress, null);
928 pItem->Construct(*__pMemoryCard, &titleText,__pMemoryCardPress, null);
935 pItem->Construct(*__pExternalStorage, &titleText,__pExternalStoragePress, null);
947 TopLevelFolderFileListForm::DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem)
958 TopLevelFolderFileListForm::CreateCategoryPanel(void)
960 Button* pImageButton = null;
961 Button* pVideoButton = null;
962 Button* pSoundButton = null;
963 Button* pDocumentButton = null;
964 Button* pOthersButton = null;
965 Label* pBackgroundLabel = null;
966 Panel* pCategoryPanel = null;
968 // Bitmap* pCategoryImagesBitmap = null;
969 // Bitmap* pCategorySoundsBitmap = null;
970 // Bitmap* pCategoryVideosBitmap = null;
971 // Bitmap* pCategoryDocsBitmap = null;
972 // Bitmap* pCategoryOthersBitmap = null;
974 // Bitmap* pCategoryPressImagesBitmap = null;
975 // Bitmap* pCategoryPressSoundsBitmap = null;
976 // Bitmap* pCategoryPressVideosBitmap = null;
977 // Bitmap* pCategoryPressDocsBitmap = null;
978 // Bitmap* pCategoryPressOthersBitmap = null;
980 Bitmap* pImages = null;
981 Bitmap* pVideos = null;
982 Bitmap* pSounds = null;
983 Bitmap* pDocs = null;
984 Bitmap* pOthers = null;
985 Bitmap* pImagesPressed = null;
986 Bitmap* pVideosPressed = null;
987 Bitmap* pSoundsPressed = null;
988 Bitmap* pDocsPressed = null;
989 Bitmap* pOthersPressed = null;
991 Point* startPoint = null;
993 startPoint = new (std::nothrow) Point(28, 10);
996 pImages = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_IMAGE_ICON, 128, 92, startPoint);
997 pVideos = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_VIDEO_ICON, 128, 92, startPoint);
998 pSounds = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_SOUND_ICON, 128, 92, startPoint);
999 pDocs = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_DOCUMENT_ICON, 128, 92, startPoint);
1000 pOthers = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_OTHERS_ICON, 128, 92, startPoint);
1002 pImagesPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_IMAGE_ICON_PRESS, 128, 92, startPoint);
1003 pVideosPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_VIDEO_ICON_PRESS, 128, 92, startPoint);
1004 pSoundsPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_SOUND_ICON_PRESS, 128, 92, startPoint);
1005 pDocsPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_DOCUMENT_ICON_PRESS, 128, 92, startPoint);
1006 pOthersPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_OTHERS_ICON_PRESS, 128, 92, startPoint);
1008 pImageButton = static_cast<Button*>(GetControl("IDC_BUTTON_IMAGES", true));
1009 pImageButton->SetActionId(IDA_BUTTON_IMAGE);
1010 pImageButton->SetNormalBackgroundBitmap(*pImages);
1011 pImageButton->SetPressedBackgroundBitmap(*pImagesPressed);
1012 pImageButton->AddActionEventListener(*this);
1014 pVideoButton = static_cast<Button*>(GetControl("IDC_BUTTON_VIDEOS", true));
1015 pVideoButton->SetActionId(IDA_BUTTON_VIDEO);
1016 pVideoButton->SetNormalBackgroundBitmap(*pVideos);
1017 pVideoButton->SetPressedBackgroundBitmap(*pVideosPressed);
1018 pVideoButton->AddActionEventListener(*this);
1020 pSoundButton = static_cast<Button*>(GetControl("IDC_BUTTON_SOUNDS", true));
1021 pSoundButton->SetNormalBackgroundBitmap(*pSounds);
1022 pSoundButton->SetPressedBackgroundBitmap(*pSoundsPressed);
1023 pSoundButton->SetActionId(IDA_BUTTON_SOUND);
1024 pSoundButton->AddActionEventListener(*this);
1026 pDocumentButton = static_cast<Button*>(GetControl("IDC_BUTTON_DOCUMENTS", true));
1027 pDocumentButton->SetNormalBackgroundBitmap(*pDocs);
1028 pDocumentButton->SetPressedBackgroundBitmap(*pDocsPressed);
1029 pDocumentButton->SetActionId(IDA_BUTTON_DOCUMENT);
1030 pDocumentButton->AddActionEventListener(*this);
1032 pOthersButton = static_cast<Button*>(GetControl("IDC_BUTTON_OTHERS", true));
1033 pOthersButton->SetNormalBackgroundBitmap(*pOthers);
1034 pOthersButton->SetPressedBackgroundBitmap(*pOthersPressed);
1035 pOthersButton->SetActionId(IDA_BUTTON_OTHERS);
1036 pOthersButton->AddActionEventListener(*this);
1038 pCategoryPanel = static_cast<Panel*>(GetControl("IDC_CATEGORY_ICON_PANEL", true));
1040 pBackgroundLabel = static_cast<Label*>(GetControl("IDC_LABEL_BACKGROUND", true));
1042 pCategoryPanel->SetControlAlwaysAtBottom(*pBackgroundLabel, true);
1051 delete pImagesPressed;
1052 delete pVideosPressed;
1053 delete pSoundsPressed;
1054 delete pDocsPressed;
1055 delete pOthersPressed;
1059 TopLevelFolderFileListForm::OnAppControlCompleted(void)
1061 AppLogDebug("TopLevelFolderFileListForm::OnAppControlCompleted");