2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file GlBaseForm.cpp
19 * @brief This is the implementation file for GlBaseForm class.
22 #include "GlFileListPresentationModel.h"
23 #include "GlBaseForm.h"
25 using namespace Tizen::Base;
26 using namespace Tizen::Base::Collection;
27 using namespace Tizen::Ui::Controls;
28 using namespace Tizen::Base::Utility;
31 BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList, FileListPresentationModel* pPresentationModel)
33 if (&moveDir == null || moveDir.IsEmpty())
35 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
39 if (pMoveIndexList == null || pMoveIndexList->GetCount() <= 0)
41 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
45 IList* pCollisionList = pPresentationModel->GetCollisionIndexListN(*pMoveIndexList, moveDir);
47 if (pCollisionList != null)
49 int loopCount = pCollisionList->GetCount();
50 int collisionCount = 0;
51 for (int i = 0; i < loopCount; ++i)
53 String* pCollisionString = const_cast<String*>(static_cast<const String*>(pCollisionList->GetAt(i)));
56 if (pCollisionString != null)
58 tmpString = (*pCollisionString);
61 String delim(MULTI_ITEM_SEPARATOR);
62 StringTokenizer st(tmpString, delim);
68 if (st.HasMoreTokens() == true)
70 st.GetNextToken(token);
71 Integer::Parse(token, collisionIndex);
73 if (st.HasMoreTokens() == true)
75 st.GetNextToken(fileName);
78 int innerLoopCount = pMoveIndexList->GetCount();
79 for (int j = 0; j < innerLoopCount; ++j)
81 if (collisionIndex == (const_cast<Integer*>(static_cast<const Integer*>
82 (pMoveIndexList->GetAt(j))))->ToInt())
84 pMoveIndexList->RemoveAt(j, true);
92 if ( collisionCount > 0)
94 MessageBox messageBox;
95 messageBox.Construct(L"", L"Unable to move some files. Same files exists",
96 MSGBOX_STYLE_NONE, 3000);
98 messageBox.ShowAndWait(modalResult);
101 return pMoveIndexList;