Fixed prevent issue
[apps/osp/Gallery.git] / src / GlFileListPresentationModel.cpp
index b37cdd2..17020bf 100644 (file)
@@ -68,6 +68,7 @@ static const Rectangle RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127);
 static const Color COLOR_DURATION_BG (Color::GetColor(COLOR_ID_BLACK));
 static const Color COLOR_TEXT_OUTLINE (Color::GetColor(COLOR_ID_WHITE));
 
+static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
 static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera";
 static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera";
 static const String RESERVED_DOWNLOAD_PATH = Environment::GetMediaPath() + L"Downloads";
@@ -1025,12 +1026,28 @@ FileListPresentationModel::MoveToContentFile(const String& filePath, const Strin
        if (destPath.CompareTo(filePath) == 0)
        {
                AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
-               return E_SUCCESS;
+               return E_FAILURE;
        }
 
-       if (File::IsFileExist(destPath) == true)
+       while (File::IsFileExist(destPath) == true)
        {
-               File::Remove(destPath);
+               int index = 0;
+               r = destPath.IndexOf(FILE_EXT_SEPARATOR, 0, index);
+               if (!IsFailed(r))
+               {
+                       if (index < 0)
+                       {
+                               return E_FAILURE;
+                       }
+                       else
+                       {
+                               destPath.Insert(Math::Rand()%10, index);
+                       }
+               }
+               else
+               {
+                       return E_FAILURE;
+               }
        }
 
        r = File::Copy(filePath, destPath, false);
@@ -1591,6 +1608,11 @@ FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
                return albumName;
        }
 
+       String mediaPath = RESERVED_MEDIA_PATH;
+       int length = mediaPath.GetLength();
+       mediaPath.Remove(length-1,1);
+
+
        if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT)
        {
                albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
@@ -1599,6 +1621,11 @@ FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
        {
                albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS");
        }
+       else if (targetPath == mediaPath)
+       {
+
+               albumName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
+       }
        else
        {
                String directoryName = GetDirecotyNameFromFullPath(targetPath);