--- /dev/null
+#ifndef _APPRESOURCEID_H_
+#define _APPRESOURCEID_H_
+
+extern const wchar_t* IDL_BASE_FORM;
+extern const wchar_t* IDL_CATEGORY_SEARCH;
+extern const wchar_t* IDL_CREATE_FOLDER;
+extern const wchar_t* IDL_DETAIL_FORM;
+extern const wchar_t* IDL_EDIT;
+extern const wchar_t* IDL_MAIN_FORM;
+extern const wchar_t* IDL_ROOT_DIRECTORY;
+extern const wchar_t* IDL_SPLIT_PANEL;
+extern const wchar_t* IDL_SPLIT_PANEL_FILE_MANAGER;
+extern const wchar_t* IDL_SUB_DIRECTORY;
+extern const wchar_t* IDL_SUB_FOLDER_FILE_SELECTION;
+extern const wchar_t* IDL_SUB_FOLDER_MOVE_COPY;
+extern const wchar_t* IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE;
+extern const wchar_t* IDL_TOP_MOST_FILE_SELECTION;
+extern const wchar_t* IDL_TOP_MOST_MOVE_COPY;
+
+#endif // _APPRESOURCEID_H_
: public Tizen::App::IAppControlProviderEventListener\r
, public Tizen::App::UiApp\r
, public Tizen::System::IScreenEventListener\r
+ , public Tizen::System::ISettingEventListener\r
{\r
public:\r
//! Constructor of the class.\r
\r
virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);\r
\r
+ virtual void OnSettingChanged(Tizen::Base::String& key) ;\r
void InitializeListeners(void);\r
public:\r
/**\r
private:\r
bool __bAppControlEnabled;\r
bool __bImgAppControlLaunched;\r
+ Tizen::Base::String __currentDisplayLanguage;\r
\r
RequestId __currentRequestId;\r
Tizen::App::AppCtrlResult __currentAppControlResult;\r
\r
private:\r
bool __searchToStop;\r
+ bool __isSDCardSearchedAlready;\r
\r
Tizen::Base::Collection::ArrayList* __pFolderSearchStartedMessage;\r
Tizen::Base::String __folderToSearch;\r
--- /dev/null
+#ifndef _RESOURCEAFX_H_\r
+#define _RESOURCEAFX_H_\r
+\r
+//static const wchar_t* IDC_LISTVIEW_TOP_LEVEL_DIR_COPY_MOVE = L"IDC_LISTVIEW_TOP_LEVEL_DIR_COPY_MOVE";\r
+//static const wchar_t* IDC_LISTVIEW_TEMP_FORM = L"IDC_LISTVIEW_TEMP_FORM";\r
+\r
+#endif // _RESOURCEAFX_H_\r
--- /dev/null
+#include "AppResourceId.h"
+
+const wchar_t* IDL_BASE_FORM = L"IDL_BASE_FORM";
+const wchar_t* IDL_CATEGORY_SEARCH = L"IDL_CATEGORY_SEARCH";
+const wchar_t* IDL_CREATE_FOLDER = L"IDL_CREATE_FOLDER";
+const wchar_t* IDL_DETAIL_FORM = L"IDL_DETAIL_FORM";
+const wchar_t* IDL_EDIT = L"IDL_EDIT";
+const wchar_t* IDL_MAIN_FORM = L"IDL_MAIN_FORM";
+const wchar_t* IDL_ROOT_DIRECTORY = L"IDL_ROOT_DIRECTORY";
+const wchar_t* IDL_SPLIT_PANEL = L"IDL_SPLIT_PANEL";
+const wchar_t* IDL_SPLIT_PANEL_FILE_MANAGER = L"IDL_SPLIT_PANEL_FILE_MANAGER";
+const wchar_t* IDL_SUB_DIRECTORY = L"IDL_SUB_DIRECTORY";
+const wchar_t* IDL_SUB_FOLDER_FILE_SELECTION = L"IDL_SUB_FOLDER_FILE_SELECTION";
+const wchar_t* IDL_SUB_FOLDER_MOVE_COPY = L"IDL_SUB_FOLDER_MOVE_COPY";
+const wchar_t* IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE = L"IDL_TOP_LEVEL_DIRECTORY_COPY_MOVE";
+const wchar_t* IDL_TOP_MOST_FILE_SELECTION = L"IDL_TOP_MOST_FILE_SELECTION";
+const wchar_t* IDL_TOP_MOST_MOVE_COPY = L"IDL_TOP_MOST_MOVE_COPY";
if (__pFtTitle == null)\r
return;\r
\r
- if (__isSearchedTextPresent && __searchedText.GetLength() > 0)\r
- {\r
- String tempTitleString = __contentTitle;\r
- tempTitleString.ToLowerCase();\r
- bool found = false;\r
- __searchedText.ToLowerCase();\r
- String temp1 = L"", temp2 = L"", temp3 = L"";\r
-\r
- if (tempTitleString.StartsWith(__searchedText, 0))\r
- {\r
- found = true;\r
- __contentTitle.SubString(0, __searchedText.GetLength(), temp1);\r
- __contentTitle.SubString(__searchedText.GetLength(), __contentTitle.GetLength() - __searchedText.GetLength(), temp2);\r
+ __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);\r
+ __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);\r
\r
- Color titleColor = Color(42, 137, 194);\r
- __pFtTitle->AddText(temp1, FONT_MAIN, titleColor);\r
- __pFtTitle->AddText(temp2, FONT_MAIN, COLOR_TITLE);\r
- }\r
- else\r
- {\r
- int index = -1;\r
- tempTitleString.IndexOf(__searchedText, 0, index);\r
- if (index > -1)\r
- {\r
- __contentTitle.SubString(0, index, temp1);\r
- __contentTitle.SubString(index, __searchedText.GetLength(), temp2);\r
- __contentTitle.SubString(index + __searchedText.GetLength(), tempTitleString.GetLength() - __searchedText.GetLength() - index, temp3);\r
- }\r
- else\r
- {\r
- __contentTitle.SubString(0, tempTitleString.GetLength(), temp1);\r
- }\r
- __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);\r
- Color titleColor = Color(42, 137, 194);\r
- if (temp1.GetLength() > 0)\r
- __pFtTitle->AddText(temp1, FONT_MAIN, COLOR_TITLE);\r
- if (temp2.GetLength() > 0)\r
- __pFtTitle->AddText(temp2, FONT_MAIN, titleColor);\r
- if (temp3.GetLength() > 0)\r
- __pFtTitle->AddText(temp3, FONT_MAIN, COLOR_TITLE);\r
- }\r
- }\r
- else\r
- {\r
- __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);\r
- __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);\r
- }\r
AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);\r
AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
}\r
__pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);\r
if (__pFtTitle == null)\r
return;\r
+ if (__searchedText.GetLength() > 0)\r
+ {\r
+ String tempTitleString = __contentTitle;\r
+ tempTitleString.ToLowerCase();\r
+ bool found = false;\r
+ __searchedText.ToLowerCase();\r
+ String temp1 = L"", temp2 = L"", temp3 = L"";\r
+\r
+ if (tempTitleString.StartsWith(__searchedText, 0))\r
+ {\r
+ found = true;\r
+ __contentTitle.SubString(0, __searchedText.GetLength(), temp1);\r
+ __contentTitle.SubString(__searchedText.GetLength(), __contentTitle.GetLength() - __searchedText.GetLength(), temp2);\r
+\r
+ Color titleColor = Color(42, 137, 194);\r
+ __pFtTitle->AddText(temp1, FONT_MAIN, titleColor);\r
+ __pFtTitle->AddText(temp2, FONT_MAIN, COLOR_TITLE);\r
+ }\r
+ else\r
+ {\r
+ int index = -1;\r
+ tempTitleString.IndexOf(__searchedText, 0, index);\r
+ if (index > -1)\r
+ {\r
+ __contentTitle.SubString(0, index, temp1);\r
+ __contentTitle.SubString(index, __searchedText.GetLength(), temp2);\r
+ __contentTitle.SubString(index + __searchedText.GetLength(), tempTitleString.GetLength() - __searchedText.GetLength() - index, temp3);\r
+ }\r
+ else\r
+ {\r
+ __contentTitle.SubString(0, tempTitleString.GetLength(), temp1);\r
+ }\r
+ __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);\r
+ Color titleColor = Color(42, 137, 194);\r
+ if (temp1.GetLength() > 0)\r
+ __pFtTitle->AddText(temp1, FONT_MAIN, COLOR_TITLE);\r
+ if (temp2.GetLength() > 0)\r
+ __pFtTitle->AddText(temp2, FONT_MAIN, titleColor);\r
+ if (temp3.GetLength() > 0)\r
+ __pFtTitle->AddText(temp3, FONT_MAIN, COLOR_TITLE);\r
+ }\r
+ }\r
+ else\r
+ {\r
__pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);\r
+ }\r
AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);\r
\r
__pFtFilepath = new (std::nothrow) FormatedText(nMultiTextWidth);\r
__bLoadBitmap = true;\r
//__DummyImage= content.__DummyImage;\r
__DummyImage= true;\r
+ creationDate = content.creationDate;\r
\r
#if 0\r
__pEntryBitmap = content.__pEntryBitmap;\r
this->__fileExtension = source.__fileExtension;\r
//this->__DummyImage = source.__DummyImage;\r
this->__DummyImage = true;\r
+ this->creationDate = source.creationDate;\r
\r
#if 0\r
this->__pEntryBitmap = source.__pEntryBitmap;\r
__isRenamingActive = true;
- /*r = CopyFile(__filePath,__renameFilePath);
- TryCatch(r == E_SUCCESS,,"copy failed");
+ bool isScanFailed = false;
- r = DeleteFileContentDB(__filePath);
+ r = Directory::Rename(__filePath,__renameFilePath);
+ TryCatch(r == E_SUCCESS,,"Rename file failed");
File::GetAttributes(__renameFilePath, fileAttrib);
- 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);
if (fileAttrib.IsDirectory())
{
+ isScanFailed = true;
+
RequestId reqId;
r = ContentManager::ScanDirectory(__renameFilePath,true,this,reqId);
AppLogDebug("Scan dir result %s",GetErrorMessage(r));
}
else
{
+ isScanFailed = true;
+
r = ContentManager::ScanFile(__renameFilePath);
AppLogDebug("scan file result %s",GetErrorMessage(r));
TryCatch(r == E_SUCCESS,,"scan file failed");
r = ContentManager::ScanFile(__filePath);
- AppLogDebug("scan file result %s",GetErrorMessage(r));
+ AppLogDebug("scan file result %s",GetErrorMessage(r));
TryCatch(r == E_SUCCESS,,"scan file failed");
}
//return r;
//r = DeleteFile(__renameFilePath);
__fileManagingingResult = FILE_MANAGING_RENAME_FAILED;
AppLogDebug("catch result is %s",GetErrorMessage(r));
- return r;
+ if(isScanFailed)
+ {
+ return E_SUCCESS;
+ }
+ else
+ {
+ return r;
+ }
}
result
{
DirEntry currentDirEntry = pCurrentDirectoryEnum->GetCurrentDirEntry();
String directoryName = currentDirEntry.GetName();
+
+ DirectoryEntry* pCurrentFolderEntry = new (std::nothrow) DirectoryEntry();
+ String fullPath = *currentDirectoryPath+directoryName;
+ pCurrentFolderEntry->SetFileExtension(File::GetFileExtension(fullPath));
+ fileExtensionResult = GetLastResult();
+ fileExtensionLength = pCurrentFolderEntry->GetFileExtension().GetLength();
+ if(fileExtensionLength != 0)
+ {
+ directoryName.Remove(directoryName.GetLength() - fileExtensionLength - 1, fileExtensionLength + 1);
+ }
+ pCurrentFolderEntry->SetFullFilePath(fullPath);
+ pCurrentFolderEntry->SetFileName(directoryName);
+ pCurrentFolderEntry->SetCheckDirectory(false);
+
if(currentDirEntry.IsDirectory() && directoryName != "." && directoryName != "..")
{
+ AppLogDebug("SearchPresentationModel::Search::");
+ if (__sourceForm == CREATE_ITEM_SOURCE_SEARCH_FORM)
+ {
+ AppLogDebug("SearchPresentationModel::Search::%S", pCurrentFolderEntry->GetFullFilePath().GetPointer());
+ pCurrentFolderEntry->SetCheckDirectory(true);
+ __pFolderEntries->Add(pCurrentFolderEntry);
+ }
+ else
+ {
+ delete pCurrentFolderEntry;
+ pCurrentFolderEntry = null;
+ }
String pathtoPush = *currentDirectoryPath + directoryName + "/";
r = __pFolderEntryStack->Push(new (std::nothrow) String(pathtoPush));
TryCatch(r == E_SUCCESS, ,"push failed");
}
else if (!(directoryName.StartsWith(L".", 0)) && !currentDirEntry.IsHidden())
{
- DirectoryEntry* pCurrentFolderEntry = new (std::nothrow) DirectoryEntry();
- String fullPath = *currentDirectoryPath+directoryName;
- pCurrentFolderEntry->SetFileExtension(File::GetFileExtension(fullPath));
- fileExtensionResult = GetLastResult();
- fileExtensionLength = pCurrentFolderEntry->GetFileExtension().GetLength();
- if(fileExtensionLength != 0)
- {
- directoryName.Remove(directoryName.GetLength() - fileExtensionLength - 1, fileExtensionLength + 1);
- }
- pCurrentFolderEntry->SetFullFilePath(fullPath);
- pCurrentFolderEntry->SetFileName(directoryName);
- pCurrentFolderEntry->SetCheckDirectory(false);
contentType = ContentManagerUtil::CheckContentType(fullPath);
r = GetLastResult();
fileExtension = pCurrentFolderEntry->GetFileExtension();
SceneManager* pSceneManager = null;\r
MfMainFrame* pMyFileMainFrame = null;\r
MessageBox messageBox;\r
+ String languageKey = L"http://tizen.org/setting/locale.language";\r
\r
// Create a Frame\r
pMyFileMainFrame = new (std::nothrow) MfMainFrame();\r
pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TEMP_FORM));\r
}\r
}\r
+\r
+\r
+ //Setting Application setting change event listener.\r
+ SettingInfo::GetValue(languageKey, __currentDisplayLanguage);\r
+ SettingInfo::AddSettingEventListener(*this);\r
+ //Ends\r
return true;\r
CATCH:\r
return false; //Returning false changes app state to TERMINATING and app's OnAppTerminating function will be called.\r
const HashMap* pResultHash = null;\r
IMapEnumerator* pResultMapEnum = null;\r
DirectoryEntry* pDirStr = null;\r
- int Count=0;\r
\r
pResultHash = FolderEntryEditorPresentationModel::GetInstance()->GetCheckedList();\r
\r
__pCurrentListToUpdate = null;\r
__pNotificationListener = null;\r
}\r
+void\r
+MyFilesApp::OnSettingChanged(Tizen::Base::String& key)\r
+{\r
+ String languageSettingKey = L"http://tizen.org/setting/locale.language";\r
+ String languageSelected;\r
+\r
+ AppLogDebug("SettingChanged++");\r
+ if ( key.CompareTo(languageSettingKey) == 0 )\r
+ {\r
+ SettingInfo::GetValue(languageSettingKey, languageSelected);\r
+\r
+ if ( __currentDisplayLanguage.CompareTo(languageSelected) !=0)\r
+ {\r
+ Application::Terminate();\r
+ }\r
+ }\r
+ AppLogDebug("SettingChanged--");\r
+}\r
\r
if (__pFolderEntryPM != null)\r
{\r
- __pFolderEntryPM->SetFolderEntryPath(__currentSearchDirectoryPath);\r
- __pContentListFromLastView = __pFolderEntryPM->GetFolderEntryList();\r
- TryCatch(__pContentListFromLastView != null, , "Failed to allocate Memory to __pContentListFromLastView");\r
- __pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SEARCH_FORM);\r
+ __pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SEARCH_FORM);\r
+ if (__currentSearchDirectoryPath.IsEmpty() == false)\r
+ {\r
+ __pFolderEntryPM->SetFolderEntryPath(__currentSearchDirectoryPath);\r
+ __pContentListFromLastView = __pFolderEntryPM->GetFolderEntryList();\r
+ TryCatch(__pContentListFromLastView != null, , "Failed to allocate Memory to __pContentListFromLastView");\r
+ }\r
}\r
-\r
__isSearchCompleted = false;\r
__isSearchStarted = false;\r
\r
void\r
SearchForm::TransitionScene(void)\r
{\r
- String rootMediaPath = BasePresentationModel::GetHomePath();\r
+ //String rootMediaPath = BasePresentationModel::GetHomePath();\r
+ String rootMediaPath = BasePresentationModel::GetMediaPath();\r
SceneManager* pSceneManager = null;\r
pSceneManager = SceneManager::GetInstance();\r
\r
int count = 0;\r
\r
TryCatch(__pSearchedContentList != null, , "__pContentListFromLastView is null!")\r
- TryCatch(__pContentListFromLastView != null, , "__pContentListFromLastView is null!")\r
\r
if (__isSearchCompleted == false)\r
{\r
if (__isSearchStarted == true)\r
count = __pSearchedContentList->GetCount();\r
else\r
- count = __pContentListFromLastView->GetCount();\r
+ {\r
+ if (__pContentListFromLastView != null)\r
+ count = __pContentListFromLastView->GetCount();\r
+ }\r
}\r
else\r
{\r
return pItem;\r
}\r
\r
- TryCatch(__pContentListFromLastView != null, , "__pContentListFromLastView is NULL!");\r
- TryCatch(__pContentListFromLastView->GetCount() != 0, , "__pContentListFromLastView count is Zero!");\r
-\r
pAppResource = Application::GetInstance()->GetAppResource();\r
TryCatch(pAppResource != null, , "Resource manager not found!");\r
\r
}\r
else\r
{\r
- pFileDetails = static_cast< DirectoryEntry* >(__pContentListFromLastView->GetAt(index));\r
+ if (__pContentListFromLastView != null && __pContentListFromLastView->GetCount() != 0)\r
+ pFileDetails = static_cast< DirectoryEntry* >(__pContentListFromLastView->GetAt(index));\r
}\r
}\r
else\r
String* pFolderSearchResult = (String*) pArgs->GetAt(1);\r
TryCatch(pFolderSearchResult != null, , "SearchForm::GetCurrentFileControl::folderSearchResult is null");\r
\r
- String defMediaPath = FolderNavigationPresentationModel::GetMediaPath();\r
- String defSdCardPath = FolderNavigationPresentationModel::GetSdCardPath();\r
+ String defMediaPath(L"/opt/usr/media");\r
+ String defSdCardPath(L"/opt/storage/sdcard");\r
\r
String displayPhone = defaultPhoneBody;\r
String displaySdCard = defaultSdCardBody;\r
\r
- displayPhone.Append("/");\r
- displaySdCard.Append("/");\r
\r
if (pFolderSearchResult->IsEmpty() == false)\r
{\r
\r
__bIsResultList = true;\r
\r
- if(__searchItemIndex == 0)\r
- {\r
- __pListView->UpdateList();\r
- }\r
- else\r
- {\r
- result res = __pListView->RefreshList(__searchItemIndex, LIST_REFRESH_TYPE_ITEM_ADD);\r
- AppLogDebug("Check Refresh List Result: %s", GetErrorMessage(res));\r
- }\r
-\r
-\r
+ result res = __pListView->RefreshList(__searchItemIndex, LIST_REFRESH_TYPE_ITEM_ADD);\r
+ AppLogDebug("Check Refresh List Result: %s", GetErrorMessage(res));\r
}\r
break;\r
\r
topLevelPath = __pFolderEntryPM->GetSdCardPath();\r
}\r
\r
- if (__currentSearchDirectoryPath.GetLength() > 0 && __currentSearchDirectoryPath == topLevelPath)\r
+ if ( (__currentSearchDirectoryPath.GetLength() > 0 && __currentSearchDirectoryPath == topLevelPath ) || (FolderNavigationPresentationModel::GetCurrentPath().IsEmpty() == true))\r
{\r
__searchedAllFolders = true;\r
}\r
-//\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: MfSearchPresentationModel.cpp\r
- * @brief: This file contains implementation of SearchPresentationModel class.\r
- */\r
-\r
-#include "MfSearchPresentationModel.h"\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::Base::Runtime;\r
-using namespace Tizen::Content;\r
-using namespace Tizen::Io;\r
-\r
-SearchPresentationModel::SearchPresentationModel(void)\r
-{\r
- __pFolderSearchStartedMessage = null;\r
- __pFolderEntryPM = null;\r
- __searchToStop = false;\r
-}\r
-\r
-SearchPresentationModel::~SearchPresentationModel(void)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-\r
-result\r
-SearchPresentationModel::Initialize(void)\r
-{\r
- result r = E_FAILURE;\r
- r = Construct(THREAD_TYPE_WORKER);\r
- return r;\r
-}\r
-\r
-void\r
-SearchPresentationModel::SetFolderToSearch(const String& foldername)\r
-{\r
- __folderToSearch = foldername;\r
-}\r
-\r
-void\r
-SearchPresentationModel::SetStringToSearch(const String& searchString)\r
-{\r
- __searchKeyword = searchString;\r
-}\r
-\r
-\r
-Tizen::Base::Object*\r
-SearchPresentationModel::Run(void)\r
-{\r
- AppLogDebug("Enter:SearchPresentationModel::Run");\r
- __searchToStop = false;\r
-\r
- if (__folderToSearch.IsEmpty() == false)\r
- {\r
- Search();\r
- }\r
- return null;\r
-\r
-}\r
-bool\r
-SearchPresentationModel::OnStart(void)\r
-{\r
- AppLogDebug("Enter:SearchPresentationModel::OnStart");\r
- return true;\r
-}\r
-\r
-void\r
-SearchPresentationModel::OnStop(void)\r
-{\r
- AppLogDebug("Enter:SearchPresentationModel::OnStop");\r
- result r = E_FAILURE;\r
- Tizen::Base::Collection::ArrayList* pSearchCompleteMessage = null;\r
- if (!IsFailed(GetLastResult()))\r
- {\r
- pSearchCompleteMessage = new (std::nothrow) ArrayList();\r
- TryCatch(pSearchCompleteMessage != null, , "SearchPresentationModel::Run::Failed to allocate Memory to pSearchCompleteMessage");\r
-\r
- r = pSearchCompleteMessage->Construct();\r
- TryCatch(r == E_SUCCESS, , "SearchPresentationModel::Run::Failed to Construct pFinalListToBeSent");\r
-\r
- pSearchCompleteMessage->Add(new (std::nothrow) Integer(ID_SEARCH_COMPLETED));\r
-\r
- Application::GetInstance()->SendUserEvent(ID_SEARCH_COMPLETED, pSearchCompleteMessage);\r
-\r
- }\r
- AppLogDebug("Exit:SearchPresentationModel::OnStop");\r
- return;\r
-\r
-CATCH:\r
- if (pSearchCompleteMessage)\r
- {\r
- delete pSearchCompleteMessage;\r
- }\r
- AppLogDebug("SearchPresentationModel::OnStop--");\r
- return;\r
-\r
-}\r
-\r
-void\r
-SearchPresentationModel::StopSearch(void)\r
-{\r
- AppLogDebug("Enter:SearchPresentationModel::StopSearch");\r
- __searchToStop = true;\r
-}\r
-\r
-void\r
-SearchPresentationModel::Search(void)\r
-{\r
- String* pCurrentDirectoryPath = null;\r
- ArrayList* pDirectoryEntryList = null;\r
- int directoryEntryCount = 0;\r
- result r = E_FAILURE;\r
-\r
- AppLogDebug("SearchPresentationModel::Search");\r
-\r
- __pFolderEntryStack = new (std::nothrow) Stack();\r
- TryCatch(__pFolderEntryStack != null, , "Stack is null");\r
-\r
- pCurrentDirectoryPath = new (std::nothrow) String(__folderToSearch);\r
- TryCatch(pCurrentDirectoryPath != null, , "pCurrentDirectoryPath is null");\r
-\r
- r = __pFolderEntryStack->Push(new String(*pCurrentDirectoryPath));\r
- TryCatch(r == E_SUCCESS, ,"push failed");\r
-\r
- __pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();\r
- TryCatch(__pFolderEntryPM != null, , "SearchPresentationModel::Search::Failed to allocate Memory to __pFolderEntryPM");\r
- __pFolderEntryPM->Construct();\r
-\r
- do\r
- {\r
- AppLogDebug("SearchPresentationModel::Search:%S", pCurrentDirectoryPath->GetPointer());\r
-\r
- if (__searchToStop == true)\r
- {\r
- break;\r
- }\r
- __pFolderSearchStartedMessage = new (std::nothrow) ArrayList();\r
- if (__pFolderSearchStartedMessage != null)\r
- {\r
- __pFolderSearchStartedMessage->Construct();\r
- __pFolderSearchStartedMessage->Add(new (std::nothrow) Integer(ID_FOLDER_SEARCH_STARTED));\r
- __pFolderSearchStartedMessage->Add(new (std::nothrow) String(*pCurrentDirectoryPath));\r
- }\r
- Application::GetInstance()->SendUserEvent(ID_FOLDER_SEARCH_STARTED, __pFolderSearchStartedMessage);\r
-\r
- __pFolderEntryPM->SetFolderEntryPath(*pCurrentDirectoryPath);\r
- pDirectoryEntryList = __pFolderEntryPM->GetFolderEntryList();\r
-\r
- while(directoryEntryCount < pDirectoryEntryList->GetCount())\r
- {\r
- if (__searchToStop == true)\r
- {\r
- break;\r
- }\r
- DirectoryEntry* pdirStructure = static_cast< DirectoryEntry* >(pDirectoryEntryList->GetAt(directoryEntryCount));\r
- TryCatch(pdirStructure != null, , "SearchPresentationModel::Search::pdirStructure is null");\r
-\r
- if(pdirStructure->IsDirectory() == true)\r
- {\r
- String directoryFullPath = pdirStructure->GetFullFilePath();\r
- r = __pFolderEntryStack->Push(new (std::nothrow) String(directoryFullPath));\r
- TryCatch(r == E_SUCCESS, ,"push failed");\r
-\r
- String filename;\r
- filename = pdirStructure->GetFileName();\r
-\r
- if (filename.IsEmpty() == false && __searchKeyword.IsEmpty() == false)\r
- {\r
- int index = -1;\r
- filename.ToLowerCase();\r
- __searchKeyword.ToLowerCase();\r
- filename.IndexOf(__searchKeyword, 0, index);\r
- if (index >= 0)\r
- {\r
- //__pSearchedResult->Add(*new (std::nothrow) DirectoryEntry(*pdirStructure));\r
- ArrayList* pListToBeSent = new (std::nothrow) ArrayList();\r
- if (pListToBeSent != null)\r
- {\r
- pListToBeSent->Construct();\r
- pListToBeSent->Add(new (std::nothrow) Integer(ID_SEARCH_RESULT_FOUND));\r
- pListToBeSent->Add(new (std::nothrow) DirectoryEntry(*pdirStructure));\r
- }\r
- AppLogDebug("Exit:SearchPresentationModel::Search::Result:%S", filename.GetPointer());\r
- Application::GetInstance()->SendUserEvent(ID_SEARCH_RESULT_FOUND, pListToBeSent);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- String filename;\r
- filename = pdirStructure->GetFullFilePath();\r
-\r
- if (filename.IsEmpty() == false && __searchKeyword.IsEmpty() == false)\r
- {\r
- int index = -1;\r
- filename.ToLowerCase();\r
- __searchKeyword.ToLowerCase();\r
- filename.IndexOf(__searchKeyword, 0, index);\r
- if (index >= 0)\r
- {\r
- //__pSearchedResult->Add(*new (std::nothrow) DirectoryEntry(*pdirStructure));\r
- ArrayList* pListToBeSent = new (std::nothrow) ArrayList();\r
- if (pListToBeSent != null)\r
- {\r
- pListToBeSent->Construct();\r
- pListToBeSent->Add(new (std::nothrow) Integer(ID_SEARCH_RESULT_FOUND));\r
- pListToBeSent->Add(new (std::nothrow) DirectoryEntry(*pdirStructure));\r
- }\r
- AppLogDebug("Exit:SearchPresentationModel::Search::Result:%S", filename.GetPointer());\r
- Application::GetInstance()->SendUserEvent(ID_SEARCH_RESULT_FOUND, pListToBeSent);\r
- }\r
- }\r
- }\r
- directoryEntryCount++;\r
- }\r
- directoryEntryCount = 0;\r
- pCurrentDirectoryPath = static_cast<String *>(__pFolderEntryStack->Pop());\r
- TryCatch(pCurrentDirectoryPath !=null, , "Pop Failed");\r
- }\r
- while (__pFolderEntryStack->GetCount() > 0);\r
-\r
- return;\r
-CATCH:\r
-\r
- if (__pFolderEntryStack != null)\r
- {\r
- __pFolderEntryStack->RemoveAll(true);\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: MfSearchPresentationModel.cpp
+ * @brief: This file contains implementation of SearchPresentationModel class.
+ */
+
+#include "MfSearchPresentationModel.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Content;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+
+SearchPresentationModel::SearchPresentationModel(void)
+{
+ __pFolderSearchStartedMessage = null;
+ __pFolderEntryPM = null;
+ __searchToStop = false;
+ __isSDCardSearchedAlready = false;
+}
+
+SearchPresentationModel::~SearchPresentationModel(void)
+{
+ //Empty Implementation.
+}
+
+
+result
+SearchPresentationModel::Initialize(void)
+{
+ result r = E_FAILURE;
+ r = Construct(THREAD_TYPE_WORKER);
+ return r;
+}
+
+void
+SearchPresentationModel::SetFolderToSearch(const String& foldername)
+{
+ __folderToSearch = foldername;
+}
+
+void
+SearchPresentationModel::SetStringToSearch(const String& searchString)
+{
+ __searchKeyword = searchString;
+}
+
+
+Tizen::Base::Object*
+SearchPresentationModel::Run(void)
+{
+ AppLogDebug("Enter:SearchPresentationModel::Run");
+ __searchToStop = false;
+
+ Search();
+
+ return null;
+
+}
+bool
+SearchPresentationModel::OnStart(void)
+{
+ AppLogDebug("Enter:SearchPresentationModel::OnStart");
+ return true;
+}
+
+void
+SearchPresentationModel::OnStop(void)
+{
+ AppLogDebug("Enter:SearchPresentationModel::OnStop");
+ result r = E_FAILURE;
+ Tizen::Base::Collection::ArrayList* pSearchCompleteMessage = null;
+ if (!IsFailed(GetLastResult()))
+ {
+ pSearchCompleteMessage = new (std::nothrow) ArrayList();
+ TryCatch(pSearchCompleteMessage != null, , "SearchPresentationModel::Run::Failed to allocate Memory to pSearchCompleteMessage");
+
+ r = pSearchCompleteMessage->Construct();
+ TryCatch(r == E_SUCCESS, , "SearchPresentationModel::Run::Failed to Construct pFinalListToBeSent");
+
+ pSearchCompleteMessage->Add(new (std::nothrow) Integer(ID_SEARCH_COMPLETED));
+
+ Application::GetInstance()->SendUserEvent(ID_SEARCH_COMPLETED, pSearchCompleteMessage);
+
+ }
+ AppLogDebug("Exit:SearchPresentationModel::OnStop");
+ return;
+
+CATCH:
+ if (pSearchCompleteMessage)
+ {
+ delete pSearchCompleteMessage;
+ }
+ AppLogDebug("SearchPresentationModel::OnStop--");
+ return;
+
+}
+
+void
+SearchPresentationModel::StopSearch(void)
+{
+ AppLogDebug("Enter:SearchPresentationModel::StopSearch");
+ __searchToStop = true;
+}
+
+void
+SearchPresentationModel::Search(void)
+{
+ AppLogDebug("SearchPresentationModel::Search");
+
+ String* pCurrentDirectoryPath = null;
+ ArrayList* pDirectoryEntryList = null;
+ int directoryEntryCount = 0;
+ result r = E_FAILURE;
+ String defMediaPath(L"/opt/usr/media/");
+
+ __pFolderEntryStack = new (std::nothrow) Stack();
+ TryCatch(__pFolderEntryStack != null, , "Stack is null");
+
+
+ //If Current Folder Path is Empty , Set DefaultMediaPath as CurrentPath
+ //as default starting point for search
+ if (FolderNavigationPresentationModel::GetCurrentPath().IsEmpty() == true)
+ pCurrentDirectoryPath = new (std::nothrow) String(defMediaPath);
+ else
+ pCurrentDirectoryPath = new (std::nothrow) String(__folderToSearch);
+
+ TryCatch(pCurrentDirectoryPath != null, , "pCurrentDirectoryPath is null");
+
+ r = __pFolderEntryStack->Push(new String(*pCurrentDirectoryPath));
+ TryCatch(r == E_SUCCESS, ,"push failed");
+
+ __pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();
+ TryCatch(__pFolderEntryPM != null, , "SearchPresentationModel::Search::Failed to allocate Memory to __pFolderEntryPM");
+ __pFolderEntryPM->Construct();
+
+ do
+ {
+ AppLogDebug("SearchPresentationModel::Search:%S", pCurrentDirectoryPath->GetPointer());
+
+ if (__searchToStop == true)
+ {
+ break;
+ }
+ __pFolderSearchStartedMessage = new (std::nothrow) ArrayList();
+ if (__pFolderSearchStartedMessage != null)
+ {
+ __pFolderSearchStartedMessage->Construct();
+ __pFolderSearchStartedMessage->Add(new (std::nothrow) Integer(ID_FOLDER_SEARCH_STARTED));
+ __pFolderSearchStartedMessage->Add(new (std::nothrow) String(*pCurrentDirectoryPath));
+ }
+ Application::GetInstance()->SendUserEvent(ID_FOLDER_SEARCH_STARTED, __pFolderSearchStartedMessage);
+
+ __pFolderEntryPM->SetFolderEntryPath(*pCurrentDirectoryPath);
+ pDirectoryEntryList = __pFolderEntryPM->GetFolderEntryList();
+
+ while(directoryEntryCount < pDirectoryEntryList->GetCount())
+ {
+ if (__searchToStop == true)
+ {
+ break;
+ }
+ DirectoryEntry* pdirStructure = static_cast< DirectoryEntry* >(pDirectoryEntryList->GetAt(directoryEntryCount));
+ TryCatch(pdirStructure != null, , "SearchPresentationModel::Search::pdirStructure is null");
+
+ if(pdirStructure->IsDirectory() == true)
+ {
+ String directoryFullPath = pdirStructure->GetFullFilePath();
+
+ AppLogDebug("SearchPresentationModel::Search::%S", directoryFullPath.GetPointer());
+
+ r = __pFolderEntryStack->Push(new (std::nothrow) String(directoryFullPath));
+ TryCatch(r == E_SUCCESS, ,"push failed");
+
+ String filename;
+ filename = pdirStructure->GetFileName();
+
+ if (filename.IsEmpty() == false && __searchKeyword.IsEmpty() == false)
+ {
+ AppLogDebug("SearchPresentationModel::Search::%S", filename.GetPointer(), __searchKeyword.GetPointer());
+ int index = -1;
+ filename.ToLowerCase();
+ __searchKeyword.ToLowerCase();
+ filename.IndexOf(__searchKeyword, 0, index);
+ if (index >= 0)
+ {
+ //__pSearchedResult->Add(*new (std::nothrow) DirectoryEntry(*pdirStructure));
+ ArrayList* pListToBeSent = new (std::nothrow) ArrayList();
+ if (pListToBeSent != null)
+ {
+ pListToBeSent->Construct();
+ pListToBeSent->Add(new (std::nothrow) Integer(ID_SEARCH_RESULT_FOUND));
+ pListToBeSent->Add(new (std::nothrow) DirectoryEntry(*pdirStructure));
+ }
+ AppLogDebug("Exit:SearchPresentationModel::Search::Result:%S", filename.GetPointer());
+ Application::GetInstance()->SendUserEvent(ID_SEARCH_RESULT_FOUND, pListToBeSent);
+ }
+ }
+ }
+ else
+ {
+ String filename;
+ filename = pdirStructure->GetFileName();
+ AppLogDebug("SearchPresentationModel::Search::%S %S", filename.GetPointer(), __searchKeyword.GetPointer());
+
+ if (filename.IsEmpty() == false && __searchKeyword.IsEmpty() == false)
+ {
+ int index = -1;
+ filename.ToLowerCase();
+ __searchKeyword.ToLowerCase();
+ filename.IndexOf(__searchKeyword, 0, index);
+ if (index >= 0)
+ {
+ //__pSearchedResult->Add(*new (std::nothrow) DirectoryEntry(*pdirStructure));
+ ArrayList* pListToBeSent = new (std::nothrow) ArrayList();
+ if (pListToBeSent != null)
+ {
+ pListToBeSent->Construct();
+ pListToBeSent->Add(new (std::nothrow) Integer(ID_SEARCH_RESULT_FOUND));
+ pListToBeSent->Add(new (std::nothrow) DirectoryEntry(*pdirStructure));
+ }
+ AppLogDebug("Exit:SearchPresentationModel::Search::Result:%S", filename.GetPointer());
+ Application::GetInstance()->SendUserEvent(ID_SEARCH_RESULT_FOUND, pListToBeSent);
+ }
+ }
+ }
+ directoryEntryCount++;
+ }
+ directoryEntryCount = 0;
+ pCurrentDirectoryPath = static_cast<String *>(__pFolderEntryStack->Pop());
+
+ if (pCurrentDirectoryPath->CompareTo(L"/opt/usr/media/")==0 ||
+ pCurrentDirectoryPath->CompareTo(L"/opt/storage/sdcard/") ==0)
+ {
+ if (__folderToSearch.IsEmpty() == true && __isSDCardSearchedAlready == false )
+ {
+ String deviceSateSdCard;
+ String defaultSDCardPath;
+ DeviceManager::GetState(StorageCard, deviceSateSdCard);
+ if (deviceSateSdCard == sdCardStatusMounted && pCurrentDirectoryPath->CompareTo(L"/opt/usr/media/") ==0)
+ {
+ String defSdCardPath(L"/opt/storage/sdcard/");
+ pCurrentDirectoryPath = new (std::nothrow) String(defSdCardPath);
+ __isSDCardSearchedAlready = true;
+
+ r = __pFolderEntryStack->Push(new String(*pCurrentDirectoryPath));
+ TryCatch(r == E_SUCCESS, ,"push failed");
+ }
+ }
+ else
+ break;
+ }
+
+ TryCatch(pCurrentDirectoryPath !=null, , "Pop Failed");
+ }
+ while (__pFolderEntryStack->GetCount() > 0);
+
+ return;
+CATCH:
+
+ if (__pFolderEntryStack != null)
+ {
+ __pFolderEntryStack->RemoveAll(true);
+ }
+}
#endif
pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
}
-
+ FolderNavigationPresentationModel::SetCurrentFilePath(L"");
__listItemCount = __pFolderList->GetCount();
if (deviceSateSdCard == mounted && __listItemCount < 2)