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 DeviceManager::RemoveAllDeviceEventListeners();
402 if (_pFileEventManager != null)
404 _pFileEventManager->RemovePath(_pathOfSelectedFile);
405 delete _pFileEventManager;
406 _pFileEventManager = null;
409 if (_pIconListView != null)
411 _pIconListView->RemoveGestureDetector(*_pLongPressGestureDetector);
417 CategorySearch::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId)
419 AppLogDebug("Enter");
420 String mediaPath = BasePresentationModel::GetMediaPath();
421 SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
422 CreateItemSource sourceForm = CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM;
423 ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
424 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_NONE);
426 if (_pFolderEntryPM != null)
428 _pFolderEntryPM->SetFolderEntryType(__currentFileType);
429 _pFolderEntryPM->SetSourceForm(sourceForm);
430 _pFolderEntryPM->CreateStack();
431 _pFolderEntryPM->CreateTraversalTree();
432 _pFolderEntryPM->SortFolderEntries();
433 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
438 if (_pFilenames != null)
440 if (_pFilenames->GetCount() == 0)
442 _bIsDirectoryEmpty = true;
444 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
448 _bIsDirectoryEmpty = false;
450 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
451 _pLongPressGestureDetector->AddLongPressGestureEventListener(*this);
452 if (_pIconListView != null && _pIconListView->IsVisible())
454 _pIconListView->AddGestureDetector(*_pLongPressGestureDetector);
459 if (_pFolderEntryPM != null)
461 _pFolderEntryPM->InitThumbnailManager();
467 CategorySearch::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)
469 //Empty Implementation
473 CategorySearch::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
475 SceneManager* pSceneManager = SceneManager::GetInstance();
476 result r = E_SUCCESS;
477 r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
481 CategorySearch::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
483 AppLogDebug("ENTER");
485 result r = E_SUCCESS;
490 case IDA_CONTEXT_MENU_HIDE_EXTENSION:
492 //__currentDirectoryPath.Clear();
493 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
499 case IDA_CONTEXT_MENU_SHOW_EXTENSION:
501 //__currentDirectoryPath.Clear();
502 //__currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath();
510 SubBaseOnActionPerformed(source, actionId);
514 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
517 CategorySearch::GetParentFolderPath(Tizen::Base::String* filePath)
522 StringTokenizer tokenizer(*filePath, delim);
524 while (tokenizer.HasMoreTokens())
526 if (tokenizer.GetTokenCount() != 1)
528 filePath->Append(L"/");
529 tokenizer.GetNextToken(token);
530 filePath->Append(token);
537 filePath->Append(L"/");
540 CategorySearch::GetFileName(Tizen::Base::String* fileName)
545 if (fileName->StartsWith(BasePresentationModel::GetMediaPath(),0))
547 fileName->Replace(BasePresentationModel::GetMediaPath(),"Phone/",0);
549 else if(fileName->StartsWith(BasePresentationModel::GetSdCardPath(),0))
551 fileName->Replace(BasePresentationModel::GetSdCardPath(),"Memory Card/",0);
553 StringTokenizer tokenizer(*fileName, delim);
555 while (tokenizer.HasMoreTokens())
557 if (tokenizer.GetTokenCount() != 1)
559 tokenizer.GetNextToken(token);
563 tokenizer.GetNextToken(token);
564 fileName->Append(token);
570 CategorySearch::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
572 AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured:%S", path.GetPointer());
576 HashMap* pCacheList = null;
577 DirectoryEntry* pCurrentEntry = null;
578 bool cacheKeyStatus = false;
581 AppLogDebug("ContentManager::ScanFile:%S", path.GetPointer());
583 if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
585 _bBackFromAppControl = true;
586 if ( (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM))
588 AppLogDebug("Items to delete: %d", _indexTracker);
589 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
590 if (pCacheList != null)
592 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
594 if (pCurrentEntry != null)
596 cachePath = pCurrentEntry->GetFullFilePath();
598 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
601 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
605 if (_pFolderEntryPM!=null)
607 _pFolderEntryPM->RefreshFolderEntries();
614 CategorySearch::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
616 AppLogDebug("Enter");
617 HashMap* pCacheList = null;
618 DirectoryEntry* pCurrentEntry = null;
619 bool cacheKeyStatus = false;
621 Integer* pFileProcessingResult = null;
622 TryCatch(pArgs != null, , "Argument list received is invalid!");
623 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
625 TryCatch(pFileProcessingResult != null, , "FileProcessing Result list is invalid!");
626 TryCatch(_pFilenames != null, , "_pFilenames is Null.");
628 switch (pFileProcessingResult->ToInt())
630 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
632 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
634 if (pCacheList != null)
636 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
638 if (pCurrentEntry != null)
640 cachePath = pCurrentEntry->GetFullFilePath();
643 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
647 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
650 _pFilenames->RemoveAt(_indexTracker, true);
652 if (_pListView != null)
654 _pListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
656 if (_pIconListView != null && _pIconListView->IsVisible())
658 _pIconListView->RefreshList(_indexTracker, LIST_REFRESH_TYPE_ITEM_REMOVE);
661 HideFileProgressingPopup();
665 case FILE_MANAGING_RESULT_DELETING_FAILED:
667 HideFileProgressingPopup();
670 case FILE_MANAGING_RESULT_THREAD_STOP:
672 HideFileProgressingPopup();
682 if (_pFilenames->GetCount() == 0)
684 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
690 pArgs->RemoveAll(true);
697 CategorySearch::SetFooterItemsVisibility(int mode)
699 AppLogDebug("ENTRY mode = %d",mode);
700 _pFooter = GetFooter();
704 _pFooter->SetItemEnabled(0, false);
705 _pFooter->SetItemEnabled(1, false);
706 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
710 _pFooter->SetItemEnabled(0, true);
711 _pFooter->SetItemEnabled(1, true);
712 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
714 _pFooter->Invalidate(true);
717 CategorySearch::OnIconListViewOverlayBitmapSelected (Tizen::Ui::Controls::IconListView &iconListView, int index, int overlayBitmapId)
719 result r = E_SUCCESS;
721 ArrayList* pArgs = null;
724 DirectoryEntry* pCheckedEntry = null;
726 SceneManager* pSceneManager = null;
728 MemoryType currentMemoryType = MEMORY_TYPE_PHONE;
730 pSceneManager = SceneManager::GetInstance();
732 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
733 if (pCheckedEntry == null)
740 pArgs = new (std::nothrow) ArrayList();
744 fullPath = pCheckedEntry->GetFullFilePath();
745 GetParentFolderPath(&fullPath);
746 FolderNavigationPresentationModel::SetCurrentFilePath(fullPath);
748 if (fullPath.StartsWith(BasePresentationModel::GetMediaPath(),0))
750 currentMemoryType = MEMORY_TYPE_PHONE;
751 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
753 else if(fullPath.StartsWith(BasePresentationModel::GetSdCardPath(),0))
755 currentMemoryType = MEMORY_TYPE_SD_CARD;
756 FolderNavigationPresentationModel::SetStorageType(currentMemoryType);
759 GetFileName(&fullPath);
760 pArgs->Add(fullPath);
761 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArgs);
767 CategorySearch::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
769 AppLogDebug("ENTER");
770 //If the source of the event is from the RootForm's IconListView, Changes the Scene to the SubFolderFileListForm. Else just refreshes the source IconListView.
772 DirectoryEntry* pDirStr = null;
773 CustomAppControl* pCustomAppControl = null;
775 //Get the directory structure at this index from the filenames arraylist
776 if (_pFilenames != null)
778 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
781 //Get the filename of the specified index if pDirStr not null.
784 _pathOfSelectedFile = pDirStr->GetFullFilePath();
786 if (_pFileEventManager != null)
788 _pFileEventManager->RemovePath(_pathOfSelectedFile);
789 delete _pFileEventManager;
790 _pFileEventManager = null;
794 _pFileEventManager = new (std::nothrow)FileEventManager();
795 _pFileEventManager->Construct(*this);
797 String FileName = pDirStr->GetFileName() + "." + pDirStr->GetFileExtension();
798 String parentDirectoryOfSelectedFile = L"";
799 _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
800 _fileEventPath = parentDirectoryOfSelectedFile;
801 _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
804 pCustomAppControl = CustomAppControl::GetInstance();
806 if (pCustomAppControl != null)
810 pCustomAppControl->SetAppControlListener(null);
812 AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(_pathOfSelectedFile);
813 if (pAppControlInUse != null)
814 CustomAppControl::SetAppControlInUse(pAppControlInUse);
818 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
823 CategorySearch::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
826 ComponentType currentDeviceType;
831 currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
837 currentDeviceType = COMPONENT_TYPE_USB;
847 OnDeviceChange(currentDeviceType, state);
851 CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state)
853 AppLogDebug("CategorySearch::OnDeviceChange");
854 if (_pFolderEntryPM != null)
856 _pFolderEntryPM->CreateTraversalTree();
857 _pFilenames = _pFolderEntryPM->GetFolderEntryList();
860 if (_pFilenames != null)
862 if (_pFilenames->GetCount() == 0)
864 _bIsDirectoryEmpty = true;
865 SetFooterItemsVisibility(DISABLE_FOOTER_ITEM);
869 _bIsDirectoryEmpty = false;
870 SetFooterItemsVisibility(ENABLE_FOOTER_ITEM);
874 if (_pListView != null && _pListView->IsVisible())
876 _pListView->UpdateList();
877 _pListView->Invalidate(true);
880 if (_pIconListView != null && _pIconListView->IsVisible())
882 _pIconListView->UpdateList();
883 _pIconListView->Invalidate(true);
886 if (_pFolderEntryPM != null)
888 _pFolderEntryPM->InitThumbnailManager();
892 CategorySearch::OnAppControlCompleted(void)
894 SubBaseFolderEntryForm::OnAppControlCompleted();