Fixed issue 55407
[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.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
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 "GlFileUpdateTimer.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 float H_COUNT_LABEL = 48.0f;
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         : __itemCount(0)
56         , __pContentIconListView(null)
57         , __pCheckButton(null)
58         , __pLabelSelectCnt(null)
59         , __pPresentationModel(null)
60         , __pFileListEditorForm(null)
61 {
62         AppLogDebug("ENTER");
63         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
64 }
65
66 ImageListEditorPanel::~ImageListEditorPanel(void)
67 {
68         AppLogDebug("ENTER");
69         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
70 }
71
72 result
73 ImageListEditorPanel::Initialize(void)
74 {
75         AppLogDebug("ENTER");
76         result r = Construct(RECT_INITIAL);
77         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
78
79         return r;
80 }
81
82 result
83 ImageListEditorPanel::OnInitializing(void)
84 {
85         AppLogDebug("ENTER");
86         const Form* pForm = dynamic_cast<Form*>(GetParent());
87         TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
88
89         __pPresentationModel = FileListPresentationModel::GetInstance();
90         __pPresentationModel->ClearThumbnailRequests();
91         __pPresentationModel->AddPresentationModelListener(this);
92         __itemCount = 0;
93
94         FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
95         SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
96
97         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
98         {
99                 __pContentIconListView = new (std::nothrow) IconListView();
100
101                 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
102                 {
103                         __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
104                                         DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK,
105                                         ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
106                         Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
107                         if (pBitmapEmpty != null)
108                         {
109                                 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
110                                 delete pBitmapEmpty;
111                         }
112                         __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
113                         __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
114                         __pContentIconListView->SetItemProvider(*this);
115                         __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
116                         __pContentIconListView->AddIconListViewItemEventListener(*this);
117                         __pContentIconListView->SetTouchAnimationEnabled(false);
118                         AddControl(__pContentIconListView);
119                         __pContentIconListView->SetShowState(true);
120
121                         __pLabelSelectCnt = new (std::nothrow) Label();
122                         
123                         __pLabelSelectCnt->Construct(FloatRectangle(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                         delete pIconListviewItem;
256                         delete pItemText;
257                         return null;
258                 }
259         }
260         else
261         {
262                 pIconListviewItem->Construct(*pBitmap, pItemText);
263         }
264
265         if (pBitmap != null)
266         {
267                 delete pBitmap;
268         }
269         if (pItemText != null)
270         {
271                 delete pItemText;
272         }
273         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
274
275         return pIconListviewItem;
276 }
277
278 bool
279 ImageListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
280 {
281         AppLogDebug("ENTER");
282         delete pItem;
283         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
284
285         return true;
286 }
287
288 void
289 ImageListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
290 {
291         AppLogDebug("ENTER");
292
293         if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
294         {
295                 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
296                 {
297                         if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
298                         {
299                                 int checkedCount = GetItemCheckedCount();
300                                 String strTmp;
301                                 if (checkedCount == 0)
302                                 {
303                                         strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
304                                 }
305                                 else if (checkedCount == 1)
306                                 {
307                                         strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
308                                 }
309                                 else
310                                 {
311                                         strTmp.Format(LENGTH_COUNT_LABEL,
312                                                         ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
313                                 }
314
315                                 __pLabelSelectCnt->SetText(strTmp);
316                                 __pLabelSelectCnt->RequestRedraw(true);
317                                 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
318                         }
319                 }
320                 else
321                 {
322                         int checkedCount = GetItemCheckedCount();
323                         String strTmp;
324                         if (checkedCount == 0)
325                         {
326                                 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
327                         }
328                         else if (checkedCount == 1)
329                         {
330                                 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
331                         }
332                         else
333                         {
334                                 strTmp.Format(LENGTH_COUNT_LABEL,
335                                                 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
336                         }
337
338                         __pLabelSelectCnt->SetText(strTmp);
339                         __pLabelSelectCnt->RequestRedraw(true);
340                         if (__pCheckButton->IsSelected())
341                         {
342                                 __pCheckButton->SetSelected(false);
343                         }
344                         __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
345                 }
346         }
347
348         if (    __pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
349                 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE)
350         {
351                 if (status == ICON_LIST_VIEW_ITEM_SELECTED)
352                 {
353                         GalleryApp* pApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
354                         const IMap* pArguments = pApp->GetAppControlArguments();
355                         const String* cropMode = null;
356                         if (pArguments != null)
357                         {
358                                 cropMode = static_cast<const String*>(pArguments->GetValue(String(APPCONTROL_KEY_IMAGEVIEWER_MODE)));
359                         }
360
361                         if (cropMode != null)
362                         {
363                                 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
364                                 pList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
365                                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
366                         }
367                         else
368                         {
369
370                                 HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
371                                 result r = pMap->Construct();
372                                 if (r == E_SUCCESS)
373                                 {
374
375                                         ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
376                                         r = pArrayList->Construct();
377                                         if (r == E_SUCCESS)
378                                         {
379                                                 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
380                                                 pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList);
381
382                                                 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
383                                                 if (pApp != null)
384                                                 {
385                                                         pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap);
386                                                         pApp->Terminate();
387                                                 }
388                                                 else
389                                                 {
390                                                         delete pMap;
391                                                 }
392                                         }
393                                         else
394                                         {
395                                                 delete pArrayList;
396                                                 delete pMap;
397                                         }
398                                 }
399                                 else
400                                 {
401                                         delete pMap;
402                                 }
403                         }
404                 }
405         }
406         SetButtonState();
407
408         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
409 }
410
411 void
412 ImageListEditorPanel::OnFileInfoChanged(const ContentType contentType)
413 {
414         AppLogDebug("ENTER");
415         if (contentType == CONTENT_TYPE_IMAGE)
416         {
417                 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE);
418                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
419                 __pContentIconListView->UpdateList();
420         }
421         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
422 }
423
424 void
425 ImageListEditorPanel::OnThumbnailDecoded(const int index)
426 {
427         AppLogDebug("ENTER : index(%d)",index);
428         if (index >= 0)
429         {
430                 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
431         }
432         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
433 }
434
435 void
436 ImageListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
437                                                                 const SceneId& currentSceneId, IList* pArgs)
438 {
439         AppLogDebug("ENTER");
440
441         ChangeOrientation();
442
443         SceneManager* pSceneManager = SceneManager::GetInstance();
444         __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
445
446         __pPresentationModel = FileListPresentationModel::GetInstance();
447
448         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
449         {
450                 if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR)
451                 {
452                         if (previousSceneId == IDSCN_ALBUM_LIST)
453                         {
454                                 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
455                                 if (pAlbumInfo == null)
456                                 {
457                                         AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
458
459                                         return;
460                                 }
461
462                                 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
463                                 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
464
465                                 if (pDirectoryList != null)
466                                 {
467                                         delete pDirectoryList;
468                                 }
469                                 delete pArgs;
470
471                                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
472                                 __pContentIconListView->UpdateList();
473                         }
474                 }
475         }
476         else
477         {
478                 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
479                 __pContentIconListView->RequestRedraw(true);
480         }
481
482         String titleText = __pPresentationModel->GetCurrentAlbumName();
483
484         if (titleText == ALL_ALBUMS_REAL_NAME)
485         {
486                 String text = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS");
487                 __pFileListEditorForm->SetTitleText(text);
488         }
489         else
490         {
491                 __pFileListEditorForm->SetTitleText(titleText);
492         }
493
494         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
495 }
496
497 void
498 ImageListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
499                                                                 const SceneId& nextSceneId)
500 {
501         AppLogDebug("ENTER");
502         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
503 }
504
505 int
506 ImageListEditorPanel::GetItemCheckedCount(void) const
507 {
508         AppLogDebug("ENTER");
509         int count = 0;
510         if (__pContentIconListView != null)
511         {
512                 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
513                 for (int i = 0; i < loopCount; ++i)
514                 {
515                         if (__pContentIconListView->IsItemChecked(i))
516                         {
517                                 ++count;
518                         }
519                 }
520         }
521         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
522
523         return count;
524 }
525
526 IList*
527 ImageListEditorPanel::GetItemCheckedIndexListN(void) const
528 {
529         AppLogDebug("ENTER");
530         IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
531         Integer* pIndex = null;
532
533         if (__pContentIconListView != null)
534         {
535                 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
536                 AppLogDebug("ENTER loopCount(%d)", loopCount);
537                 for (int i = 0; i < loopCount; ++i)
538                 {
539                         if (__pContentIconListView->IsItemChecked(i))
540                         {
541                                 pIndex = new (std::nothrow) Integer(i);
542                                 AppLogDebug("ENTER loopCount(%d)", loopCount);
543                                 AppLogDebug("ENTER loopCount(%d)", pIndex->ToInt());
544                                 pList->Add(pIndex);
545                         }
546                 }
547         }
548         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
549
550         return pList;
551 }
552
553 void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
554 {
555         SceneManager* pSceneManager = SceneManager::GetInstance();
556         FileListEditorForm* pFileListEditorForm =
557                                 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
558         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
559                         GetErrorMessage(GetLastResult()));
560         pFileListEditorForm->Invalidate(true);
561 }
562
563 void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
564 {
565 }
566
567 void
568 ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
569 {
570         AppLogDebug("ENTER");
571         IList* pIndexList = GetItemCheckedIndexListN();
572
573         if (pIndexList->GetCount() <= 0)
574         {
575                 delete pIndexList;
576                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
577                 return;
578         }
579
580         ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
581         pArrayList->Construct();
582         int loopCount = pIndexList->GetCount();
583         Integer* pTemp = null;
584         for (int i = 0; i < loopCount; ++i)
585         {
586                 pTemp = static_cast<Integer*>(pIndexList->GetAt(i));
587                 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(pTemp->ToInt())));
588         }
589
590         HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
591         pMap->Construct();
592         pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), pArrayList);
593
594         GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
595         if (pApp != null)
596         {
597                 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap);
598                 pApp->Terminate();
599         }
600
601         delete pIndexList;
602         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
603 }
604
605 void
606 ImageListEditorPanel::OnSelectAllPressed(void)
607 {
608         bool needToSelectAll = true;
609         int checkedCount = GetItemCheckedCount();
610         int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
611         if (checkedCount == totalFileCount)
612         {
613                 needToSelectAll = false;
614         }
615
616         if (needToSelectAll == true)
617         {
618                 for (int i = 0; i < totalFileCount; ++i)
619                 {
620                         if (__pContentIconListView->IsItemChecked(i) == false)
621                         {
622                                 __pContentIconListView->SetItemChecked(i, true);
623                                 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
624                         }
625                         __pFileListEditorForm->SetFooterButtonsState(true);
626                 }
627         }
628         else
629         {
630                 for (int i = 0; i < totalFileCount; ++i)
631                 {
632                         if (__pContentIconListView->IsItemChecked(i) == true)
633                         {
634                                 __pContentIconListView->SetItemChecked(i, false);
635                                 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
636                         }
637                         __pFileListEditorForm->SetFooterButtonsState(false);
638                 }
639         }
640
641         String tempString;
642         if (needToSelectAll == true)
643         {
644                 tempString.Format(LENGTH_COUNT_LABEL,
645                                                 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount);
646         }
647         else
648         {
649                 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
650         }
651
652         __pLabelSelectCnt->SetText(tempString);
653         __pLabelSelectCnt->RequestRedraw(true);
654 }
655
656 void
657 ImageListEditorPanel::SetButtonState(void)
658 {
659         AppLogDebug("ENTER");
660         SceneManager* pSceneManager = SceneManager::GetInstance();
661         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
662
663         if (GetItemCheckedCount() > 0)
664         {
665                 AppLogDebug("BUTTONSTATE : Request Enable");
666                 __pFileListEditorForm->SetFooterButtonsState(true);
667         }
668         else
669         {
670                 AppLogDebug("BUTTONSTATE : Request disable");
671                 __pFileListEditorForm->SetFooterButtonsState(false);
672         }
673         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
674 }
675
676 void
677 ImageListEditorPanel::ChangeOrientation(void)
678 {
679         AppLogDebug("ENTER");
680         SceneManager* pSceneManager = SceneManager::GetInstance();
681         const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
682         TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
683
684         FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
685         SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
686         if (__pLabelSelectCnt != NULL)
687         {
688         __pLabelSelectCnt->SetBounds(0.0f, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL);
689         }
690         __pContentIconListView->SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height -H_COUNT_LABEL);
691 }