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