virtual void OnIconListViewItemStateChangeNotify(void);
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void){}
};
#endif
* @param [ComponentType, String]deviceType, of the storage device, state, the current state of the storage device.
* @return No Return Values.
*/
+ void OnAppControlCompleted(void){}
void OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state);
private:
* @return No Return Values.\r
*/\r
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq) = 0;\r
+ virtual void OnAppControlCompleted(void) = 0;\r
};\r
\r
#endif\r
virtual void OnListViewItemStateChangedNotify(ViewType viewType);\r
\r
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);\r
+ void OnAppControlCompleted(void) ;\r
\r
//IDeviceEventListener\r
virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);\r
bool __bCheckArgsNull;\r
bool __isCurrentDirectoryRenamed;\r
bool __bIsResultList;\r
+ bool __backFromAppControl;\r
int __itemCount;\r
int __searchItemIndex;\r
int __selectedItemIndexForRename;\r
* @return No Return Values.*/
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void){}
// IFileNotificationListener
void OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs);
* @return No Return Values.
*/
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void){}
//IFileEventNotification
void OnFileEventExecuted(const Tizen::Base::String& path, const unsigned long eventId);
void SubBaseOnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status);
void SubBaseOnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs);
void SubBaseOnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void) {}
/*
* A private member function taking and returning no arguments.
* @fn CopyFile
* @return No Return Values.
*/
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void){}
/*! @fn OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
* @brief Called when the state of an element in the ListContextItem is changed.
* @return [FileListPresentationModel*] A pointer to the filelistpresentation model.
*/
void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void){}
//IListViewItemEventListener
/*
* @return [FileListPresentationModel*] A pointer to the filelistpresentation model.\r
*/\r
virtual void OnThumbnailReceived(ThumbRequest* pThumbReq);\r
+ void OnAppControlCompleted(void){}\r
\r
protected:\r
/*\r
virtual FolderEntryPresentationModel* GetFolderEntryPresentationModel(void);
void OnThumbnailReceived(ThumbRequest* pThumbReq);
+ void OnAppControlCompleted(void) {}
private:
/*
ANNEX_STYLE_DETAILED
};
-/*class IListViewStateChangeListener
-{
-public:
- virtual void OnListViewItemStateChangedNotify(ViewType viewType) = 0;
- virtual void OnFooterStateChangeNotify(void) {}
- virtual void OnThumbnailReceived(ThumbRequest* pThumbReq) = 0;
- virtual ~IListViewStateChangeListener(void){}
-};*/
-
//!Enumerator containing the AppControlState
enum AppControlState
{
__pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), dirCount, fileCount);
itemCount = fileCount;
}
- AppLogDebug("Exit");
+ AppLogDebug("Exit % d ", itemCount);
return itemCount;
}
contentType = ContentManagerUtil::CheckContentType(fullFilePath);
if (pFileDetails->GetBitmap() == null && pFileDetails->IstDummy())
{
+ AppLogDebug("Item Index : %d", listItemIndex);
if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))
{
if (pFileDetails != null)
{
AppLogDebug("BITMAP FOUND from cachemanager NO: Index[ %d] Path[%S]", listItemIndex, cacheImagePath.GetPointer());
pFileDetails->SetDummy(true);
+ pFileDetails->SetLoadBitmap(true);
pCustomItem->SetThumbnail(__pDummyImage);
}
}
return;
}
+ _indexTracker = index;
// if (elementId == CONTENT_LIST_ITEM_TYPE_RENAME || elementId == DETAILED_LIST_ELEMENTS_RENAME)
if (status == LIST_ITEM_STATUS_MORE)
{
_pFileEventManager = null;
}
_pathOfSelectedFile = pCheckedEntry->GetFullFilePath();
+ AppLogDebug("Selected File path : %S", _pathOfSelectedFile.GetPointer());
+
_pFileEventManager = new (std::nothrow)FileEventManager();
_pFileEventManager->Construct(*this);
- _pFileEventManager->AddPath(_pathOfSelectedFile, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_DELETE );
+
+ String FileName = pCheckedEntry->GetFileName() + "." + pCheckedEntry->GetFileExtension();
+ String parentDirectoryOfSelectedFile = L"";
+ _pathOfSelectedFile.SubString(0, _pathOfSelectedFile.GetLength() - FileName.GetLength() , parentDirectoryOfSelectedFile);
+
+ _pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_MOVED_FROM);
if (pCustomAppControl != null)
{
void
CategorySearch::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
{
- if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE))
+ /*if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_TO) || (events & FILE_EVENT_TYPE_MOVED_FROM))
{
if (_pFolderEntryPM!=null)
{
{
_pFolderEntryPM->InitThumbnailManager();
}
+ }*/
+
+
+ AppLogDebug("TopMostFolderFileListForm::OnFileEventOccured:%S", path.GetPointer());
+
+ //Scan the directory
+
+ static unsigned short bRotate = 0;
+ HashMap* pCacheList = null;
+ DirectoryEntry* pCurrentEntry = null;
+ bool cacheKeyStatus = false;
+ String cachePath;
+
+ if( !(bRotate ^ 3) )
+ bRotate = 0;
+ AppLogDebug("ContentManager::ScanFile:%S", path.GetPointer());
+
+ if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
+ {
+ if ( (events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_MOVED_TO) )
+ {
+ if ( bRotate & 1)
+ bRotate |= 2;
+ AppLogDebug("Items were rotated afted creation: %d", bRotate);
+ }
+ if ( (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM))
+ {
+ bRotate |= 1;
+ AppLogDebug("Items were rotated after deletion: %d", bRotate);
+
+ AppLogDebug("Items to delete: %d", _indexTracker);
+ pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
+ if (pCacheList != null)
+ {
+ pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(_indexTracker));
+
+ if (pCurrentEntry != null)
+ {
+ cachePath = pCurrentEntry->GetFullFilePath();
+ }
+
+ cacheKeyStatus = pCacheList->ContainsKey(cachePath);
+
+ if (cacheKeyStatus)
+ {
+ CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
+ }
+ }
+ }
+ if (_pFolderEntryPM!=null)
+ {
+ _pFolderEntryPM->RefreshFolderEntries();
+ }
+
+ if (_pListView != null && _pListView->IsVisible())
+ {
+ _pListView->UpdateList();
+ }
+
+ if (_pIconListView != null && _pIconListView->IsVisible())
+ {
+ _pIconListView->UpdateList();
+ }
+
+ if (_pFolderEntryPM!=null)
+ {
+ if (!(bRotate ^ 3) )
+ {
+ {
+ AppLogDebug("Items were rotated : %d", bRotate);
+ //CacheManager::GetInstance()->ClearCache();
+ }
+ }
+ /* AppLogDebug("InitThumbnailManager");
+ _pFolderEntryPM->InitThumbnailManager();*/
+ }
}
+
}
void
{\r
pCurrentFrame->SetEnabled(true);\r
}\r
+\r
+ __pCurrentListToUpdate->OnAppControlCompleted();\r
}\r
\r
void\r
__isSearchStarted = false;
__bCheckArgsNull = false;
__isCurrentDirectoryRenamed = false;
+ __backFromAppControl = false;
__itemCount = -1;
__searchItemIndex = INVALID_LIST_INDEX;
if (pCustomAppControl != null)
{
pCustomAppControl->SetAppControlListener(this);
- __pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );
+ __pFileEventManager->AddPath(parentDirectoryOfSelectedFile, FILE_EVENT_TYPE_CREATE | FILE_EVENT_TYPE_MOVED_FROM | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );
AppControl* pAppControlInUse = pCustomAppControl->LaunchAppControl(__pathOfSelectedFile);
if (pAppControlInUse != null)
CustomAppControl::SetAppControlInUse(pAppControlInUse);
void
SearchForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
{
- if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
+ if ((events & FILE_EVENT_TYPE_CREATE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_FROM) || (events & FILE_EVENT_TYPE_MOVED_TO ))
{
- __pSearchBar->SetMode(__searchBarMode);
-
- if (__searchText.IsEmpty() == false)
- StartSearch();
-
- if (__pListView != null)
- __pListView->UpdateList();
+ __backFromAppControl = true;
}
}
}
}
+void
+SearchForm::OnAppControlCompleted(void)
+{
+ AppLogDebug("OnAppControlCompleted++");
+ if ( __backFromAppControl==true )
+ {
+ __pSearchBar->SetMode(__searchBarMode);
+
+ if (__searchText.IsEmpty() == false)
+ StartSearch();
+
+ if (__pListView != null)
+ __pListView->UpdateList();
+ __backFromAppControl = false;
+ }
+ AppLogDebug("OnAppControlCompleted--");
+}
SubBaseFileManageForm::SetFooterVisibility(int mode)
{
AppLogDebug("ENTRY mode = %d",mode);
- int folderCount = 0, fileCount = 0;
+
_pFooter = GetFooter();
if (mode == DISABLE_FOOTER_ITEM)
-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://floralicense.org/license/\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-/**\r
- * @file: MfSubBaseSelectionForm.cpp\r
- * @brief: This file contains implementation of SubBaseSelection class, which acts as a view for traversing SubDirectories\r
- * in the AppControl.\r
- */\r
-\r
-#include "MfMyFilesApp.h"\r
-#include "MfSceneRegister.h"\r
-#include "MfSubBaseSelectionForm.h"\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::Base::Utility;\r
-using namespace Tizen::Content;\r
-using namespace Tizen::Graphics;\r
-using namespace Tizen::Io;\r
-using namespace Tizen::Locales;\r
-using namespace Tizen::Media;\r
-using namespace Tizen::System;\r
-using namespace Tizen::Ui;\r
-using namespace Tizen::Ui::Controls;\r
-using namespace Tizen::Ui::Scenes;\r
-\r
-SubBaseSelection::SubBaseSelection(void)\r
-: _pFilenames(null)\r
-, _pFooter(null)\r
-, _pAttach(null)\r
-//, _pCancel(null)\r
-, _pCreateFolder(null)\r
-, _pExport(null)\r
-, _pImport(null)\r
-, _pHeader(null)\r
-, _pLabelNumberOfItems(null)\r
-, _pListView(null)\r
-, _pAudioPause(null)\r
-, _pAudioPlay(null)\r
-, _pAudioPlayPressed(null)\r
-, _pDummyImage(null)\r
-, _pFolderBitmap(null)\r
-, _pAudioPlayer(null)\r
-, _pFileManager(null)\r
-, _pFolderEntryPM(null)\r
-, _pThumbnailManager(null)\r
-{\r
- //,_listAnnexStyle(null)\r
- _selectionMode = SELECTION_MODE_MULTIPLE;\r
- _storedSortStyle = SORT_BY_TYPE_DATE_RECENT;\r
- _storePreviousIndex = -1;\r
- _currentViewStyle = APPCONTROL_VIEW_DEFAULT;\r
- _currentExportFileType = EXPORT_TYPE_CONTACTS;\r
- _currentFileType = FILE_TYPE_ALL;\r
- _previousAudioSelected = -1;\r
- _annexStyle = ANNEX_STYLE_NORMAL;\r
- _storageType = MEMORY_TYPE_PHONE;\r
- _currentAudioPlayIndex = -1;\r
- __defaultListViewBounds = Rectangle(0,0,0,0);\r
-}\r
-\r
-SubBaseSelection::~SubBaseSelection(void)\r
-{\r
-/* if (_pCancel != null)\r
- {\r
- delete _pCancel;\r
- }*/\r
-\r
- if (_pAttach != null)\r
- {\r
- delete _pAttach;\r
- }\r
-\r
- if (_pImport != null)\r
- {\r
- delete _pImport;\r
- }\r
-\r
- if (_pExport != null)\r
- {\r
- delete _pExport;\r
- }\r
-\r
- if (_pCreateFolder != null)\r
- {\r
- delete _pCreateFolder;\r
- }\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- delete _pAudioPlayer;\r
- }\r
-\r
- if (_pFolderEntryPM != null)\r
- {\r
- delete _pFolderEntryPM;\r
- }\r
-\r
- if (_pAudioPlay != null)\r
- {\r
- delete _pAudioPlay;\r
- }\r
-\r
- if (_pAudioPause != null)\r
- {\r
- delete _pAudioPause;\r
- }\r
-\r
- if (_pAudioPlayPressed != null)\r
- {\r
- delete _pAudioPlayPressed;\r
- }\r
-\r
- if (_pFolderBitmap != null)\r
- {\r
- delete _pFolderBitmap;\r
- }\r
-\r
- if (_pDummyImage != null)\r
- {\r
- delete _pDummyImage;\r
- }\r
-}\r
-\r
-SubBaseSelection&\r
-SubBaseSelection::operator =(const SubBaseSelection& pSubBaseSelection)\r
-{\r
- return *this;\r
-}\r
-\r
-SubBaseSelection::SubBaseSelection(const SubBaseSelection& pSubBaseSelection)\r
-{\r
- //Do Nothing\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerOpened(result r)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerEndOfClip(void)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerBuffering(int percent)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerErrorOccurred(PlayerErrorReason r)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerInterrupted(void)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerReleased(void)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerSeekCompleted(result r)\r
-{\r
- //empty implementation\r
-}\r
-\r
-Tizen::Ui::Controls::ListItemBase*\r
-SubBaseSelection::CreateItem(int index, int itemWidth)\r
-{\r
- AppLogDebug("Entry");\r
- CustomItem* pCustomItem = null;\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- pCustomItem = CreateExportListViewItem(index, itemWidth);\r
- }\r
- else\r
- {\r
- pCustomItem = CreateDefaultContentItem(index, itemWidth);\r
- }\r
- return pCustomItem;\r
-}\r
-\r
-bool\r
-SubBaseSelection::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)\r
-{\r
- if (pItem != null)\r
- {\r
- delete pItem;\r
- pItem = null;\r
- }\r
-\r
- return true;\r
-}\r
-\r
-int\r
-SubBaseSelection::GetItemCount(void)\r
-{\r
- AppLogDebug("Entry");\r
- int itemCount = 0;\r
-\r
- if (_pFilenames != null)\r
- {\r
- AppResource* pAppResource = null;\r
- String selectFiles;\r
-\r
- pAppResource = Application::GetInstance()->GetAppResource();\r
- TryCatch(pAppResource != null, , "Resource manager not found!");\r
-\r
- pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);\r
-\r
- if (_currentViewStyle == APPCONTROL_VIEW_IMPORT)\r
- {\r
- itemCount = _pFilenames->GetCount();\r
- }\r
-\r
- else\r
- {\r
- if (_pFilenames->GetCount() == 0)\r
- {\r
- if (_pLabelNumberOfItems->GetShowState() == true)\r
- {\r
- _pLabelNumberOfItems->SetShowState(false);\r
- _pLabelNumberOfItems->Draw();\r
-\r
- if (_selectionMode == SELECTION_MODE_MULTIPLE)\r
- {\r
- _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height);\r
- _pListView->Invalidate(true);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if (_pLabelNumberOfItems->GetShowState() == false && _selectionMode != SELECTION_MODE_SINGE && _currentViewStyle == APPCONTROL_VIEW_DEFAULT)\r
- {\r
- _pLabelNumberOfItems->SetShowState(true);\r
- }\r
-\r
- if (_selectionMode == SELECTION_MODE_MULTIPLE)\r
- {\r
- _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height - _pLabelNumberOfItems->GetHeight());\r
- _pListView->Invalidate(true);\r
- }\r
- _itemSelectedCount.Clear();\r
- _itemSelectedCount.Append(selectFiles);\r
- _pLabelNumberOfItems->SetText(_itemSelectedCount);\r
- _pLabelNumberOfItems->Invalidate(true);\r
- }\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- itemCount = _pFilenames->GetCount();\r
- }\r
- else\r
- {\r
- itemCount = 0;\r
- }\r
- return itemCount;\r
- CATCH:\r
- AppLogDebug("Failed to get count");\r
- return 0;\r
-}\r
-\r
-ContentListItem*\r
-SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- Font font;\r
- String filename;\r
- String folderIconPath;\r
- String fontName;\r
- String searchedString;\r
- String cacheImagePath;\r
-\r
- PlayerState audioPlayerStatus;\r
- ContentType contentType = CONTENT_TYPE_UNKNOWN;\r
-\r
- ContentListItem* pCustomItem = null;\r
- Bitmap* pFetchedCacheImage = null;\r
- Bitmap* pThumbnailImage = null;\r
- HashMap* pCacheList = null;\r
-\r
- Dimension thumbnailDimension(W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP);\r
- Dimension textDimension(itemWidth - W_LISTVIEW_ITEM_BITMAP, H_ITEM_LISTVIEW);\r
- AppResource* pAppResource = null;\r
- DirectoryEntry* pFileDetails = null;\r
-\r
- int w_Title = 0;\r
-\r
- w_Title = itemWidth - ((W_LISTVIEW_ITEM_BITMAP * 4) + (4 * X_LISTVIEW));\r
- TryCatch(_pFilenames != null, , "Filename list if empty!");\r
-\r
- pAppResource = Application::GetInstance()->GetAppResource();\r
- TryCatch(pAppResource != null, , "Resource manager not found!");\r
-\r
- pCustomItem = new (std::nothrow) ContentListItem(itemWidth, H_ITEM_LISTVIEW);\r
- TryCatch(pCustomItem != null, , "Failed to alloated customitem");\r
-\r
- pFileDetails = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));\r
- if (pFileDetails != null)\r
- {\r
- filename = pFileDetails->GetFileName();\r
-\r
- contentType = ContentManagerUtil::CheckContentType(pFileDetails->GetFullFilePath());\r
- pCacheList = CacheManager::GetInstance()->GetCacheHashMap();\r
- if (_pThumbnailManager != null)\r
- {\r
- if (pFileDetails->IsDirectory())\r
- {\r
- pCustomItem->SetThumbnail(_pFolderBitmap);\r
- _annexStyle = ANNEX_STYLE_NORMAL;\r
- pCustomItem->SetListAnnexStyle(_annexStyle);\r
- }\r
- else\r
- {\r
- if (pFileDetails->GetBitmap() == null)\r
- {\r
- if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))\r
- {\r
- if (pFileDetails != null)\r
- {\r
- cacheImagePath = pFileDetails->GetFullFilePath();\r
- AppLogDebug("cache path is %S",cacheImagePath.GetPointer());\r
- }\r
-\r
- if ((pCacheList->GetValue(cacheImagePath)) != null)\r
- {\r
- pFetchedCacheImage = static_cast< Bitmap* >(pCacheList->GetValue(cacheImagePath));\r
- }\r
- }\r
-\r
- if (pFetchedCacheImage != null)\r
- {\r
- AppLogDebug("image taken from cachemanager");\r
- pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath);\r
- pCustomItem->SetThumbnail(pThumbnailImage);\r
- }\r
- else\r
- {\r
- pFileDetails->SetDummy(true);\r
- pCustomItem->SetThumbnail(_pDummyImage);\r
- AppLogDebug("call to thumbnail manager");\r
- }\r
-\r
- //r = _pFolderEntryPM->InitThumbnailManager(index);\r
- }\r
- else\r
- {\r
- pCustomItem->SetThumbnail(pFileDetails->GetBitmap());\r
- }\r
-\r
- if (_selectionMode == SELECTION_MODE_SINGE)\r
- {\r
- _annexStyle = ANNEX_STYLE_RADIO;\r
- pCustomItem->SetListAnnexStyle(_annexStyle);\r
- }\r
- else if (_selectionMode == SELECTION_MODE_MULTIPLE)\r
- {\r
- _annexStyle = ANNEX_STYLE_MARK;\r
- pCustomItem->SetListAnnexStyle(_annexStyle);\r
- }\r
- else if (_selectionMode == SELECTION_MODE_NONE)\r
- {\r
- _annexStyle = ANNEX_STYLE_NORMAL;\r
- pCustomItem->SetListAnnexStyle(_annexStyle);\r
- }\r
-\r
- if (contentType == CONTENT_TYPE_AUDIO)\r
- {\r
- if (_pAudioPlayer != null)\r
- {\r
- audioPlayerStatus = _pAudioPlayer->GetState();\r
-\r
- if (audioPlayerStatus == PLAYER_STATE_CLOSED)\r
- {\r
- pCustomItem->SetAudioBitmap(_pAudioPlay, null);\r
- }\r
-\r
- if (_currentAudioPlayIndex == index)\r
- {\r
- if (audioPlayerStatus == PLAYER_STATE_PLAYING)\r
- {\r
- pCustomItem->SetAudioBitmap(null, _pAudioPause);\r
- }\r
- //else if (audioPlayerStatus == PLAYER_STATE_PAUSED || audioPlayerStatus == PLAYER_STATE_ENDOFCLIP)\r
- else\r
- {\r
- pCustomItem->SetAudioBitmap(_pAudioPlay, null);\r
- }\r
- }\r
- else\r
- {\r
- pCustomItem->SetAudioBitmap(_pAudioPlay, null);\r
- }\r
- }\r
- else\r
- {\r
- pCustomItem->SetAudioBitmap(_pAudioPlay, null);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (!filename.IsEmpty())\r
- {\r
- pCustomItem->SetTitle(filename, searchedString);\r
- }\r
- pCustomItem->MakeAppControlFormListItem();\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(r));\r
-\r
- return pCustomItem;\r
-\r
- CATCH:\r
- //Free EnrichedText\r
- if (_pAudioPlay != null)\r
- {\r
- delete _pAudioPlay;\r
- _pAudioPlay = null;\r
- }\r
-\r
- if (_pAudioPause != null)\r
- {\r
- delete _pAudioPause;\r
- _pAudioPause = null;\r
- }\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- return null;\r
-}\r
-\r
-void\r
-SubBaseSelection::OnThumbnailReceived(ThumbRequest* pThumbReq)\r
-{\r
- result res = E_SUCCESS;\r
- AppLogDebug("Enter");\r
-\r
- if (_pFolderEntryPM)\r
- {\r
- if (pThumbReq != null)\r
- {\r
- if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())\r
- {\r
- if (pThumbReq->pBitmap != null)\r
- {\r
- AppLogDebug("This Bitmap is not requested from same form");\r
- delete pThumbReq->pBitmap;\r
- }\r
- return;\r
- }\r
- }\r
-\r
- if (pThumbReq)\r
- {\r
- if (pThumbReq->iRquestId < _pFilenames->GetCount())\r
- {\r
-\r
- _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);\r
-\r
- if (_pListView && _pListView->IsVisible())\r
- {\r
- res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- _pFolderEntryPM->OnThumbnailResponseFailed();\r
- }\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(res));\r
- return;\r
-}\r
-\r
-void\r
-SubBaseSelection::OnListViewItemStateChangedNotify(ViewType viewType)\r
-{\r
- //empty Implementation\r
-}\r
-\r
-void\r
-SubBaseSelection::InitializePlayer(void)\r
-{\r
- _pAudioPlayer = new (std::nothrow) Player();\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- _pAudioPlayer->Construct(*this);\r
- }\r
-}\r
-\r
-void\r
-SubBaseSelection::LoadMusicPlayer(const Tizen::Base::String& mediaFilepath, Tizen::Media::PlayerState PlayerCurrentState)\r
-{\r
- result r = E_SUCCESS;\r
- if (_pAudioPlayer != null && mediaFilepath.IsEmpty() == false)\r
- {\r
- if (_pAudioPlayer->GetState() != PLAYER_STATE_PAUSED)\r
- {\r
- if (_pAudioPlayer != null)\r
- {\r
- delete _pAudioPlayer;\r
- _pAudioPlayer = null;\r
- }\r
- _pAudioPlayer = new (std::nothrow) Player();\r
- _pAudioPlayer->Construct(*this);\r
- }\r
-\r
- r = _pAudioPlayer->OpenFile(mediaFilepath, false);\r
- r = _pAudioPlayer->Play();\r
- r = _pAudioPlayer->SetLooping(false);\r
- r = _pAudioPlayer->SetVolume(100);\r
- }\r
- AppLogDebug("Exit: %s", GetErrorMessage(r));\r
-}\r
-\r
-result\r
-SubBaseSelection::InitializeAppRegistry(void)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- int previousSortValue = 0;\r
- AppRegistry* pAppRegistry = null;\r
- String sortbyKeyName(L"SortBy");\r
- SortByType sortStyle = SORT_BY_TYPE_DATE_RECENT;\r
-\r
- pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();\r
-\r
- r = pAppRegistry->Add(sortbyKeyName, sortStyle);\r
-\r
- if (r == E_SUCCESS)\r
- {\r
- r = pAppRegistry->Save();\r
- }\r
- else if (r == E_KEY_ALREADY_EXIST)\r
- {\r
- pAppRegistry->Get(sortbyKeyName, previousSortValue);\r
- _storedSortStyle = static_cast< SortByType >(previousSortValue);\r
- if (_storedSortStyle != null)\r
- {\r
- pAppRegistry->Set(sortbyKeyName, sortStyle);\r
- r = pAppRegistry->Save();\r
- }\r
- }\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(r));\r
- return r;\r
-}\r
-\r
-result\r
-SubBaseSelection::CreateLabelControl(void)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- Color backgroundColor(68, 68, 68);\r
- //Color textColor(Color(76, 81, 88));\r
-\r
- _pLabelNumberOfItems = static_cast< Label* >(GetControl(L"IDC_LABEL_SELECTED"));\r
- TryCatch(_pLabelNumberOfItems != null, , "applog: allocation failed for __pLabelNumberOfItems");\r
-\r
-// _pLabelNumberOfItems->Construct(Rectangle(0, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL), _itemSelectedCount);\r
-// _pLabelNumberOfItems->SetBackgroundColor(backgroundColor);\r
-// _pLabelNumberOfItems->SetTextColor(Color::GetColor(COLOR_ID_WHITE));\r
- _pLabelNumberOfItems->SetTextHorizontalAlignment(ALIGNMENT_CENTER);\r
-// _pLabelNumberOfItems->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);\r
- _pLabelNumberOfItems->SetTextConfig(ID_FONT_SIZE_26, LABEL_TEXT_STYLE_BOLD);\r
-\r
- if (_selectionMode == SELECTION_MODE_SINGE)\r
- {\r
- _pLabelNumberOfItems->SetShowState(false);\r
- }\r
- else\r
- {\r
- if (_currentViewStyle != APPCONTROL_VIEW_IMPORT)\r
- {\r
- _pLabelNumberOfItems->SetShowState(true);\r
- }\r
- }\r
-\r
-// r = AddControl(*_pLabelNumberOfItems);\r
- AppLogDebug("Exit %s", GetErrorMessage(r));\r
- return r;\r
- CATCH:\r
- AppLogDebug("Exit %s", GetErrorMessage(r));\r
- r = GetLastResult();\r
- return r;\r
-}\r
-\r
-\r
-void\r
-SubBaseSelection::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)\r
-{\r
- AppLogDebug("Entry");\r
- String mediaPath;\r
- String storagePath;\r
-\r
- switch (actionId)\r
- {\r
- case IDA_BTN_ATTACH:\r
- {\r
- UiApp* pApp = UiApp::GetInstance();\r
- ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();\r
- ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);\r
-\r
- if (pApp != null)\r
- {\r
- pApp->Terminate();\r
- }\r
- }\r
- break;\r
-/*\r
- case IDA_BTN_CANCEL:\r
- {\r
-\r
- }\r
- break;*/\r
-\r
- case IDA_BTN_IMPORT:\r
- {\r
- UiApp* pApp = UiApp::GetInstance();\r
-\r
- ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();\r
- ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);\r
-\r
- if (pApp != null)\r
- {\r
- pApp->Terminate();\r
- }\r
- }\r
- break;\r
-\r
- case IDA_BTN_EXPORT:\r
- {\r
- UiApp* pApp = UiApp::GetInstance();\r
-\r
- ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();\r
- ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);\r
-\r
- if (pApp != null)\r
- {\r
- pApp->Terminate();\r
- }\r
- }\r
- break;\r
-\r
- case IDA_BTN_CREATE_FOLDER:\r
- {\r
- ArrayList* pArg = null;\r
- Integer* pSourceSelected = null;\r
- SceneManager* pSceneManager = null;\r
-\r
- pSceneManager = SceneManager::GetInstance();\r
-\r
- pArg = new (std::nothrow) ArrayList();\r
- pArg->Construct();\r
- pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);\r
- pArg->Add(pSourceSelected);\r
-\r
- _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- pArg->Add(&_rootMediaPath);\r
-\r
- if (pSceneManager != null)\r
- {\r
- pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);\r
- }\r
- }\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
-}\r
-\r
-void\r
-SubBaseSelection::ClearSelectedItems(Tizen::Ui::Controls::ListView& listView)\r
-{\r
- ArrayList* pCheckedKeys = null;\r
- int itemCount = 0;\r
- if (_pFileManager != null)\r
- {\r
- pCheckedKeys = static_cast< ArrayList* >(_pFileManager->GetCheckedList()->GetKeysN());\r
- AppLogDebug("Get count is %d",pCheckedKeys->GetCount());\r
- for (itemCount=0; itemCount<pCheckedKeys->GetCount();itemCount++)\r
- {\r
- Integer* currentIndex = static_cast<Integer*>(pCheckedKeys->GetAt(itemCount));\r
- listView.SetItemChecked(currentIndex->ToInt(), false);\r
- }\r
- _pFileManager->ClearCheckedList();\r
- }\r
-}\r
-\r
-void\r
-SubBaseSelection::ResetFooter(void)\r
-{\r
- AppResource* pAppResource = null;\r
- String selectFiles;\r
-\r
- pAppResource = Application::GetInstance()->GetAppResource();\r
- pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);\r
-\r
- if (_pListView != null)\r
- {\r
- ClearSelectedItems(*_pListView);\r
- _pFooter->SetItemEnabled(0,false);\r
- _pFooter->Invalidate(true);\r
- _itemSelectedCount.Clear();\r
- _itemSelectedCount.Append(selectFiles);\r
- _pLabelNumberOfItems->SetText(_itemSelectedCount);\r
- _pLabelNumberOfItems->Invalidate(true);\r
- }\r
-}\r
-\r
-void\r
-SubBaseSelection::OnPlayerAudioFocusChanged (void)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-SubBaseSelection::OnFormBackRequested(Form& source)\r
-{\r
- String currentPath;\r
- String parentPath;\r
- result r = E_SUCCESS;\r
- SceneManager* pSceneManager = null;\r
- pSceneManager = SceneManager::GetInstance();\r
- currentPath = FolderNavigationPresentationModel::GetCurrentPath();\r
-\r
- if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)\r
- {\r
- ResetFooter();\r
- }\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING)\r
- {\r
- _pAudioPlayer->Stop();\r
- }\r
- }\r
- if (currentPath == BasePresentationModel::GetMediaPath() || currentPath == BasePresentationModel::GetSdCardPath())\r
- {\r
- FolderNavigationPresentationModel::SetCurrentFilePath(currentPath);\r
- ShowHomeView();\r
- }\r
- else\r
- {\r
- parentPath = FolderNavigationPresentationModel::GetParentPath();\r
-\r
- FolderNavigationPresentationModel::SetCurrentFilePath(parentPath);\r
- r = pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);\r
- }\r
-}\r
-\r
-void\r
-SubBaseSelection::ShowHomeView(void)\r
-{\r
- SceneManager* pSceneManager = null;\r
- String topMostFileSelection(L"ScnTempForm");\r
- pSceneManager = SceneManager::GetInstance();\r
- if (pSceneManager != null)\r
- {\r
- IList* pArgs = new (std::nothrow) ArrayList();\r
- pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED));\r
- if (pSceneManager->IsSceneAlive(topMostFileSelection))\r
- {\r
- pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs);\r
- }\r
- else\r
- {\r
- pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), pArgs);\r
- }\r
- }\r
-}\r
-\r
-ContentListItem*\r
-SubBaseSelection::CreateExportListViewItem(int listItemIndex, int listItemWidth)\r
-{\r
- AppLogDebug("ENTER");\r
-\r
- Font font;\r
-\r
- String filename;\r
- String folderIconPath;\r
- String imageIconPath;\r
- String fontName;\r
- String searchedText;\r
- String fileExtension;\r
- String creationDate;\r
- String searchedString;\r
- String selectAll;\r
- String fullFilePath;\r
- String cacheImagePath;\r
-\r
- HashMap* pCacheList = null;\r
- Bitmap* pFetchedCacheImage = null;\r
- Bitmap* pThumbnailImage = null;\r
-\r
- DateTime dateCreated;\r
- Dimension thumbnailDimension(H_LISTVIEW_ITEM_BITMAP, W_LISTVIEW_ITEM_BITMAP);\r
- Dimension textDimension(listItemWidth - W_LISTVIEW_ITEM_BITMAP, H_ITEM_LISTVIEW);\r
-\r
- DirectoryEntry* pFileDetails = null;\r
-\r
- ContentListItem* pCustomItem = null;\r
- ContentType contentType = CONTENT_TYPE_UNKNOWN;\r
-\r
- //AppRegistry* pAppRegistry = null;\r
- //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();\r
-\r
- TryCatch(_pFilenames != null, , "MfMyFilesApp::Filename list if empty!");\r
- TryCatch(_pFilenames->GetCount() != 0, , "MfMyFilesApp::Filename count is Zero!");\r
-\r
- pCustomItem = new (std::nothrow) ContentListItem(listItemWidth, H_ITEM_LISTVIEW);\r
- TryCatch(pCustomItem != null, , "MfMyFilesApp::Failed to allocate Memory to pCustomItem");\r
-\r
- //Get the Directory Entry for the element at index from the Filenames list.\r
-\r
- pFileDetails = static_cast< DirectoryEntry* >(_pFilenames->GetAt(listItemIndex));\r
- TryCatch(pFileDetails != null, , "MfMyFilesApp::Failed to fetch FileDetails from __pFileNames!");\r
-\r
- pCacheList = CacheManager::GetInstance()->GetCacheHashMap();\r
-\r
- //Set the filename of the element at index index\r
- filename = pFileDetails->GetFileName();\r
- fullFilePath = pFileDetails->GetFullFilePath();\r
-\r
- //If the registry key value is set for show extension append the extension of the filename else do not.\r
-\r
- if (!pFileDetails->GetFileExtension().IsEmpty())\r
- {\r
- filename = filename + "." + pFileDetails->GetFileExtension();\r
- }\r
-\r
-\r
- if (pFileDetails->IsDirectory())\r
- {\r
- pCustomItem->SetThumbnail(_pFolderBitmap);\r
- }\r
- else\r
- {\r
- pCustomItem->SetDescColor(Color::GetColor(COLOR_ID_GREY));\r
-\r
- contentType = ContentManagerUtil::CheckContentType(fullFilePath);\r
-\r
- if (pFileDetails->GetBitmap() == null && pFileDetails->IstDummy())\r
- {\r
- if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))\r
- {\r
- if (pFileDetails != null)\r
- {\r
- cacheImagePath = pFileDetails->GetFullFilePath();\r
- AppLogDebug("cache path is %S",cacheImagePath.GetPointer());\r
- }\r
-\r
- if ((pCacheList->GetValue(cacheImagePath)) != null)\r
- {\r
- pFetchedCacheImage = static_cast< Bitmap* >(pCacheList->GetValue(cacheImagePath));\r
- }\r
- }\r
-\r
- if (pFetchedCacheImage != null)\r
- {\r
- AppLogDebug("image taken from cachemanager");\r
- pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath);\r
- pCustomItem->SetThumbnail(pThumbnailImage);\r
- }\r
- else\r
- {\r
- pFileDetails->SetDummy(true);\r
- pCustomItem->SetThumbnail(_pDummyImage);\r
- AppLogDebug("call to thumbnail manager");\r
- }\r
- }\r
- else\r
- {\r
- AppLogDebug("BITMAP FOUND : NOT NEED TO DO GETTHUMBNAIL");\r
- pCustomItem->SetThumbnail(pFileDetails->GetBitmap());\r
- }\r
- }\r
-\r
- pCustomItem->SetTitle(filename, searchedText);\r
-\r
- pCustomItem->Make();\r
-\r
- AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));\r
-\r
- return pCustomItem;\r
-\r
-CATCH:\r
- if (pCustomItem != null)\r
- {\r
- delete pCustomItem;\r
- pCustomItem = null;\r
- }\r
- return null;\r
-}\r
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file: MfSubBaseSelectionForm.cpp
+ * @brief: This file contains implementation of SubBaseSelection class, which acts as a view for traversing SubDirectories
+ * in the AppControl.
+ */
+
+#include "MfMyFilesApp.h"
+#include "MfSceneRegister.h"
+#include "MfSubBaseSelectionForm.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Content;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Locales;
+using namespace Tizen::Media;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+SubBaseSelection::SubBaseSelection(void)
+: _pFilenames(null)
+, _pFooter(null)
+, _pAttach(null)
+//, _pCancel(null)
+, _pCreateFolder(null)
+, _pExport(null)
+, _pImport(null)
+, _pHeader(null)
+, _pLabelNumberOfItems(null)
+, _pListView(null)
+, _pAudioPause(null)
+, _pAudioPlay(null)
+, _pAudioPlayPressed(null)
+, _pDummyImage(null)
+, _pFolderBitmap(null)
+, _pAudioPlayer(null)
+, _pFileManager(null)
+, _pFolderEntryPM(null)
+, _pThumbnailManager(null)
+{
+ //,_listAnnexStyle(null)
+ _selectionMode = SELECTION_MODE_MULTIPLE;
+ _storedSortStyle = SORT_BY_TYPE_DATE_RECENT;
+ _storePreviousIndex = -1;
+ _currentViewStyle = APPCONTROL_VIEW_DEFAULT;
+ _currentExportFileType = EXPORT_TYPE_CONTACTS;
+ _currentFileType = FILE_TYPE_ALL;
+ _previousAudioSelected = -1;
+ _annexStyle = ANNEX_STYLE_NORMAL;
+ _storageType = MEMORY_TYPE_PHONE;
+ _currentAudioPlayIndex = -1;
+ __defaultListViewBounds = Rectangle(0,0,0,0);
+}
+
+SubBaseSelection::~SubBaseSelection(void)
+{
+/* if (_pCancel != null)
+ {
+ delete _pCancel;
+ }*/
+
+ if (_pAttach != null)
+ {
+ delete _pAttach;
+ }
+
+ if (_pImport != null)
+ {
+ delete _pImport;
+ }
+
+ if (_pExport != null)
+ {
+ delete _pExport;
+ }
+
+ if (_pCreateFolder != null)
+ {
+ delete _pCreateFolder;
+ }
+
+ if (_pAudioPlayer != null)
+ {
+ delete _pAudioPlayer;
+ }
+
+ if (_pFolderEntryPM != null)
+ {
+ delete _pFolderEntryPM;
+ }
+
+ if (_pAudioPlay != null)
+ {
+ delete _pAudioPlay;
+ }
+
+ if (_pAudioPause != null)
+ {
+ delete _pAudioPause;
+ }
+
+ if (_pAudioPlayPressed != null)
+ {
+ delete _pAudioPlayPressed;
+ }
+
+ if (_pFolderBitmap != null)
+ {
+ delete _pFolderBitmap;
+ }
+
+ if (_pDummyImage != null)
+ {
+ delete _pDummyImage;
+ }
+}
+
+SubBaseSelection&
+SubBaseSelection::operator =(const SubBaseSelection& pSubBaseSelection)
+{
+ return *this;
+}
+
+SubBaseSelection::SubBaseSelection(const SubBaseSelection& pSubBaseSelection)
+{
+ //Do Nothing
+}
+
+void
+SubBaseSelection::OnPlayerOpened(result r)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerEndOfClip(void)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerBuffering(int percent)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerErrorOccurred(PlayerErrorReason r)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerInterrupted(void)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerReleased(void)
+{
+ //empty implementation
+}
+
+void
+SubBaseSelection::OnPlayerSeekCompleted(result r)
+{
+ //empty implementation
+}
+
+Tizen::Ui::Controls::ListItemBase*
+SubBaseSelection::CreateItem(int index, int itemWidth)
+{
+ AppLogDebug("Entry");
+ CustomItem* pCustomItem = null;
+ if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)
+ {
+ pCustomItem = CreateExportListViewItem(index, itemWidth);
+ }
+ else
+ {
+ pCustomItem = CreateDefaultContentItem(index, itemWidth);
+ }
+ return pCustomItem;
+}
+
+bool
+SubBaseSelection::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+ if (pItem != null)
+ {
+ delete pItem;
+ pItem = null;
+ }
+
+ return true;
+}
+
+int
+SubBaseSelection::GetItemCount(void)
+{
+ AppLogDebug("Entry");
+ int itemCount = 0;
+
+ if (_pFilenames != null)
+ {
+ AppResource* pAppResource = null;
+ String selectFiles;
+
+ pAppResource = Application::GetInstance()->GetAppResource();
+ TryCatch(pAppResource != null, , "Resource manager not found!");
+
+ pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);
+
+ if (_currentViewStyle == APPCONTROL_VIEW_IMPORT)
+ {
+ itemCount = _pFilenames->GetCount();
+ }
+
+ else
+ {
+ if (_pFilenames->GetCount() == 0)
+ {
+ if (_pLabelNumberOfItems->GetShowState() == true)
+ {
+ _pLabelNumberOfItems->SetShowState(false);
+ _pLabelNumberOfItems->Draw();
+
+ if (_selectionMode == SELECTION_MODE_MULTIPLE)
+ {
+ _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height);
+ _pListView->Invalidate(true);
+ }
+ }
+ }
+ else
+ {
+ if (_pLabelNumberOfItems->GetShowState() == false && _selectionMode != SELECTION_MODE_SINGE && _currentViewStyle == APPCONTROL_VIEW_DEFAULT)
+ {
+ _pLabelNumberOfItems->SetShowState(true);
+ }
+
+ if (_selectionMode == SELECTION_MODE_MULTIPLE)
+ {
+ _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height - _pLabelNumberOfItems->GetHeight());
+ _pListView->Invalidate(true);
+ }
+ _itemSelectedCount.Clear();
+ _itemSelectedCount.Append(selectFiles);
+ _pLabelNumberOfItems->SetText(_itemSelectedCount);
+ _pLabelNumberOfItems->Invalidate(true);
+ }
+ }
+ AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
+ itemCount = _pFilenames->GetCount();
+ }
+ else
+ {
+ itemCount = 0;
+ }
+ return itemCount;
+ CATCH:
+ AppLogDebug("Failed to get count");
+ return 0;
+}
+
+ContentListItem*
+SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth)
+{
+ AppLogDebug("Entry");
+ result r = E_SUCCESS;
+ Font font;
+ String filename;
+ String folderIconPath;
+ String fontName;
+ String searchedString;
+ String cacheImagePath;
+
+ PlayerState audioPlayerStatus;
+ ContentType contentType = CONTENT_TYPE_UNKNOWN;
+
+ ContentListItem* pCustomItem = null;
+ Bitmap* pFetchedCacheImage = null;
+ Bitmap* pThumbnailImage = null;
+ HashMap* pCacheList = null;
+
+ Dimension thumbnailDimension(W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP);
+ Dimension textDimension(itemWidth - W_LISTVIEW_ITEM_BITMAP, H_ITEM_LISTVIEW);
+ AppResource* pAppResource = null;
+ DirectoryEntry* pFileDetails = null;
+
+ int w_Title = 0;
+
+ w_Title = itemWidth - ((W_LISTVIEW_ITEM_BITMAP * 4) + (4 * X_LISTVIEW));
+ TryCatch(_pFilenames != null, , "Filename list if empty!");
+
+ pAppResource = Application::GetInstance()->GetAppResource();
+ TryCatch(pAppResource != null, , "Resource manager not found!");
+
+ pCustomItem = new (std::nothrow) ContentListItem(itemWidth, H_ITEM_LISTVIEW);
+ TryCatch(pCustomItem != null, , "Failed to alloated customitem");
+
+ pFileDetails = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
+ if (pFileDetails != null)
+ {
+ filename = pFileDetails->GetFileName();
+
+ contentType = ContentManagerUtil::CheckContentType(pFileDetails->GetFullFilePath());
+ pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
+ if (_pThumbnailManager != null)
+ {
+ if (pFileDetails->IsDirectory())
+ {
+ pCustomItem->SetThumbnail(_pFolderBitmap);
+ _annexStyle = ANNEX_STYLE_NORMAL;
+ pCustomItem->SetListAnnexStyle(_annexStyle);
+ }
+ else
+ {
+ if (pFileDetails->GetBitmap() == null)
+ {
+ if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))
+ {
+ if (pFileDetails != null)
+ {
+ cacheImagePath = pFileDetails->GetFullFilePath();
+ AppLogDebug("cache path is %S",cacheImagePath.GetPointer());
+ }
+
+ if ((pCacheList->GetValue(cacheImagePath)) != null)
+ {
+ pFetchedCacheImage = static_cast< Bitmap* >(pCacheList->GetValue(cacheImagePath));
+ }
+ }
+
+ if (pFetchedCacheImage != null)
+ {
+ AppLogDebug("image taken from cachemanager");
+ pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath);
+ pCustomItem->SetThumbnail(pThumbnailImage);
+ }
+ else
+ {
+ pFileDetails->SetDummy(true);
+ pCustomItem->SetThumbnail(_pDummyImage);
+ AppLogDebug("call to thumbnail manager");
+ }
+
+ //r = _pFolderEntryPM->InitThumbnailManager(index);
+ }
+ else
+ {
+ pCustomItem->SetThumbnail(pFileDetails->GetBitmap());
+ }
+
+ if (_selectionMode == SELECTION_MODE_SINGE)
+ {
+ _annexStyle = ANNEX_STYLE_RADIO;
+ pCustomItem->SetListAnnexStyle(_annexStyle);
+ }
+ else if (_selectionMode == SELECTION_MODE_MULTIPLE)
+ {
+ _annexStyle = ANNEX_STYLE_MARK;
+ pCustomItem->SetListAnnexStyle(_annexStyle);
+ }
+ else if (_selectionMode == SELECTION_MODE_NONE)
+ {
+ _annexStyle = ANNEX_STYLE_NORMAL;
+ pCustomItem->SetListAnnexStyle(_annexStyle);
+ }
+
+ if (contentType == CONTENT_TYPE_AUDIO)
+ {
+ if (_pAudioPlayer != null)
+ {
+ audioPlayerStatus = _pAudioPlayer->GetState();
+
+ if (audioPlayerStatus == PLAYER_STATE_CLOSED)
+ {
+ pCustomItem->SetAudioBitmap(_pAudioPlay, null);
+ }
+
+ if (_currentAudioPlayIndex == index)
+ {
+ if (audioPlayerStatus == PLAYER_STATE_PLAYING)
+ {
+ pCustomItem->SetAudioBitmap(null, _pAudioPause);
+ }
+ //else if (audioPlayerStatus == PLAYER_STATE_PAUSED || audioPlayerStatus == PLAYER_STATE_ENDOFCLIP)
+ else
+ {
+ pCustomItem->SetAudioBitmap(_pAudioPlay, null);
+ }
+ }
+ else
+ {
+ pCustomItem->SetAudioBitmap(_pAudioPlay, null);
+ }
+ }
+ else
+ {
+ pCustomItem->SetAudioBitmap(_pAudioPlay, null);
+ }
+ }
+ }
+ }
+ }
+
+ if (!filename.IsEmpty())
+ {
+ pCustomItem->SetTitle(filename, searchedString);
+ }
+ pCustomItem->MakeAppControlFormListItem();
+
+ AppLogDebug("Exit %s", GetErrorMessage(r));
+
+ return pCustomItem;
+
+ CATCH:
+ //Free EnrichedText
+ if (_pAudioPlay != null)
+ {
+ delete _pAudioPlay;
+ _pAudioPlay = null;
+ }
+
+ if (_pAudioPause != null)
+ {
+ delete _pAudioPause;
+ _pAudioPause = null;
+ }
+
+ AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
+ return null;
+}
+
+void
+SubBaseSelection::OnThumbnailReceived(ThumbRequest* pThumbReq)
+{
+ result res = E_SUCCESS;
+ AppLogDebug("Enter");
+
+ if (_pFolderEntryPM)
+ {
+ if (pThumbReq != null)
+ {
+ if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
+ {
+ if (pThumbReq->pBitmap != null)
+ {
+ AppLogDebug("This Bitmap is not requested from same form");
+ delete pThumbReq->pBitmap;
+ }
+ return;
+ }
+ }
+
+ if (pThumbReq)
+ {
+ if (pThumbReq->iRquestId < _pFilenames->GetCount())
+ {
+
+ _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
+
+ if (_pListView && _pListView->IsVisible())
+ {
+ res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
+ }
+ }
+ }
+ else
+ {
+ _pFolderEntryPM->OnThumbnailResponseFailed();
+ }
+ }
+ AppLogDebug("Exit %s", GetErrorMessage(res));
+ return;
+}
+
+void
+SubBaseSelection::OnListViewItemStateChangedNotify(ViewType viewType)
+{
+ //empty Implementation
+}
+
+void
+SubBaseSelection::InitializePlayer(void)
+{
+ _pAudioPlayer = new (std::nothrow) Player();
+
+ if (_pAudioPlayer != null)
+ {
+ _pAudioPlayer->Construct(*this);
+ }
+}
+
+void
+SubBaseSelection::LoadMusicPlayer(const Tizen::Base::String& mediaFilepath, Tizen::Media::PlayerState PlayerCurrentState)
+{
+ result r = E_SUCCESS;
+ if (_pAudioPlayer != null && mediaFilepath.IsEmpty() == false)
+ {
+ if (_pAudioPlayer->GetState() != PLAYER_STATE_PAUSED)
+ {
+ if (_pAudioPlayer != null)
+ {
+ delete _pAudioPlayer;
+ _pAudioPlayer = null;
+ }
+ _pAudioPlayer = new (std::nothrow) Player();
+ _pAudioPlayer->Construct(*this);
+ }
+
+ r = _pAudioPlayer->OpenFile(mediaFilepath, false);
+ r = _pAudioPlayer->Play();
+ r = _pAudioPlayer->SetLooping(false);
+ r = _pAudioPlayer->SetVolume(100);
+ }
+ AppLogDebug("Exit: %s", GetErrorMessage(r));
+}
+
+result
+SubBaseSelection::InitializeAppRegistry(void)
+{
+ AppLogDebug("Entry");
+ result r = E_SUCCESS;
+ int previousSortValue = 0;
+ AppRegistry* pAppRegistry = null;
+ String sortbyKeyName(L"SortBy");
+ SortByType sortStyle = SORT_BY_TYPE_DATE_RECENT;
+
+ pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
+
+ r = pAppRegistry->Add(sortbyKeyName, sortStyle);
+
+ if (r == E_SUCCESS)
+ {
+ r = pAppRegistry->Save();
+ }
+ else if (r == E_KEY_ALREADY_EXIST)
+ {
+ pAppRegistry->Get(sortbyKeyName, previousSortValue);
+ _storedSortStyle = static_cast< SortByType >(previousSortValue);
+ if (_storedSortStyle != null)
+ {
+ pAppRegistry->Set(sortbyKeyName, sortStyle);
+ r = pAppRegistry->Save();
+ }
+ }
+
+ AppLogDebug("Exit %s", GetErrorMessage(r));
+ return r;
+}
+
+result
+SubBaseSelection::CreateLabelControl(void)
+{
+ AppLogDebug("Entry");
+ result r = E_SUCCESS;
+ Color backgroundColor(68, 68, 68);
+ //Color textColor(Color(76, 81, 88));
+
+ _pLabelNumberOfItems = static_cast< Label* >(GetControl(L"IDC_LABEL_SELECTED"));
+ TryCatch(_pLabelNumberOfItems != null, , "applog: allocation failed for __pLabelNumberOfItems");
+
+// _pLabelNumberOfItems->Construct(Rectangle(0, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL), _itemSelectedCount);
+// _pLabelNumberOfItems->SetBackgroundColor(backgroundColor);
+// _pLabelNumberOfItems->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
+ _pLabelNumberOfItems->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
+// _pLabelNumberOfItems->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
+ _pLabelNumberOfItems->SetTextConfig(ID_FONT_SIZE_26, LABEL_TEXT_STYLE_BOLD);
+
+ if (_selectionMode == SELECTION_MODE_SINGE)
+ {
+ _pLabelNumberOfItems->SetShowState(false);
+ }
+ else
+ {
+ if (_currentViewStyle != APPCONTROL_VIEW_IMPORT)
+ {
+ _pLabelNumberOfItems->SetShowState(true);
+ }
+ }
+
+// r = AddControl(*_pLabelNumberOfItems);
+ AppLogDebug("Exit %s", GetErrorMessage(r));
+ return r;
+ CATCH:
+ AppLogDebug("Exit %s", GetErrorMessage(r));
+ r = GetLastResult();
+ return r;
+}
+
+
+void
+SubBaseSelection::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ AppLogDebug("Entry");
+ String mediaPath;
+ String storagePath;
+
+ switch (actionId)
+ {
+ case IDA_BTN_ATTACH:
+ {
+ UiApp* pApp = UiApp::GetInstance();
+ ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();
+ ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);
+
+ if (pApp != null)
+ {
+ pApp->Terminate();
+ }
+ }
+ break;
+/*
+ case IDA_BTN_CANCEL:
+ {
+
+ }
+ break;*/
+
+ case IDA_BTN_IMPORT:
+ {
+ UiApp* pApp = UiApp::GetInstance();
+
+ ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();
+ ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);
+
+ if (pApp != null)
+ {
+ pApp->Terminate();
+ }
+ }
+ break;
+
+ case IDA_BTN_EXPORT:
+ {
+ UiApp* pApp = UiApp::GetInstance();
+
+ ((MyFilesApp*) Application::GetInstance())->SetAppControlSelected();
+ ((MyFilesApp*) Application::GetInstance())->AddAppControlResult(APP_CTRL_RESULT_SUCCEEDED);
+
+ if (pApp != null)
+ {
+ pApp->Terminate();
+ }
+ }
+ break;
+
+ case IDA_BTN_CREATE_FOLDER:
+ {
+ ArrayList* pArg = null;
+ Integer* pSourceSelected = null;
+ SceneManager* pSceneManager = null;
+
+ pSceneManager = SceneManager::GetInstance();
+
+ pArg = new (std::nothrow) ArrayList();
+ pArg->Construct();
+ pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
+ pArg->Add(pSourceSelected);
+
+ _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();
+ pArg->Add(&_rootMediaPath);
+
+ if (pSceneManager != null)
+ {
+ pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
+}
+
+void
+SubBaseSelection::ClearSelectedItems(Tizen::Ui::Controls::ListView& listView)
+{
+ ArrayList* pCheckedKeys = null;
+ int itemCount = 0;
+ if (_pFileManager != null)
+ {
+ pCheckedKeys = static_cast< ArrayList* >(_pFileManager->GetCheckedList()->GetKeysN());
+ AppLogDebug("Get count is %d",pCheckedKeys->GetCount());
+ for (itemCount=0; itemCount<pCheckedKeys->GetCount();itemCount++)
+ {
+ Integer* currentIndex = static_cast<Integer*>(pCheckedKeys->GetAt(itemCount));
+ listView.SetItemChecked(currentIndex->ToInt(), false);
+ }
+ _pFileManager->ClearCheckedList();
+ }
+}
+
+void
+SubBaseSelection::ResetFooter(void)
+{
+ AppResource* pAppResource = null;
+ String selectFiles;
+
+ pAppResource = Application::GetInstance()->GetAppResource();
+ pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);
+
+ if (_pListView != null)
+ {
+ ClearSelectedItems(*_pListView);
+ _pFooter->SetItemEnabled(0,false);
+ _pFooter->Invalidate(true);
+ _itemSelectedCount.Clear();
+ _itemSelectedCount.Append(selectFiles);
+ _pLabelNumberOfItems->SetText(_itemSelectedCount);
+ _pLabelNumberOfItems->Invalidate(true);
+ }
+}
+
+void
+SubBaseSelection::OnPlayerAudioFocusChanged (void)
+{
+ //Empty Implementation.
+}
+
+void
+SubBaseSelection::OnFormBackRequested(Form& source)
+{
+ String currentPath;
+ String parentPath;
+ result r = E_SUCCESS;
+ SceneManager* pSceneManager = null;
+ pSceneManager = SceneManager::GetInstance();
+ currentPath = FolderNavigationPresentationModel::GetCurrentPath();
+
+ if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)
+ {
+ ResetFooter();
+ }
+
+ if (_pAudioPlayer != null)
+ {
+ if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING)
+ {
+ _pAudioPlayer->Stop();
+ }
+ }
+ if (currentPath == BasePresentationModel::GetMediaPath() || currentPath == BasePresentationModel::GetSdCardPath())
+ {
+ FolderNavigationPresentationModel::SetCurrentFilePath(currentPath);
+ ShowHomeView();
+ }
+ else
+ {
+ parentPath = FolderNavigationPresentationModel::GetParentPath();
+
+ FolderNavigationPresentationModel::SetCurrentFilePath(parentPath);
+ r = pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
+ }
+}
+
+void
+SubBaseSelection::ShowHomeView(void)
+{
+ SceneManager* pSceneManager = null;
+ String topMostFileSelection(L"ScnTempForm");
+ pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager != null)
+ {
+ IList* pArgs = new (std::nothrow) ArrayList();
+ pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED));
+ if (pSceneManager->IsSceneAlive(topMostFileSelection))
+ {
+ pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs);
+ }
+ else
+ {
+ pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_NONE), pArgs);
+ }
+ }
+}
+
+ContentListItem*
+SubBaseSelection::CreateExportListViewItem(int listItemIndex, int listItemWidth)
+{
+ AppLogDebug("ENTER");
+
+ Font font;
+
+ String filename;
+ String folderIconPath;
+ String imageIconPath;
+ String fontName;
+ String searchedText;
+ String fileExtension;
+ String creationDate;
+ String searchedString;
+ String selectAll;
+ String fullFilePath;
+ String cacheImagePath;
+
+ HashMap* pCacheList = null;
+ Bitmap* pFetchedCacheImage = null;
+ Bitmap* pThumbnailImage = null;
+
+ DateTime dateCreated;
+ Dimension thumbnailDimension(H_LISTVIEW_ITEM_BITMAP, W_LISTVIEW_ITEM_BITMAP);
+ Dimension textDimension(listItemWidth - W_LISTVIEW_ITEM_BITMAP, H_ITEM_LISTVIEW);
+
+ DirectoryEntry* pFileDetails = null;
+
+ ContentListItem* pCustomItem = null;
+ ContentType contentType = CONTENT_TYPE_UNKNOWN;
+
+ //AppRegistry* pAppRegistry = null;
+ //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
+
+ TryCatch(_pFilenames != null, , "MfMyFilesApp::Filename list if empty!");
+ TryCatch(_pFilenames->GetCount() != 0, , "MfMyFilesApp::Filename count is Zero!");
+
+ pCustomItem = new (std::nothrow) ContentListItem(listItemWidth, H_ITEM_LISTVIEW);
+ TryCatch(pCustomItem != null, , "MfMyFilesApp::Failed to allocate Memory to pCustomItem");
+
+ //Get the Directory Entry for the element at index from the Filenames list.
+
+ pFileDetails = static_cast< DirectoryEntry* >(_pFilenames->GetAt(listItemIndex));
+ TryCatch(pFileDetails != null, , "MfMyFilesApp::Failed to fetch FileDetails from __pFileNames!");
+
+ pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
+
+ //Set the filename of the element at index index
+ filename = pFileDetails->GetFileName();
+ fullFilePath = pFileDetails->GetFullFilePath();
+
+ //If the registry key value is set for show extension append the extension of the filename else do not.
+
+ if (!pFileDetails->GetFileExtension().IsEmpty())
+ {
+ filename = filename + "." + pFileDetails->GetFileExtension();
+ }
+
+
+ if (pFileDetails->IsDirectory())
+ {
+ pCustomItem->SetThumbnail(_pFolderBitmap);
+ }
+ else
+ {
+ pCustomItem->SetDescColor(Color::GetColor(COLOR_ID_GREY));
+
+ contentType = ContentManagerUtil::CheckContentType(fullFilePath);
+
+ if (pFileDetails->GetBitmap() == null && pFileDetails->IstDummy())
+ {
+ if (pCacheList != null && (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO))
+ {
+ if (pFileDetails != null)
+ {
+ cacheImagePath = pFileDetails->GetFullFilePath();
+ AppLogDebug("cache path is %S",cacheImagePath.GetPointer());
+ }
+
+ if ((pCacheList->GetValue(cacheImagePath)) != null)
+ {
+ pFetchedCacheImage = static_cast< Bitmap* >(pCacheList->GetValue(cacheImagePath));
+ }
+ }
+
+ if (pFetchedCacheImage != null)
+ {
+ AppLogDebug("image taken from cachemanager");
+ pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath);
+ pCustomItem->SetThumbnail(pThumbnailImage);
+ }
+ else
+ {
+ pFileDetails->SetDummy(true);
+ pCustomItem->SetThumbnail(_pDummyImage);
+ AppLogDebug("call to thumbnail manager");
+ }
+ }
+ else
+ {
+ AppLogDebug("BITMAP FOUND : NOT NEED TO DO GETTHUMBNAIL");
+ pCustomItem->SetThumbnail(pFileDetails->GetBitmap());
+ }
+ }
+
+ pCustomItem->SetTitle(filename, searchedText);
+
+ pCustomItem->Make();
+
+ AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
+
+ return pCustomItem;
+
+CATCH:
+ if (pCustomItem != null)
+ {
+ delete pCustomItem;
+ pCustomItem = null;
+ }
+ return null;
+}
SubFolderFileListForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
{
Integer* pFileProcessingResult = null;
- HashMap* pCacheList = null;
- DirectoryEntry* pCurrentEntry = null;
- bool cacheKeyStatus = false;
String cachePath;
+
TryCatch(pArgs != null, , "Argument list received is invalid!");
pFileProcessingResult = (Integer*) pArgs->GetAt(0);
-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.0 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://floralicense.org/license/\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-/**\r
- * @file: MfTopLevelDirectoryMoveCopy.cpp\r
- * @brief:\r
- */\r
-\r
-#include "MfTopLevelDirectoryMoveCopy.h"\r
-#include "MfTypes.h"\r
-#include "MfSceneRegister.h"\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Graphics;\r
-using namespace Tizen::System;\r
-using namespace Tizen::Ui;\r
-using namespace Tizen::Ui::Controls;\r
-using namespace Tizen::Ui::Scenes;\r
-using namespace Tizen::Base::Collection;\r
-\r
-MfTopLevelDirectoryMoveCopy::MfTopLevelDirectoryMoveCopy(void)\r
-: __pFolderList(null)\r
-, __pPhone(null)\r
-, __pMemoryCard(null)\r
-, __pExternalStorage(null)\r
-, __pPhonePress(null)\r
-, __pMemoryCardPress(null)\r
-, __pExternalStoragePress(null)\r
-, __pFormFooter(null)\r
-, __footerItemMovePaste(null)\r
-\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-MfTopLevelDirectoryMoveCopy::~MfTopLevelDirectoryMoveCopy(void)\r
-{\r
- AppLogDebug("Enter");\r
-\r
- if (__pFolderList != null)\r
- {\r
- __pFolderList->RemoveAll(true);\r
- delete __pFolderList;\r
- }\r
-\r
- if (__pPhone != null)\r
- {\r
- delete __pPhone;\r
- }\r
-\r
- if (__pMemoryCard != null)\r
- {\r
- delete __pMemoryCard;\r
- }\r
-\r
- if (__pExternalStorage != null)\r
- {\r
- delete __pExternalStorage;\r
- }\r
-\r
- if (__pPhonePress != null)\r
- {\r
- delete __pPhonePress;\r
- }\r
-\r
- if (__pMemoryCardPress != null)\r
- {\r
- delete __pMemoryCardPress;\r
- }\r
-\r
- if (__pExternalStoragePress != null)\r
- {\r
- delete __pExternalStoragePress;\r
- }\r
-}\r
-\r
-bool\r
-MfTopLevelDirectoryMoveCopy::Initialize(void)\r
-{\r
- Form::Construct(L"IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE");\r
- return true;\r
-}\r
-\r
-result\r
-MfTopLevelDirectoryMoveCopy::OnInitializing(void)\r
-{\r
- AppLogDebug("Enter");\r
- result r = E_SUCCESS;\r
- AppResource* pAppResource = null;\r
-\r
- String headerDisplayText;\r
- String buttonSearch;\r
- String contextItemText;\r
- String phoneStorage;\r
- String* phonetext = null;\r
-\r
- ButtonItem footerItemMenu;\r
- Header* pHeader = null;\r
-\r
- pAppResource = UiApp::GetInstance()->GetAppResource();\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_COM_BODY_MY_FILES", headerDisplayText);\r
- pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);\r
- pAppResource->GetString(L"IDS_MF_SK_DETAILS", contextItemText);\r
- pAppResource->GetString(L"IDS_MF_TAB_PHONE", phoneStorage);\r
-\r
- __pPhone = pAppResource->GetBitmapN(IDB_PHONE_ICON);\r
- __pMemoryCard = pAppResource->GetBitmapN(IDB_SDCARD_ICON_TOP_LEVEL);\r
- __pExternalStorage = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON);\r
- __pPhonePress = pAppResource->GetBitmapN(IDB_PHONE_ICON_PRESSED);\r
- __pMemoryCardPress = pAppResource->GetBitmapN(IDB_SDCARD_ICON_PRESSED);\r
- __pExternalStoragePress = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON_PRESSED);\r
- }\r
-\r
-\r
- phonetext = new (std::nothrow) String(phoneStorage);\r
-\r
- __pFolderList = new (std::nothrow) ArrayList();\r
- //TryCatch(__pFolderList != null, , "MfMyFilesApp::Failed to Allocate memory to pTabList!");\r
- __pFolderList->Construct();\r
-\r
- __pFolderList->Add(phonetext);\r
-\r
- __listItemCount = __pFolderList->GetCount();\r
-\r
-\r
- pHeader = GetHeader();\r
- if (pHeader != null)\r
- {\r
- pHeader-> SetTitleText(headerDisplayText);\r
- }\r
- __pFormFooter = GetFooter();\r
- SetFormBackEventListener(this);\r
-\r
- __footerItemMovePaste = new (std::nothrow) FooterItem();\r
- __footerItemMovePaste->Construct(IDA_BTN_FOOTER);\r
-\r
- if (__pFormFooter != null)\r
- {\r
- __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);\r
- __pFormFooter->AddActionEventListener(*this);\r
- __pFormFooter->SetBackButton();\r
- }\r
-\r
- __pListView = static_cast< ListView* >(GetControl("IDC_LISTVIEW_TOP_LEVEL_DIR_COPY_MOVE"));\r
- if (__pListView != null)\r
- {\r
- __pListView->AddListViewItemEventListener(*this);\r
- __pListView->SetItemProvider(*this);\r
- __pListView->SetShowState(true);\r
- }\r
-\r
- __pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_TOP_MOVECOPY"));\r
- if (__pIconListView != null)\r
- {\r
- __pIconListView->AddIconListViewItemEventListener(*this);\r
- __pIconListView->SetItemProvider(*this);\r
- __pIconListView->SetShowState(false);\r
- }\r
-\r
- AppLogDebug("Exit");\r
- return r;\r
-}\r
-\r
-result\r
-MfTopLevelDirectoryMoveCopy::OnTerminating(void)\r
-{\r
- __pFormFooter = GetFooter();\r
- if (__pFormFooter != null)\r
- {\r
- __pFormFooter->RemoveAllItems();\r
- __pFormFooter->RemoveAllButtons();\r
- }\r
- return E_SUCCESS;\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnFormBackRequested(Tizen::Ui::Controls::Form& source)\r
-{\r
- AppLogDebug("Enter");\r
- SceneManager* pSceneManager = SceneManager::GetInstance();\r
- if (pSceneManager != null)\r
- {\r
- pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_DESTROY_OPTION_DESTROY), null);\r
- }\r
- return;\r
- AppLogDebug("Exit");\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnListViewContextItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnListViewItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)\r
-{\r
- AppLogDebug("Enter");\r
- //SceneManager* pSceneManager = SceneManager::GetInstance();\r
- ArrayList* pArgs = null;\r
- Integer* pSourceForm = null;\r
-\r
- pArgs = new (std::nothrow) ArrayList();\r
- // FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());\r
- pArgs->Construct();\r
-\r
- switch (index)\r
- {\r
- case 0:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);\r
- break;\r
- case 1:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);\r
-\r
- break;\r
- case 2:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);\r
- break;\r
- }\r
-\r
- //TryCatch(pArgs != null, , "pArgs is null.");\r
- pSourceForm = new (std::nothrow) Integer(__sourceFromOption);\r
- pArgs->Add(pSourceForm);\r
-\r
- SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_MOVE_COPY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArgs);\r
- AppLogDebug("Exit");\r
-}\r
-\r
-// IListViewItemProvider\r
-Tizen::Ui::Controls::ListItemBase*\r
-MfTopLevelDirectoryMoveCopy::CreateItem(int index, int itemWidth)\r
-{\r
- String titleText;\r
- String memoryCard;\r
- String externalStorage;\r
- String* tempStr;\r
-\r
- CustomItem* pItem = new CustomItem();\r
- AppResource* pAppResource = null;\r
- pAppResource = UiApp::GetInstance()->GetAppResource();\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", memoryCard);\r
-#if 0\r
- pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);\r
-#endif\r
- }\r
-\r
- ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;\r
-\r
- pItem->Construct(Dimension(itemWidth, H_ITEM_LISTVIEW), style);\r
-\r
- switch (index)\r
- {\r
- case 0:\r
- {\r
- pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);\r
-\r
- }\r
- break;\r
- case 1:\r
- {\r
- pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);\r
-\r
- }\r
- break;\r
- case 2:\r
- {\r
- pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);\r
- }\r
- break;\r
- default:\r
- break;\r
- }\r
-\r
- tempStr = static_cast<String*>(__pFolderList->GetAt(index));\r
-\r
- titleText.Clear();\r
- titleText.Append(*tempStr);\r
-\r
- pItem->AddElement(Rectangle(W_LISTVIEW_ITEM_BITMAP + 2 * X_LISTVIEW, (H_ITEM_LISTVIEW - H_LISTVIEW_ITEM_TITLE) /2, itemWidth - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW), H_LISTVIEW_ITEM_TITLE),\r
- IDA_FORMAT_STRING,\r
- titleText,\r
- true);\r
-\r
- return pItem;\r
-}\r
-\r
-bool\r
-MfTopLevelDirectoryMoveCopy::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)\r
-{\r
- AppLogDebug("Enter");\r
- if (pItem != null)\r
- {\r
- delete pItem;\r
- pItem = null;\r
- }\r
- AppLogDebug("EXit");\r
- return true;\r
-}\r
-\r
-bool\r
-MfTopLevelDirectoryMoveCopy::DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem)\r
-{\r
- if (pItem != null)\r
- {\r
- delete pItem;\r
- pItem = null;\r
- }\r
- return true;\r
-}\r
-\r
-\r
-Tizen::Ui::Controls::IconListViewItem*\r
-MfTopLevelDirectoryMoveCopy::CreateItem(int index)\r
-{\r
- String titleText;\r
- String* tempStr;\r
-\r
- IconListViewItem* pItem = null;\r
- pItem = new (std::nothrow) IconListViewItem();\r
-\r
- tempStr = static_cast<String*>(__pFolderList->GetAt(index));\r
-\r
- titleText.Clear();\r
- titleText.Append(*tempStr);\r
-\r
- switch (index)\r
- {\r
- case 0:\r
- {\r
- pItem->Construct(*__pPhone, &titleText,__pPhonePress, null);\r
- // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);\r
-\r
- }\r
- break;\r
- case 1:\r
- {\r
- pItem->Construct(*__pMemoryCard, &titleText,__pMemoryCardPress, null);\r
- // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);\r
-\r
- }\r
- break;\r
- case 2:\r
- {\r
- pItem->Construct(*__pExternalStorage, &titleText,__pExternalStoragePress, null);\r
-\r
- // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);\r
- }\r
- break;\r
- default:\r
- break;\r
- }\r
-\r
- return pItem;\r
-}\r
-\r
-int\r
-MfTopLevelDirectoryMoveCopy::GetItemCount(void)\r
-{\r
- AppLogDebug("Enter");\r
- return __listItemCount;\r
-}\r
-\r
-//ISceneEventListener\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)\r
-{\r
- AppLogDebug("Enter");\r
- Integer* pIsCopyOrMove = null;\r
-\r
- AppResource* pAppResource = null;\r
- String footerItemText;\r
-\r
- pAppResource = UiApp::App::GetInstance()->GetAppResource();\r
-\r
- //((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);\r
-\r
- SceneManager::GetInstance()->AddSceneManagerEventListener(*this);\r
-\r
- DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);\r
-#if 0\r
- DeviceManager::AddDeviceEventListener(DEVICE_TYPE_USB_CLIENT, *this);\r
-#endif\r
-\r
- if (pArgs != null)\r
- {\r
- pIsCopyOrMove = static_cast< Integer* >(pArgs->GetAt(0));\r
-\r
- if (pIsCopyOrMove != null)\r
- {\r
- if(pIsCopyOrMove->ToInt() == SELECT_COPY_BUTTON)\r
- {\r
- __sourceFromOption = SELECT_COPY_BUTTON;\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_SK3_PASTE_HERE", footerItemText);\r
-\r
- }\r
- }\r
- else\r
- {\r
- __sourceFromOption = SELECT_MOVE_BUTTON;\r
-\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_SK3_MOVE_HERE", footerItemText);\r
-\r
- }\r
- }\r
- }\r
-\r
- __footerItemMovePaste->SetText(footerItemText);\r
- __pFormFooter->AddItem(*__footerItemMovePaste);\r
- __pFormFooter->SetItemEnabled(0, false);\r
-\r
- __pFormFooter->Invalidate(true);\r
-\r
- pArgs->RemoveAll(true);\r
- delete pArgs;\r
- pArgs = null;\r
- }\r
-\r
-\r
- AppLogDebug("Exit");\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)\r
-{\r
- //((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);\r
-\r
- DeviceManager::RemoveAllDeviceEventListeners();\r
-\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId ¤tSceneId,\r
- const Tizen::Ui::Scenes::SceneId &nextSceneId)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,\r
- const Tizen::Ui::Scenes::SceneId ¤tSceneId)\r
-{\r
- SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);\r
-\r
- String deviceSateSdCard;\r
- String deviceSateUSBStorage;\r
-\r
- String mounted = sdCardStatusMounted;\r
- String unmounted = sdCardStatusUnmounted;\r
- String inserted = usbDeviceStatusInserted;\r
- String removed = usbDeviceStatusRemoved;\r
-\r
- String sdCardStorage;\r
- String externalStorage;\r
- String* pSDCard = null;\r
-// String* pExternalStorage = null;\r
-\r
- DeviceManager::GetState(StorageCard, deviceSateSdCard);\r
- DeviceManager::GetState(UsbClient, deviceSateUSBStorage);\r
-\r
- AppResource* pAppResource = null;\r
-\r
- pAppResource = UiApp::App::GetInstance()->GetAppResource();\r
-\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);\r
-#if 0\r
- pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);\r
-#endif\r
-\r
- }\r
-\r
- __listItemCount = __pFolderList->GetCount();\r
-\r
- if (deviceSateSdCard == mounted)\r
- {\r
- pSDCard = new (std::nothrow) String(sdCardStorage);\r
-\r
- __pFolderList->Add(pSDCard);\r
- }\r
- else if (deviceSateSdCard == unmounted && __listItemCount > 1)\r
- {\r
- __pFolderList->RemoveAt(__listItemCount - 1, true);\r
- }\r
-\r
-#if 0\r
- if (deviceSateUSBStorage == inserted)\r
- {\r
- pExternalStorage = new (std::nothrow) String(externalStorage);\r
- __pFolderList->Add(pExternalStorage);\r
- }\r
- else if (deviceSateUSBStorage == removed && __listItemCount > 1)\r
- {\r
- __pFolderList->RemoveAt(__listItemCount - 1);\r
- }\r
-#endif\r
-\r
- __listItemCount = __pFolderList->GetCount();\r
-\r
- //__pListView->UpdateList();\r
-\r
- SwitchViewType();\r
-\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)\r
-{\r
- AppLogDebug("Enter");\r
- //SceneManager* pSceneManager = SceneManager::GetInstance();\r
- ArrayList* pArgs = null;\r
- Integer* pSourceForm = null;\r
-\r
- pArgs = new (std::nothrow) ArrayList();\r
- // FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());\r
- pArgs->Construct();\r
-\r
- switch (index)\r
- {\r
- case 0:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);\r
- break;\r
- case 1:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);\r
-\r
- break;\r
- case 2:\r
- FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());\r
- FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);\r
- break;\r
- }\r
-\r
- //TryCatch(pArgs != null, , "pArgs is null.");\r
- pSourceForm = new (std::nothrow) Integer(__sourceFromOption);\r
- pArgs->Add(pSourceForm);\r
-\r
- SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_MOVE_COPY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArgs);\r
- AppLogDebug("Exit");\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)\r
-{\r
- ComponentType currentDeviceType = COMPONENT_TYPE_NONE;\r
-\r
- String mounted = sdCardStatusMounted;\r
- String unmounted = sdCardStatusUnmounted;\r
- String inserted = usbDeviceStatusInserted;\r
- String removed = usbDeviceStatusRemoved;\r
-\r
- String sdCardStorage;\r
- String externalStorage;\r
-\r
- String* pSdCard = null;\r
- String* pExternalStorage = null;\r
-\r
- AppResource* pAppResource = null;\r
-\r
- pAppResource = UiApp::App::GetInstance()->GetAppResource();\r
-\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);\r
-#if 0\r
- pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);\r
-#endif\r
-\r
- }\r
-\r
- switch (deviceType)\r
- {\r
- case StorageCard:\r
- {\r
- currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;\r
-\r
- if (state == mounted)\r
- {\r
- pSdCard = new (std::nothrow) String(sdCardStorage);\r
- __pFolderList->Add(pSdCard);\r
-\r
- }\r
- else if (state == unmounted)\r
- {\r
- __pFolderList->RemoveAt(__listItemCount - 1);\r
- }\r
-\r
- __listItemCount = __pFolderList->GetCount();\r
- }\r
- break;\r
-\r
- case UsbClient:\r
- {\r
- currentDeviceType = COMPONENT_TYPE_USB;\r
-\r
- if (state == inserted)\r
- {\r
- pExternalStorage = new (std::nothrow) String(externalStorage);\r
- __pFolderList->Add(pExternalStorage);\r
- }\r
- else if (state == removed)\r
- {\r
- __pFolderList->RemoveAt(__listItemCount - 1);\r
- }\r
- __listItemCount = __pFolderList->GetCount();\r
-\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- //Do Nothing.\r
- }\r
- break;\r
- }\r
-\r
- __pListView->UpdateList();\r
- __pIconListView->UpdateList();\r
-\r
- //OnDeviceChange(currentDeviceType, state);\r
-}\r
-\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)\r
-{\r
- switch (orientationStatus)\r
- {\r
- case ORIENTATION_STATUS_PORTRAIT:\r
- {\r
- //Do Nothing\r
- }\r
- break;\r
-\r
- case ORIENTATION_STATUS_LANDSCAPE:\r
- {\r
- //Do Nothing\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- //Do Nothing\r
- }\r
- break;\r
- }\r
-}\r
-\r
-void\r
-MfTopLevelDirectoryMoveCopy::SwitchViewType(void)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- AppRegistry* pAppRegistry = null;\r
-\r
- int viewType = VIEW_TYPE_AS_NONE;\r
-\r
- String viewStyleKeyName(L"ListDisplayType");\r
-\r
-\r
- pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();\r
- r = pAppRegistry->Get(viewStyleKeyName, viewType);\r
-\r
- switch (viewType)\r
- {\r
- case VIEW_TYPE_AS_DETAILED_LIST:\r
- {\r
- if (__pIconListView != null && __pIconListView->IsVisible())\r
- {\r
- __pIconListView->SetShowState(false);\r
- }\r
- if (__pListView != null)\r
- {\r
- __pListView->UpdateList();\r
- __pListView->SetShowState(true);\r
- }\r
-\r
- }\r
- break;\r
-\r
- case VIEW_TYPE_AS_NORMAL_LIST:\r
- {\r
- if (__pIconListView != null && __pIconListView->IsVisible())\r
- {\r
- __pIconListView->SetShowState(false);\r
- }\r
-\r
- if (__pListView != null)\r
- {\r
- __pListView->UpdateList();\r
- __pListView->SetShowState(true);\r
- }\r
- }\r
- break;\r
-\r
- case VIEW_TYPE_AS_THUMBNAILS:\r
- {\r
- if (__pListView != null && __pListView->IsVisible())\r
- {\r
- __pListView->SetShowState(false);\r
- }\r
- if (__pIconListView != null)\r
- {\r
- __pIconListView->UpdateList();\r
- __pIconListView->SetShowState(true);\r
- }\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- if (__pListView != null)\r
- {\r
- __pListView->UpdateList();\r
- }\r
- }\r
- break;\r
- }\r
-}\r
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file: MfTopLevelDirectoryMoveCopy.cpp
+ * @brief:
+ */
+
+#include "MfTopLevelDirectoryMoveCopy.h"
+#include "MfTypes.h"
+#include "MfSceneRegister.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Base::Collection;
+
+MfTopLevelDirectoryMoveCopy::MfTopLevelDirectoryMoveCopy(void)
+: __pFolderList(null)
+, __pPhone(null)
+, __pMemoryCard(null)
+, __pExternalStorage(null)
+, __pPhonePress(null)
+, __pMemoryCardPress(null)
+, __pExternalStoragePress(null)
+, __pFormFooter(null)
+, __footerItemMovePaste(null)
+
+{
+ //Empty Implementation.
+}
+
+MfTopLevelDirectoryMoveCopy::~MfTopLevelDirectoryMoveCopy(void)
+{
+ AppLogDebug("Enter");
+
+ if (__pFolderList != null)
+ {
+ __pFolderList->RemoveAll(true);
+ delete __pFolderList;
+ }
+
+ if (__pPhone != null)
+ {
+ delete __pPhone;
+ }
+
+ if (__pMemoryCard != null)
+ {
+ delete __pMemoryCard;
+ }
+
+ if (__pExternalStorage != null)
+ {
+ delete __pExternalStorage;
+ }
+
+ if (__pPhonePress != null)
+ {
+ delete __pPhonePress;
+ }
+
+ if (__pMemoryCardPress != null)
+ {
+ delete __pMemoryCardPress;
+ }
+
+ if (__pExternalStoragePress != null)
+ {
+ delete __pExternalStoragePress;
+ }
+}
+
+bool
+MfTopLevelDirectoryMoveCopy::Initialize(void)
+{
+ Form::Construct(L"IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE");
+ return true;
+}
+
+result
+MfTopLevelDirectoryMoveCopy::OnInitializing(void)
+{
+ AppLogDebug("Enter");
+ result r = E_SUCCESS;
+ AppResource* pAppResource = null;
+
+ String headerDisplayText;
+ String buttonSearch;
+ String contextItemText;
+ String phoneStorage;
+ String* phonetext = null;
+
+ ButtonItem footerItemMenu;
+ Header* pHeader = null;
+
+ pAppResource = UiApp::GetInstance()->GetAppResource();
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_COM_BODY_MY_FILES", headerDisplayText);
+ pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
+ pAppResource->GetString(L"IDS_MF_SK_DETAILS", contextItemText);
+ pAppResource->GetString(L"IDS_MF_TAB_PHONE", phoneStorage);
+
+ __pPhone = pAppResource->GetBitmapN(IDB_PHONE_ICON);
+ __pMemoryCard = pAppResource->GetBitmapN(IDB_SDCARD_ICON_TOP_LEVEL);
+ __pExternalStorage = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON);
+ __pPhonePress = pAppResource->GetBitmapN(IDB_PHONE_ICON_PRESSED);
+ __pMemoryCardPress = pAppResource->GetBitmapN(IDB_SDCARD_ICON_PRESSED);
+ __pExternalStoragePress = pAppResource->GetBitmapN(IDB_EXTERNAL_ICON_PRESSED);
+ }
+
+
+ phonetext = new (std::nothrow) String(phoneStorage);
+
+ __pFolderList = new (std::nothrow) ArrayList();
+ //TryCatch(__pFolderList != null, , "MfMyFilesApp::Failed to Allocate memory to pTabList!");
+ __pFolderList->Construct();
+
+ __pFolderList->Add(phonetext);
+
+ __listItemCount = __pFolderList->GetCount();
+
+
+ pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader-> SetTitleText(headerDisplayText);
+ }
+ __pFormFooter = GetFooter();
+ SetFormBackEventListener(this);
+
+ __footerItemMovePaste = new (std::nothrow) FooterItem();
+ __footerItemMovePaste->Construct(IDA_BTN_FOOTER);
+
+ if (__pFormFooter != null)
+ {
+ __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
+ __pFormFooter->AddActionEventListener(*this);
+ __pFormFooter->SetBackButton();
+ }
+
+ __pListView = static_cast< ListView* >(GetControl("IDC_LISTVIEW_TOP_LEVEL_DIR_COPY_MOVE"));
+ if (__pListView != null)
+ {
+ __pListView->AddListViewItemEventListener(*this);
+ __pListView->SetItemProvider(*this);
+ __pListView->SetShowState(true);
+ }
+
+ __pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_TOP_MOVECOPY"));
+ if (__pIconListView != null)
+ {
+ __pIconListView->AddIconListViewItemEventListener(*this);
+ __pIconListView->SetItemProvider(*this);
+ __pIconListView->SetShowState(false);
+ }
+
+ AppLogDebug("Exit");
+ return r;
+}
+
+result
+MfTopLevelDirectoryMoveCopy::OnTerminating(void)
+{
+ __pFormFooter = GetFooter();
+ if (__pFormFooter != null)
+ {
+ __pFormFooter->RemoveAllItems();
+ __pFormFooter->RemoveAllButtons();
+ }
+ return E_SUCCESS;
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ //Empty Implementation.
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+ AppLogDebug("Enter");
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager != null)
+ {
+ pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_DESTROY_OPTION_DESTROY), null);
+ }
+ return;
+ AppLogDebug("Exit");
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnListViewContextItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
+{
+ //Empty Implementation.
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnListViewItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+ AppLogDebug("Enter");
+ //SceneManager* pSceneManager = SceneManager::GetInstance();
+ ArrayList* pArgs = null;
+ Integer* pSourceForm = null;
+
+ pArgs = new (std::nothrow) ArrayList();
+ // FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());
+ pArgs->Construct();
+
+ switch (index)
+ {
+ case 0:
+ FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
+ break;
+ case 1:
+ FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
+
+ break;
+ case 2:
+ FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
+ break;
+ }
+
+ //TryCatch(pArgs != null, , "pArgs is null.");
+ pSourceForm = new (std::nothrow) Integer(__sourceFromOption);
+ pArgs->Add(pSourceForm);
+
+ SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_MOVE_COPY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArgs);
+ AppLogDebug("Exit");
+}
+
+// IListViewItemProvider
+Tizen::Ui::Controls::ListItemBase*
+MfTopLevelDirectoryMoveCopy::CreateItem(int index, int itemWidth)
+{
+ String titleText;
+ String memoryCard;
+ String externalStorage;
+ String* tempStr;
+
+ CustomItem* pItem = new CustomItem();
+ AppResource* pAppResource = null;
+ pAppResource = UiApp::GetInstance()->GetAppResource();
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", memoryCard);
+#if 0
+ pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
+#endif
+ }
+
+ ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+ pItem->Construct(Dimension(itemWidth, H_ITEM_LISTVIEW), style);
+
+ switch (index)
+ {
+ case 0:
+ {
+ pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);
+
+ }
+ break;
+ case 1:
+ {
+ pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);
+
+ }
+ break;
+ case 2:
+ {
+ pItem->AddElement(Rectangle(X_LISTVIEW, Y_LISTVIEW, W_LISTVIEW_ITEM_BITMAP, H_LISTVIEW_ITEM_BITMAP), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);
+ }
+ break;
+ default:
+ break;
+ }
+
+ tempStr = static_cast<String*>(__pFolderList->GetAt(index));
+
+ titleText.Clear();
+ titleText.Append(*tempStr);
+
+ pItem->AddElement(Rectangle(W_LISTVIEW_ITEM_BITMAP + 2 * X_LISTVIEW, (H_ITEM_LISTVIEW - H_LISTVIEW_ITEM_TITLE) /2, itemWidth - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW), H_LISTVIEW_ITEM_TITLE),
+ IDA_FORMAT_STRING,
+ titleText,
+ true);
+
+ return pItem;
+}
+
+bool
+MfTopLevelDirectoryMoveCopy::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+ AppLogDebug("Enter");
+ if (pItem != null)
+ {
+ delete pItem;
+ pItem = null;
+ }
+ AppLogDebug("EXit");
+ return true;
+}
+
+bool
+MfTopLevelDirectoryMoveCopy::DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem* pItem)
+{
+ if (pItem != null)
+ {
+ delete pItem;
+ pItem = null;
+ }
+ return true;
+}
+
+
+Tizen::Ui::Controls::IconListViewItem*
+MfTopLevelDirectoryMoveCopy::CreateItem(int index)
+{
+ String titleText;
+ String* tempStr;
+
+ IconListViewItem* pItem = null;
+ pItem = new (std::nothrow) IconListViewItem();
+
+ tempStr = static_cast<String*>(__pFolderList->GetAt(index));
+
+ titleText.Clear();
+ titleText.Append(*tempStr);
+
+ switch (index)
+ {
+ case 0:
+ {
+ pItem->Construct(*__pPhone, &titleText,__pPhonePress, null);
+ // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pPhone, __pPhonePress, null);
+
+ }
+ break;
+ case 1:
+ {
+ pItem->Construct(*__pMemoryCard, &titleText,__pMemoryCardPress, null);
+ // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pMemoryCard, __pMemoryCardPress, null);
+
+ }
+ break;
+ case 2:
+ {
+ pItem->Construct(*__pExternalStorage, &titleText,__pExternalStoragePress, null);
+
+ // pItem->AddElement(Rectangle(26, 19, 74, 74), IDA_FORMAT_BITMAP, *__pExternalStorage, __pExternalStoragePress, null);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return pItem;
+}
+
+int
+MfTopLevelDirectoryMoveCopy::GetItemCount(void)
+{
+ AppLogDebug("Enter");
+ return __listItemCount;
+}
+
+//ISceneEventListener
+
+void
+MfTopLevelDirectoryMoveCopy::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+ AppLogDebug("Enter");
+ Integer* pIsCopyOrMove = null;
+
+ AppResource* pAppResource = null;
+ String footerItemText;
+
+ pAppResource = UiApp::App::GetInstance()->GetAppResource();
+
+ //((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);
+
+ SceneManager::GetInstance()->AddSceneManagerEventListener(*this);
+
+ DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+#if 0
+ DeviceManager::AddDeviceEventListener(DEVICE_TYPE_USB_CLIENT, *this);
+#endif
+
+ if (pArgs != null)
+ {
+ pIsCopyOrMove = static_cast< Integer* >(pArgs->GetAt(0));
+
+ if (pIsCopyOrMove != null)
+ {
+ if(pIsCopyOrMove->ToInt() == SELECT_COPY_BUTTON)
+ {
+ __sourceFromOption = SELECT_COPY_BUTTON;
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_MF_SK3_PASTE_HERE", footerItemText);
+
+ }
+ }
+ else
+ {
+ __sourceFromOption = SELECT_MOVE_BUTTON;
+
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_MF_SK3_MOVE_HERE", footerItemText);
+
+ }
+ }
+ }
+
+ __footerItemMovePaste->SetText(footerItemText);
+ __pFormFooter->AddItem(*__footerItemMovePaste);
+ __pFormFooter->SetItemEnabled(0, false);
+
+ __pFormFooter->Invalidate(true);
+
+ pArgs->RemoveAll(true);
+ delete pArgs;
+ pArgs = null;
+ }
+
+
+ AppLogDebug("Exit");
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+ //((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);
+
+ DeviceManager::RemoveAllDeviceEventListeners();
+
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnSceneTransitionStarted(const Tizen::Ui::Scenes::SceneId ¤tSceneId,
+ const Tizen::Ui::Scenes::SceneId &nextSceneId)
+{
+ //Empty Implementation.
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnSceneTransitionCompleted(const Tizen::Ui::Scenes::SceneId &previousSceneId,
+ const Tizen::Ui::Scenes::SceneId ¤tSceneId)
+{
+ SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);
+
+ String deviceSateSdCard;
+ String deviceSateUSBStorage;
+
+ String mounted = sdCardStatusMounted;
+ String unmounted = sdCardStatusUnmounted;
+ String inserted = usbDeviceStatusInserted;
+ String removed = usbDeviceStatusRemoved;
+
+ String sdCardStorage;
+ String externalStorage;
+ String* pSDCard = null;
+// String* pExternalStorage = null;
+
+ DeviceManager::GetState(StorageCard, deviceSateSdCard);
+ DeviceManager::GetState(UsbClient, deviceSateUSBStorage);
+
+ AppResource* pAppResource = null;
+
+ pAppResource = UiApp::App::GetInstance()->GetAppResource();
+
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);
+#if 0
+ pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
+#endif
+
+ }
+
+ __listItemCount = __pFolderList->GetCount();
+
+ if (deviceSateSdCard == mounted)
+ {
+ pSDCard = new (std::nothrow) String(sdCardStorage);
+
+ __pFolderList->Add(pSDCard);
+ }
+ else if (deviceSateSdCard == unmounted && __listItemCount > 1)
+ {
+ __pFolderList->RemoveAt(__listItemCount - 1, true);
+ }
+
+#if 0
+ if (deviceSateUSBStorage == inserted)
+ {
+ pExternalStorage = new (std::nothrow) String(externalStorage);
+ __pFolderList->Add(pExternalStorage);
+ }
+ else if (deviceSateUSBStorage == removed && __listItemCount > 1)
+ {
+ __pFolderList->RemoveAt(__listItemCount - 1);
+ }
+#endif
+
+ __listItemCount = __pFolderList->GetCount();
+
+ //__pListView->UpdateList();
+
+ SwitchViewType();
+
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
+{
+ AppLogDebug("Enter");
+ //SceneManager* pSceneManager = SceneManager::GetInstance();
+ ArrayList* pArgs = null;
+ Integer* pSourceForm = null;
+
+ pArgs = new (std::nothrow) ArrayList();
+ // FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());
+ pArgs->Construct();
+
+ switch (index)
+ {
+ case 0:
+ FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
+ break;
+ case 1:
+ FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
+
+ break;
+ case 2:
+ FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
+ FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
+ break;
+ }
+
+ //TryCatch(pArgs != null, , "pArgs is null.");
+ pSourceForm = new (std::nothrow) Integer(__sourceFromOption);
+ pArgs->Add(pSourceForm);
+
+ SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_MOVE_COPY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArgs);
+ AppLogDebug("Exit");
+}
+
+void
+MfTopLevelDirectoryMoveCopy::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)
+{
+ ComponentType currentDeviceType = COMPONENT_TYPE_NONE;
+
+ String mounted = sdCardStatusMounted;
+ String unmounted = sdCardStatusUnmounted;
+ String inserted = usbDeviceStatusInserted;
+ String removed = usbDeviceStatusRemoved;
+
+ String sdCardStorage;
+ String externalStorage;
+
+ String* pSdCard = null;
+ String* pExternalStorage = null;
+
+ AppResource* pAppResource = null;
+
+ pAppResource = UiApp::App::GetInstance()->GetAppResource();
+
+ if (pAppResource != null)
+ {
+ pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCardStorage);
+#if 0
+ pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", externalStorage);
+#endif
+
+ }
+
+ switch (deviceType)
+ {
+ case StorageCard:
+ {
+ currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;
+
+ if (state == mounted)
+ {
+ pSdCard = new (std::nothrow) String(sdCardStorage);
+ __pFolderList->Add(pSdCard);
+
+ }
+ else if (state == unmounted)
+ {
+ __pFolderList->RemoveAt(__listItemCount - 1);
+ }
+
+ __listItemCount = __pFolderList->GetCount();
+ }
+ break;
+
+ case UsbClient:
+ {
+ currentDeviceType = COMPONENT_TYPE_USB;
+
+ if (state == inserted)
+ {
+ pExternalStorage = new (std::nothrow) String(externalStorage);
+ __pFolderList->Add(pExternalStorage);
+ }
+ else if (state == removed)
+ {
+ __pFolderList->RemoveAt(__listItemCount - 1);
+ }
+ __listItemCount = __pFolderList->GetCount();
+
+ }
+ break;
+
+ default:
+ {
+ //Do Nothing.
+ }
+ break;
+ }
+
+ __pListView->UpdateList();
+ __pIconListView->UpdateList();
+
+ //OnDeviceChange(currentDeviceType, state);
+}
+
+
+void
+MfTopLevelDirectoryMoveCopy::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
+{
+ switch (orientationStatus)
+ {
+ case ORIENTATION_STATUS_PORTRAIT:
+ {
+ //Do Nothing
+ }
+ break;
+
+ case ORIENTATION_STATUS_LANDSCAPE:
+ {
+ //Do Nothing
+ }
+ break;
+
+ default:
+ {
+ //Do Nothing
+ }
+ break;
+ }
+}
+
+void
+MfTopLevelDirectoryMoveCopy::SwitchViewType(void)
+{
+ result r = E_SUCCESS;
+
+ AppRegistry* pAppRegistry = null;
+
+ int viewType = VIEW_TYPE_AS_NONE;
+
+ String viewStyleKeyName(L"ListDisplayType");
+
+
+ pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
+ r = pAppRegistry->Get(viewStyleKeyName, viewType);
+
+ switch (viewType)
+ {
+ case VIEW_TYPE_AS_DETAILED_LIST:
+ {
+ if (__pIconListView != null && __pIconListView->IsVisible())
+ {
+ __pIconListView->SetShowState(false);
+ }
+ if (__pListView != null)
+ {
+ __pListView->UpdateList();
+ __pListView->SetShowState(true);
+ }
+
+ }
+ break;
+
+ case VIEW_TYPE_AS_NORMAL_LIST:
+ {
+ if (__pIconListView != null && __pIconListView->IsVisible())
+ {
+ __pIconListView->SetShowState(false);
+ }
+
+ if (__pListView != null)
+ {
+ __pListView->UpdateList();
+ __pListView->SetShowState(true);
+ }
+ }
+ break;
+
+ case VIEW_TYPE_AS_THUMBNAILS:
+ {
+ if (__pListView != null && __pListView->IsVisible())
+ {
+ __pListView->SetShowState(false);
+ }
+ if (__pIconListView != null)
+ {
+ __pIconListView->UpdateList();
+ __pIconListView->SetShowState(true);
+ }
+ }
+ break;
+
+ default:
+ {
+ if (__pListView != null)
+ {
+ __pListView->UpdateList();
+ }
+ }
+ break;
+ }
+}