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: MfTopMostFolderFileListForm.cpp
19 * @brief: This file contains the implementation of TopMostFolderFileListForm class, which acts as a
20 * media explorer displaying a list of all the files in the root directory
21 * and defines a set of operations that can be done with the files like edit, view etc.
24 #include "MfMyFilesApp.h"
25 #include "MfTopMostFolderFileListForm.h"
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Base::Runtime;
31 using namespace Tizen::Base::Utility;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Io;
34 using namespace Tizen::Locales;
35 using namespace Tizen::Media;
36 using namespace Tizen::System;
37 using namespace Tizen::Ui;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
41 TopMostFolderFileListForm::TopMostFolderFileListForm(void)
49 TopMostFolderFileListForm::~TopMostFolderFileListForm(void)
51 if (__pHomeButton != null)
56 if (__pUpButton != null)
63 TopMostFolderFileListForm::Initialize(void)
65 Form::Construct(L"IDL_ROOT_DIRECTORY");
69 TopMostFolderFileListForm&
70 TopMostFolderFileListForm::operator =(const TopMostFolderFileListForm& topMostFolderFileListForm)
75 TopMostFolderFileListForm::TopMostFolderFileListForm(const TopMostFolderFileListForm& topMostFolderFileListForm)
82 TopMostFolderFileListForm::OnInitializing(void)
86 int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_TOP_FOLDER_FILE_LIST_FORM;
88 _renameOrCreate = SELECT_CREATE_FOLDER;
89 CreateItemSource createitemsource = CREATE_ITEM_SOURCE_TOP_MOST_FILE_LIST;
91 //AddOrientationEventListener(*this);
92 //SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
94 AppResource* pAppResource = null;
95 Bitmap* pBitmapHomeButton = null;
96 Bitmap* pBitmapUpButton = null;
97 Bitmap* pBitmapHomeButtonPress = null;
98 Bitmap* pBitmapUpButtonPress = null;
100 Color backgroundColor(0xAE, 0x36, 0x36, 0xFF);
103 _pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_LABEL_DISPLAY_PATH"));
104 TryCatch(_pLabelDisplayPath != null, , "Label is Null");
105 pAppResource = UiApp::GetInstance()->GetAppResource();
106 TryCatch(pAppResource != null, , "MfMyFilesApp::Resource manager not found!");
108 pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
109 pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
110 pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
111 pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
113 __pHeader = GetHeader();
115 if (__pHeader != null)
117 __pHomeButton = new (std::nothrow) ButtonItem();
118 __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME);
119 __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapHomeButton);
120 __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapHomeButtonPress);
122 __pUpButton = new (std::nothrow) ButtonItem();
123 __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP);
124 __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapUpButton);
125 __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapUpButtonPress);
127 __pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton);
128 __pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton);
129 __pHeader->AddActionEventListener(*this);
132 displayPath = defaultPhoneBody;
133 displayPath.Append("/");
134 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
135 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
136 _extensionKeyName.Append(L"ExtensionVisibility");
137 // Setup back event listener
138 SetFormBackEventListener(this);
140 //Call the InitializeAppRegistry() method to define the keys used throughout the application.
141 InitializeAppRegistry();
143 //Create a new instance of the pointer for FileListPresentation Model.
144 if (_pFolderEntryPM == null)
146 _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
147 AppAssert(_pFolderEntryPM != null);
148 r = _pFolderEntryPM->Construct();
149 AppAssert(r==E_SUCCESS);
150 _pFolderEntryPM->SetSourceForm(createitemsource);
154 _pFolderEntryPM->SetFolderEntryPath(__StoragePath);
155 __ptempFilenames = _pFolderEntryPM->GetFolderEntryList();
156 if (__ptempFilenames != null && __ptempFilenames->GetCount() > 1)
159 pTabList = new (std::nothrow) ArrayList();
160 if (pTabList != null)
162 pTabList->Add(new String("Memory Card"));
163 r = CreateHeaderControls(pTabList);
168 r = CreateHeaderControls();
172 _pFileManager = FolderEntryEditorPresentationModel::GetInstance();
173 TryCatch(_pFileManager != null, , "MfMyFilesApp::File Manager not found!");
175 path = BasePresentationModel::GetMediaPath();
178 __rootMediaPath = path;
179 FolderNavigationPresentationModel::SetCurrentFilePath(path);
182 // _pFolderEntryPM->SetFolderEntryPath(__rootMediaPath);
183 // _pFilenames = _pFolderEntryPM->GetFolderEntryList();
184 // TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList");
186 // AppLogDebug("Filenames Count %d", _pFilenames->GetCount());
188 _pBaseItemProvider = new (std::nothrow) BaseItemProvider();
189 TryCatch(_pBaseItemProvider != null, , "Failed to allocate base itemprovider");
190 _pBaseItemProvider->Construct();
191 _pBaseItemProvider->SetSourceForm(createitemsource);
192 _pBaseItemProvider->SetFolderEntryProvider(this);
193 _pBaseItemProvider->SetFooterItemStateChangeListener(this);
195 _pListView = static_cast< ListView* >(GetControl("IDC_LISTVIEW_ROOT_DIRECTORY"));
196 if (_pListView != null)
198 _pListView->AddListViewItemEventListener(*this);
199 //__pListView->SetItemProvider(*this);
200 _pListView->SetItemProvider(*_pBaseItemProvider);
201 _pListView->SetShowState(true);
202 _pListView->SetBounds(0, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL);
205 //Initialize the itemprovider class for the listview inside the popup
206 if (_pCustomListViewForPopup == null)
208 _pCustomListViewForPopup = new (std::nothrow) CustomListViewForPopup();
210 TryCatch(_pCustomListViewForPopup != null, , "MfMyFilesApp::ListView For Popup not created!");
212 _pCustomListViewForPopup->SetEventListener(this);
214 _pFooter = GetFooter();
215 _pThumbnailItemProvider = new (std::nothrow) ThumbnailItemProviderAndListener(path, sourceForm);
216 //__pThumbnailItemProviderAndListener->Construct(__pContentManager);
217 TryCatch(_pThumbnailItemProvider != null, , "Failed to allocate Memory to __pThumbnailItemProviderAndListener");
218 _pThumbnailItemProvider->SetFolderEntryProvider(this);
219 _pThumbnailItemProvider->SetFooterItemStateChangeListener(this);
221 _pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_ROOT_THUMBNAILS"));
222 if (_pIconListView != null)
224 _pIconListView->AddIconListViewItemEventListener(*_pThumbnailItemProvider);
225 _pIconListView->SetItemProvider(*_pThumbnailItemProvider);
226 _pIconListView->SetBounds(0, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL);
227 _pIconListView->SetShowState(false);
228 // _pIconListView->AddGestureDetector(*gestureDetector);
231 delete pBitmapHomeButton;
232 delete pBitmapUpButton;
233 delete pBitmapHomeButtonPress;
234 delete pBitmapUpButtonPress;
235 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
239 if (_pFolderEntryPM != null)
241 delete _pFolderEntryPM;
242 _pFolderEntryPM = null;
245 if (_pThumbnailItemProvider != null)
247 delete _pThumbnailItemProvider;
248 _pThumbnailItemProvider = null;
251 if (__pHomeButton != null)
253 delete __pHomeButton;
254 __pHomeButton = null;
257 if (__pUpButton != null)
262 if (pBitmapHomeButton != null)
264 delete pBitmapHomeButton;
265 pBitmapHomeButton = null;
268 if (pBitmapUpButton != null)
270 delete pBitmapUpButton;
271 pBitmapUpButton = null;
273 if (pBitmapHomeButtonPress != null)
275 delete pBitmapHomeButtonPress;
276 pBitmapHomeButtonPress = null;
278 if (pBitmapUpButtonPress != null)
280 delete pBitmapUpButtonPress;
281 pBitmapUpButtonPress = null;
287 TopMostFolderFileListForm::OnTerminating(void)
289 AppLogDebug("ENTER");
290 result r = E_SUCCESS;
292 _pFooter = GetFooter();
293 if (_pFooter != null)
295 _pFooter->RemoveAllButtons();
296 _pFooter->RemoveAllItems();
298 __pHeader = GetHeader();
299 if (__pHeader != null)
301 __pHeader->RemoveAllButtons();
302 __pHeader->RemoveAllItems();
308 TopMostFolderFileListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
310 SceneManager* pSceneManager = SceneManager::GetInstance();
312 SceneManager* pSceneManager = SceneManager::GetInstance();
316 if (CheckSearchHistory() == true)
319 /*searchPath = FolderNavigationPresentationModel::GetSearchPreviousPath();
321 FolderNavigationPresentationModel::SetCurrentFilePath(searchPath);
322 if (SceneManager::GetInstance()->IsSceneAlive(__previousSceneName))
324 pSceneManager->GoBackward(BackwardSceneTransition(__previousSceneName, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_KEEP), null);
328 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
331 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
335 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
340 TopMostFolderFileListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
341 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
343 AppLogDebug("ENTER");
344 result r = E_SUCCESS;
346 String viewStyleKeyName(L"ListDisplayType");
347 AppResource* pAppResource = null;
348 AppRegistry* pAppRegistry = null;
350 SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
351 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
353 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
355 _pFileManager->SetFileManagingListener(this);
357 if (previousSceneId == IDSCN_CREATE_FOLDER_FORM)
359 if (_renameOrCreate == SELECT_RENAME)
365 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
367 pAppResource = UiApp::GetInstance()->GetAppResource();
368 TryCatch(pAppResource != null, , "MfMyFilesApp::Resource manager not found!");
370 //Call the CreateFooterControls() to personalize the footerItems.
371 r = CreateFooterControls();
372 TryCatch(r == E_SUCCESS, , "Failed to create footer controls");
374 //SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
376 //Get the current path from the Folder Navigation Model.
377 __rootMediaPath.Clear();
378 __rootMediaPath.Append(FolderNavigationPresentationModel::GetCurrentPath());
380 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
382 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
383 TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
384 _flagViewAsStatus = listViewDisplayType;
386 if (_pMoreContextMenu != null)
388 _pMoreContextMenu->SetShowState(false);
391 //Fill the ArrayList with the folder entries present at RootMediaPath.
392 _pFolderEntryPM->SetFolderEntryPath(__rootMediaPath);
394 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
395 TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList");
397 SetFooterVisibility();
399 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
403 pArgs->RemoveAll(false);
411 pArgs->RemoveAll(false);
418 TopMostFolderFileListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
419 const Tizen::Ui::Scenes::SceneId& nextSceneId)
421 DeviceManager::RemoveAllDeviceEventListeners();
422 ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);
423 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
424 _pFolderEntryPM->StopThumbnailManager(true);
425 _pFolderEntryPM->SetCurrentReqId(0);
427 if(_pFileEventManager != null)
428 _pFileEventManager->RemovePath(__rootMediaPath);*/
432 TopMostFolderFileListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
434 String rootMediaPath;
437 DirectoryEntry* pDirStr = null;
439 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
441 if (_pFilenames != null)
443 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
446 rootMediaPath = pDirStr->GetFullFilePath();
448 if (pDirStr->IsDirectory())
450 //If the current filepath is a directory then load the SubDirectoryForm
451 filePath.Append(__rootMediaPath);
452 filePath.Append(pDirStr->GetFileName());
453 filePath.Append(L"/");
456 fileName.Append(pDirStr->GetFileName());
458 _currentFileName.Clear();
459 _currentFileName = pDirStr->GetFileName();
461 FolderNavigationPresentationModel::SetCurrentFilePath(filePath);
462 //_pFileListPM->SetFileEventListener(null);
463 LoadSubDirectoryForm(filePath, fileName);
467 _pathOfSelectedFile = rootMediaPath;
468 //Else launch the corresponding AppControl.
469 if (_pathOfSelectedFile.EndsWith(L".tpk"))
471 String* pFileUriScheme = new (std::nothrow) String(L"file://");
472 pFileUriScheme->Append(_pathOfSelectedFile);
473 AppControl* pAc = null;
474 pAc = AppManager::FindAppControlN(L"D7eOJquGtL.Installer", L"http://tizen.org/appcontrol/operation/install");
477 pAc->Start(pFileUriScheme, null, null, null);
479 delete pFileUriScheme;
483 CustomAppControl* pCustomAppControl = CustomAppControl::GetInstance();
484 if (pCustomAppControl != null)
488 pCustomAppControl->SetAppControlListener(null);
489 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
490 if (pAppControlInUse != null)
491 CustomAppControl::SetAppControlInUse(pAppControlInUse);
502 TopMostFolderFileListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
504 result r = E_SUCCESS;
508 String displayMediaPath;
509 String displayStoragePath;
510 String displayUsbPath;
511 String extensionStatus;
516 AppResource* pAppResource = AppResource::GetInstance();
517 Header* pHeader = null;
518 SceneManager* pSceneManager = null;
519 pSceneManager = SceneManager::GetInstance();
521 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
523 if (pAppResource != null)
525 displayMediaPath = defaultPhoneBody;
526 displayMediaPath.Append("/");
528 displayStoragePath = defaultSdCardBody;
529 displayStoragePath.Append("/");
531 displayUsbPath = defaultExternalStorageBody;
532 displayUsbPath.Append("/");
534 pAppResource->GetString(L"IDS_MF_TAB_PHONE", tabPhone);
535 pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", tabSDCard);
536 pAppResource->GetString(L"IDS_COM_BODY_USB", tabUsb);
540 mediaPath = BasePresentationModel::GetMediaPath();
541 storagePath = BasePresentationModel::GetSdCardPath();
542 usbPath = BasePresentationModel::GetUsbPath();
543 AppLogDebug("SD Card Path is %ls", storagePath.GetPointer());
545 pHeader = GetHeader();
549 case IDA_CONTEXT_MENU_HIDE_EXTENSION:
555 case IDA_CONTEXT_MENU_SHOW_EXTENSION:
563 //Navigate to the TopFolderFileListForm.
565 homeRootPath.Append(__rootMediaPath);
567 while ((homeRootPath != BasePresentationModel::GetMediaPath()) && (homeRootPath != BasePresentationModel::GetSdCardPath()))
569 FolderNavigationPresentationModel::SetCurrentFilePath(homeRootPath);
570 homeRootPath.Clear();
571 homeRootPath = FolderNavigationPresentationModel::GetParentPath();
574 FolderNavigationPresentationModel::SetCurrentFilePath(homeRootPath);
576 if (CheckSearchHistory())
578 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
579 //TryCatch(r == E_SUCCESS, , "scene transition failed");
583 r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), null);
584 //TryCatch(r == E_SUCCESS, , "scene transition failed");
597 UiApp* pApp = UiApp::GetInstance();
605 case IDA_TABBAR_ITEM_PHONE:
608 bool enableUpdate = false;
609 currentPath = FolderNavigationPresentationModel::GetCurrentPath();
611 if (currentPath.CompareTo(mediaPath) != 0)
620 pHeader->SetItemSelected(0);
623 //_tabSelected = tabPhone;
624 //__storageType = MEMORY_TYPE_PHONE;
627 _pFolderEntryPM->SetFolderEntryPath(mediaPath);
628 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
630 __rootMediaPath.Clear();
631 __rootMediaPath.Append(mediaPath);
633 if (_pListView != null && _pListView->IsVisible())
635 _pListView->UpdateList();
636 _pListView->ScrollToItem(0);
640 if (_pIconListView != null && _pIconListView->IsVisible())
642 _pIconListView->UpdateList();
643 _pIconListView->ScrollToItem(0);
646 FolderNavigationPresentationModel::SetCurrentFilePath(mediaPath);
647 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
650 SetFooterVisibility();
654 if (_pFolderEntryPM != null)
656 _pFolderEntryPM->InitThumbnailManager();
661 case IDA_TABBAR_ITEM_SD_CARD:
664 bool enableUpdate = false;
665 currentPath = FolderNavigationPresentationModel::GetCurrentPath();
667 if (currentPath.CompareTo(storagePath) != 0)
676 pHeader->SetItemSelected(1);
679 //_tabSelected = tabSDCard;
681 __rootMediaPath.Clear();
682 __rootMediaPath.Append(storagePath);
684 _pFolderEntryPM->SetFolderEntryPath(storagePath);
685 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
688 SetFooterVisibility();
690 if (_pListView != null && _pListView->IsVisible())
692 _pListView->ScrollToItem(0);
693 _pListView->UpdateList();
696 if (_pIconListView != null && _pIconListView->IsVisible())
698 _pIconListView->ScrollToItem(0);
699 _pIconListView->UpdateList();
703 FolderNavigationPresentationModel::SetCurrentFilePath(storagePath);
704 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
707 if (_pFolderEntryPM != null)
709 _pFolderEntryPM->InitThumbnailManager();
714 case IDA_TABBAR_ITEM_USB:
717 bool enableUpdate = false;
718 currentPath = FolderNavigationPresentationModel::GetCurrentPath();
720 if (currentPath.CompareTo(usbPath) != 0)
727 //_tabSelected = tabUsb;
731 pHeader->SetItemSelected(2);
734 __rootMediaPath.Clear();
735 __rootMediaPath.Append(usbPath);
737 _pFolderEntryPM->SetFolderEntryPath(usbPath);
738 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
740 if (_pListView != null && _pListView->IsVisible())
742 _pListView->ScrollToItem(0);
743 _pListView->UpdateList();
746 if (_pIconListView != null && _pIconListView->IsVisible())
748 _pIconListView->ScrollToItem(0);
749 _pIconListView->UpdateList();
752 SetFooterVisibility();
754 FolderNavigationPresentationModel::SetCurrentFilePath(usbPath);
755 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
763 SubBaseOnActionPerformed(source, actionId);
770 TopMostFolderFileListForm::LoadSubDirectoryForm(Tizen::Base::String& fullPath, Tizen::Base::String& fileName)
772 result r = E_SUCCESS;
773 ArrayList* pArg = null;
774 SceneManager* pSceneManager = null;
776 pArg = new (std::nothrow) ArrayList();
779 pArg->Add(&fileName);
780 TryCatch(r == E_SUCCESS, , "Failed to Add Arguments to ArrayList");
782 pSceneManager = SceneManager::GetInstance();
783 TryCatch(pSceneManager != null, , "Failed to get SceneManager Instance");
785 //pSceneManager->GoForward(SCENE_SUB_DIRECTORY_FORM,pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
786 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
802 TopMostFolderFileListForm::InitializeAppRegistry(void)
804 AppLogDebug("ENTER");
805 // 3 keys: ViewStyle, SortBy, Show/Hide File Extension
806 result r = E_SUCCESS;
808 AppRegistry* pAppRegistry = null;
809 String viewStyleKeyName(L"ListDisplayType");
810 ViewType viewStyle = VIEW_TYPE_AS_NORMAL_LIST;
812 String sortbyKeyName(L"SortBy");
813 SortByType sortStyle = SORT_BY_TYPE_DATE_RECENT;
815 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
817 r = pAppRegistry->Add(viewStyleKeyName, viewStyle);
820 r = pAppRegistry->Save();
823 r = pAppRegistry->Add(_extensionKeyName, _hideExtension);
826 r = pAppRegistry->Save();
829 r = pAppRegistry->Add(sortbyKeyName, sortStyle);
832 r = pAppRegistry->Save();
835 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
839 TopMostFolderFileListForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
841 AppLogDebug("ENTER");
842 Integer* pFileProcessingResult = null;
844 TryCatch(pArgs != null, , "Argument list received is invalid!");
845 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
847 TryCatch(pFileProcessingResult != null, , "FileProcessing Result list is invalid!");
849 switch (pFileProcessingResult->ToInt())
851 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
853 AppLogDebug("FILE_PROCESSING_RESULT_DELETING_SUCCESS");
854 if (_pFilenames != null)
856 _pFilenames->RemoveAt(_indexTracker, true);
857 //r = __pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_REMOVE);
858 _pListView->UpdateList();
860 if (_pIconListView != null && _pIconListView->IsVisible())
862 _pIconListView->UpdateList();
865 HideFileProgressingPopup();
869 case FILE_MANAGING_RESULT_DELETING_FAILED:
871 HideFileProgressingPopup();
874 case FILE_MANAGING_RESULT_THREAD_STOP:
876 HideFileProgressingPopup();
890 pArgs->RemoveAll(true);
896 TopMostFolderFileListForm::OnFileEventExecuted(const Tizen::Base::String& path, const unsigned long eventId)
898 AppLogDebug("ENTER");
901 // Tizen::Shell::NotificationManager* pNotiMgr = null;
902 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
904 NotificationManager* pNotiMgr = null;
905 AppResource* pAppResource = null;
906 pAppResource = UiApp::GetInstance()->GetAppResource();
907 TryCatch(pAppResource != null, , "Failed to fetch AppResource");
909 pNotiMgr = new (std::nothrow) NotificationManager();
910 TryCatch(pNotiMgr != null, , "Failed to fetch AppNotificationManager");
912 pNotiMgr->Construct();
913 badgeNumber = pNotiMgr->GetBadgeNumber();
917 //_pFolderEntryPM->SetFileEventListener(null);
921 case FILE_EVENT_TYPE_CREATE:
923 if (_pListView != null && _pListView->IsVisible())
925 _pListView->RefreshList(_pFilenames->GetCount() - 1, LIST_REFRESH_TYPE_ITEM_ADD);
927 if (_pIconListView != null && _pIconListView->IsVisible())
929 _pIconListView->RefreshList(_pFilenames->GetCount() - 1, LIST_REFRESH_TYPE_ITEM_ADD);
934 case FILE_EVENT_TYPE_DELETE:
936 if (_pListView != null && _pListView->IsVisible())
938 _pListView->RefreshList(__counter, LIST_REFRESH_TYPE_ITEM_REMOVE);
940 if (_pIconListView != null && _pIconListView->IsVisible())
942 if (_pThumbnailItemProvider != null)
944 __counter = _pThumbnailItemProvider->GetPressedIndex();
946 _pIconListView->RefreshList(__counter, LIST_REFRESH_TYPE_ITEM_REMOVE);
953 //Empty Implementation.
958 if (pNotiMgr != null)
966 // if (pNotiMgr != null)
975 TopMostFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,
976 const Tizen::Ui::Scenes::SceneId ¤tSceneId)
978 AppLogDebug("Enter");
979 AppLogDebug("_rename index %d",_renameIndex);
980 AppRegistry* pAppRegistry = null;
981 String sortbyKeyName(L"SortBy");
982 int sortStyle = SORT_BY_TYPE_DATE_RECENT;
984 TryReturn (_pFolderEntryPM !=null, , "FolderEntryPresentation Model is NULL");
986 if (_pFileEventManager != null)
988 delete _pFileEventManager;
989 _pFileEventManager = null;
993 /*_pFileEventManager = new FileEventManager();
994 _pFileEventManager->Construct(*this);
996 _pFileEventManager->AddPath(__rootMediaPath, FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_DELETE );*/
999 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
1000 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1002 if (previousSceneId == IDSCN_CREATE_FOLDER_FORM)
1004 if (_renameOrCreate == SELECT_RENAME)
1006 pAppRegistry->Get(sortbyKeyName, sortStyle);
1008 if (sortStyle == SORT_BY_TYPE_NAME_ASCENDING || sortStyle == SORT_BY_TYPE_NAME_DESCENDING
1009 || sortStyle == SORT_BY_TYPE_DATE_OLDEST || sortStyle == SORT_BY_TYPE_DATE_RECENT)
1011 _pFolderEntryPM->SetFolderEntryPath(FolderNavigationPresentationModel::GetCurrentPath());
1012 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
1014 if (_pListView != null && _pListView->IsVisible())
1016 _pListView->UpdateList();
1017 _pListView->ScrollToItem(0);
1019 _pFolderEntryPM->InitThumbnailManager();
1023 _pListView->RefreshList(_renameIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
1025 //_pFolderEntryPM->InitThumbnailManager();
1029 if (CheckSearchHistory())
1031 __previousSceneName = previousSceneId;
1035 _pFolderEntryPM->InitThumbnailManager();
1039 TopMostFolderFileListForm::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId ¤tSceneId,
1040 const Tizen::Ui::Scenes::SceneId &nextSceneId)
1042 //Empty Implementation.
1046 TopMostFolderFileListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1048 switch (orientationStatus)
1050 case ORIENTATION_STATUS_LANDSCAPE:
1052 SceneManager* pSceneManager = null;
1053 pSceneManager = SceneManager::GetInstance();
1054 if (pSceneManager != null)
1056 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SPLIT_PANEL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), null);
1066 TopMostFolderFileListForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
1068 AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured");
1069 if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE))
1071 _pFolderEntryPM->RefreshFolderEntries();
1073 if (_pListView != null && _pListView->IsVisible())
1075 _pListView->UpdateList();
1078 if (_pIconListView != null && _pIconListView->IsVisible())
1080 _pIconListView->UpdateList();
1082 _pFolderEntryPM->InitThumbnailManager();