Fix jira issue
[apps/osp/Gallery.git] / src / GlImageListEditorPanel.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                GlImageListEditorPanel.cpp
19  * @brief               This is the implementation file for ImageListEditorPanel class.
20  */
21
22 #include <FContent.h>
23 #include <FMedia.h>
24 #include "GlAlbumInfo.h"
25 #include "GlCommonUtil.h"
26 #include "GlFileListPresentationModel.h"
27 #include "GlGalleryApp.h"
28 #include "GlImageListEditorPanel.h"
29 #include "GlResourceManager.h"
30 #include "GlTypes.h"
31 #include "GlFileDeleteTimer.h"
32 #include "GlFileListEditorForm.h"
33
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Content;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Media;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43
44 static const int H_SELECTALL_REGION = 112;
45 static const int COUNT_LABEL_FONT_SIZE = 33;
46 static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value;
47 static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
48 static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
49 static const int H_COUNT_LABEL = 48;
50 static const int LENGTH_COUNT_LABEL = 256;
51 static const int ALPHA_THUMBNAIL_DIM = 70;
52 static const Rectangle RECT_INITIAL (0, 0, 10, 10);
53
54 ImageListEditorPanel::ImageListEditorPanel(void)
55         : __pContentIconListView(null)
56         , __pCheckButton(null)
57         , __pLabelSelectCnt(null)
58         , __itemCount(0)
59         , __pPresentationModel(null)
60         , __pFileDelete(null)
61 {
62         AppLogDebug("ENTER");
63         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
64 }
65
66 ImageListEditorPanel::~ImageListEditorPanel(void)
67 {
68         AppLogDebug("ENTER");
69         delete __pFileDelete;
70         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
71 }
72
73 result
74 ImageListEditorPanel::Initialize(void)
75 {
76         AppLogDebug("ENTER");
77         result r = Construct(RECT_INITIAL);
78         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
79
80         return r;
81 }
82
83 result
84 ImageListEditorPanel::OnInitializing(void)
85 {
86         AppLogDebug("ENTER");
87         const Form* pForm = dynamic_cast<Form*>(GetParent());
88         TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
89
90         __pPresentationModel = FileListPresentationModel::GetInstance();
91         __pPresentationModel->ClearThumbnailRequests();
92         __pPresentationModel->AddPresentationModelListener(this);
93         __itemCount = 0;
94
95         Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
96         SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
97
98         if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
99         {
100                 __pContentIconListView = new (std::nothrow) IconListView();
101
102                 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
103                 {
104                         __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
105                                         DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK,
106                                         ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
107                         Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
108                         if (pBitmapEmpty != null)
109                         {
110                                 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
111                                 delete pBitmapEmpty;
112                         }
113                         __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
114                         __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
115                         __pContentIconListView->SetItemProvider(*this);
116                         __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
117                         __pContentIconListView->AddIconListViewItemEventListener(*this);
118                         __pContentIconListView->SetTouchAnimationEnabled(false);
119                         AddControl(*__pContentIconListView);
120                         __pContentIconListView->SetShowState(true);
121
122                         __pLabelSelectCnt = new (std::nothrow) Label();
123                         __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL,
124                                         clientAreaBounds.width, H_COUNT_LABEL), ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
125                         __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
126                         __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
127                         __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
128                         __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
129                         __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
130                         AddControl(*__pLabelSelectCnt);
131                 }
132                 else
133                 {
134                         __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
135                                         DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL,
136                                         ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
137                         Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
138                         if (pBitmapEmpty != null)
139                         {
140                                 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
141                                 delete pBitmapEmpty;
142                         }
143                         __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
144                         __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
145                         __pContentIconListView->SetItemProvider(*this);
146                         __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
147                         __pContentIconListView->AddIconListViewItemEventListener(*this);
148                         __pContentIconListView->SetTouchAnimationEnabled(false);
149                         AddControl(*__pContentIconListView);
150                         __pContentIconListView->SetShowState(true);
151                 }
152         }
153         else
154         {
155                 __pContentIconListView = new (std::nothrow) IconListView();
156                 __pContentIconListView->Construct(Rectangle(0, H_SELECTALL_REGION, clientAreaBounds.width,
157                                 clientAreaBounds.height - H_SELECTALL_REGION), DIMENSION_DEFAULT_THUMBNAIL,
158                                 ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
159                 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
160                 if (pBitmapEmpty != null)
161                 {
162                         __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
163                         delete pBitmapEmpty;
164                 }
165                 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
166                 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
167                 __pContentIconListView->SetItemProvider(*this);
168                 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
169                 __pContentIconListView->AddIconListViewItemEventListener(*this);
170                 __pContentIconListView->SetTouchAnimationEnabled(false);
171                 AddControl(*__pContentIconListView);
172                 __pContentIconListView->SetShowState(true);
173
174                 __pLabelSelectCnt = new (std::nothrow) Label();
175                 __pLabelSelectCnt->Construct(
176                                 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
177                                 ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
178                 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
179                 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
180                 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
181                 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
182                 AddControl(*__pLabelSelectCnt);
183         }
184         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
185
186         return E_SUCCESS;
187 }
188
189 result
190 ImageListEditorPanel::OnTerminating(void)
191 {
192         AppLogDebug("ENTER");
193         __pPresentationModel->RemovePresentationModelListener(*this);
194         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
195
196         return E_SUCCESS;
197 }
198
199 int
200 ImageListEditorPanel::GetItemCount(void)
201 {
202         AppLogDebug("ENTER");
203         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
204
205         return __itemCount;
206 }
207
208 IconListViewItem*
209 ImageListEditorPanel::CreateItem(int index)
210 {
211         AppLogDebug("ENTER : index(%d)", index);
212         IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
213         Bitmap* pBitmap = null;
214         String* pItemText = null;
215
216         result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap);
217         if (pBitmap == null || r == E_FAILURE)
218         {
219                 __pPresentationModel->RequestThumbnail(index);
220                 pBitmap = CommonUtil::GetEmptyThumbnailN();
221         }
222
223         if (pItemText == null)
224         {
225                 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
226         }
227         else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
228         {
229                 delete pItemText;
230                 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
231         }
232
233         if (__pContentIconListView->IsItemChecked(index) == true)
234         {
235                 if (pBitmap != null)
236                 {
237                         BufferInfo bufferInfo;
238                         pBitmap->Lock(bufferInfo, INFINITE);
239                         pBitmap->Unlock();
240                         Color dimColor(COLOR_THUMBNAIL_DIM);
241                         dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
242
243                         Canvas canvas;
244                         canvas.Construct(bufferInfo);
245                         canvas.FillRectangle(dimColor, canvas.GetBounds());
246
247                         Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
248                         pSelectedBitmap->Construct(canvas, canvas.GetBounds());
249                         pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
250                         delete pSelectedBitmap;
251                 }
252                 else
253                 {
254                         AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
255
256                         return null;
257                 }
258         }
259         else
260         {
261                 pIconListviewItem->Construct(*pBitmap, pItemText);
262         }
263
264         if (pBitmap != null)
265         {
266                 delete pBitmap;
267         }
268         if (pItemText != null)
269         {
270                 delete pItemText;
271         }
272         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
273
274         return pIconListviewItem;
275 }
276
277 bool
278 ImageListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
279 {
280         AppLogDebug("ENTER");
281         delete pItem;
282         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
283
284         return true;
285 }
286
287 void
288 ImageListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
289 {
290         AppLogDebug("ENTER");
291
292         if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
293         {
294                 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
295                 {
296                         if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
297                         {
298                                 int checkedCount = GetItemCheckedCount();
299                                 String strTmp;
300                                 if (checkedCount == 0)
301                                 {
302                                         strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
303                                 }
304                                 else if (checkedCount == 1)
305                                 {
306                                         strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
307                                 }
308                                 else
309                                 {
310                                         strTmp.Format(LENGTH_COUNT_LABEL,
311                                                         ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
312                                 }
313
314                                 __pLabelSelectCnt->SetText(strTmp);
315                                 __pLabelSelectCnt->RequestRedraw(true);
316                                 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
317                         }
318                 }
319                 else
320                 {
321                         int checkedCount = GetItemCheckedCount();
322                         String strTmp;
323                         if (checkedCount == 0)
324                         {
325                                 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
326                         }
327                         else if (checkedCount == 1)
328                         {
329                                 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
330                         }
331                         else
332                         {
333                                 strTmp.Format(LENGTH_COUNT_LABEL,
334                                                 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
335                         }
336
337                         __pLabelSelectCnt->SetText(strTmp);
338                         __pLabelSelectCnt->RequestRedraw(true);
339                         if (__pCheckButton->IsSelected())
340                         {
341                                 __pCheckButton->SetSelected(false);
342                         }
343                         __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
344                 }
345         }
346
347         if (    __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
348                 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE)
349         {
350                 if (status == ICON_LIST_VIEW_ITEM_SELECTED)
351                 {
352                         HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
353                         result r = map->Construct();
354                         if (r == E_SUCCESS)
355                         {
356                                 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
357                                 r = pArrayList->Construct();
358
359                                 if (r == E_SUCCESS)
360                                 {
361                                         pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
362                                         map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList);
363
364                                         GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
365                                         if (pApp != null)
366                                         {
367                                                 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
368                                                 pApp->Terminate();
369                                         }
370                                         else
371                                         {
372                                                 delete map;
373                                         }
374                                 }
375                                 else
376                                 {
377                                         delete pArrayList;
378                                         delete map;
379                                 }
380                         }
381                         else
382                         {
383                                 delete map;
384                         }
385                 }
386         }
387         SetButtonState();
388
389         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
390 }
391
392 void
393 ImageListEditorPanel::OnFileInfoChanged(const ContentType contentType)
394 {
395         AppLogDebug("ENTER");
396         if (contentType == CONTENT_TYPE_IMAGE)
397         {
398                 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE);
399                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
400                 __pContentIconListView->UpdateList();
401         }
402         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
403 }
404
405 void
406 ImageListEditorPanel::OnThumbnailDecoded(const int index)
407 {
408         AppLogDebug("ENTER : index(%d)",index);
409         if (index >= 0)
410         {
411                 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
412         }
413         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
414 }
415
416 void
417 ImageListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
418                                                                 const SceneId& currentSceneId, IList* pArgs)
419 {
420         AppLogDebug("ENTER");
421
422         SceneManager* pSceneManager = SceneManager::GetInstance();
423         __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
424
425         __pPresentationModel = FileListPresentationModel::GetInstance();
426
427         if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
428         {
429                 if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR)
430                 {
431                         if (previousSceneId == IDSCN_ALBUM_LIST)
432                         {
433                                 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
434                                 if (pAlbumInfo == null)
435                                 {
436                                         AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
437
438                                         return;
439                                 }
440
441                                 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
442                                 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
443
444                                 if (pDirectoryList != null)
445                                 {
446                                         delete pDirectoryList;
447                                 }
448                                 delete pArgs;
449
450                                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
451                                 __pContentIconListView->UpdateList();
452                         }
453                 }
454         }
455         else
456         {
457                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
458                 __pContentIconListView->RequestRedraw(true);
459         }
460         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
461 }
462
463 void
464 ImageListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
465                                                                 const SceneId& nextSceneId)
466 {
467         AppLogDebug("ENTER");
468         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
469 }
470
471 int
472 ImageListEditorPanel::GetItemCheckedCount(void) const
473 {
474         AppLogDebug("ENTER");
475         int count = 0;
476         if (__pContentIconListView != null)
477         {
478                 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
479                 for (int i = 0; i < loopCount; ++i)
480                 {
481                         if (__pContentIconListView->IsItemChecked(i))
482                         {
483                                 ++count;
484                         }
485                 }
486         }
487         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
488
489         return count;
490 }
491
492 IList*
493 ImageListEditorPanel::GetItemCheckedIndexListN(void) const
494 {
495         AppLogDebug("ENTER");
496         IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
497         Integer* pIndex = null;
498
499         if (__pContentIconListView != null)
500         {
501                 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
502                 AppLogDebug("ENTER loopCount(%d)", loopCount);
503                 for (int i = 0; i < loopCount; ++i)
504                 {
505                         if (__pContentIconListView->IsItemChecked(i))
506                         {
507                                 pIndex = new (std::nothrow) Integer(i);
508                                 AppLogDebug("ENTER loopCount(%d)", loopCount);
509                                 AppLogDebug("ENTER loopCount(%d)", pIndex->ToInt());
510                                 pList->Add(pIndex);
511                         }
512                 }
513         }
514         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
515
516         return pList;
517 }
518
519 void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
520 {
521         SceneManager* pSceneManager = SceneManager::GetInstance();
522         FileListEditorForm* pFileListEditorForm =
523                                 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
524         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
525                         GetErrorMessage(GetLastResult()));
526         pFileListEditorForm->Invalidate(true);
527 }
528
529 void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
530 {
531 }
532
533 void
534 ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
535 {
536         AppLogDebug("ENTER");
537         IList* pIndexList = GetItemCheckedIndexListN();
538
539         if (pIndexList->GetCount() <= 0)
540         {
541                 delete pIndexList;
542                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
543                 return;
544         }
545
546         ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
547         pArrayList->Construct();
548         int loopCount = pIndexList->GetCount();
549         Integer* temp = null;
550         for (int i = 0; i < loopCount; ++i)
551         {
552                 temp = static_cast<Integer*>(pIndexList->GetAt(i));
553                 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(temp->ToInt())));
554         }
555
556         HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
557         map->Construct();
558         map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), pArrayList);
559
560         GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
561         if (pApp != null)
562         {
563                 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
564                 pApp->Terminate();
565         }
566
567         delete pIndexList;
568         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
569 }
570
571 void
572 ImageListEditorPanel::SelectAllPressed(void)
573 {
574         bool needToSelectAll = true;
575         int checkedCount = GetItemCheckedCount();
576         int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
577         if (checkedCount == totalFileCount)
578         {
579                 needToSelectAll = false;
580         }
581
582         if (needToSelectAll == true)
583         {
584                 for (int i = 0 ; i < totalFileCount; ++i)
585                 {
586                         if (__pContentIconListView->IsItemChecked(i) == false)
587                         {
588                                 __pContentIconListView->SetItemChecked(i,true);
589                                 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
590                         }
591                 }
592         }
593         else
594         {
595                 for (int i = 0 ; i < totalFileCount; ++i)
596                 {
597                         if (__pContentIconListView->IsItemChecked(i) == true)
598                         {
599                                 __pContentIconListView->SetItemChecked(i, false);
600                                 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
601                         }
602                 }
603         }
604
605         String tempString;
606         if (needToSelectAll == true)
607         {
608                 tempString.Format(LENGTH_COUNT_LABEL,
609                                                 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount);
610         }
611         else
612         {
613                 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
614         }
615
616         __pLabelSelectCnt->SetText(tempString);
617         __pLabelSelectCnt->RequestRedraw(true);
618 }
619
620 void
621 ImageListEditorPanel::SetButtonState(void)
622 {
623         AppLogDebug("ENTER");
624         SceneManager* pSceneManager = SceneManager::GetInstance();
625         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
626
627         if (GetItemCheckedCount() > 0)
628         {
629                 AppLogDebug("BUTTONSTATE : Request Enable");
630                 __pFileListEditorForm->SetFooterButtonsState(true);
631         }
632         else
633         {
634                 AppLogDebug("BUTTONSTATE : Request disable");
635                 __pFileListEditorForm->SetFooterButtonsState(false);
636         }
637         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
638 }