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), pArgs);
280 if (_pFileEventManager != null)
282 _pFileEventManager->RemovePath(_pathOfSelectedFile);
283 delete _pFileEventManager;
284 _pFileEventManager = null;
286 _pathOfSelectedFile = pCheckedEntry->GetFullFilePath();
287 AppLogDebug("Selected File path : %S", _pathOfSelectedFile.GetPointer());
289 _pFileEventManager = new (std::nothrow)FileEventManager();
290 _pFileEventManager->Construct(*this);
292 String FileName = pCheckedEntry->GetFileName() + "." + pCheckedEntry->GetFileExtension();
293 String parentDirectoryOfSelectedFile = L"";
294 _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
295 _fileEventPath = parentDirectoryOfSelectedFile;
296 _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
298 if (pCustomAppControl != null)
301 pCustomAppControl->SetAppControlListener(null);
302 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
303 if (pAppControlInUse != null)
304 CustomAppControl::SetAppControlInUse(pAppControlInUse);
308 // ISceneEventListener
310 CategorySearch::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
313 AppLogDebug("Enter");
316 String* headerTitleText;
317 AppRegistry* pAppRegistry = null;
318 String viewStyleKeyName(L"ListDisplayType");
319 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
321 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
323 pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
324 _flagViewAsStatus = listViewDisplayType;
326 SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
328 SetCurrentDirectoryFlag(false);
332 fileType = static_cast< Integer* >(pArgs->GetAt(0));
333 currentType = fileType->ToInt();
334 headerTitleText = static_cast< String* >(pArgs->GetAt(1));
335 if (headerTitleText != null)
337 __currentHeaderText = *headerTitleText;
338 __pHeader->SetTitleText(__currentHeaderText);
343 case FILE_TYPE_IMAGE_TYPE:
345 AppLogDebug("File type is image");
346 __currentFileType = FILE_TYPE_IMAGE_TYPE;
350 case FILE_TYPE_VIDEO_TYPE:
352 __currentFileType = FILE_TYPE_VIDEO_TYPE;
356 case FILE_TYPE_AUDIO_TYPE:
358 __currentFileType = FILE_TYPE_AUDIO_TYPE;
362 case FILE_TYPE_DOCUMENT_TYPE:
364 __currentFileType = FILE_TYPE_DOCUMENT_TYPE;
368 case FILE_TYPE_OTHER_TYPE:
370 __currentFileType = FILE_TYPE_OTHER_TYPE;
379 if (_pFileManager != null)
381 _pFileManager->SetFileManagingListener(this);
386 pArgs->RemoveAll(true);
391 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
393 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_USB_CLIENT, *this);
399 CategorySearch::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
401 if(_pFileEventManager != null)
402 _pFileEventManager->RemovePath(_pathOfSelectedFile);
404 DeviceManager::RemoveAllDeviceEventListeners();
406 if (_pIconListView != null)
408 _pIconListView->RemoveGestureDetector(*_pLongPressGestureDetector);
414 CategorySearch::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId)
416 AppLogDebug("Enter");
417 String mediaPath = BasePresentationModel::GetMediaPath();
418 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
419 CreateItemSource sourceForm = CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM;
420 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
421 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_NONE);
423 if (_pFolderEntryPM != null)
425 _pFolderEntryPM->SetFolderEntryType(__currentFileType);
426 _pFolderEntryPM->SetSourceForm(sourceForm);
427 _pFolderEntryPM->CreateStack();
428 _pFolderEntryPM->CreateTraversalTree();
429 _pFolderEntryPM->SortFolderEntries();
430 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
435 if (_pFilenames != null)
437 if (_pFilenames->GetCount() == 0)
439 _bIsDirectoryEmpty = true;
441 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
445 _bIsDirectoryEmpty = false;
447 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
448 _pLongPressGestureDetector->AddLongPressGestureEventListener(*this);
449 if (_pIconListView != null && _pIconListView->IsVisible())
451 _pIconListView->AddGestureDetector(*_pLongPressGestureDetector);
456 if (_pFolderEntryPM != null)
458 _pFolderEntryPM->InitThumbnailManager();
464 CategorySearch::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)
466 //Empty Implementation
470 CategorySearch::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
472 SceneManager* pSceneManager = SceneManager::GetInstance();
473 result r = E_SUCCESS;
474 r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
478 CategorySearch::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
480 AppLogDebug("ENTER");
482 result r = E_SUCCESS;
487 case IDA_CONTEXT_MENU_HIDE_EXTENSION:
489 //__currentDirectoryPath.Clear();
490 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
496 case IDA_CONTEXT_MENU_SHOW_EXTENSION:
498 //__currentDirectoryPath.Clear();
499 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
507 SubBaseOnActionPerformed(source, actionId);
511 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
514 CategorySearch::GetParentFolderPath(Tizen::Base::String* filePath)
519 StringTokenizer tokenizer(*filePath, delim);
521 while (tokenizer.HasMoreTokens())
523 if (tokenizer.GetTokenCount() != 1)
525 filePath->Append(L"/");
526 tokenizer.GetNextToken(token);
527 filePath->Append(token);
534 filePath->Append(L"/");
537 CategorySearch::GetFileName(Tizen::Base::String* fileName)
542 if (fileName->StartsWith(BasePresentationModel::GetMediaPath(),0))
544 fileName->Replace(BasePresentationModel::GetMediaPath(),"Phone/",0);
546 else if(fileName->StartsWith(BasePresentationModel::GetSdCardPath(),0))
548 fileName->Replace(BasePresentationModel::GetSdCardPath(),"Memory Card/",0);
550 StringTokenizer tokenizer(*fileName, delim);
552 while (tokenizer.HasMoreTokens())
554 if (tokenizer.GetTokenCount() != 1)
556 tokenizer.GetNextToken(token);
560 tokenizer.GetNextToken(token);
561 fileName->Append(token);
567 CategorySearch::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
569 AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured:%S", path.GetPointer());
573 HashMap* pCacheList = null;
574 DirectoryEntry* pCurrentEntry = null;
575 bool cacheKeyStatus = false;
578 AppLogDebug("ContentManager::ScanFile:%S", path.GetPointer());
580 if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
582 _bBackFromAppControl = true;
583 if ( (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM))
585 AppLogDebug("Items to delete: %d", _indexTracker);
586 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
587 if (pCacheList != null)
589 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
591 if (pCurrentEntry != null)
593 cachePath = pCurrentEntry->GetFullFilePath();
595 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
598 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
602 if (_pFolderEntryPM!=null)
604 _pFolderEntryPM->RefreshFolderEntries();
611 CategorySearch::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
613 AppLogDebug("Enter");
614 HashMap* pCacheList = null;
615 DirectoryEntry* pCurrentEntry = null;
616 bool cacheKeyStatus = false;
618 Integer* pFileProcessingResult = null;
619 TryCatch(pArgs != null, , "Argument list received is invalid!");
620 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
622 TryCatch(pFileProcessingResult != null, , "FileProcessing Result list is invalid!");
623 TryCatch(_pFilenames != null, , "_pFilenames is Null.");
625 switch (pFileProcessingResult->ToInt())
627 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
629 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
631 if (pCacheList != null)
633 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
635 if (pCurrentEntry != null)
637 cachePath = pCurrentEntry->GetFullFilePath();
640 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
644 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
647 _pFilenames->RemoveAt(_indexTracker, true);
649 if (_pListView != null)
651 _pListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
653 if (_pIconListView != null && _pIconListView->IsVisible())
655 _pIconListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
658 HideFileProgressingPopup();
662 case FILE_MANAGING_RESULT_DELETING_FAILED:
664 HideFileProgressingPopup();
667 case FILE_MANAGING_RESULT_THREAD_STOP:
669 HideFileProgressingPopup();
679 if (_pFilenames->GetCount() == 0)
681 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
687 pArgs->RemoveAll(true);
694 CategorySearch::SetFooterItemsVisibility(int mode)
696 AppLogDebug("ENTRY mode = %d",mode);
697 _pFooter = GetFooter();
701 _pFooter->SetItemEnabled(0, false);
702 _pFooter->SetItemEnabled(1, false);
703 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
707 _pFooter->SetItemEnabled(0, true);
708 _pFooter->SetItemEnabled(1, true);
709 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
711 _pFooter->Invalidate(true);
714 CategorySearch::OnIconListViewOverlayBitmapSelected (Tizen::Ui::Controls::IconListView &iconListView, int index, int overlayBitmapId)
716 result r = E_SUCCESS;
718 ArrayList* pArgs = null;
721 DirectoryEntry* pCheckedEntry = null;
723 SceneManager* pSceneManager = null;
725 MemoryType currentMemoryType = MEMORY_TYPE_PHONE;
727 pSceneManager = SceneManager::GetInstance();
729 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
730 if (pCheckedEntry == null)
737 pArgs = new (std::nothrow) ArrayList();
741 fullPath = pCheckedEntry->GetFullFilePath();
742 GetParentFolderPath(&fullPath);
743 FolderNavigationPresentationModel::SetCurrentFilePath(fullPath);
745 if (fullPath.StartsWith(BasePresentationModel::GetMediaPath(),0))
747 currentMemoryType = MEMORY_TYPE_PHONE;
748 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
750 else if(fullPath.StartsWith(BasePresentationModel::GetSdCardPath(),0))
752 currentMemoryType = MEMORY_TYPE_SD_CARD;
753 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
756 GetFileName(&fullPath);
757 pArgs->Add(fullPath);
758 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArgs);
764 CategorySearch::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
766 AppLogDebug("ENTER");
767 //If the source of the event is from the RootForm's IconListView, Changes the Scene to the SubFolderFileListForm. Else just refreshes the source IconListView.
769 DirectoryEntry* pDirStr = null;
770 CustomAppControl* pCustomAppControl = null;
772 //Get the directory structure at this index from the filenames arraylist
773 if (_pFilenames != null)
775 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
778 //Get the filename of the specified index if pDirStr not null.
781 _pathOfSelectedFile = pDirStr->GetFullFilePath();
783 if (_pFileEventManager != null)
785 _pFileEventManager->RemovePath(_pathOfSelectedFile);
786 delete _pFileEventManager;
787 _pFileEventManager = null;
791 _pFileEventManager = new (std::nothrow)FileEventManager();
792 _pFileEventManager->Construct(*this);
794 String FileName = pDirStr->GetFileName() + "." + pDirStr->GetFileExtension();
795 String parentDirectoryOfSelectedFile = L"";
796 _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
797 _fileEventPath = parentDirectoryOfSelectedFile;
798 _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
801 pCustomAppControl = CustomAppControl::GetInstance();
803 if (pCustomAppControl != null)
807 pCustomAppControl->SetAppControlListener(null);
809 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
810 if (pAppControlInUse != null)
811 CustomAppControl::SetAppControlInUse(pAppControlInUse);
815 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
820 CategorySearch::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
823 ComponentType currentDeviceType;
828 currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
834 currentDeviceType = COMPONENT_TYPE_USB;
844 OnDeviceChange(currentDeviceType, state);
848 CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state)
850 AppLogDebug("CategorySearch::OnDeviceChange");
851 if (_pFolderEntryPM != null)
853 _pFolderEntryPM->CreateTraversalTree();
854 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
857 if (_pFilenames != null)
859 if (_pFilenames->GetCount() == 0)
861 _bIsDirectoryEmpty = true;
862 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
866 _bIsDirectoryEmpty = false;
867 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
871 if (_pListView != null && _pListView->IsVisible())
873 _pListView->UpdateList();
874 _pListView->Invalidate(true);
877 if (_pIconListView != null && _pIconListView->IsVisible())
879 _pIconListView->UpdateList();
880 _pIconListView->Invalidate(true);
883 if (_pFolderEntryPM != null)
885 _pFolderEntryPM->InitThumbnailManager();
889 CategorySearch::OnAppControlCompleted(void)
891 SubBaseFolderEntryForm::OnAppControlCompleted();