From 9234e168142867b7c80f1fdcace33c473ba1729b Mon Sep 17 00:00:00 2001 From: "chitta.rs" Date: Thu, 28 Mar 2013 15:47:46 +0530 Subject: [PATCH] NABI issue fixes Change-Id: I62bda8890a09c86b4fb57cc507e4491439ef771d --- inc/MfFileManageWorkerThread.h | 3 + inc/MfFolderEntryPresentationModel.h | 2 + inc/MfMyFilesApp.h | 5 + inc/MfSubBaseSelectionForm.h | 3 + inc/MfThumbnailItemProviderAndListener.h | 8 +- inc/MfTypes.h | 6 + res/screen-size-normal/IDL_CREATE_FOLDER.xml | 22 +- res/screen-size-normal/IDL_DETAIL_FORM.xml | 12 +- res/screen-size-normal/IDL_EDIT.xml | 18 +- res/screen-size-normal/IDL_MAIN_FORM.xml | 64 ++--- res/screen-size-normal/IDL_SEARCH.xml | 18 +- res/screen-size-normal/IDL_SUB_DIRECTORY.xml | 22 +- .../IDL_SUB_FOLDER_FILE_SELECTION.xml | 5 +- .../IDL_SUB_FOLDER_MOVE_COPY.xml | 6 +- .../IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE.xml | 18 +- .../IDL_TOP_MOST_FILE_SELECTION.xml | 12 +- src/MfFileManageForm.cpp | 1 + src/MfFileManageWorkerThread.cpp | 97 ++++++- src/MfFolderEntryPresentationModel.cpp | 18 ++ src/MfMyFilesApp.cpp | 130 +++++++-- src/MfSplitPanelFileManageForm.cpp | 7 + src/MfSplitPanelForm.cpp | 8 +- src/MfSubBaseSelectionForm.cpp | 147 ++++++++++ src/MfSubFolderFileListForm.cpp | 19 +- src/MfSubFolderMoveCopy.cpp | 6 + src/MfSubFolderSelection.cpp | 113 ++++++-- src/MfThumbnailItemProviderAndListener.cpp | 39 +-- src/MfTopLevelFolderFileListForm.cpp | 39 +-- src/MfTopMostFileSelectionForm.cpp | 296 ++++----------------- 29 files changed, 684 insertions(+), 460 deletions(-) diff --git a/inc/MfFileManageWorkerThread.h b/inc/MfFileManageWorkerThread.h index a54180d..7c9f800 100644 --- a/inc/MfFileManageWorkerThread.h +++ b/inc/MfFileManageWorkerThread.h @@ -110,6 +110,7 @@ private: class FileManageWorkerThread : public Tizen::Base::Runtime::Thread + ,public Tizen::Content::IContentScanListener //: public Tizen::Base::Runtime::EventDrivenThread { public: @@ -291,6 +292,8 @@ private: long long int GetFileSize(const Tizen::Base::String& filePath); long long int GetTotalFileSize(); + + virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r); private: static int __fileManagedCounter; diff --git a/inc/MfFolderEntryPresentationModel.h b/inc/MfFolderEntryPresentationModel.h index 8c7dac0..9835671 100644 --- a/inc/MfFolderEntryPresentationModel.h +++ b/inc/MfFolderEntryPresentationModel.h @@ -149,6 +149,8 @@ public: */ void SetFolderEntryType(FileType currentType); + void SetViewType(AppControlView currentView); + /* * @fn SetSortEnabled * @brief: This method determines whether the directory entries have to be sorted or not diff --git a/inc/MfMyFilesApp.h b/inc/MfMyFilesApp.h index 2adcb0d..575707c 100644 --- a/inc/MfMyFilesApp.h +++ b/inc/MfMyFilesApp.h @@ -66,6 +66,10 @@ public: AppControlView GetCurrentView(void); + AppControlState GetCurrentState(void); + + ExportFileType GetCurrentExportFileType(void); + IListViewStateChangeListener* GetCurrentViewToUpdate(void); bool IsImageAppControlLanched(void); @@ -142,6 +146,7 @@ private: FileType __currentFileType; SelectionMode __currentSelectionMode; + ExportFileType __currentExportFileType; }; #endif //_MY_FILES_H_ diff --git a/inc/MfSubBaseSelectionForm.h b/inc/MfSubBaseSelectionForm.h index a92c395..0294f23 100644 --- a/inc/MfSubBaseSelectionForm.h +++ b/inc/MfSubBaseSelectionForm.h @@ -58,6 +58,8 @@ public: */ ContentListItem* CreateDefaultContentItem(int index, int itemWidth); + ContentListItem* CreateExportListViewItem(int listItemIndex, int listItemWidth); + //IPlayerEventListener virtual void OnPlayerOpened(result r); virtual void OnPlayerEndOfClip(void); @@ -184,6 +186,7 @@ protected: AnnexStyle _annexStyle; AppControlView _currentViewStyle; FileType _currentFileType; + ExportFileType _currentExportFileType; MemoryType _storageType; SelectionMode _selectionMode; SortByType _storedSortStyle; diff --git a/inc/MfThumbnailItemProviderAndListener.h b/inc/MfThumbnailItemProviderAndListener.h index d06ccb7..ec9d70d 100644 --- a/inc/MfThumbnailItemProviderAndListener.h +++ b/inc/MfThumbnailItemProviderAndListener.h @@ -153,13 +153,7 @@ public: * */ void SetSourceFromOption(int sourceFromOption); - //! Function used to set the rootMediaPath. - /*!@fn SetRootPath(Tizen::Base::String rootMediaPath) - * @brief Used to set the RootMediaPath. - * @param [String] rootMediaPath, rootMediaPath of the current View. - * @return An ErrorCode - * */ - result SetRootPath(const Tizen::Base::String& rootMediaPath); + void SetCreateItemSource(int createItemSource); //! Function used to stop sending requests to ThumbnailManager. /*!@fn StopThumbnailRequest(void) diff --git a/inc/MfTypes.h b/inc/MfTypes.h index 604a19d..5d6bc20 100644 --- a/inc/MfTypes.h +++ b/inc/MfTypes.h @@ -497,5 +497,11 @@ enum MoveCopySource MOVE_COPY_SOURCE_TOP_MOST, MOVE_COPY_SOURCE_SUB_FOLDER }; + +enum ExportFileType +{ + EXPORT_TYPE_CONTACTS, + EXPORT_TYPE_CALENDAR +}; #endif /* _MF_TYPES_H_ */ diff --git a/res/screen-size-normal/IDL_CREATE_FOLDER.xml b/res/screen-size-normal/IDL_CREATE_FOLDER.xml index 8cea963..073dda5 100644 --- a/res/screen-size-normal/IDL_CREATE_FOLDER.xml +++ b/res/screen-size-normal/IDL_CREATE_FOLDER.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,22 +15,22 @@
- +
- - + + - - - + + +
diff --git a/res/screen-size-normal/IDL_DETAIL_FORM.xml b/res/screen-size-normal/IDL_DETAIL_FORM.xml index 6eab0d2..2501f30 100644 --- a/res/screen-size-normal/IDL_DETAIL_FORM.xml +++ b/res/screen-size-normal/IDL_DETAIL_FORM.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,12 +15,12 @@
- +
- - - + + +
diff --git a/res/screen-size-normal/IDL_EDIT.xml b/res/screen-size-normal/IDL_EDIT.xml index 4e8d41b..b47179f 100644 --- a/res/screen-size-normal/IDL_EDIT.xml +++ b/res/screen-size-normal/IDL_EDIT.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,17 +15,17 @@
- +
- - - + + + - - - + + +
diff --git a/res/screen-size-normal/IDL_MAIN_FORM.xml b/res/screen-size-normal/IDL_MAIN_FORM.xml index e9b5933..1e68156 100644 --- a/res/screen-size-normal/IDL_MAIN_FORM.xml +++ b/res/screen-size-normal/IDL_MAIN_FORM.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,57 +15,57 @@
- +
- - + + - - - + + + - - - + + +
diff --git a/res/screen-size-normal/IDL_SEARCH.xml b/res/screen-size-normal/IDL_SEARCH.xml index 64725ee..2c7cd65 100644 --- a/res/screen-size-normal/IDL_SEARCH.xml +++ b/res/screen-size-normal/IDL_SEARCH.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720 diff --git a/res/screen-size-normal/IDL_SUB_DIRECTORY.xml b/res/screen-size-normal/IDL_SUB_DIRECTORY.xml index e7d40d7..c1bf109 100644 --- a/res/screen-size-normal/IDL_SUB_DIRECTORY.xml +++ b/res/screen-size-normal/IDL_SUB_DIRECTORY.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,18 +15,18 @@ - - - + + + - - - + + +
diff --git a/res/screen-size-normal/IDL_SUB_FOLDER_FILE_SELECTION.xml b/res/screen-size-normal/IDL_SUB_FOLDER_FILE_SELECTION.xml index 2a94e37..3498557 100644 --- a/res/screen-size-normal/IDL_SUB_FOLDER_FILE_SELECTION.xml +++ b/res/screen-size-normal/IDL_SUB_FOLDER_FILE_SELECTION.xml @@ -3,11 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - 720
- + @@ -22,7 +21,7 @@ diff --git a/res/screen-size-normal/IDL_SUB_FOLDER_MOVE_COPY.xml b/res/screen-size-normal/IDL_SUB_FOLDER_MOVE_COPY.xml index 81f1016..74b5d37 100644 --- a/res/screen-size-normal/IDL_SUB_FOLDER_MOVE_COPY.xml +++ b/res/screen-size-normal/IDL_SUB_FOLDER_MOVE_COPY.xml @@ -6,7 +6,7 @@ 720
- + @@ -21,12 +21,12 @@ - + - +
diff --git a/res/screen-size-normal/IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE.xml b/res/screen-size-normal/IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE.xml index c3a3226..9d5bb78 100644 --- a/res/screen-size-normal/IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE.xml +++ b/res/screen-size-normal/IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,17 +15,17 @@
- +
- - - + + + - - - + + +
diff --git a/res/screen-size-normal/IDL_TOP_MOST_FILE_SELECTION.xml b/res/screen-size-normal/IDL_TOP_MOST_FILE_SELECTION.xml index 64f7539..2b1b3e4 100644 --- a/res/screen-size-normal/IDL_TOP_MOST_FILE_SELECTION.xml +++ b/res/screen-size-normal/IDL_TOP_MOST_FILE_SELECTION.xml @@ -3,10 +3,10 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - + 720
- + @@ -15,12 +15,12 @@
- +
- - - + + +
diff --git a/src/MfFileManageForm.cpp b/src/MfFileManageForm.cpp index a15d379..f610d25 100644 --- a/src/MfFileManageForm.cpp +++ b/src/MfFileManageForm.cpp @@ -234,6 +234,7 @@ FileManageForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousScen _pFolderEntryPM = pcurrentFolderEntryPM; _pBaseItemProvider->SetFolderEntryProvider(this); + _pThumbnailItemProvider->SetFolderEntryProvider(this); if (_editOrShare == FILE_MANAGE_EDIT) { diff --git a/src/MfFileManageWorkerThread.cpp b/src/MfFileManageWorkerThread.cpp index a8bed04..7a1027f 100644 --- a/src/MfFileManageWorkerThread.cpp +++ b/src/MfFileManageWorkerThread.cpp @@ -1687,8 +1687,42 @@ FileManageWorkerThread::GetContentTypeInfo(const String& FilePath) result FileManageWorkerThread::DeleteFileContentDB(String filePath) { + AppLogDebug("Entry"); result r = E_SUCCESS; + FileAttributes fileAttrib; + File::GetAttributes(filePath, fileAttrib); + + if (fileAttrib.IsDirectory()) + { + r = Directory::Remove(filePath, true); + AppLogDebug("remove dir result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"remove dir failed"); + RequestId reqId; + r = ContentManager::ScanDirectory(filePath,true,this,reqId); + AppLogDebug("Scan dir result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"scan directory failed"); + } + else + { + r = File::Remove(filePath); + AppLogDebug("remove file result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"remove file failed"); + r = ContentManager::ScanFile(filePath); + AppLogDebug("scan file result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"scan file failed"); + } + __fileManagingingResult = FILE_MANAGING_RESULT_DELETING_SUCCESS; + AppLogDebug("Exit"); + return r; +CATCH: +__fileManagingingResult = FILE_MANAGING_RESULT_DELETING_FAILED; +AppLogDebug("Catch result %s", GetErrorMessage(r)); +AppLogDebug("Exit"); +r = E_FAILURE; +return r; +/* AppLogDebug("Entry"); + result r = E_SUCCESS; ContentId contentId; ContentManager contentManager; ArrayList* pContentList = null; @@ -1788,13 +1822,14 @@ CATCH: AppLogDebug("Catch result %s", GetErrorMessage(r)); AppLogDebug("Exit"); r = E_FAILURE; - return r; + return r;*/ + } result FileManageWorkerThread::UpdateContentDB(Tizen::Base::String filePath) { - AppLogDebug("Entry"); +/* AppLogDebug("Entry"); result r = E_SUCCESS; ContentId contentId; ArrayList* pContentList = null; @@ -1833,22 +1868,24 @@ CATCH: r = GetLastResult(); AppLogDebug("result is %s", GetErrorMessage(r)); AppLogDebug("Exit"); - return r; - /*AppLogDebug("Enter"); + return r;*/ + AppLogDebug("Enter"); result r = E_SUCCESS; FileAttributes fileAttrib; File::GetAttributes(filePath, fileAttrib); AppLogDebug("file path is %ls", filePath.GetPointer()); if (fileAttrib.IsDirectory()) { - + RequestId reqId; + r = ContentManager::ScanDirectory(filePath,true,this,reqId); + AppLogDebug("Scan dir result %s",GetErrorMessage(r)); } else { r = ContentManager::ScanFile(filePath); AppLogDebug("scan file result %s",GetErrorMessage(r)); } - return r;*/ + return r; } @@ -1968,7 +2005,7 @@ FileManageWorkerThread::RenameFolderEntry(void) __isRenamingActive = true; - r = CopyFile(__filePath,__renameFilePath); + /*r = CopyFile(__filePath,__renameFilePath); TryCatch(r == E_SUCCESS,,"copy failed"); r = DeleteFileContentDB(__filePath); @@ -1977,13 +2014,47 @@ FileManageWorkerThread::RenameFolderEntry(void) if(fileAttrib.IsDirectory()) { __renameFilePath.Append(L"/"); + }*/ + + //result r = E_SUCCESS; + //FileAttributes fileAttrib; + //__renameFilePath.Append(L"/"); + + Directory::Rename(__filePath,__renameFilePath); + File::GetAttributes(__renameFilePath, fileAttrib); + AppLogDebug("file path is %ls", __renameFilePath.GetPointer()); + //RequestId reqId; + //r = ContentManager::ScanDirectory(__renameFilePath,true,this,reqId); + //AppLogDebug("Scan dir result %s",GetErrorMessage(r)); + + if (fileAttrib.IsDirectory()) + { + RequestId reqId; + r = ContentManager::ScanDirectory(__renameFilePath,true,this,reqId); + AppLogDebug("Scan dir result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"scan directory failed"); + + r = ContentManager::ScanDirectory(__filePath,true,this,reqId); + AppLogDebug("Scan dir result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"scan directory failed"); + + } + else + { + r = ContentManager::ScanFile(__renameFilePath); + AppLogDebug("scan file result %s",GetErrorMessage(r)); + + r = ContentManager::ScanFile(__filePath); + AppLogDebug("scan file result %s",GetErrorMessage(r)); + TryCatch(r == E_SUCCESS,,"scan file failed"); } + //return r; __fileManagingingResult = FILE_MANAGING_RENAME_SUCCESS; return r; CATCH: - r = DeleteFile(__renameFilePath); + //r = DeleteFile(__renameFilePath); __fileManagingingResult = FILE_MANAGING_RENAME_FAILED; AppLogDebug("catch result is %s",GetErrorMessage(r)); return r; @@ -2029,8 +2100,8 @@ FileManageWorkerThread::Copy(Tizen::Base::String& sourcePath, Tizen::Base::Strin { destFile.Write(byteToWrite, count); TryCatch(r == E_SUCCESS,,"copy file failed"); - if(!__isRenamingActive) - { + //if(!__isRenamingActive) + //{ percentage = percentage + count; percentageComplete = (percentage * 100) / (toatalsize); @@ -2048,7 +2119,7 @@ FileManageWorkerThread::Copy(Tizen::Base::String& sourcePath, Tizen::Base::Strin pArg->Add(pTotalFileCount); pArg->Add(pPercentageCompletion); Application::GetInstance()->SendUserEvent(ID_COPY_COMPLETE, pArg); - } + //} count = sourceFIle.Read(byteToWrite, BUFFER_SIZE_MAX); } } @@ -2160,9 +2231,9 @@ CATCH: } -/*void +void FileManageWorkerThread::OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r) { AppLogDebug("Enter"); AppLogDebug("Exit"); -}*/ +} diff --git a/src/MfFolderEntryPresentationModel.cpp b/src/MfFolderEntryPresentationModel.cpp index c95983f..0149fbd 100644 --- a/src/MfFolderEntryPresentationModel.cpp +++ b/src/MfFolderEntryPresentationModel.cpp @@ -829,6 +829,12 @@ FolderEntryPresentationModel::SetFolderEntryType(FileType currentType) } void +FolderEntryPresentationModel::SetViewType(AppControlView currentView) +{ + __currentViewType = currentView; +} + +void FolderEntryPresentationModel::UpdateFileListEnteries(const unsigned long events, const Tizen::Base::String& path) { AppLogDebug("Entry"); @@ -1408,6 +1414,18 @@ FolderEntryPresentationModel::CreateTraversalTree(void) pCurrentFolderEntry = null; } } + else if (__entryType == FILE_TYPE_CONTACTS_TYPE) + { + if ( fileExtension.EndsWith(L"vcs") || fileExtension.EndsWith(L"VCS")) + { + __pFolderEntries->Add(pCurrentFolderEntry); + } + else + { + delete pCurrentFolderEntry; + pCurrentFolderEntry = null; + } + } else if (__entryType == FILE_TYPE_OTHER_TYPE) { if (contentType == CONTENT_TYPE_OTHER || r != E_SUCCESS) diff --git a/src/MfMyFilesApp.cpp b/src/MfMyFilesApp.cpp index e83faa3..c956a85 100644 --- a/src/MfMyFilesApp.cpp +++ b/src/MfMyFilesApp.cpp @@ -52,6 +52,7 @@ MyFilesApp::MyFilesApp(void) __currentFileType = FILE_TYPE_ALL; __currentSelectionMode = SELECTION_MODE_SINGE; __currentView = APPCONTROL_VIEW_DEFAULT; + __currentExportFileType = EXPORT_TYPE_CONTACTS; __bImgAppControlLaunched = true; __currentAppControlResult = APP_CTRL_RESULT_FAILED; } @@ -112,11 +113,48 @@ MyFilesApp::OnAppInitialized(void) { if (__operationId.CompareTo("http://tizen.org/appcontrol/operation/pick") == 0) { - __inputSource = APPCONTROL_STATE_SELECTED; - IList* pArgs = new (std::nothrow) ArrayList(); - pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED)); - pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TEMP_FORM), pArgs); - //pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM)); + if (__currentView != APPCONTROL_VIEW_IMPORT && __currentView != APPCONTROL_VIEW_EXPORT) + { + AppLogDebug("Ravi: inside appcontrol"); + __inputSource = APPCONTROL_STATE_SELECTED; + IList* pArgs = new (std::nothrow) ArrayList(); + pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED)); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TEMP_FORM), pArgs); + } + + else if (__currentView == APPCONTROL_VIEW_EXPORT) + { + if (__pResultList == null) + { + __pResultList = new (std::nothrow) HashMap(); + __pResultList->Construct(); + } + ArrayList* pArgs = null; + String currentFilePath; + String headertitle; + pArgs = new (std::nothrow) ArrayList(); + + if (__currentExportFileType == EXPORT_TYPE_CALENDAR) + { + currentFilePath = BasePresentationModel::GetMediaPath(); + currentFilePath.Append("Backup/Calendar/"); + headertitle.Append("Calendar"); + } + if (__currentExportFileType == EXPORT_TYPE_CONTACTS) + { + currentFilePath = BasePresentationModel::GetMediaPath(); + currentFilePath.Append("Backup/Contacts/"); + headertitle.Append("Contacts"); + } + + pArgs->Add(new String (headertitle)); + FolderNavigationPresentationModel::SetCurrentFilePath(currentFilePath); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM), pArgs); + } + else if (__currentView == APPCONTROL_VIEW_IMPORT) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM), null); + } } else { @@ -147,17 +185,42 @@ MyFilesApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) { AppLogDebug("ENTER"); String resultList; + result r = E_SUCCESS; // Deallocate resources allocated by this App for termination. // The App's permanent data and context can be saved via appRegistry. if (__bAppControlEnabled == true) { - result r = E_SUCCESS; - const HashMap* pResultHash = null; - IMapEnumerator* pResultMapEnum = null; - DirectoryEntry* pDirStr = null; - int Count=0; + if (__currentView == APPCONTROL_VIEW_EXPORT) + { + if (__currentAppControlResult == APP_CTRL_RESULT_CANCELED) + { + if (__pResultList != null) + { + __pResultList->RemoveAll(true); + delete __pResultList; + __pResultList = null; + } + r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, null); + } + else + { + resultList = FolderNavigationPresentationModel::GetCurrentPath(); + if (__pResultList != null && resultList.CompareTo("") != 0) + { + __pResultList->Add(new (std::nothrow) String(appcontrolKey), new (std::nothrow) String(resultList)); + } + AppLog("Result added is %S",resultList.GetPointer()); + r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, __pResultList); + } + } + else + { + const HashMap* pResultHash = null; + IMapEnumerator* pResultMapEnum = null; + DirectoryEntry* pDirStr = null; + int Count=0; pResultHash = FolderEntryEditorPresentationModel::GetInstance()->GetCheckedList(); @@ -193,21 +256,21 @@ MyFilesApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) __pResultList->Add(new (std::nothrow) String(appcontroldataKey), new (std::nothrow) String(resultList)); } - if (__currentAppControlResult == APP_CTRL_RESULT_CANCELED) - { - if (__pResultList != null) + if (__currentAppControlResult == APP_CTRL_RESULT_CANCELED) { - __pResultList->RemoveAll(true); - delete __pResultList; - __pResultList = null; + if (__pResultList != null) + { + __pResultList->RemoveAll(true); + delete __pResultList; + __pResultList = null; + } + r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, null); + } + else + { + r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, __pResultList); } - r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, null); - } - else - { - r = AppControlProviderManager::GetInstance()->SendAppControlResult(__currentRequestId, __currentAppControlResult, __pResultList); } - } //Following code stops FolderEntryEditor thread and thumbnail manager thread. Don't remove this code as it's must to gracefully terminate the spawned thread from main threads. @@ -409,6 +472,19 @@ MyFilesApp::GetCurrentView(void) { return __currentView; } + +AppControlState +MyFilesApp::GetCurrentState(void) +{ + return __inputSource; +} + +ExportFileType +MyFilesApp::GetCurrentExportFileType(void) +{ + return __currentExportFileType; +} + void MyFilesApp::SetNotifyListener(INotificationListener* listener) { @@ -521,13 +597,21 @@ MyFilesApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Stri SceneManager* pSceneManager = null; pSceneManager = SceneManager::GetInstance(); - if (pSceneManager != null) + if (pSceneManager != null && __currentView != APPCONTROL_VIEW_IMPORT && __currentView != APPCONTROL_VIEW_EXPORT) { IList* pArgs = new (std::nothrow) ArrayList(); pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED)); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TEMP_FORM), pArgs); //pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM)); } + else if (pSceneManager != null && __currentView == APPCONTROL_VIEW_IMPORT) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_MOST_SELECTION_FORM), null); + } + else if (pSceneManager != null && __currentView == APPCONTROL_VIEW_EXPORT) + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_FOLDER_SELECTION_FORM), null); + } } } diff --git a/src/MfSplitPanelFileManageForm.cpp b/src/MfSplitPanelFileManageForm.cpp index 733e07e..c9f5c85 100644 --- a/src/MfSplitPanelFileManageForm.cpp +++ b/src/MfSplitPanelFileManageForm.cpp @@ -433,6 +433,7 @@ SplitPanelFileManageForm::OnSceneActivatedN(const SceneId& previousSceneId, cons FolderEntryPresentationModel* pcurrentFolderEntryPM = null; int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST; String viewStyleKeyName(L"ListDisplayType"); + int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SPLIT_PANEL_FILE_MANAGE_FORM; DirectoryEntry* pRootDirectory = new DirectoryEntry(); @@ -459,6 +460,12 @@ SplitPanelFileManageForm::OnSceneActivatedN(const SceneId& previousSceneId, cons _pBaseItemProvider->SetFolderEntryProvider(this); } + + if (_pThumbnailItemProvider != null) + { + _pThumbnailItemProvider->SetCreateItemSource(sourceForm); + } + if (previousSceneId == IDSCN_SPLIT_PANEL_FORM) { _currentDirectoryPath = FolderNavigationPresentationModel::GetCurrentPath(); diff --git a/src/MfSplitPanelForm.cpp b/src/MfSplitPanelForm.cpp index 1cdbaa2..89b5748 100644 --- a/src/MfSplitPanelForm.cpp +++ b/src/MfSplitPanelForm.cpp @@ -323,7 +323,7 @@ SplitPanelForm::OnOrientationChanged(const Control& source, OrientationStatus or } void -SplitPanelForm::ChangeOrientationToPortrait() +SplitPanelForm::ChangeOrientationToPortrait(void) { AppLogDebug("ENTER"); SceneManager* pSceneManager = SceneManager::GetInstance(); @@ -718,6 +718,7 @@ SplitPanelForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST; int fileCount = 0; int folderCount = 0; + int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SPLIT_PANEL_FORM; String viewStyleKeyName(L"ListDisplayType"); @@ -751,6 +752,11 @@ SplitPanelForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& _pFilenames = _pFolderEntryPM->GetFolderEntryList(); } + if (_pThumbnailItemProvider) + { + _pThumbnailItemProvider->SetCreateItemSource(sourceForm); + } + //update footer if (_pFilenames->GetCount() == 0) { diff --git a/src/MfSubBaseSelectionForm.cpp b/src/MfSubBaseSelectionForm.cpp index 4bdab7e..4d8a37d 100644 --- a/src/MfSubBaseSelectionForm.cpp +++ b/src/MfSubBaseSelectionForm.cpp @@ -64,6 +64,7 @@ SubBaseSelection::SubBaseSelection(void) _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; @@ -193,7 +194,14 @@ 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; } @@ -225,6 +233,13 @@ SubBaseSelection::GetItemCount(void) pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles); + if (_currentViewStyle == APPCONTROL_VIEW_IMPORT) + { + itemCount = _pFilenames->GetCount(); + } + + else + { if (_pFilenames->GetCount() == 0) { if (_pLabelNumberOfItems->GetShowState() == true) @@ -256,6 +271,7 @@ SubBaseSelection::GetItemCount(void) _pLabelNumberOfItems->SetText(_itemSelectedCount); _pLabelNumberOfItems->Invalidate(true); } + } AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); itemCount = _pFilenames->GetCount(); } @@ -629,7 +645,15 @@ SubBaseSelection::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int 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; @@ -749,3 +773,126 @@ SubBaseSelection::ShowHomeView(void) } } } + +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; +} diff --git a/src/MfSubFolderFileListForm.cpp b/src/MfSubFolderFileListForm.cpp index f11d2a8..143dd7c 100644 --- a/src/MfSubFolderFileListForm.cpp +++ b/src/MfSubFolderFileListForm.cpp @@ -229,8 +229,8 @@ SubFolderFileListForm::OnInitializing(void) _pIconListView = static_cast< IconListView* >(GetControl("IDC_ICONLISTVIEW_SUB_DIRECTORY_THUMBNAILS")); TryCatch(_pIconListView != null, , "__pIconListviewSubThumbnails is Null"); _pIconListView->AddIconListViewItemEventListener(*_pThumbnailItemProvider); - _pIconListView->SetItemProvider(*_pThumbnailItemProvider); _pIconListView->AddTouchEventListener(*this); + _pIconListView->SetItemProvider(*_pThumbnailItemProvider); _pIconListView->SetShowState(false); __pLongPressGestureDetector = new (std::nothrow) TouchLongPressGestureDetector(); @@ -396,6 +396,7 @@ SubFolderFileListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previ int folderCount = 0; int fileCount = 0; + int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SUB_FOLDER_FILE_LIST_FORM; result r = E_SUCCESS; String parentPath; @@ -538,7 +539,15 @@ SubFolderFileListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previ TryCatch(_pFilenames != null, , "Failed to allocate Memory to __pFilenames"); } + + if (_pThumbnailItemProvider != null) + { + _pThumbnailItemProvider->SetCreateItemSource(sourceForm); + _pThumbnailItemProvider->SetFolderEntryProvider(this); + } + SetNextDisplayPath(); + SetHeaderTitleText(__currentDirectoryPath); if (fileCount == 0) { @@ -566,6 +575,13 @@ SubFolderFileListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previ _pFilenames = _pFolderEntryPM->GetFolderEntryList(); TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList"); } + + + if (_pThumbnailItemProvider != null) + { + _pThumbnailItemProvider->SetCreateItemSource(sourceForm); + _pThumbnailItemProvider->SetFolderEntryProvider(this); + } } if (_pFilenames != null && _pFilenames->GetCount() == 0) @@ -1366,6 +1382,7 @@ SubFolderFileListForm::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::Scen } SwitchViewType(); + if (_pFolderEntryPM != null) { _pFolderEntryPM->InitThumbnailManager(); diff --git a/src/MfSubFolderMoveCopy.cpp b/src/MfSubFolderMoveCopy.cpp index 81a0400..910523c 100644 --- a/src/MfSubFolderMoveCopy.cpp +++ b/src/MfSubFolderMoveCopy.cpp @@ -397,6 +397,7 @@ SubFolderMoveCopy::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousS String externalStorage; pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry(); int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST; + int sourceForm = THUMBNAIL_PROVIDER_SOURCEID_SUB_MOVE_COPY_FORM; r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType); AppLogDebug("AppRegistry Get Result: %s", GetErrorMessage(r)); @@ -420,6 +421,11 @@ SubFolderMoveCopy::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousS SceneManager::GetInstance()->AddSceneManagerEventListener(*this); + if (_pThumbnailItemProvider != null) + { + _pThumbnailItemProvider->SetCreateItemSource(sourceForm); + } + if (pArgs != null) { sourceFormOption = *(static_cast< Integer* >(pArgs->GetAt(0))); diff --git a/src/MfSubFolderSelection.cpp b/src/MfSubFolderSelection.cpp index 38c124f..f980009 100644 --- a/src/MfSubFolderSelection.cpp +++ b/src/MfSubFolderSelection.cpp @@ -36,6 +36,7 @@ using namespace Tizen::System; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; +using namespace Tizen::Io; SubFolderSelection::SubFolderSelection(void) : __pReceivedFilename(null) @@ -125,6 +126,7 @@ SubFolderSelection::OnInitializing(void) _selectionMode = ((MyFilesApp*) Application::GetInstance())->GetCurrentSelectionMode(); _currentFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentFileType(); _currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView(); + _currentExportFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentExportFileType(); __pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH")); TryCatch(__pLabelDisplayPath != null, , "Label is Null"); @@ -138,6 +140,7 @@ SubFolderSelection::OnInitializing(void) //pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome); pAppResource->GetString(L"IDS_COM_POP_ATTACH", buttonAttach); pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel); + pAppResource->GetString(L"IDS_EXPORT_HERE", buttonExportHere); //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp); pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888); pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); @@ -202,7 +205,7 @@ SubFolderSelection::OnInitializing(void) { _pExport = new (std::nothrow) FooterItem(); r = _pExport->Construct(IDA_BTN_EXPORT); - _pExport->SetText(buttonExport); + _pExport->SetText(buttonExportHere); /* _pCreateFolder = new (std::nothrow) FooterItem(); r = _pCreateFolder->Construct(IDA_BTN_CREATE_FOLDER); @@ -240,10 +243,13 @@ SubFolderSelection::OnInitializing(void) //_pFooter->AddItem(*_pCancel); _pFooter->AddActionEventListener(*this); - _pFooter->SetItemEnabled(0, false); _pFooter->SetBackButton(); - _pFooter->Invalidate(true); SetFormBackEventListener(this); + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + _pFooter->SetItemEnabled(0, false); + } + _pFooter->Invalidate(true); } CreateLabelControl(); @@ -258,10 +264,13 @@ SubFolderSelection::OnInitializing(void) _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath(); _rootStoragePath = BasePresentationModel::GetSdCardPath(); + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { _pFolderEntryPM->SetFolderEntryType(_currentFileType); _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); _pFilenames = _pFolderEntryPM->GetFolderEntryList(); TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList"); + } _pThumbnailManager = ThumbnailManager::GetInstance(); TryCatch(_pThumbnailManager != null, , "Thumbnail Manager not found!"); @@ -510,7 +519,10 @@ SubFolderSelection::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& li } else { + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { _pFooter->SetItemEnabled(0, false); + } } if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if @@ -580,6 +592,15 @@ SubFolderSelection::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previous __pReceivedFilename->Clear(); __pReceivedFilename->Append(*static_cast(pArgs->GetAt(0))); } + else + { + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + String headerDisplayPath = FolderNavigationPresentationModel::GetCurrentPath(); + SetHeaderTitleText(headerDisplayPath); + __pReceivedFilename->Clear(); + } + } ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this); @@ -671,7 +692,11 @@ SubFolderSelection::ShowParentDirectoryView(void) } else { - ResetFooter(); + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + ResetFooter(); + } + if (_pAudioPlayer != null) { if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED) @@ -1005,6 +1030,7 @@ SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId String external; String received_Filepath; int receivedStorageType = -1; + result r = E_SUCCESS; Tizen::Base::String parentPath; pAppResource = Application::GetInstance()->GetAppResource(); @@ -1023,30 +1049,73 @@ SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId _pListView->SetShowState(true); } - if (__pReceivedFilename != null) + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT) + { + AppLogDebug("inside view check"); + String backupPath; + String backupCalendarpath; + String backupContactpath; + backupPath = BasePresentationModel::GetMediaPath(); + backupPath.Append("Backup"); + if (!File::IsFileExist(backupPath)) { - //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0)); - received_Filepath = FolderNavigationPresentationModel::GetCurrentPath(); - receivedStorageType = FolderNavigationPresentationModel::GetStorageType(); + Directory::Create(backupPath, true); + } - if (__pReceivedFilename != null) + if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CALENDER_TYPE) + || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CALENDAR)) + { + backupCalendarpath.Append(backupPath); + backupCalendarpath.Append("/"); + backupCalendarpath.Append("Calendar"); + if (!File::IsFileExist(backupCalendarpath)) { - _pHeader = GetHeader(); - if (_pHeader != null) - { - _pHeader->SetTitleText(*__pReceivedFilename); - _pHeader->Invalidate(true); - } + r = Directory::Create(backupCalendarpath, true); + AppLogDebug("Result is %s",GetErrorMessage(r)); } - if (received_Filepath != null) + } + if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CONTACTS_TYPE) + || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CONTACTS)) + { + backupContactpath.Append(backupPath); + backupContactpath.Append("/"); + backupContactpath.Append("Contacts"); + if (!File::IsFileExist(backupContactpath)) { + r = Directory::Create(backupContactpath, true); + AppLogDebug("Result is %s",GetErrorMessage(r)); + } + } - //Clear the rootMediaPath and set it to the received filepath. - if (_rootMediaPath != null) - { - _rootMediaPath.Clear(); - _rootMediaPath.Append(received_Filepath); - } + /*_pFolderEntryPM->SetFolderEntryType(_currentFileType); + _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + */ + } + if (__pReceivedFilename != null) + { + //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0)); + received_Filepath = FolderNavigationPresentationModel::GetCurrentPath(); + receivedStorageType = FolderNavigationPresentationModel::GetStorageType(); + + if (__pReceivedFilename != null && !__pReceivedFilename->IsEmpty()) + { + _pHeader = GetHeader(); + if (_pHeader != null) + { + _pHeader->SetTitleText(*__pReceivedFilename); + _pHeader->Invalidate(true); + } + } + if (received_Filepath != null) + { + + //Clear the rootMediaPath and set it to the received filepath. + //if (_rootMediaPath != null) + { + _rootMediaPath.Clear(); + _rootMediaPath.Append(received_Filepath); + } if (__pLabelDisplayPath != null) { diff --git a/src/MfThumbnailItemProviderAndListener.cpp b/src/MfThumbnailItemProviderAndListener.cpp index c80e913..227542d 100644 --- a/src/MfThumbnailItemProviderAndListener.cpp +++ b/src/MfThumbnailItemProviderAndListener.cpp @@ -69,18 +69,6 @@ ThumbnailItemProviderAndListener::ThumbnailItemProviderAndListener(Tizen::Base:: __storageType = MEMORY_TYPE_NONE; return; - - -#if 0 - CATCH: - if (__pFolderEntryPM != null) - { - delete __pFolderEntryPM; - __pFolderEntryPM = null; - } -#else - return; -#endif } result @@ -89,20 +77,13 @@ ThumbnailItemProviderAndListener::Construct(FolderEntryPresentationModel* pModel result res = E_SUCCESS; TryCatch(pModel != null, , "Received PresentataionModel is null!"); -#if 0 - __pContentBrowser = pModel; -#else __pFolderEntryPM = __pProviderPM->GetFolderEntryPresentationModel(); -#endif - //TryCatch(__pContentBrowser!=null, , "Presentataion Model is null!"); CATCH: return res; } ThumbnailItemProviderAndListener::~ThumbnailItemProviderAndListener(void) { - //Empty Implementation - if (__pRenameBitmap != null) { delete __pRenameBitmap; @@ -360,8 +341,7 @@ ThumbnailItemProviderAndListener::CreateItem(int index) pItem = new (std::nothrow) IconListViewItem(); r = pItem->Construct(*pListBitmap, &fileName); - source = __pProviderPM->GetFolderEntryPresentationModel()->GetSourceForm(); - if (source == CREATE_ITEM_SOURCE_FILE_MANAGE_FORM || source == CREATE_ITEM_SOURCE_SPLIT_PANEL_FILE_MANAGE_FORM) + if (__sourceForm == THUMBNAIL_PROVIDER_SOURCEID_FILE_MANAGE_FORM || __sourceForm == THUMBNAIL_PROVIDER_SOURCEID_SPLIT_PANEL_FILE_MANAGE_FORM) { Bitmap* __pRenameBitmap = MfUtility::MergeBitmapN(IDB_RENAME_OUTER_CIRCLE, IDB_RENAME, ICON_LISTVIEW_RENAME_BOTTON_WIDTH, ICON_LISTVIEW_RENAME_BOTTON_HEIGHT); if (__pRenameBitmap != null) @@ -372,7 +352,7 @@ ThumbnailItemProviderAndListener::CreateItem(int index) } - if (source == CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM) + if (__sourceForm == THUMBNAIL_PROVIDER_SOURCEID_CATEGORY_SEARCH_FORM) { Bitmap* pGotoLocation = MfUtility::MergeBitmapN(IDB_CATEGORY_GO_TO_LOCATION_BG, IDB_CATEGORY_GO_TO_LOCATION, ICON_LISTVIEW_RENAME_BOTTON_WIDTH, ICON_LISTVIEW_RENAME_BOTTON_HEIGHT); if (pGotoLocation != null) @@ -532,15 +512,6 @@ ThumbnailItemProviderAndListener::SetSourceFromOption(int sourceFromOption) } -result -ThumbnailItemProviderAndListener::SetRootPath(const String& rootMediaPath) -{ - if (!rootMediaPath.IsEmpty()) - { - __rootMediaPath = rootMediaPath; - } - return E_SUCCESS; -} void ThumbnailItemProviderAndListener::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData) @@ -629,3 +600,9 @@ ThumbnailItemProviderAndListener::OnFileEventOccured(const unsigned long events, { //Empty Implementation } + +void +ThumbnailItemProviderAndListener::SetCreateItemSource(int createItemSource) +{ + __sourceForm = createItemSource; +} diff --git a/src/MfTopLevelFolderFileListForm.cpp b/src/MfTopLevelFolderFileListForm.cpp index 83671ab..5fb07c3 100644 --- a/src/MfTopLevelFolderFileListForm.cpp +++ b/src/MfTopLevelFolderFileListForm.cpp @@ -728,6 +728,7 @@ TopLevelFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes:: String deviceSateSdCard; String mounted = sdCardStatusMounted; String unmounted = sdCardStatusUnmounted; + AppControlState currentState; #if 0 String deviceSateUSBStorage; @@ -765,7 +766,7 @@ TopLevelFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes:: __listItemCount = __pFolderList->GetCount(); - if (deviceSateSdCard == mounted) + if (deviceSateSdCard == mounted && __listItemCount < 2) { pSDCard = new (std::nothrow) String(sdCardStorage); @@ -792,35 +793,37 @@ TopLevelFolderFileListForm::OnSceneTransitionCompleted(const Tizen::Ui::Scenes:: _pFooter = GetFooter(); + currentState = ((MyFilesApp*) Application::GetInstance())->GetCurrentState(); - if (CheckSearchHistory()) + if (currentState != APPCONTROL_STATE_SELECTED) { - if (_pFooter != null) + if (CheckSearchHistory()) { - _pFooter->RemoveItemAt(0); - _pFooter->Invalidate(true); + if (_pFooter != null) + { + _pFooter->RemoveItemAt(0); + _pFooter->Invalidate(true); + } } - } - else - { - if (_pFooter != null) + else { - footerItemCount = _pFooter->GetItemCount(); - - if (footerItemCount != 1) + if (_pFooter != null) { - footerItemSearch.Construct(IDA_CONTEXT_MENU_BTN_SEARCH); - footerItemSearch.SetText(buttonSearch); - _pFooter->AddItem(footerItemSearch); - _pFooter->Invalidate(true); + footerItemCount = _pFooter->GetItemCount(); + + if (footerItemCount != 1) + { + footerItemSearch.Construct(IDA_CONTEXT_MENU_BTN_SEARCH); + footerItemSearch.SetText(buttonSearch); + _pFooter->AddItem(footerItemSearch); + _pFooter->Invalidate(true); + } } } } SwitchViewType(); - } - void TopLevelFolderFileListForm::OnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status) { diff --git a/src/MfTopMostFileSelectionForm.cpp b/src/MfTopMostFileSelectionForm.cpp index 5a63435..550e749 100644 --- a/src/MfTopMostFileSelectionForm.cpp +++ b/src/MfTopMostFileSelectionForm.cpp @@ -219,6 +219,7 @@ TopMostFileSelectionForm::OnInitializing(void) if (_pHeader != null) { _pHeader->SetButton(BUTTON_POSITION_RIGHT, __pCheckButtonSelectAll); + _pHeader->AddActionEventListener(*this); } } else @@ -261,7 +262,11 @@ TopMostFileSelectionForm::OnInitializing(void) SetFormBackEventListener(this); } - CreateLabelControl(); + + if (_currentViewStyle != APPCONTROL_VIEW_IMPORT) + { + CreateLabelControl(); + } __defaultListViewBounds = _pListView->GetBounds(); @@ -276,6 +281,7 @@ TopMostFileSelectionForm::OnInitializing(void) FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath); _pFolderEntryPM->SetFolderEntryType(_currentFileType); + _pFolderEntryPM->SetViewType(_currentViewStyle); _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); _pFilenames = _pFolderEntryPM->GetFolderEntryList(); TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList"); @@ -290,7 +296,7 @@ TopMostFileSelectionForm::OnInitializing(void) if (_currentViewStyle == APPCONTROL_VIEW_IMPORT) { - r = _pLabelNumberOfItems->SetShowState(false); + //r = _pLabelNumberOfItems->SetShowState(false); _pHeader->SetTitleText(importText); _pHeader->Invalidate(true); @@ -527,6 +533,7 @@ TopMostFileSelectionForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListVi //listView.SetItemChecked(0, false); //__pCheckButtonSelectAll->SetSelected(false); _pFileManager->RemoveCheckedListEntry(index); + __isSelectAll = false; } else //start of item selected true else { @@ -553,13 +560,19 @@ TopMostFileSelectionForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListVi } }*/ _pFooter->SetItemEnabled(0, true); + + if (selectedItemsCount == _pFilenames->GetCount()) + { + __isSelectAll = true; + } } else { _pFooter->SetItemEnabled(0, false); + __isSelectAll = false; } - if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if + if (_selectionMode == SELECTION_MODE_MULTIPLE && _currentViewStyle != APPCONTROL_VIEW_IMPORT) // start of MULTIPLE_MODE_SELECTION if { if (selectedItemsCount > 0) { @@ -586,11 +599,6 @@ TopMostFileSelectionForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListVi return; CATCH: r = GetLastResult(); - /*if (_pFolderEntryPM != null) - { - delete _pFolderEntryPM; - _pFolderEntryPM = null; - }*/ AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); } @@ -625,8 +633,6 @@ TopMostFileSelectionForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& pr displayPath.Append("/"); pAppResource->GetString(L"IDS_COM_OPT_IMPORT", importText); - //pAppResource->GetString(L"IDS_MOUNTED", mounted); - //pAppResource->GetString(L"IDS_INSERTED", inserted); //Not required to get from Resource XML pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", headerTextMemCard); pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", headerTextExternal); @@ -677,10 +683,6 @@ TopMostFileSelectionForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& pr } } } -/* else - { - //r = CreateHeaderControls(); - }*/ if (pTabList != null) { @@ -710,24 +712,52 @@ TopMostFileSelectionForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& pr if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT) { String backupPath; + String backupCalendarpath; + String backupContactpath; backupPath = BasePresentationModel::GetMediaPath(); backupPath.Append("Backup"); if (!File::IsFileExist(backupPath)) { Directory::Create(backupPath, true); } + + if (_currentFileType == FILE_TYPE_CALENDER_TYPE) + { + backupCalendarpath.Append(backupPath); + backupCalendarpath.Append("/"); + backupCalendarpath.Append("Calendar"); + if (!File::IsFileExist(backupCalendarpath)) + { + Directory::Create(backupCalendarpath, true); + } + } + if (_currentFileType == FILE_TYPE_CONTACTS_TYPE) + { + backupContactpath.Append(backupPath); + backupContactpath.Append("/"); + backupContactpath.Append("Contacts"); + if (!File::IsFileExist(backupContactpath)) + { + Directory::Create(backupContactpath, true); + } + } } parentPath.Append(_rootMediaPath); - if (_pFolderEntryPM != null) + if (_pFolderEntryPM != null && _currentViewStyle != APPCONTROL_VIEW_IMPORT) { _pFolderEntryPM->SetFolderEntryPath(parentPath); _pFilenames = _pFolderEntryPM->GetFolderEntryList(); TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList"); } - + else if (_currentViewStyle == APPCONTROL_VIEW_IMPORT) + { + _pFolderEntryPM->CreateStack(); + _pFolderEntryPM->CreateTraversalTree(); + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + } FolderNavigationPresentationModel::SetCurrentFilePath(parentPath); } @@ -791,103 +821,6 @@ TopMostFileSelectionForm::OnActionPerformed(const Tizen::Ui::Control& source, in switch (actionId) { -/* - case IDA_TABBAR_ITEM_PHONE: - { - String displayPath; - String currentPath; - bool enableUpdate = false; - - displayPath = defaultPhoneBody; - displayPath.Append("/"); - currentPath = FolderNavigationPresentationModel::GetCurrentPath(); - - if (!currentPath.StartsWith(mediaPath, 0)) - { - enableUpdate = true; - } - - if (enableUpdate) - { - _rootMediaPath.Clear(); - _rootMediaPath.Append(mediaPath); - - ResetFooter(); - - if (_pFolderEntryPM != null) - { - _pFolderEntryPM->SetFolderEntryPath(mediaPath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - } - - if (_pListView != null) - { - _pListView->UpdateList(); - } - - FolderNavigationPresentationModel::SetCurrentFilePath(mediaPath); - FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE); - //Invalidate(true); - } - } - break; -*/ - -/* case IDA_TABBAR_ITEM_SD_CARD: - { - String displayPath; - displayPath = defaultSdCardBody; - displayPath.Append(L"/"); - - _rootMediaPath.Clear(); - _rootMediaPath.Append(storagePath); - - ResetFooter(); - - if (_pFolderEntryPM != null) - { - _pFolderEntryPM->SetFolderEntryPath(storagePath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - } - - if (_pListView != null) - { - _pListView->UpdateList(); - } - - FolderNavigationPresentationModel::SetCurrentFilePath(storagePath); - FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD); - ResetFooter(); - //Invalidate(true); - } - break; - - case IDA_TABBAR_ITEM_USB: - { - String displayPath; - displayPath = defaultExternalStorageBody; - displayPath.Append("/"); - - _rootMediaPath.Clear(); - _rootMediaPath.Append(usbPath); - - if (_pFolderEntryPM != null) - { - _pFolderEntryPM->SetFolderEntryPath(usbPath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - } - - if (_pListView != null) - { - _pListView->UpdateList(); - } - - FolderNavigationPresentationModel::SetCurrentFilePath(usbPath); - FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL); - //Invalidate(true); - } - break;*/ - case IDA_BTN_MORE: { __pMoreContextMenu->RemoveAllItems(); @@ -954,6 +887,11 @@ TopMostFileSelectionForm::OnActionPerformed(const Tizen::Ui::Control& source, in _pFooter->Invalidate(true); } } + + if (_pListView != null) + { + _pListView->Invalidate(true); + } } break; @@ -1159,138 +1097,6 @@ TopMostFileSelectionForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceT OnDeviceChange(currentDeviceType, state); } -/* -result -TopMostFileSelectionForm::CreateHeaderControls(ArrayList* pExtraHeaderItemList) -{ - AppLogDebug("ENTER"); - Header* pHeader = GetHeader(); - Bitmap* pPhoneIcon = null; - Bitmap* pSDCardIcon = null; - Bitmap* pUsbIcon = null; - - Bitmap* pPhoneIconPressed = null; - Bitmap* pSDCardIconPressed = null; - Bitmap* pUsbIconPressed = null; - - String headerDisplayPhone; - String headerDisplayMfMyFilesApp; - String headerTextMemCard; - String headerTextExternal; - result r = E_SUCCESS; - - AppResource* pAppResource = null; - pAppResource = UiApp::GetInstance()->GetAppResource(); - TryCatch(pAppResource != null, , "Failed to Fetch the AppResource"); - - pAppResource->GetString(L"IDS_MF_TAB_PHONE", headerDisplayPhone); - pAppResource->GetString(L"IDS_COM_BODY_MY_FILES", headerDisplayMfMyFilesApp); - pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", headerTextMemCard); - pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", headerTextExternal); - - pPhoneIcon = pAppResource->GetBitmapN(IDB_PHONE_HEADER_TAB, BITMAP_PIXEL_FORMAT_ARGB8888); - pSDCardIcon = pAppResource->GetBitmapN(IDB_SDCARD_HEADER_TAB, BITMAP_PIXEL_FORMAT_ARGB8888); - pUsbIcon = pAppResource->GetBitmapN(IDB_EXTERNAL_HEADER_TAB, BITMAP_PIXEL_FORMAT_ARGB8888); - - pPhoneIconPressed = pAppResource->GetBitmapN(IDB_PHONE_HEADER_TAB_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888); - pSDCardIconPressed = pAppResource->GetBitmapN(IDB_SDCARD_HEADER_TAB_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888); - pUsbIconPressed = pAppResource->GetBitmapN(IDB_EXTERNAL_HEADER_TAB_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888); - - if (pPhoneIconPressed && pSDCardIconPressed && pUsbIconPressed) - { - AppLogDebug("TopMostFileSelectionForm::CreateHeaderControls: Pressed icons are not null:%s", GetErrorMessage(GetLastResult())); - } - - if (pHeader != null) - { - if (pExtraHeaderItemList != null && pExtraHeaderItemList->GetCount() > 0) - { - pHeader->RemoveAllItems(); - pHeader->SetStyle(HEADER_STYLE_TAB); - - HeaderItem headerItemPhone; - headerItemPhone.Construct(IDA_TABBAR_ITEM_PHONE); - headerItemPhone.SetText(headerDisplayPhone); - headerItemPhone.SetIcon(HEADER_ITEM_STATUS_NORMAL, pPhoneIcon); - headerItemPhone.SetIcon(HEADER_ITEM_STATUS_PRESSED, pPhoneIconPressed); - headerItemPhone.SetIcon(HEADER_ITEM_STATUS_SELECTED, pPhoneIconPressed); - r = pHeader->AddItem(headerItemPhone); - TryCatch(r == E_SUCCESS, , "Failed to add header item"); - - for (int headerItemCount = 0; headerItemCount < pExtraHeaderItemList->GetCount(); headerItemCount++) - { - HeaderItem headerItem; - String* PHeaderItemText = static_cast< String* >(pExtraHeaderItemList->GetAt(headerItemCount)); - if (PHeaderItemText != null) - { - if (PHeaderItemText->CompareTo(headerTextMemCard) == 0) - { - headerItem.Construct(IDA_TABBAR_ITEM_SD_CARD); - headerItem.SetIcon(HEADER_ITEM_STATUS_NORMAL, pSDCardIcon); - headerItem.SetIcon(HEADER_ITEM_STATUS_SELECTED, pSDCardIconPressed); - headerItem.SetIcon(HEADER_ITEM_STATUS_PRESSED, pSDCardIconPressed); - } - else if (PHeaderItemText->CompareTo(headerTextExternal) == 0) - { - headerItem.Construct(IDA_TABBAR_ITEM_USB); - headerItem.SetIcon(HEADER_ITEM_STATUS_NORMAL, pUsbIcon); - headerItem.SetIcon(HEADER_ITEM_STATUS_PRESSED, pUsbIconPressed); - headerItem.SetIcon(HEADER_ITEM_STATUS_SELECTED, pUsbIconPressed); - } - - headerItem.SetText(*PHeaderItemText); - } - r = pHeader->AddItem(headerItem); - TryCatch(r == E_SUCCESS, , "Failed to add header item"); - } - pHeader->AddActionEventListener(*this); - } - else - { - pHeader->RemoveAllItems(); - pHeader->SetStyle(HEADER_STYLE_TITLE); - r = pHeader->SetTitleText(headerDisplayMfMyFilesApp); - pHeader->Invalidate(true); - } - } - - if (pPhoneIcon != null) - { - delete pPhoneIcon; - } - - if (pSDCardIcon != null) - { - delete pSDCardIcon; - } - - if (pUsbIcon != null) - { - delete pUsbIcon; - } - - AppLogDebug("EXIT: r = %s", GetErrorMessage(r)); - return E_SUCCESS; - -CATCH: - if (pPhoneIcon != null) - { - delete pPhoneIcon; - } - - if (pSDCardIcon != null) - { - delete pSDCardIcon; - } - - if (pUsbIcon != null) - { - delete pUsbIcon; - } - return r; -} -*/ - void TopMostFileSelectionForm::LoadSubDirectoryForm(Tizen::Base::String& fullPath, Tizen::Base::String& fileName) { -- 2.7.4