void RemoveContentListener(void);
bool GetChangeNotificationStatus();
void ResumeOperation();
-
+ Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const;
private:
ContentUpdateEventListener(void);
virtual ~ContentUpdateEventListener(void);
void ClearImageCache(void);
void ClearProviderId(void);
+ void AddDirectoryIfNew(const Tizen::Base::String& fullPath);
private:
FileListPresentationModel(void);
virtual ~FileListPresentationModel(void);
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
using namespace Tizen::Content;
ContentUpdateEventListener* ContentUpdateEventListener::__pContentUpdateEventListener = null;
AppLogDebug("EXIT");
}
+String
+ContentUpdateEventListener::GetDirecotyNameFromFullPath(const String& fullPath)const
+{
+ AppLogDebug("ENTER");
+ if (fullPath == null)
+ {
+ AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+
+ return null;
+ }
+ String delim(DIRECTORY_SEPARATOR);
+ StringTokenizer st(fullPath,delim);
+ String token;
+ String tokenPrev;
+ while (st.HasMoreTokens())
+ {
+ tokenPrev = token;
+ st.GetNextToken(token);
+ }
+
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+
+ return tokenPrev;
+}
+
void
ContentUpdateEventListener::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r)
{
AppLogDebug("ENTER");
-
if ( contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_VIDEO)
{
+ Tizen::Content::ContentInfo* cntInfo = __pContentManager->GetContentInfoN(contentId);
+ String path = cntInfo->GetContentPath();
+ String dirName = GetDirecotyNameFromFullPath(path);
+
+ FileListPresentationModel* pFileListPM = FileListPresentationModel::GetInstance();
+ pFileListPM->AddDirectoryIfNew(dirName);
AlbumListPresentationModel::GetInstance()->OnContentCreated();
- FileListPresentationModel::GetInstance()->OnContentCreated();
+ pFileListPM->OnContentCreated();
}
AppLogDebug("EXIT");
return r;
}
+void
+FileListPresentationModel::AddDirectoryIfNew(const String& dirName)
+{
+ bool isMatched = false;
+ int dirCount = __pDirectoryList->GetCount();
+ if (__albumName != ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"))//we are not in All albums
+ {
+ return;
+ }
+ for (int i = 0; i < dirCount ; ++i)
+ {
+ if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(dirName) == 0)
+ {
+ isMatched = true;
+ break;
+ }
+ }
+ if (!isMatched)
+ {
+ String fullPath = Environment::GetMediaPath();
+ fullPath.Append(dirName);
+ __pDirectoryList->Add(new (std::nothrow) String(fullPath));
+
+ }
+}
+
+
+
result
FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
{
delete __pContentInfoList;
__pContentInfoList = null;
}
+
__pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));