2 #include "MfCategorySearch.h"
3 #include "MfBasePresentationModel.h"
4 #include "MfMyFilesApp.h"
7 using namespace Tizen::Base;
8 using namespace Tizen::Base::Collection;
9 using namespace Tizen::App;
10 using namespace Tizen::Graphics;
11 using namespace Tizen::Io;
12 using namespace Tizen::Ui;
13 using namespace Tizen::Ui::Controls;
14 using namespace Tizen::Ui::Scenes;
15 using namespace Tizen::System;
16 using namespace Tizen::Base::Utility;
18 CategorySearch::CategorySearch(void)
23 __currentFileType = FILE_TYPE_OTHER_TYPE;
27 CategorySearch::~CategorySearch(void)
29 DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD,*this);
30 if (__pHomeButton != null)
35 if (__pUpButton != null)
42 CategorySearch::Initialize(void)
44 Form::Construct(L"IDL_CATEGORY_SEARCH");
49 CategorySearch::OnInitializing(void)
52 CreateItemSource createitemsource = CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM;
53 int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_CATEGORY_SEARCH_FORM;
56 String rootParentPath;
59 String extensionVisibility;
60 String currentDirectoryPath = BasePresentationModel::GetMediaPath();
62 Bitmap* pBitmapHomeButton = null;
63 Bitmap* pBitmapUpButton = null;
64 Bitmap* pBitmapHomeButtonPress = null;
65 Bitmap* pBitmapUpButtonPress = null;
66 AppResource* pAppResource = null;
68 if (_pFolderEntryPM == null)
70 _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
71 AppAssert(_pFolderEntryPM != null);
72 r = _pFolderEntryPM->Construct();
73 AppAssert(r==E_SUCCESS);
74 _pFolderEntryPM->SetSourceForm(createitemsource);
77 _pBaseItemProvider = new (std::nothrow) BaseItemProvider();
78 TryCatch(_pBaseItemProvider != null, , "Failed to allocate base itemprovider");
79 _pBaseItemProvider->Construct();
80 _pBaseItemProvider->SetSourceForm(createitemsource);
81 _pBaseItemProvider->SetFolderEntryProvider(this);
82 _pBaseItemProvider->SetFooterItemStateChangeListener(this);
84 _pListView = static_cast<ListView *>(GetControl(L"IDC_LISTVIEW_CATEGORY_SEARCH"));
85 TryCatch(_pListView != null, , "__pListView is Null");
86 _pListView->AddListViewItemEventListener(*this);
87 _pListView->SetItemProvider(*this);
88 _pListView->SetItemProvider(*_pBaseItemProvider);
90 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
92 pAppResource = UiApp::App::GetInstance()->GetAppResource();
93 TryCatch(pAppResource != null, , "Resource manager not found!");
95 pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome);
96 pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp);
97 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
98 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
99 pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
100 pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
101 pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
102 pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
103 extensionVisibility = fileExtenstionKeyName;
105 __pHeader = GetHeader();
106 _extensionKeyName.Append(extensionVisibility);
108 createitemsource = CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM;
110 //Initialize the itemprovider class for the listview inside the popup
111 if (_pCustomListViewForPopup == null)
113 _pCustomListViewForPopup = new (std::nothrow) CustomListViewForPopup();
115 TryCatch(_pCustomListViewForPopup != null, , "MfMyFilesApp::ListView For Popup not created!");
117 _pCustomListViewForPopup->SetEventListener(this);
120 if (_pThumbnailItemProvider == null)
122 _pThumbnailItemProvider = new (std::nothrow) ThumbnailItemProviderAndListener(currentDirectoryPath, sourceForm);
123 _pThumbnailItemProvider->SetFolderEntryProvider(this);
125 TryCatch(_pThumbnailItemProvider != null, , "Failed to allocate Memory to __pSubFolderThumbnailsProvider");
127 _pThumbnailItemProvider->SetFooterItemStateChangeListener(this);
129 _pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_CATEGORY_SEARCH"));
130 TryCatch(_pIconListView != null, , "__pIconListviewSubThumbnails is Null");
131 _pIconListView->SetItemProvider(*_pThumbnailItemProvider);
132 _pIconListView->AddIconListViewItemEventListener(*this);
133 _pIconListView->AddTouchEventListener(*this);
134 _pIconListView->SetShowState(false);
136 _pLongPressGestureDetector = new (std::nothrow) TouchLongPressGestureDetector();
137 _pLongPressGestureDetector->Construct();
139 delete pBitmapHomeButton;
140 delete pBitmapUpButton;
141 delete pBitmapHomeButtonPress;
142 delete pBitmapUpButtonPress;
144 CreateFooterControls();
145 //Set FormBackEvent Listener
146 SetFormBackEventListener(this);
147 _pFileManager = FolderEntryEditorPresentationModel::GetInstance();
149 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
153 AppLogDebug("caught exception");
154 if (__pHomeButton != null)
156 delete __pHomeButton;
157 __pHomeButton = null;
160 if (__pUpButton != null)
166 if (_pCustomListViewForPopup != null)
168 delete _pCustomListViewForPopup;
169 _pCustomListViewForPopup = null;
172 if (pBitmapHomeButton != null)
174 delete pBitmapHomeButton;
175 pBitmapHomeButton = null;
178 if (pBitmapUpButton != null)
180 delete pBitmapUpButton;
181 pBitmapUpButton = null;
183 if (pBitmapHomeButtonPress != null)
185 delete pBitmapHomeButtonPress;
186 pBitmapHomeButtonPress = null;
188 if (pBitmapUpButtonPress != null)
190 delete pBitmapUpButtonPress;
191 pBitmapUpButtonPress = null;
197 CategorySearch::OnTerminating(void)
199 result r = E_SUCCESS;
200 //((MfMyFilesApp*)Application::GetInstance())->SetCurrentView(null);
202 _pFooter = GetFooter();
203 if (_pFooter != null)
205 _pFooter->RemoveAllButtons();
206 _pFooter->RemoveAllItems();
209 __pHeader = GetHeader();
210 if (__pHeader != null)
212 __pHeader->RemoveAllButtons();
213 __pHeader->RemoveAllItems();
222 CategorySearch::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
224 AppLogDebug("Entry");
226 DirectoryEntry* pCheckedEntry = null;
230 result r = E_SUCCESS;
231 MemoryType currentMemoryType = MEMORY_TYPE_PHONE;
232 ArrayList* pArgs = null;
233 SceneManager* pSceneManager = null;
234 AppResource* pAppResource = null;
235 CustomAppControl* pCustomAppControl = CustomAppControl::GetInstance();
236 pAppResource = UiApp::GetInstance()->GetAppResource();
237 pSceneManager = SceneManager::GetInstance();
238 if (pAppResource != null)
240 pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selected);
242 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
244 if (pCheckedEntry == null)
249 _indexTracker = index;
250 // if (elementId == CONTENT_LIST_ITEM_TYPE_RENAME || elementId == DETAILED_LIST_ELEMENTS_RENAME)
251 if (status == LIST_ITEM_STATUS_MORE/* || elementId == DETAILED_LIST_ELEMENTS_RENAME*/)
255 pArgs = new (std::nothrow) ArrayList();
259 fullPath = pCheckedEntry->GetFullFilePath();
260 GetParentFolderPath(&fullPath);
261 FolderNavigationPresentationModel::SetCurrentFilePath(fullPath);
263 if (fullPath.StartsWith(BasePresentationModel::GetMediaPath(),0))
265 currentMemoryType = MEMORY_TYPE_PHONE;
266 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
268 else if(fullPath.StartsWith(BasePresentationModel::GetSdCardPath(),0))
270 currentMemoryType = MEMORY_TYPE_SD_CARD;
271 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
274 GetFileName(&fullPath);
275 pArgs->Add(fullPath);
276 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArgs);
281 if (_pFileEventManager != null)
283 _pFileEventManager->RemovePath(_pathOfSelectedFile);
284 delete _pFileEventManager;
285 _pFileEventManager = null;
287 _pathOfSelectedFile = pCheckedEntry->GetFullFilePath();
288 AppLogDebug("Selected File path : %S", _pathOfSelectedFile.GetPointer());
290 _pFileEventManager = new (std::nothrow)FileEventManager();
291 _pFileEventManager->Construct(*this);
293 String FileName = pCheckedEntry->GetFileName() + "." + pCheckedEntry->GetFileExtension();
294 String parentDirectoryOfSelectedFile = L"";
295 _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
296 _fileEventPath = parentDirectoryOfSelectedFile;
297 _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
299 if (pCustomAppControl != null)
302 pCustomAppControl->SetAppControlListener(null);
303 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
304 if (pAppControlInUse != null)
305 CustomAppControl::SetAppControlInUse(pAppControlInUse);
309 // ISceneEventListener
311 CategorySearch::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
314 AppLogDebug("Enter");
317 String* headerTitleText;
318 AppRegistry* pAppRegistry = null;
319 String viewStyleKeyName(L"ListDisplayType");
320 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
322 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
324 pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
325 _flagViewAsStatus = listViewDisplayType;
327 SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
329 SetCurrentDirectoryFlag(false);
333 fileType = static_cast< Integer* >(pArgs->GetAt(0));
334 currentType = fileType->ToInt();
335 headerTitleText = static_cast< String* >(pArgs->GetAt(1));
336 if (headerTitleText != null)
338 __currentHeaderText = *headerTitleText;
339 __pHeader->SetTitleText(__currentHeaderText);
344 case FILE_TYPE_IMAGE_TYPE:
346 AppLogDebug("File type is image");
347 __currentFileType = FILE_TYPE_IMAGE_TYPE;
351 case FILE_TYPE_VIDEO_TYPE:
353 __currentFileType = FILE_TYPE_VIDEO_TYPE;
357 case FILE_TYPE_AUDIO_TYPE:
359 __currentFileType = FILE_TYPE_AUDIO_TYPE;
363 case FILE_TYPE_DOCUMENT_TYPE:
365 __currentFileType = FILE_TYPE_DOCUMENT_TYPE;
369 case FILE_TYPE_OTHER_TYPE:
371 __currentFileType = FILE_TYPE_OTHER_TYPE;
380 if (_pFileManager != null)
382 _pFileManager->SetFileManagingListener(this);
387 pArgs->RemoveAll(true);
392 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
394 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_USB_CLIENT, *this);
400 CategorySearch::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
402 DeviceManager::RemoveAllDeviceEventListeners();
403 if (_pFileEventManager != null)
405 _pFileEventManager->RemovePath(_pathOfSelectedFile);
406 delete _pFileEventManager;
407 _pFileEventManager = null;
410 if (_pIconListView != null)
412 _pIconListView->RemoveGestureDetector(_pLongPressGestureDetector);
418 CategorySearch::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId)
420 AppLogDebug("Enter");
421 String mediaPath = BasePresentationModel::GetMediaPath();
422 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
423 CreateItemSource sourceForm = CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM;
424 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
425 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_NONE);
427 if (_pFolderEntryPM != null)
429 _pFolderEntryPM->SetFolderEntryType(__currentFileType);
430 _pFolderEntryPM->SetSourceForm(sourceForm);
431 _pFolderEntryPM->CreateStack();
432 _pFolderEntryPM->CreateTraversalTree();
433 _pFolderEntryPM->SortFolderEntries();
434 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
439 if (_pFilenames != null)
441 if (_pFilenames->GetCount() == 0)
443 _bIsDirectoryEmpty = true;
445 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
449 _bIsDirectoryEmpty = false;
451 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
452 _pLongPressGestureDetector->AddLongPressGestureEventListener(*this);
453 if (_pIconListView != null && _pIconListView->IsVisible())
455 _pIconListView->AddGestureDetector(*_pLongPressGestureDetector);
460 if (_pFolderEntryPM != null)
462 _pFolderEntryPM->InitThumbnailManager();
468 CategorySearch::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)
470 //Empty Implementation
474 CategorySearch::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
476 SceneManager* pSceneManager = SceneManager::GetInstance();
477 result r = E_SUCCESS;
478 r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
482 CategorySearch::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
484 AppLogDebug("ENTER");
486 result r = E_SUCCESS;
491 case IDA_CONTEXT_MENU_HIDE_EXTENSION:
493 //__currentDirectoryPath.Clear();
494 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
500 case IDA_CONTEXT_MENU_SHOW_EXTENSION:
502 //__currentDirectoryPath.Clear();
503 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
511 SubBaseOnActionPerformed(source, actionId);
515 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
518 CategorySearch::GetParentFolderPath(Tizen::Base::String* filePath)
523 StringTokenizer tokenizer(*filePath, delim);
525 while (tokenizer.HasMoreTokens())
527 if (tokenizer.GetTokenCount() != 1)
529 filePath->Append(L"/");
530 tokenizer.GetNextToken(token);
531 filePath->Append(token);
538 filePath->Append(L"/");
541 CategorySearch::GetFileName(Tizen::Base::String* fileName)
546 if (fileName->StartsWith(BasePresentationModel::GetMediaPath(),0))
548 fileName->Replace(BasePresentationModel::GetMediaPath(),"Phone/",0);
550 else if(fileName->StartsWith(BasePresentationModel::GetSdCardPath(),0))
552 fileName->Replace(BasePresentationModel::GetSdCardPath(),"Memory Card/",0);
554 StringTokenizer tokenizer(*fileName, delim);
556 while (tokenizer.HasMoreTokens())
558 if (tokenizer.GetTokenCount() != 1)
560 tokenizer.GetNextToken(token);
564 tokenizer.GetNextToken(token);
565 fileName->Append(token);
571 CategorySearch::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
573 AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured:%S", path.GetPointer());
577 HashMap* pCacheList = null;
578 DirectoryEntry* pCurrentEntry = null;
579 bool cacheKeyStatus = false;
582 AppLogDebug("ContentManager::ScanFile:%S", path.GetPointer());
584 if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
586 _bBackFromAppControl = true;
587 if ( (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM))
589 AppLogDebug("Items to delete: %d", _indexTracker);
590 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
591 if (pCacheList != null)
593 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
595 if (pCurrentEntry != null)
597 cachePath = pCurrentEntry->GetFullFilePath();
599 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
602 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
606 if (_pFolderEntryPM!=null)
608 _pFolderEntryPM->RefreshFolderEntries();
615 CategorySearch::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
617 AppLogDebug("Enter");
618 HashMap* pCacheList = null;
619 DirectoryEntry* pCurrentEntry = null;
620 bool cacheKeyStatus = false;
622 Integer* pFileProcessingResult = null;
623 TryCatch(pArgs != null, , "Argument list received is invalid!");
624 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
626 TryCatch(pFileProcessingResult != null, , "FileProcessing Result list is invalid!");
627 TryCatch(_pFilenames != null, , "_pFilenames is Null.");
629 switch (pFileProcessingResult->ToInt())
631 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
633 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
635 if (pCacheList != null)
637 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
639 if (pCurrentEntry != null)
641 cachePath = pCurrentEntry->GetFullFilePath();
644 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
648 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
651 _pFilenames->RemoveAt(_indexTracker, true);
653 if (_pListView != null)
655 _pListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
657 if (_pIconListView != null && _pIconListView->IsVisible())
659 _pIconListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
662 HideFileProgressingPopup();
666 case FILE_MANAGING_RESULT_DELETING_FAILED:
668 HideFileProgressingPopup();
671 case FILE_MANAGING_RESULT_THREAD_STOP:
673 HideFileProgressingPopup();
683 if (_pFilenames->GetCount() == 0)
685 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
691 pArgs->RemoveAll(true);
698 CategorySearch::SetFooterItemsVisibility(int mode)
700 AppLogDebug("ENTRY mode = %d",mode);
701 _pFooter = GetFooter();
705 _pFooter->SetItemEnabled(0, false);
706 _pFooter->SetItemEnabled(1, false);
707 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
711 _pFooter->SetItemEnabled(0, true);
712 _pFooter->SetItemEnabled(1, true);
713 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
715 _pFooter->Invalidate(true);
718 CategorySearch::OnIconListViewOverlayBitmapSelected (Tizen::Ui::Controls::IconListView &iconListView, int index, int overlayBitmapId)
720 result r = E_SUCCESS;
722 ArrayList* pArgs = null;
725 DirectoryEntry* pCheckedEntry = null;
727 SceneManager* pSceneManager = null;
729 MemoryType currentMemoryType = MEMORY_TYPE_PHONE;
731 pSceneManager = SceneManager::GetInstance();
733 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
734 if (pCheckedEntry == null)
741 pArgs = new (std::nothrow) ArrayList();
745 fullPath = pCheckedEntry->GetFullFilePath();
746 GetParentFolderPath(&fullPath);
747 FolderNavigationPresentationModel::SetCurrentFilePath(fullPath);
749 if (fullPath.StartsWith(BasePresentationModel::GetMediaPath(),0))
751 currentMemoryType = MEMORY_TYPE_PHONE;
752 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
754 else if(fullPath.StartsWith(BasePresentationModel::GetSdCardPath(),0))
756 currentMemoryType = MEMORY_TYPE_SD_CARD;
757 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
760 GetFileName(&fullPath);
761 pArgs->Add(fullPath);
762 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArgs);
768 CategorySearch::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
770 AppLogDebug("ENTER");
771 //If the source of the event is from the RootForm's IconListView, Changes the Scene to the SubFolderFileListForm. Else just refreshes the source IconListView.
773 DirectoryEntry* pDirStr = null;
774 CustomAppControl* pCustomAppControl = null;
776 //Get the directory structure at this index from the filenames arraylist
777 if (_pFilenames != null)
779 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
782 //Get the filename of the specified index if pDirStr not null.
785 _pathOfSelectedFile = pDirStr->GetFullFilePath();
787 if (_pFileEventManager != null)
789 _pFileEventManager->RemovePath(_pathOfSelectedFile);
790 delete _pFileEventManager;
791 _pFileEventManager = null;
795 _pFileEventManager = new (std::nothrow)FileEventManager();
796 _pFileEventManager->Construct(*this);
798 String FileName = pDirStr->GetFileName() + "." + pDirStr->GetFileExtension();
799 String parentDirectoryOfSelectedFile = L"";
800 _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
801 _fileEventPath = parentDirectoryOfSelectedFile;
802 _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
805 pCustomAppControl = CustomAppControl::GetInstance();
807 if (pCustomAppControl != null)
811 pCustomAppControl->SetAppControlListener(null);
813 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
814 if (pAppControlInUse != null)
815 CustomAppControl::SetAppControlInUse(pAppControlInUse);
819 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
824 CategorySearch::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
827 ComponentType currentDeviceType;
832 currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
838 currentDeviceType = COMPONENT_TYPE_USB;
848 OnDeviceChange(currentDeviceType, state);
852 CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state)
854 AppLogDebug("CategorySearch::OnDeviceChange");
855 if (_pFolderEntryPM != null)
857 _pFolderEntryPM->CreateTraversalTree();
858 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
861 if (_pFilenames != null)
863 if (_pFilenames->GetCount() == 0)
865 _bIsDirectoryEmpty = true;
866 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
870 _bIsDirectoryEmpty = false;
871 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
875 if (_pListView != null && _pListView->IsVisible())
877 _pListView->UpdateList();
878 _pListView->Invalidate(true);
881 if (_pIconListView != null && _pIconListView->IsVisible())
883 _pIconListView->UpdateList();
884 _pIconListView->Invalidate(true);
887 if (_pFolderEntryPM != null)
889 _pFolderEntryPM->InitThumbnailManager();
893 CategorySearch::OnAppControlCompleted(void)
895 if (_pFilenames != null)
897 if (_pFilenames->GetCount() == 0)
899 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
903 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
906 SubBaseFolderEntryForm::OnAppControlCompleted();