Fixed issue 48334
[apps/osp/Gallery.git] / src / GlBaseForm.cpp
index 2597caa..cfe5ba4 100644 (file)
@@ -28,7 +28,7 @@ using namespace Tizen::Ui::Controls;
 using namespace Tizen::Base::Utility;
 
 IList*
-BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListPresentationModel* pPresentationModel)
+BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListPresentationModel* pPresentationModel, bool isCopyOp)
 {
        if (&moveDir == null || moveDir.IsEmpty())
        {
@@ -47,7 +47,7 @@ BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListP
        if (pCollisionList != null)
        {
                int loopCount = pCollisionList->GetCount();
-               int collisionCount = 0;\r
+               int collisionCount = 0;
                for (int i = 0; i < loopCount; ++i)
                {
                        String* pCollisionString = const_cast<String*>(static_cast<const String*>(pCollisionList->GetAt(i)));
@@ -75,27 +75,40 @@ BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListP
                                        st.GetNextToken(fileName);
                                }
 
-                               int innerLoopCount = pMoveIndexList->GetCount();\r
-                               for (int j = 0; j < innerLoopCount; ++j)\r
+                               int innerLoopCount = pMoveIndexList->GetCount();
+                               for (int j = 0; j < innerLoopCount; ++j)
                                {
-                                       if (collisionIndex == (const_cast<Integer*>(static_cast<const Integer*>\r
-                                       (pMoveIndexList->GetAt(j))))->ToInt())\r
+                                       if (collisionIndex == (const_cast<Integer*>(static_cast<const Integer*>
+                                       (pMoveIndexList->GetAt(j))))->ToInt())
                                        {
-                                               pMoveIndexList->RemoveAt(j, true);\r
-                                               --j;\r
-                                               --innerLoopCount;\r
-                                               collisionCount++;\r
+                                               pMoveIndexList->RemoveAt(j, true);
+                                               --j;
+                                               --innerLoopCount;
+                                               ++collisionCount;
                                        }
                                }
                        }
-               }\r
-               if ( collisionCount > 0)\r
-               {\r
-                       MessageBox messageBox;\r
-                       messageBox.Construct(L"", L"Unable to move some files. Same files exists",\r
-                                       MSGBOX_STYLE_NONE, 3000);\r
-                       int modalResult;\r
-                       messageBox.ShowAndWait(modalResult);\r
+               }
+
+               pCollisionList->RemoveAll(true);
+               delete pCollisionList;
+
+               if (collisionCount > 0)
+               {
+                       MessageBox messageBox;
+
+                       if ( isCopyOp)
+                       {
+                               messageBox.Construct(L"", L"Unable to copy some files. Same files exists",
+                                                               MSGBOX_STYLE_NONE, 3000);
+                       }
+                       else
+                       {
+                       messageBox.Construct(L"", L"Unable to move some files. Same files exists",
+                                       MSGBOX_STYLE_NONE, 3000);
+                       }
+                       int modalResult;
+                       messageBox.ShowAndWait(modalResult);
                }
        }
        return pMoveIndexList;