using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
using namespace Tizen::Content;
ContentUpdateEventListener* ContentUpdateEventListener::__pContentUpdateEventListener = null;
ContentUpdateEventListener::ContentUpdateEventListener(void)
: __pContentManager(null)
+ , __changeNotificationReceived(false)
{
AppLogDebug("ENTER");
AppLogDebug("EXIT");
{
AppLogDebug("ENTER");
__pContentManager->RemoveContentUpdateEventListener(*this);
+ delete __pContentManager;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
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");