Remove ini file
[apps/osp/Gallery.git] / src / GlBaseForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file                GlBaseForm.cpp
19  * @brief               This is the implementation file for GlBaseForm class.
20  */
21
22 #include <FApp.h>
23 #include <FBase.h>
24 #include <FContent.h>
25 #include <FUi.h>
26
27 #include "GlFileListPresentationModel.h"
28 #include "GlBaseForm.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Ui::Controls;
33 using namespace Tizen::Base::Utility;
34
35
36 IList* BaseForm::GetMoveFileIndexList(String& moveDir, IList* pMoveIndexList,
37                 FileListPresentationModel* pPresentationModel)
38 {
39
40         if (&moveDir == null || moveDir.IsEmpty())
41         {
42                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
43                 return null;
44         }
45
46         if (pMoveIndexList == null || pMoveIndexList->GetCount() <= 0)
47         {
48                 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
49                 return null;
50         }
51
52         IList* pCollisionList = pPresentationModel->GetCollisionIndexListN(*pMoveIndexList, moveDir);
53
54         if (pCollisionList != null)
55         {
56                 int loopCount = pCollisionList->GetCount();
57                 for (int i = 0; i < loopCount; ++i)
58                 {
59                         String* pCollisionString = const_cast<String*>(static_cast<const String*>(pCollisionList->GetAt(i)));
60                         String tmpString;
61
62                         if (pCollisionString != null)
63                         {
64                                 tmpString = (*pCollisionString);
65                         }
66
67                         String delim(MULTI_ITEM_SEPARATOR);
68                         StringTokenizer st(tmpString, delim);
69                         String token;
70
71                         int collisionIndex;
72                         String fileNmae;
73
74                         if (st.HasMoreTokens() == true)
75                         {
76                                 st.GetNextToken(token);
77                                 Integer::Parse(token, collisionIndex);
78
79                                 if (st.HasMoreTokens() == true)
80                                 {
81                                         st.GetNextToken(fileNmae);
82                                 }
83
84                                 MessageBox messageBox;
85                                 messageBox.Construct(L"", fileNmae + ResourceManager::GetString(L"IDS_MEDIABR_POP_ALREADY_EXISTS_OVERWRITE_Q"),
86                                                 MSGBOX_STYLE_YESNO, 0);
87                                 int modalResult = 0;
88                                 __overlayMsg = true;
89                                 messageBox.ShowAndWait(modalResult);
90                                 __overlayMsg = false;
91
92                                 if (modalResult == MSGBOX_RESULT_NO)
93                                 {
94                                         int innerLoopCount = pMoveIndexList->GetCount();
95                                         for (int j = 0; j < innerLoopCount; ++j)
96                                         {
97                                                 if (collisionIndex == (const_cast<Integer*>(static_cast<const Integer*>
98                                                 (pMoveIndexList->GetAt(j))))->ToInt())
99                                                 {
100                                                         pMoveIndexList->RemoveAt(j, true);
101                                                         --j;
102                                                         --innerLoopCount;
103                                                 }
104                                         }
105                                 }
106                         }
107                 }
108         }
109         return pMoveIndexList;
110 }