Modify share via message
[apps/osp/Gallery.git] / src / GlAllListSelectionPanel.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                GlAllListSelectionPanel.cpp
19  * @brief               This is the implementation file for AllListSelectionPanel class.
20  */
21
22 #include <FContent.h>
23 #include <FMedia.h>
24 #include "GlAllListSelectionPanel.h"
25 #include "GlCommonUtil.h"
26 #include "GlFileListEditorForm.h"
27 #include "GlFileListPresentationModel.h"
28 #include "GlResourceManager.h"
29 #include "GlTypes.h"
30 #include "GlFileDeleteTimer.h"
31
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::Content;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Media;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41
42 static const int LENGTH_COUNT_LABEL = 256;
43 static const int H_CONTENT_MARGIN = 9;
44 static const int W_CONTENT_MARGIN = 6;
45 static const int W_CONTENT_SPACE = 6;
46 static const int H_CONTENT_SPACE = 6;
47 static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
48 static const int ALPHA_THUMBNAIL_DIM = 70;
49
50 static const Rectangle RECT_INITIAL (0, 0, 10, 10);
51
52 AllListSelectionPanel::AllListSelectionPanel(void)
53         : __pContentIconListView(null)
54         , __pSeletedIndexList(null)
55         , __itemCount(0)
56         , __deleteInProgress(false)
57         , __pPresentationModel(null)
58         , __pFileDelete(null)
59 {
60         AppLogDebug("ENTER");
61         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
62 }
63
64 AllListSelectionPanel::~AllListSelectionPanel(void)
65 {
66         AppLogDebug("ENTER");
67         delete __pFileDelete;
68         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
69 }
70
71 result
72 AllListSelectionPanel::Initialize(void)
73 {
74         AppLogDebug("ENTER");
75         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
76
77         return Construct(RECT_INITIAL); // Should be set proper area at OnInitializing()
78 }
79
80 result
81 AllListSelectionPanel::OnInitializing(void)
82 {
83         AppLogDebug("ENTER");
84         const Form* pForm = dynamic_cast<Form*>(GetParent());
85         TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
86
87         __pPresentationModel = FileListPresentationModel::GetInstance();
88         __pPresentationModel->ClearThumbnailRequests();
89         __pPresentationModel->AddPresentationModelListener(this);
90
91         Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
92         clientAreaBounds.x = clientAreaBounds.y = 0;
93         result r = SetBounds(clientAreaBounds);
94
95         __pContentIconListView = new (std::nothrow) IconListView();
96         __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
97                         DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
98         Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
99         if (pBitmapEmpty != null)
100         {
101                 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
102                 delete pBitmapEmpty;
103                 pBitmapEmpty = null;
104         }
105         __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
106         __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN);
107         __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN);
108         __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN);
109         __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE);
110         __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
111         __pContentIconListView->SetItemProvider(*this);
112         __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
113         __pContentIconListView->AddIconListViewItemEventListener(*this);
114         __pContentIconListView->SetTouchAnimationEnabled(false);
115         AddControl(*__pContentIconListView);
116         __pContentIconListView->SetShowState(true);
117
118         __itemCount=0;
119         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
120
121         return r;
122 }
123
124 void
125 AllListSelectionPanel::OnUpdateContentList()
126 {
127         AppLogDebug("ENTER");
128         SceneManager* pSceneManager = SceneManager::GetInstance();
129         FileListEditorForm* pFileListEditorForm =
130                         dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
131         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
132                         GetErrorMessage(GetLastResult()));
133
134         if ( pFileListEditorForm->GetOverlayStatus() == false && __deleteInProgress == false )
135         {
136                 SceneManager* pSceneManager = SceneManager::GetInstance();
137                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
138         }
139         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
140 }
141
142 result
143 AllListSelectionPanel::OnTerminating(void)
144 {
145         AppLogDebug("ENTER");
146         result r = E_SUCCESS;
147         __pPresentationModel->RemovePresentationModelListener(*this);
148         if (__pSeletedIndexList != null)
149         {
150                 delete __pSeletedIndexList;
151                 __pSeletedIndexList = null;
152         }
153         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
154
155         return r;
156 }
157
158 int
159 AllListSelectionPanel::GetItemCount(void)
160 {
161         AppLogDebug("ENTER");
162         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
163
164         return __itemCount;
165 }
166
167 IconListViewItem*
168 AllListSelectionPanel::CreateItem(int index)
169 {
170         AppLogDebug("ENTER : index(%d)", index);
171         IconListViewItem* pIconListviewItem;
172         Bitmap* pBitmap = null;
173         String* pItemText = null;
174
175         int realIndex = GetRealindexFromVirtualIndex(index);
176         result r = __pPresentationModel->GetThumbnailInSyncCacheN(realIndex, pItemText, pBitmap);
177         if (pBitmap == null || r == E_FAILURE)
178         {
179                 __pPresentationModel->RequestThumbnail(realIndex);
180                 pBitmap = CommonUtil::GetEmptyThumbnailN();
181         }
182
183         if (pItemText == null)
184         {
185                 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
186         }
187         else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
188         {
189                 delete pItemText;
190                 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
191         }
192
193         if (__pContentIconListView->IsItemChecked(index) == true)
194         {
195                 if (pBitmap != null)
196                 {
197                         BufferInfo bufferInfo;
198                         pBitmap->Lock(bufferInfo, INFINITE);
199                         pBitmap->Unlock();
200
201                         Color dimColor(COLOR_THUMBNAIL_DIM);
202                         dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
203
204                         Canvas canvas;
205                         canvas.Construct(bufferInfo);
206                         canvas.FillRectangle(dimColor, canvas.GetBounds());
207
208                         Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
209                         pSelectedBitmap->Construct(canvas, canvas.GetBounds());
210                         pIconListviewItem = new (std::nothrow) IconListViewItem();
211                         pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
212                         delete pSelectedBitmap;
213                         pSelectedBitmap = null;
214                 }
215                 else
216                 {
217                         AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
218                         return null;
219                 }
220
221         }
222         else
223         {
224                 pIconListviewItem = new (std::nothrow) IconListViewItem();
225                 pIconListviewItem->Construct(*pBitmap, pItemText);
226         }
227
228         if (pBitmap != null)
229         {
230                 delete pBitmap;
231                 pBitmap = null;
232         }
233         if (pItemText != null)
234         {
235                 delete pItemText;
236                 pItemText = null;
237         }
238         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
239
240         return pIconListviewItem;
241 }
242
243 bool
244 AllListSelectionPanel::DeleteItem(int index, IconListViewItem* pItem)
245 {
246         AppLogDebug("ENTER");
247         delete pItem;
248         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
249
250         return true;
251 }
252
253 void
254 AllListSelectionPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
255 {
256         AppLogDebug("ENTER");
257         if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
258         {
259                 SceneManager* pSceneManager = SceneManager::GetInstance();
260                 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
261
262                 FileListEditorForm* pFileListEditorForm =
263                                 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
264                 TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.",
265                                 GetErrorMessage(GetLastResult()));
266
267                 String strTmp;
268                 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
269                                 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), GetItemCheckedCount());
270                 pFileListEditorForm->SetTitleText(strTmp);
271                 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
272         }
273
274         SetButtonState();
275         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
276 }
277
278 void
279 AllListSelectionPanel::OnFileInfoChanged(const ContentType contentType)
280 {
281         AppLogDebug("ENTER");
282         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
283 }
284
285 void
286 AllListSelectionPanel::OnThumbnailDecoded(const int index)
287 {
288         AppLogDebug("ENTER : index(%d)", index);
289         if (index >= 0)
290         {
291                 int virtualIndex = -1;
292                 int loopCount = __pSeletedIndexList->GetCount();
293                 for (int i = 0; i < loopCount; ++i)
294                 {
295                         virtualIndex = GetVirtualIndexFromRealIndex(index);
296                         if (virtualIndex >= 0)
297                         {
298                                 __pContentIconListView->RefreshList(virtualIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);
299                                 break;
300                         }
301                 }
302         }
303         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
304 }
305
306 void
307 AllListSelectionPanel::OnSceneActivatedN(const SceneId& previousSceneId,
308                 const SceneId& currentSceneId, IList* pArgs)
309 {
310         AppLogDebug("ENTER");
311         __pPresentationModel = FileListPresentationModel::GetInstance();
312
313         SceneManager* pSceneManager = SceneManager::GetInstance();
314         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
315
316         if (previousSceneId == IDSCN_ALL_LIST_EDITOR)
317         {
318                 if (pArgs != null)
319                 {
320                         __pSeletedIndexList = pArgs;
321                         pArgs = null;
322                 }
323                 ResetSelection();
324                 int loopCount = __pSeletedIndexList->GetCount();
325                 for (int i = 0; i < loopCount; ++i)
326                 {
327                         __pContentIconListView->SetItemChecked(i, true);
328                         __pContentIconListView->RequestRedraw(true);
329                 }
330         }
331         SetButtonState();
332         FileListEditorForm* pFileListEditorForm =
333                         dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
334         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.",
335                         GetErrorMessage(GetLastResult()));
336
337         if (pArgs != null && pArgs->GetCount() > 0)
338         {
339                 String* pDirectory = static_cast<String*>(pArgs->GetAt(0));
340                 if (pDirectory != null && pDirectory->GetLength() > 0)
341                 {
342                         pFileListEditorForm->MoveToAlbum(*pDirectory);
343                 }
344         }
345         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
346 }
347
348 void
349 AllListSelectionPanel::OnSceneDeactivated(const SceneId& currentSceneId,
350                 const SceneId& nextSceneId)
351 {
352         AppLogDebug("ENTER");
353         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
354 }
355
356 int
357 AllListSelectionPanel::GetItemCheckedCount(void) const
358 {
359         AppLogDebug("ENTER");
360         int count = 0;
361         if (__pContentIconListView != null && __pSeletedIndexList != null)
362         {
363                 int loopCount = __pSeletedIndexList->GetCount();
364                 for (int i = 0; i < loopCount; ++i)
365                 {
366                         if (__pContentIconListView->IsItemChecked(i))
367                         {
368                                 ++count;
369                         }
370                 }
371         }
372         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
373
374         return count;
375 }
376
377 IList*
378 AllListSelectionPanel::GetItemCheckedIndexListN(void)
379 {
380         AppLogDebug("ENTER");
381         IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
382         Integer* pIndex=null;
383
384         if (__pContentIconListView!=null)
385         {
386                 int realIndex = -1;
387                 int loopCount = __pSeletedIndexList->GetCount();
388                 for (int i = 0; i < loopCount; ++i)
389                 {
390                         if (__pContentIconListView->IsItemChecked(i))
391                         {
392                                 realIndex = GetRealindexFromVirtualIndex(i);
393                                 pIndex = new (std::nothrow) Integer(realIndex);
394                                 pList->Add(pIndex);
395                         }
396                 }
397         }
398         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
399
400         return pList;
401 }
402
403 int
404 AllListSelectionPanel::GetRealindexFromVirtualIndex(int virtualIndex)
405 {
406         if (__pSeletedIndexList == null || __pSeletedIndexList->GetCount() == 0)
407         {
408                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
409
410                 return -1;
411         }
412
413         Integer* pRealIndex = static_cast<Integer*>(__pSeletedIndexList->GetAt(virtualIndex));
414         int realIndex = -1;
415         if (pRealIndex != null)
416         {
417                 realIndex = pRealIndex->ToInt();
418         }
419         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
420
421         return realIndex;
422 }
423
424 int
425 AllListSelectionPanel::GetVirtualIndexFromRealIndex(int realIndex)
426 {
427         int returnValue = -1;
428         int loopCount = __pSeletedIndexList->GetCount();
429         for (int i = 0; i < loopCount; ++i)
430         {
431                 Integer* pRealIndex = static_cast<Integer*>(__pSeletedIndexList->GetAt(i));
432                 int index = -1;
433                 if (pRealIndex != null)
434                 {
435                         index = pRealIndex->ToInt();
436                 }
437
438                 if (index == realIndex)
439                 {
440                         returnValue = i;
441                         break;
442                 }
443         }
444         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
445
446         return returnValue;
447 }
448
449 result
450 AllListSelectionPanel::OnRequestDelete(void)
451 {
452         AppLogDebug("ENTER");
453         IList* pIndexList = GetItemCheckedIndexListN();
454         if (pIndexList->GetCount() <= 0)
455         {
456                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
457
458                 return E_FAILURE;
459         }
460
461         delete __pFileDelete;
462         __pFileDelete = new FileDeleteTimer(pIndexList,
463                         __pPresentationModel,
464                         this );
465         result r = __pFileDelete->StartTimer();
466
467         if (IsFailed(r))
468         {
469                 delete __pFileDelete;
470                 __pFileDelete = null;
471                 return E_FAILURE;
472         }
473         else
474         {
475                 __deleteInProgress = true;
476         }
477
478         return E_SUCCESS;
479 }
480
481 void AllListSelectionPanel::OnFileOpInvalidate(enum FileActionMode actionId)
482 {
483         SceneManager* pSceneManager = SceneManager::GetInstance();
484         FileListEditorForm* pFileListEditorForm =
485                                 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
486         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
487                         GetErrorMessage(GetLastResult()));
488         pFileListEditorForm->Invalidate(true);
489 }
490
491 void AllListSelectionPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
492 {
493         __deleteInProgress = false;
494         SceneManager* pSceneManager = SceneManager::GetInstance();
495         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.",
496                         GetErrorMessage(GetLastResult()));
497
498         FileListEditorForm* pFileListEditorForm =
499                         dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
500         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
501                         GetErrorMessage(GetLastResult()));
502
503         String strTmp;
504         String selectString = ResourceManager::GetString(L"IDS_COM_BODY_SELECTED");
505         strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", selectString.GetPointer(), 0);
506         pFileListEditorForm->SetTitleText(strTmp);
507
508         __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
509         __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
510         __pContentIconListView->UpdateList();
511
512         if (GetItemCount() > 0)
513         {
514                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
515         }
516         else
517         {
518                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
519         }
520         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
521 }
522
523 result
524 AllListSelectionPanel::OnRequestMessage(void)
525 {
526         AppLogDebug("ENTER");
527         IList* pIndexList = GetItemCheckedIndexListN();
528         if (pIndexList == null || pIndexList->GetCount() <= 0)
529         {
530                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
531
532                 return E_FAILURE;
533         }
534
535         String combineText;
536         String path;
537         Integer* pIndex = null;
538         int checkedIndex;
539
540         int loopCount = pIndexList->GetCount();
541         AppLogDebug("pIndexList->GetCount(%d)", loopCount);
542         for (int i = 0; i < loopCount; ++i)
543         {
544                 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
545                 if (pIndex != null)
546                 {
547                         checkedIndex = pIndex->ToInt();
548                         path = __pPresentationModel->GetContentFilePath(checkedIndex);
549                 }
550
551                 if (combineText.CompareTo(EMPTY_SPACE) != 0)
552                 {
553                         combineText.Append(L";");
554                 }
555                 combineText.Append(path);
556         }
557         HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
558         pDataList->Construct();
559         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
560         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
561
562         __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
563                         pDataList, null);
564         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
565
566         return E_SUCCESS;
567 }
568
569 result
570 AllListSelectionPanel::OnRequestEmail(void)
571 {
572         AppLogDebug("ENTER");
573         IList* pIndexList = GetItemCheckedIndexListN();
574         if (pIndexList == null || pIndexList->GetCount() <= 0)
575         {
576                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
577
578                 return E_FAILURE;
579         }
580
581         String combineText;
582         String path;
583         Integer* pIndex = null;
584         int checkedIndex;
585
586         int loopCount = pIndexList->GetCount();
587         AppLogDebug("pIndexList->GetCount(%d)", loopCount);
588         for (int i = 0; i < loopCount; ++i)
589         {
590                 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
591                 if (pIndex != null)
592                 {
593                         checkedIndex = pIndex->ToInt();
594                         path = __pPresentationModel->GetContentFilePath(checkedIndex);
595                 }
596
597                 if (combineText.CompareTo(EMPTY_SPACE) != 0)
598                 {
599                         combineText.Append(L";");
600                 }
601                 combineText.Append(path);
602         }
603         HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
604         pDataList->Construct();
605         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
606
607         __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
608                         APPCONTROL_OPERATION_ID_COMPOSE, pDataList, null);
609         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
610
611         return E_SUCCESS;
612 }
613
614 result
615 AllListSelectionPanel::OnRequestSlideShow(void)
616 {
617         AppLogDebug("ENTER");
618         IList* pIndexList = GetItemCheckedIndexListN();
619         if (pIndexList == null)
620         {
621                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
622
623                 return E_FAILURE;
624         }
625
626         HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
627         result r = pDataList->Construct();
628         if (r != E_SUCCESS)
629         {
630                 delete pDataList;
631                 pDataList = null;
632                 delete pIndexList;
633                 pIndexList = null;
634                 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
635
636                 return E_FAILURE;
637         }
638
639         pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
640                         new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW));
641
642         Integer* pRealIndex = null;
643         int realIndex = -1;
644         String combineText;
645         String path;
646
647         int loopCount = pIndexList->GetCount();
648         if (loopCount > 0)
649         {
650                 for (int i = 0; i < loopCount; ++i)
651                 {
652                         pRealIndex = static_cast<Integer*>(pIndexList->GetAt(i));
653                         if (pRealIndex != null)
654                         {
655                                 realIndex = pRealIndex->ToInt();
656                         }
657
658                         path = __pPresentationModel->GetContentFilePath(realIndex);
659                         if (combineText.CompareTo(EMPTY_SPACE) != 0)
660                         {
661                                 combineText.Append(L";");
662                         }
663                         combineText.Append(path);
664                 }
665                 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
666                                 new (std::nothrow) String(combineText));
667         }
668
669         delete pIndexList;
670         pIndexList = null;
671
672         __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE,
673                         APPCONTROL_OPERATION_ID_VIEW, pDataList, null);
674         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
675
676         return E_SUCCESS;
677 }
678
679 void
680 AllListSelectionPanel::ResetSelection(void)
681 {
682         AppLogDebug("ENTER");
683         __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
684         if (__pSeletedIndexList == null)
685         {
686                 __itemCount = 0;
687         }
688         else
689         {
690                 __itemCount = __pSeletedIndexList->GetCount();
691         }
692
693         SceneManager* pSceneManager = SceneManager::GetInstance();
694         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
695
696         FileListEditorForm* pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
697         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.", GetErrorMessage(GetLastResult()));
698
699         String strTmp;
700         String bodyText = ResourceManager::GetString(L"IDS_COM_BODY_SELECTED");
701         strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)", bodyText.GetPointer(), __itemCount);
702         pFileListEditorForm->SetTitleText(strTmp);
703         if (__pContentIconListView != null)
704         {
705                 __pContentIconListView->UpdateList();
706         }
707         SetButtonState();
708         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
709 }
710
711 void
712 AllListSelectionPanel::SetButtonState(void)
713 {
714         AppLogDebug("ENTER");
715         SceneManager* pSceneManager = SceneManager::GetInstance();
716         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
717
718         FileListEditorForm* pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
719         TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get FileListEditorForm.", GetErrorMessage(GetLastResult()));
720
721         if (GetItemCheckedCount() > 0)
722         {
723                 AppLogDebug("BUTTONSTATE : Request Enable");
724                 pFileListEditorForm->SetFooterButtonsState(true);
725         }
726         else
727         {
728                 AppLogDebug("BUTTONSTATE : Request disable");
729                 pFileListEditorForm->SetFooterButtonsState(false);
730         }
731         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
732 }
733
734