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;
324 if (state == mounted)
326 pSdCard = new (std::nothrow) String(sdCardStorage);
327 __pFolderList->Add(pSdCard);
330 else if (state == unmounted)
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();
367 //OnDeviceChange(currentDeviceType, state);
371 TopLevelFolderFileListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
375 result r = E_SUCCESS;
376 Integer currentFileType;
377 AppResource* pAppResource = null;
378 ArrayList *pArgs = null;
384 SceneManager* pSceneManager = SceneManager::GetInstance();
385 pAppResource = UiApp::GetInstance()->GetAppResource();
386 if (pAppResource != null)
388 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
389 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
390 pAppResource->GetString(L"IDS_MF_BODY_SOUNDS", sounds);
391 pAppResource->GetString(L"IDS_MF_BODY_VIDEOS", videos);
392 pAppResource->GetString(L"IDS_MF_BODY_IMAGES", images);
393 pAppResource->GetString(L"IDS_MF_BODY_DOCUMENT", document);
394 pAppResource->GetString(L"IDS_MF_BODY_OTHERS", others);
400 case IDA_BUTTON_IMAGE:
402 currentFileType = FILE_TYPE_IMAGE_TYPE;
405 pArgs = new (std::nothrow) ArrayList();
408 pArgs->Add(new (std::nothrow) Integer(currentFileType));
409 pArgs->Add(new (std::nothrow) String(images));
411 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
416 case IDA_BUTTON_VIDEO:
418 currentFileType = FILE_TYPE_VIDEO_TYPE;
421 pArgs = new (std::nothrow) ArrayList();
424 pArgs->Add(new (std::nothrow) Integer(currentFileType));
425 pArgs->Add(new (std::nothrow) String(videos));
426 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
430 case IDA_BUTTON_SOUND:
432 currentFileType = FILE_TYPE_AUDIO_TYPE;
435 pArgs = new (std::nothrow) ArrayList();
438 pArgs->Add(new (std::nothrow) Integer(currentFileType));
439 pArgs->Add(new (std::nothrow) String(sounds));
440 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
444 case IDA_BUTTON_DOCUMENT:
446 currentFileType = FILE_TYPE_DOCUMENT_TYPE;
449 pArgs = new (std::nothrow) ArrayList();
452 pArgs->Add(new (std::nothrow) Integer(currentFileType));
453 pArgs->Add(new (std::nothrow) String(document));
454 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
458 case IDA_BUTTON_OTHERS:
460 currentFileType = FILE_TYPE_OTHER_TYPE;
464 pArgs = new (std::nothrow) ArrayList();
468 pArgs->Add(new (std::nothrow) Integer(currentFileType));
469 pArgs->Add(new (std::nothrow) String(others));
470 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CATEGORY_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
474 case IDA_CONTEXT_MENU_BTN_SEARCH:
476 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_NONE);
482 SubBaseOnActionPerformed(source, actionId);
489 TopLevelFolderFileListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
491 switch (orientationStatus)
493 case ORIENTATION_STATUS_PORTRAIT:
495 if (_pLabelDisplayPath != null)
497 _pLabelDisplayPath->SetShowState(true);
502 case ORIENTATION_STATUS_LANDSCAPE:
504 if (_pLabelDisplayPath != null)
506 _pLabelDisplayPath->SetShowState(false);
520 TopLevelFolderFileListForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus status)
527 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
528 filePath = FolderNavigationPresentationModel::GetMediaPath();
529 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
532 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
533 filePath = FolderNavigationPresentationModel::GetSdCardPath();
534 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
538 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
539 filePath = FolderNavigationPresentationModel::GetUsbPath();
540 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
544 LoadDetailForm(filePath);
549 TopLevelFolderFileListForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
551 ArrayList* pArgs = null;
552 pArgs = new (std::nothrow) ArrayList();
560 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
561 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
563 fileName.Append(defaultPhoneBody);
566 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
567 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
569 fileName.Append(defaultSdCardBody);
572 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
573 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
575 fileName.Append(defaultExternalStorageBody);
581 if (__appControlRequest == false)
583 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
587 pArgs->Add(&fileName);
588 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
593 TopLevelFolderFileListForm::CreateItem(int index, int itemWidth)
598 String externalStorage;
602 CustomItem* pItem = new CustomItem();
603 AppResource* pAppResource = null;
604 pAppResource = UiApp::GetInstance()->GetAppResource();
605 if (pAppResource != null)
607 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", memoryCard);
609 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
613 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
615 pItem->Construct(Dimension(itemWidth, H_ITEM_LISTVIEW), style);
621 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);
627 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);
634 pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);
642 tempStr = static_cast<String*>(__pFolderList->GetAt(index));
645 titleText.Append(*tempStr);
647 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);
648 pItem->SetContextItem(__pItemContext);
653 TopLevelFolderFileListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
664 TopLevelFolderFileListForm::GetItemCount(void)
666 return __listItemCount;
671 TopLevelFolderFileListForm::OnFormBackRequested(Form& source)
673 SceneManager* pSceneManager = SceneManager::GetInstance();
674 if (CheckSearchHistory() == true)
676 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
680 MyFilesApp* pApp = (MyFilesApp*) Application::GetInstance();
682 if (__appControlRequest)
684 ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();
685 ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_CANCELED);
697 TopLevelFolderFileListForm::InitializeAppRegistry(void)
699 AppLogDebug("ENTER");
700 // 3 keys: ViewStyle, SortBy, Show/Hide File Extension
701 result r = E_SUCCESS;
703 AppRegistry* pAppRegistry = null;
704 String viewStyleKeyName(L"ListDisplayType");
705 ViewType viewStyle = VIEW_TYPE_AS_NORMAL_LIST;
707 String sortbyKeyName(L"SortBy");
708 SortByType sortStyle = SORT_BY_TYPE_DATE_RECENT;
710 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
712 r = pAppRegistry->Add(viewStyleKeyName, viewStyle);
715 r = pAppRegistry->Save();
718 r = pAppRegistry->Add(_extensionKeyName, _showExtension);
721 r = pAppRegistry->Save();
724 r = pAppRegistry->Add(sortbyKeyName, sortStyle);
727 r = pAppRegistry->Save();
730 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
734 TopLevelFolderFileListForm::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId ¤tSceneId,
735 const Tizen::Ui::Scenes::SceneId &nextSceneId)
737 //Empty Implementation.
741 TopLevelFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,
742 const Tizen::Ui::Scenes::SceneId ¤tSceneId)
744 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
746 String deviceSateSdCard;
747 String mounted = sdCardStatusMounted;
748 String unmounted = sdCardStatusUnmounted;
749 AppControlState currentState;
752 String deviceSateUSBStorage;
753 String inserted = usbDeviceStatusInserted;
754 String removed = usbDeviceStatusRemoved;
755 String externalStorage;
756 String* pExternalStorage = null;
759 String sdCardStorage;
762 String* pSDCard = null;
764 FooterItem footerItemSearch;
766 int footerItemCount = 0;
767 DeviceManager::GetState(StorageCard, deviceSateSdCard);
769 DeviceManager::GetState(UsbClient, deviceSateUSBStorage);
772 AppResource* pAppResource = null;
774 pAppResource = UiApp::App::GetInstance()->GetAppResource();
776 if (pAppResource != null)
778 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);
780 pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
782 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
784 FolderNavigationPresentationModel::SetCurrentFilePath(L"");
785 __listItemCount = __pFolderList->GetCount();
787 if (deviceSateSdCard == mounted && __listItemCount < 2)
789 pSDCard = new (std::nothrow) String(sdCardStorage);
791 __pFolderList->Add(pSDCard);
793 else if (deviceSateSdCard == unmounted && __listItemCount > 1)
795 __pFolderList->RemoveAt(__listItemCount - 1, true);
799 if (deviceSateUSBStorage == inserted)
801 pExternalStorage = new (std::nothrow) String(externalStorage);
802 __pFolderList->Add(pExternalStorage);
804 else if (deviceSateUSBStorage == removed && __listItemCount > 1)
806 __pFolderList->RemoveAt(__listItemCount - 1);
810 __listItemCount = __pFolderList->GetCount();
813 _pFooter = GetFooter();
814 currentState = ((MyFilesApp*) Application::GetInstance())->GetCurrentState();
816 if (currentState != APPCONTROL_STATE_SELECTED)
818 if (CheckSearchHistory())
820 if (_pFooter != null)
822 _pFooter->RemoveItemAt(0);
823 _pFooter->Invalidate(true);
828 if (_pFooter != null)
830 footerItemCount = _pFooter->GetItemCount();
832 if (footerItemCount != 1)
834 footerItemSearch.Construct(IDA_CONTEXT_MENU_BTN_SEARCH);
835 footerItemSearch.SetText(buttonSearch);
836 _pFooter->AddItem(footerItemSearch);
837 _pFooter->Invalidate(true);
844 _pLongPressGestureDetector->AddLongPressGestureEventListener(*this);
845 if (_pIconListView != null)
847 _pIconListView->AddGestureDetector(*_pLongPressGestureDetector);
853 TopLevelFolderFileListForm::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
856 if (__appControlRequest == false)
861 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
862 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
865 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
866 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
870 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
871 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
875 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
880 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM));
884 Tizen::Ui::Controls::IconListViewItem*
885 TopLevelFolderFileListForm::CreateItem(int index)
890 IconListViewItem* pItem = null;
891 pItem = new (std::nothrow) IconListViewItem();
893 tempStr = static_cast<String*>(__pFolderList->GetAt(index));
896 titleText.Append(*tempStr);
902 pItem->Construct(*__pPhone, &titleText,__pPhonePress, null);
907 pItem->Construct(*__pMemoryCard, &titleText,__pMemoryCardPress, null);
914 pItem->Construct(*__pExternalStorage, &titleText,__pExternalStoragePress, null);
926 TopLevelFolderFileListForm::DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem)
937 TopLevelFolderFileListForm::CreateCategoryPanel(void)
939 Button* pImageButton = null;
940 Button* pVideoButton = null;
941 Button* pSoundButton = null;
942 Button* pDocumentButton = null;
943 Button* pOthersButton = null;
944 Label* pBackgroundLabel = null;
945 Panel* pCategoryPanel = null;
947 // Bitmap* pCategoryImagesBitmap = null;
948 // Bitmap* pCategorySoundsBitmap = null;
949 // Bitmap* pCategoryVideosBitmap = null;
950 // Bitmap* pCategoryDocsBitmap = null;
951 // Bitmap* pCategoryOthersBitmap = null;
953 // Bitmap* pCategoryPressImagesBitmap = null;
954 // Bitmap* pCategoryPressSoundsBitmap = null;
955 // Bitmap* pCategoryPressVideosBitmap = null;
956 // Bitmap* pCategoryPressDocsBitmap = null;
957 // Bitmap* pCategoryPressOthersBitmap = null;
959 Bitmap* pImages = null;
960 Bitmap* pVideos = null;
961 Bitmap* pSounds = null;
962 Bitmap* pDocs = null;
963 Bitmap* pOthers = null;
964 Bitmap* pImagesPressed = null;
965 Bitmap* pVideosPressed = null;
966 Bitmap* pSoundsPressed = null;
967 Bitmap* pDocsPressed = null;
968 Bitmap* pOthersPressed = null;
970 Point* startPoint = null;
972 startPoint = new (std::nothrow) Point(28, 10);
975 pImages = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_IMAGE_ICON, 128, 92, startPoint);
976 pVideos = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_VIDEO_ICON, 128, 92, startPoint);
977 pSounds = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_SOUND_ICON, 128, 92, startPoint);
978 pDocs = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_DOCUMENT_ICON, 128, 92, startPoint);
979 pOthers = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_OTHERS_ICON, 128, 92, startPoint);
981 pImagesPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_IMAGE_ICON_PRESS, 128, 92, startPoint);
982 pVideosPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_VIDEO_ICON_PRESS, 128, 92, startPoint);
983 pSoundsPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_SOUND_ICON_PRESS, 128, 92, startPoint);
984 pDocsPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_DOCUMENT_ICON_PRESS, 128, 92, startPoint);
985 pOthersPressed = MfUtility::MergeNinePatchedBitmapN(IDB_CATEGORY_BACKGROUND, IDB_CATEGORY_OTHERS_ICON_PRESS, 128, 92, startPoint);
987 pImageButton = static_cast<Button*>(GetControl("IDC_BUTTON_IMAGES", true));
988 pImageButton->SetActionId(IDA_BUTTON_IMAGE);
989 pImageButton->SetNormalBackgroundBitmap(*pImages);
990 pImageButton->SetPressedBackgroundBitmap(*pImagesPressed);
991 pImageButton->AddActionEventListener(*this);
993 pVideoButton = static_cast<Button*>(GetControl("IDC_BUTTON_VIDEOS", true));
994 pVideoButton->SetActionId(IDA_BUTTON_VIDEO);
995 pVideoButton->SetNormalBackgroundBitmap(*pVideos);
996 pVideoButton->SetPressedBackgroundBitmap(*pVideosPressed);
997 pVideoButton->AddActionEventListener(*this);
999 pSoundButton = static_cast<Button*>(GetControl("IDC_BUTTON_SOUNDS", true));
1000 pSoundButton->SetNormalBackgroundBitmap(*pSounds);
1001 pSoundButton->SetPressedBackgroundBitmap(*pSoundsPressed);
1002 pSoundButton->SetActionId(IDA_BUTTON_SOUND);
1003 pSoundButton->AddActionEventListener(*this);
1005 pDocumentButton = static_cast<Button*>(GetControl("IDC_BUTTON_DOCUMENTS", true));
1006 pDocumentButton->SetNormalBackgroundBitmap(*pDocs);
1007 pDocumentButton->SetPressedBackgroundBitmap(*pDocsPressed);
1008 pDocumentButton->SetActionId(IDA_BUTTON_DOCUMENT);
1009 pDocumentButton->AddActionEventListener(*this);
1011 pOthersButton = static_cast<Button*>(GetControl("IDC_BUTTON_OTHERS", true));
1012 pOthersButton->SetNormalBackgroundBitmap(*pOthers);
1013 pOthersButton->SetPressedBackgroundBitmap(*pOthersPressed);
1014 pOthersButton->SetActionId(IDA_BUTTON_OTHERS);
1015 pOthersButton->AddActionEventListener(*this);
1017 pCategoryPanel = static_cast<Panel*>(GetControl("IDC_CATEGORY_ICON_PANEL", true));
1019 pBackgroundLabel = static_cast<Label*>(GetControl("IDC_LABEL_BACKGROUND", true));
1021 pCategoryPanel->SetControlAlwaysAtBottom(*pBackgroundLabel, true);
1030 delete pImagesPressed;
1031 delete pVideosPressed;
1032 delete pSoundsPressed;
1033 delete pDocsPressed;
1034 delete pOthersPressed;