4adca410392315ee1b740328db029eea3e078ac4
[apps/osp/Gallery.git] / src / GlFileListEditorForm.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                GlFileListEditorForm.cpp
19  * @brief               This is the implementation file for FileListEditorForm class.
20  */
21
22 #include "GlAllListEditorPanel.h"
23 #include "GlAllListSelectionPanel.h"
24 #include "GlFileListEditorForm.h"
25 #include "GlFileListPresentationModel.h"
26 #include "GlGalleryApp.h"
27 #include "GlImageListEditorPanel.h"
28 #include "GlResourceManager.h"
29 #include "GlSlideSettingListener.h"
30 #include "GlSlideShowPopUp.h"
31 #include "GlTypes.h"
32 #include "GlVideoListEditorPanel.h"
33 #include "GlFileMoveTimer.h"
34
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Content;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::System;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
44 using namespace Tizen::Base::Utility;
45
46 static const int GAP_W_POPUP_ITEM = 5;
47 static const int W_DELETE_POPUP = 600;
48 static const int H_DELETE_POPUP = 300;
49 static const int H_DELETE_LABEL = 180;
50 static const int Y_DELETE_BUTTON = 180;
51 static const int H_DELETE_BUTTON = 80;
52 static const int H_TOAST_LABEL = 48;
53
54 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
55 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
56 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
57
58 static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
59
60 FileListEditorForm::FileListEditorForm(void)
61         : __pContextMenuMore(null)
62         , __pContextMenuShare(null)
63         , __pContextEditorMenuMove(null)
64         , __pContextSelectionMenuMove(null)
65         , __pDeletePopup(null)
66         , __morePosition(Point(0, 0))
67         , __pContentDirectoryList(null)
68         , __pContentDirectoryNameList(null)
69         , __pPopUp(null)
70         , __pFileMove(null)
71         , __isCopyOperation(false)
72         , __pPresentationModel(null)
73 {
74         AppLogDebug("ENTER");
75         _overlayMsg = false;
76         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
77 }
78
79 FileListEditorForm::~FileListEditorForm(void)
80 {
81         AppLogDebug("ENTER");
82         if (__pContentDirectoryList != null)
83         {
84                 delete __pContentDirectoryList;
85         }
86
87         if (__pContentDirectoryNameList != null)
88         {
89                 delete __pContentDirectoryNameList;
90         }
91         delete __pFileMove;
92         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
93 }
94
95 result
96 FileListEditorForm::Initialize(void)
97 {
98         AppLogDebug("ENTER");
99         result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
100         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
101
102         return r;
103 }
104
105 result
106 FileListEditorForm::OnInitializing(void)
107 {
108         AppLogDebug("ENTER");
109         Header* pHeader = GetHeader();
110         TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
111
112         __pPopUp = new (std::nothrow) SlideShowPopUp();
113
114         if (__pPopUp != null)
115         {
116                 __pPopUp->Initialize();
117                 __pPopUp->SetEventListner(this);
118                 AddControl(__pPopUp);
119         }
120
121         __pPresentationModel = FileListPresentationModel::GetInstance();
122         __pPresentationModel->ClearThumbnailRequests();
123
124         pHeader->SetStyle(HEADER_STYLE_TITLE);
125         pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
126
127         if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
128                 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
129         {
130                 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
131                 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
132                 ButtonItem selectAll;
133                 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
134                 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
135                 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
136                 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
137                 delete pNormalBitmap;
138                 delete pPressBitmap;
139         }
140
141         pHeader->AddActionEventListener(*this);
142
143         InitializeFooter();
144         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
145
146         return E_SUCCESS;
147 }
148
149 result
150 FileListEditorForm::InitializeFooter(void)
151 {
152         AppLogDebug("ENTER");
153         Footer* pFooter = GetFooter();
154         TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
155         pFooter->RemoveAllItems();
156
157         result r = E_SUCCESS;
158
159         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
160         {
161                 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
162                 {
163                         pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
164
165                         FooterItem footerConfirm;
166                         footerConfirm.Construct(IDA_FOOTER_CONFIRM);
167                         footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
168                         pFooter->AddItem(footerConfirm);
169                         pFooter->SetItemEnabled(0, false);
170                 }
171                 else
172                 {
173                         pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
174                 }
175                 pFooter->SetBackButton();
176                 SetFormBackEventListener(this);
177         }
178         else
179         {
180                 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
181
182                 ButtonItem footerMore;
183                 footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE);
184                 Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE);
185                 Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED);
186                 Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED);
187
188                 if (pBitmapMore != null && pBitmapMoreDim != NULL && pBitmapMorePressed != null)
189                 {
190                         footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore);
191                         footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim);
192                         footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed);
193                 }
194                 pFooter->SetButton(BUTTON_POSITION_LEFT,footerMore);
195
196                 delete pBitmapMore;
197                 delete pBitmapMoreDim;
198                 delete pBitmapMorePressed;
199
200                 FooterItem footerShare;
201                 r = footerShare.Construct(IDA_FOOTER_SHARE);
202                 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
203                 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
204                 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
205
206                 if (pBitmapShare != null && pBitmapShareDim != null)
207                 {
208                         footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
209                         footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
210                 }
211
212                 r = pFooter->AddItem(footerShare);
213                 delete pBitmapShare;
214                 delete pBitmapShareDim;
215                 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
216
217                 FooterItem footerDelete;
218                 r = footerDelete.Construct(IDA_FOOTER_DELETE);
219                 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
220                 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
221                 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
222
223                 if (pBitmapDelete != null && pBitmapDeleteDim != null)
224                 {
225                         footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
226                         footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
227                 }
228
229                 r = pFooter->AddItem(footerDelete);
230                 delete pBitmapDelete;
231                 delete pBitmapDeleteDim;
232                 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
233
234                 pFooter->SetBackButton();
235                 SetFormBackEventListener(this);
236
237                 SceneManager* pSceneManager = SceneManager::GetInstance();
238                 int checkedCount = 0;
239
240                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
241                 {
242                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
243                         if (pEditorPanel != null)
244                         {
245                                 checkedCount = pEditorPanel->GetItemCheckedCount();
246                         }
247                 }
248                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
249                 {
250                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
251                         if (pSelectionPanel != null)
252                         {
253                                 checkedCount = pSelectionPanel->GetItemCheckedCount();
254                         }
255                 }
256
257                 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
258
259                 if (__pContextMenuMore != null)
260                 {
261                         delete __pContextMenuMore;
262                         __pContextMenuMore = null;
263                 }
264
265                 __pContextMenuMore = new (std::nothrow) ContextMenu();
266                 __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
267
268                 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
269                                 IDA_CONTEXT_MENU_MORE_MOVE);
270                 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
271                                                 IDA_CONTEXT_MENU_MORE_COPY);
272
273                 if (checkedCount > 1)
274                 {
275                         __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
276                                         IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
277                 }
278
279                 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
280                 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
281
282                 __pContextMenuMore->SetShowState(false);
283                 __pContextMenuMore->AddActionEventListener(*this);
284
285                 __pContextMenuShare = new (std::nothrow) ContextMenu();
286                 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
287                 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
288                                 IDA_CONTEXT_MENU_SHARE_MESSAGE);
289                 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
290                                 IDA_CONTEXT_MENU_SHARE_EMAIL);
291                 __pContextMenuShare->SetShowState(false);
292                 __pContextMenuShare->AddActionEventListener(*this);
293
294                 __pContextEditorMenuMove = new (std::nothrow) ContextMenu();
295                 __pContextEditorMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
296                 __pContextEditorMenuMove->AddActionEventListener(*this);
297
298                 __pContextSelectionMenuMove = new (std::nothrow) ContextMenu();
299                 __pContextSelectionMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
300                 __pContextSelectionMenuMove->AddActionEventListener(*this);
301
302                 if (__pContentDirectoryNameList != null)
303                 {
304                         delete __pContentDirectoryNameList;
305                         __pContentDirectoryNameList = null;
306                 }
307
308                 SetUpPopup();
309         }
310
311         pFooter->AddActionEventListener(*this);
312         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
313
314         return r;
315 }
316
317 String
318 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
319 {
320         AppLogDebug("ENTER");
321         if (fullPath == null)
322         {
323                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
324
325                 return null;
326         }
327         String delim(DIRECTORY_SEPARATOR);
328         StringTokenizer st(fullPath,delim);
329         String token;
330         while (st.HasMoreTokens())
331         {
332                 st.GetNextToken(token);
333         }
334         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
335
336         return token;
337 }
338
339 result
340 FileListEditorForm::OnTerminating(void)
341 {
342         AppLogDebug("ENTER");
343         __pPresentationModel->RemoveContentEventListener(this);
344         if (__pContextMenuMore != null)
345         {
346                 __pContextMenuMore->RemoveActionEventListener(*this);
347                 delete __pContextMenuMore;
348                 __pContextMenuMore = null;
349         }
350
351         if (__pContextMenuShare != null)
352         {
353                 __pContextMenuShare->RemoveActionEventListener(*this);
354                 delete __pContextMenuShare;
355                 __pContextMenuShare = null;
356         }
357
358         if (__pContextEditorMenuMove != null)
359         {
360                 __pContextEditorMenuMove->RemoveActionEventListener(*this);
361                 delete __pContextEditorMenuMove;
362                 __pContextEditorMenuMove = null;
363         }
364
365         if (__pContextSelectionMenuMove != null)
366         {
367                 __pContextSelectionMenuMove->RemoveActionEventListener(*this);
368                 delete __pContextSelectionMenuMove;
369                 __pContextSelectionMenuMove = null;
370         }
371
372         if (__pDeletePopup != null)
373         {
374                 delete __pDeletePopup;
375                 __pDeletePopup = null;
376         }
377         _overlayMsg = false;
378         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
379
380         return E_SUCCESS;
381 }
382
383 void
384 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
385 {
386         AppLogDebug("ENTER(actionId=%d)", actionId);
387         SceneManager* pSceneManager = SceneManager::GetInstance();
388         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
389
390         switch (actionId)
391         {
392         case IDA_FILE_LIST_SELECT_ALL:
393                 SelectAllPressed();
394         break;
395
396         case IDA_FOOTER_MORE:
397         {
398                 InitializeFooter();
399
400                 if (__pContextMenuMore->GetShowState() == false)
401                 {
402                         Rectangle rect = source.GetBounds();
403                         __morePosition = Point(rect.width / 8, rect.y);
404                         if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
405                         {
406                                 __pContextMenuMore->SetAnchorPosition(Point(rect.width / 10, rect.y));
407                         }
408                         else
409                         {
410                                 __pContextMenuMore->SetAnchorPosition(Point(rect.width / 10, rect.y - H_TOAST_LABEL));
411                         }
412                         __pContextMenuMore->SetShowState(true);
413                         __pContextMenuMore->Show();
414                 }
415                 else
416                 {
417                         __pContextMenuMore->SetShowState(false);
418                 }
419         }
420         break;
421
422         case IDA_FOOTER_SHARE:
423         {
424                 if (__pContextMenuShare->GetShowState() == false)
425                 {
426                         Rectangle rect = source.GetBounds();
427                         if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
428                         {
429                                 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
430                         }
431                         else
432                         {
433                                 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
434                         }
435                         __pContextMenuShare->SetShowState(true);
436                         __pContextMenuShare->Show();
437                 }
438                 else
439                 {
440                         __pContextMenuShare->SetShowState(false);
441                 }
442         }
443         break;
444
445         case IDA_FOOTER_DELETE:
446         {
447                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
448                 {
449                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
450                         if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
451                         {
452                                 __pDeletePopup->SetShowState(true);
453                                 __pDeletePopup->Show();
454                                 _overlayMsg = true;
455                         }
456                 }
457                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
458                 {
459                         ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
460                         if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
461                         {
462                                 __pDeletePopup->SetShowState(true);
463                                 __pDeletePopup->Show();
464                                 _overlayMsg = true;
465                         }
466                 }
467                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
468                 {
469                         VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
470                         if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
471                         {
472                                 __pDeletePopup->SetShowState(true);
473                                 __pDeletePopup->Show();
474                                 _overlayMsg = true;
475                         }
476                 }
477                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
478                 {
479                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
480                         (pSceneManager->GetCurrentScene()->GetPanel());
481                         if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
482                         {
483                                 __pDeletePopup->SetShowState(true);
484                                 __pDeletePopup->Show();
485                                 _overlayMsg = true;
486                         }
487                 }
488         }
489         break;
490
491         case IDA_CONTEXT_MENU_MORE_EDIT:
492         {
493                 break;
494         }
495
496         case IDA_CONTEXT_MENU_MORE_ADD_TAG:
497         {
498                 break;
499         }
500
501         case IDA_CONTEXT_MENU_MORE_COPY:
502
503         case IDA_CONTEXT_MENU_MORE_MOVE:
504         {
505                 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
506                 {
507                         __isCopyOperation = false;
508                 }
509                 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
510                 {
511                         __isCopyOperation = true;
512                 }
513                 RefreshFolderList();
514                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
515                 {
516                         if (__pContextEditorMenuMove->GetShowState() == false)
517                         {
518                                 __pContextEditorMenuMove->SetAnchorPosition(Point(__morePosition.x, __morePosition.y - 48));
519                                 __pContextEditorMenuMove->SetShowState(true);
520                                 __pContextEditorMenuMove->Show();
521                         }
522                         else
523                         {
524                                 __pContextEditorMenuMove->SetShowState(false);
525                         }
526                 }
527                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
528                 {
529                         if (__pContextSelectionMenuMove->GetShowState() == false)
530                         {
531                                 __pContextSelectionMenuMove->SetAnchorPosition(__morePosition);
532                                 __pContextSelectionMenuMove->SetShowState(true);
533                                 __pContextSelectionMenuMove->Show();
534                         }
535                         else
536                         {
537                                 __pContextSelectionMenuMove->SetShowState(false);
538                         }
539                 }
540         }
541         break;
542
543         case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
544         {
545                 if (__pPopUp != null)
546                 {
547                         __pPopUp->SetShowState(true);
548                         __pPopUp->Show();
549                 }
550         }
551         break;
552
553         case IDA_CONTEXT_MENU_SHARE_MESSAGE:
554         {
555                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
556                 {
557                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
558                         if (pEditorPanel != null)
559                         {
560                                 pEditorPanel->OnRequestMessage();
561                         }
562                 }
563                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
564                 {
565                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
566                         if (pSelectionPanel != null)
567                         {
568                                 pSelectionPanel->OnRequestMessage();
569                         }
570                 }
571         }
572         break;
573
574         case IDA_CONTEXT_MENU_SHARE_EMAIL:
575         {
576                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
577                 {
578                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
579                         if (pEditorPanel != null)
580                         {
581                                 pEditorPanel->OnRequestEmail();
582                         }
583                 }
584                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
585                 {
586                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
587                         if (pSelectionPanel != null)
588                         {
589                                 pSelectionPanel->OnRequestEmail();
590                         }
591                 }
592         }
593         break;
594
595         case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
596         {
597                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
598                 {
599                         AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
600                         if (pListEditorPanel)
601                         {
602                                 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
603                                 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
604                                 if (__isCopyOperation)
605                                 {
606                                         pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
607                                 }
608                                 else
609                                 {
610                                         pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
611                                 }
612                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
613                         }
614
615                 }
616         }
617         break;
618
619         case IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM:
620         {
621                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
622                 {
623                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
624                         (pSceneManager->GetCurrentScene()->GetPanel());
625
626                         if (pSelectionPanel != null)
627                         {
628                                 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
629                                 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
630                                 if (__isCopyOperation)
631                                 {
632                                         pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
633                                 }
634                                 else
635                                 {
636                                         pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
637                                 }
638                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
639                         }
640                 }
641         }
642         break;
643
644         case IDA_DELETE_POPUP_DEL:
645         {
646                 _overlayMsg = false;
647                 __pDeletePopup->SetShowState(false);
648                 __pDeletePopup->Invalidate(true);
649
650                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
651                 {
652                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
653                         if (pEditorPanel != null)
654                         {
655                                 result r = pEditorPanel->OnRequestDelete();
656                                 if (IsFailed(r))
657                                 {
658                                         AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
659                                 }
660                         }
661                 }
662                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
663                 {
664                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
665                         (pSceneManager->GetCurrentScene()->GetPanel());
666
667                         if (pSelectionPanel != null)
668                         {
669                                 result r = pSelectionPanel->OnRequestDelete();
670                                 if (IsFailed(r))
671                                 {
672                                         AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
673                                 }
674                         }
675                 }
676         }
677         break;
678
679         case IDA_DELETE_POPUP_CANCEL:
680         {
681                 _overlayMsg = false;
682                 __pDeletePopup->SetShowState(false);
683                 __pDeletePopup->Invalidate(true);
684         }
685         break;
686
687         case IDA_CONTEXT_MENU_ROTATE_LEFT:
688         {
689                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
690                 {
691                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
692                         if (pEditorPanel != null)
693                         {
694                                 RotateMode rotateMode = ROTATE_MODE_LEFT;
695                                 pEditorPanel->OnRequestRotate(rotateMode);
696                         }
697                 }
698                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
699                 {
700                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
701                         (pSceneManager->GetCurrentScene()->GetPanel());
702
703                         if (pSelectionPanel != null)
704                         {
705                                 RotateMode rotateMode = ROTATE_MODE_LEFT;
706                                 pSelectionPanel->OnRotateRequested(rotateMode);
707                         }
708                 }
709         }
710         break;
711
712         case IDA_CONTEXT_MENU_ROTATE_RIGHT:
713         {
714                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
715                 {
716                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
717                         if (pEditorPanel != null)
718                         {
719                                 RotateMode rotateMode = ROTATE_MODE_RIGHT;
720                                 pEditorPanel->OnRequestRotate(rotateMode);
721                         }
722                 }
723                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
724                 {
725
726                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
727                         (pSceneManager->GetCurrentScene()->GetPanel());
728
729                         if (pSelectionPanel != null)
730                         {
731                                 RotateMode rotateMode = ROTATE_MODE_RIGHT;
732                                 pSelectionPanel->OnRotateRequested(rotateMode);
733                         }
734                 }
735         }
736         break;
737
738         case IDA_FOOTER_CONFIRM:
739         {
740                 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
741                 {
742                         ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
743                         if (pEditorPanel != null)
744                         {
745                                 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
746                         }
747                 }
748                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
749                 {
750                         VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
751                         if (pEditorPanel != null)
752                         {
753                                 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
754                         }
755                 }
756         }
757         break;
758
759         default:
760         {
761                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
762                 {
763                         if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
764                                         (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
765                         {
766                                 if (__pContentDirectoryList == null)
767                                 {
768                                         return;
769                                 }
770                                 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
771                                 {
772                                         String* pDirectory = static_cast<String*>
773                                         (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
774
775                                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
776                                         (pSceneManager->GetCurrentScene()->GetPanel());
777
778                                         if (pEditorPanel != null)
779                                         {
780                                                 delete __pFileMove;
781                                                 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
782                                                 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
783                                                 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
784                                                 if (__isCopyOperation)
785                                                 {
786                                                         AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
787                                                         __pFileMove->SetCopy();
788                                                 }
789
790                                                 result r = __pFileMove->StartTimer();
791                                                 if (IsFailed(r))
792                                                 {
793                                                         delete __pFileMove;
794                                                         __pFileMove = null;
795                                                         __isCopyOperation = false;
796                                                 }
797                                                 else
798                                                 {
799                                                         _overlayMsg = true;
800                                                 }
801                                         }
802                                 }
803                         }
804                 }
805                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
806                 {
807                         if ((IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) &&
808                                         (actionId <= IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM + 1000))
809                         {
810                                 if (__pContentDirectoryList == null)
811                                 {
812
813                                         return;
814                                 }
815                                 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START)
816                                 {
817                                         String* pDirectory = static_cast<String*>
818                                         (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START));
819
820                                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
821                                                 (pSceneManager->GetCurrentScene()->GetPanel());
822
823                                         if (pSelectionPanel != null)
824                                         {
825                                                 delete __pFileMove;
826                                                 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
827                                                 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
828                                                 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
829                                                 if (__isCopyOperation)
830                                                 {
831                                                         AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
832                                                         __pFileMove->SetCopy();
833                                                 }
834                                                 result r = __pFileMove->StartTimer();
835                                                 if (IsFailed(r))
836                                                 {
837                                                         delete __pFileMove;
838                                                         __pFileMove = null;
839                                                         __isCopyOperation = false;
840                                                 }
841                                                 else
842                                                 {
843                                                         _overlayMsg = true;
844                                                 }
845                                         }
846                                 }
847                         }
848                 }
849                 break;
850         }
851         }
852         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
853 }
854
855 void
856 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
857 {
858         Invalidate(true);
859 }
860
861 bool
862 FileListEditorForm::GetOverlayStatus(void) const
863 {
864         return _overlayMsg;
865 }
866
867 void
868 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
869 {
870         _overlayMsg = false;
871         __pPresentationModel->SetUpdateProgressStatus(false);
872         if (res != COMPLETE_SUCCESS)
873         {
874                 MessageBox messageBox;
875                 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
876                 int modalResult = 0;
877                 _overlayMsg = true;
878                 messageBox.ShowAndWait(modalResult);
879                 _overlayMsg = false;
880                 SceneManager* pSceneManager = SceneManager::GetInstance();
881                 AppAssert(pSceneManager);
882                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
883         }
884 }
885
886 void
887 FileListEditorForm::OnContentUpdated()
888 {
889         AppLogDebug("ENTER");
890
891         SceneManager* pSceneManager = SceneManager::GetInstance();
892
893         if(__pDeletePopup != null)
894         {
895                 if(__pDeletePopup->IsVisible() == true)
896                 {
897                         __pDeletePopup->Destroy();
898                         __pDeletePopup = null;
899                         _overlayMsg = false;
900                         SetUpPopup();
901                 }
902         }
903
904         if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
905         {
906                 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
907                 if (pEditorPanel != null)
908                 {
909                         pEditorPanel->CancelUpdateProgress();
910                 }
911         }
912         else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
913         {
914                 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
915                 if (pSelectionPanel != null)
916                 {
917                         pSelectionPanel->CancelUpdateProgress();
918                 }
919         }
920
921         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
922                         && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
923         {
924                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
925                                 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
926
927         }
928         else if (_overlayMsg == false)
929         {
930                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
931                                 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
932         }
933
934         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
935 }
936
937 result
938 FileListEditorForm::SetUpPopup(void)
939 {
940         AppLogDebug("ENTER");
941         result r = E_SUCCESS;
942
943         if (__pDeletePopup != null)
944         {
945                 delete __pDeletePopup;
946                 __pDeletePopup = null;
947         }
948
949         __pDeletePopup = new (std::nothrow) Popup();
950         __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
951
952         Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
953
954         Label* pLabelText = new (std::nothrow) Label();
955         pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
956                         ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
957         pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
958         pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
959         __pDeletePopup->AddControl(pLabelText);
960
961         Button* pDeleteButton = new (std::nothrow) Button();
962         pDeleteButton->Construct(Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
963                         ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
964         pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
965         pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
966         pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
967         pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
968         pDeleteButton->AddActionEventListener(*this);
969         __pDeletePopup->AddControl(pDeleteButton);
970
971         Button* pButtonCancel = new (std::nothrow) Button();
972         pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
973                         popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
974         pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
975         pButtonCancel->AddActionEventListener(*this);
976         __pDeletePopup->AddControl(pButtonCancel);
977         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
978
979         return r;
980 }
981
982 void
983 FileListEditorForm::SetTitleText(const String& titleText)
984 {
985         AppLogDebug("ENTER");
986         Header* pHeader = GetHeader();
987         TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
988         pHeader->SetTitleText(titleText);
989         pHeader->Invalidate(true);
990         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
991 }
992
993 void
994 FileListEditorForm::RefreshFolderList(void)
995 {
996         AppLogDebug("ENTER");
997         ContentDirectory contentDirectory;
998         IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
999         pContentTypeList->Add(CONTENT_TYPE_IMAGE);
1000         pContentTypeList->Add(CONTENT_TYPE_VIDEO);
1001         result r = contentDirectory.Construct(*pContentTypeList);
1002         if (r != E_SUCCESS)
1003         {
1004                 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1005                 return;
1006         }
1007         delete pContentTypeList;
1008
1009         if (__pContentDirectoryList != null)
1010         {
1011                 delete __pContentDirectoryList;
1012         }
1013         __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
1014         __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1015         String* pDirPath = null;
1016         String* pDirName = null;
1017         String mediaPath = RESERVED_MEDIA_PATH;
1018         int length = mediaPath.GetLength();
1019         mediaPath.Remove(length-1,1);
1020
1021         int loopCount = __pContentDirectoryList->GetCount();
1022         for (int i = 0; i < loopCount; ++i)
1023         {
1024                 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
1025                 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
1026
1027                 if ( *pDirPath == mediaPath)
1028                 {
1029                         *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
1030                         __pContentDirectoryNameList->Add(pDirName);
1031                 }
1032                 else
1033                 {
1034                         __pContentDirectoryNameList->Add(pDirName);
1035                 }
1036         }
1037         __pContextEditorMenuMove->RemoveAllItems();
1038         __pContextEditorMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
1039                         IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
1040         __pContextSelectionMenuMove->RemoveAllItems();
1041         __pContextSelectionMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
1042                         IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM);
1043
1044         loopCount = __pContentDirectoryNameList->GetCount();
1045         for (int i = 0; i < loopCount; ++i)
1046         {
1047                 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
1048
1049                 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
1050                 {
1051                 __pContextEditorMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
1052                                 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
1053                 __pContextSelectionMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
1054                                 IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START + i);
1055                 }
1056         }
1057         __pContextEditorMenuMove->SetShowState(false);
1058         __pContextSelectionMenuMove->SetShowState(false);
1059         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1060 }
1061
1062 void
1063 FileListEditorForm::OnFormBackRequested(Form& source)
1064 {
1065         AppLogDebug("ENTER");
1066
1067         SceneManager* pSceneManager = SceneManager::GetInstance();
1068         TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
1069
1070         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1071         {
1072                 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1073                 {
1074                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1075                 }
1076                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1077                 {
1078                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1079                 }
1080         }
1081         else
1082         {
1083                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1084                 {
1085                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1086                 }
1087                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1088                 {
1089                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1090                 }
1091                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1092                 {
1093                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1094                 }
1095                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1096                 {
1097                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1098                                 (pSceneManager->GetCurrentScene()->GetPanel());
1099                         if (pSelectionPanel != null)
1100                         {
1101                                 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1102                                 if (pList == null)
1103                                 {
1104                                         pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1105                                 }
1106
1107                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1108                                                    SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1109                         }
1110                 }
1111                 else
1112                 {
1113                         pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1114                 }
1115         }
1116         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1117 }
1118
1119 void
1120 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1121 {
1122         AppLogDebug("ENTER");
1123         Footer* pFooter = GetFooter();
1124         TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1125
1126         if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1127         {
1128                 if (enableState == true)
1129                 {
1130                         pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1131                         pFooter->SetItemEnabled(0, true);
1132                 }
1133                 else
1134                 {
1135                         pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1136                         pFooter->SetItemEnabled(0, false);
1137                 }
1138         }
1139         else
1140         {
1141                 if (enableState == true)
1142                 {
1143                         pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1144                         pFooter->SetItemEnabled(0, true);
1145                         pFooter->SetItemEnabled(1, true);
1146                 }
1147                 else
1148                 {
1149                         pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1150                         pFooter->SetItemEnabled(0, false);
1151                         pFooter->SetItemEnabled(1, false);
1152                 }
1153         }
1154         pFooter->RequestRedraw(true);
1155         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1156 }
1157
1158 result
1159 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1160 {
1161         AppLogDebug("ENTER");
1162         result r = E_FAILURE;
1163         String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1164         if (albumName != EMPTY_SPACE)
1165         {
1166                 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1167                 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1168                 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1169                 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1170                 delete pDirectoryList;
1171
1172                 SceneManager* pSceneManager = SceneManager::GetInstance();
1173                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1174                 r = E_SUCCESS;
1175         }
1176         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1177
1178         return r;
1179 }
1180
1181 void
1182 FileListEditorForm::SelectAllPressed(void)
1183 {
1184         SceneManager* pSceneManager = SceneManager::GetInstance();
1185         pSceneManager->GetCurrentScene();
1186
1187         if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1188         {
1189                 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1190                 if (pEditorPanel != null)
1191                 {
1192                         pEditorPanel->OnSelectAllPressed();
1193                 }
1194         }
1195         else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1196         {
1197                 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1198                 if (pEditorPanel != null)
1199                 {
1200                         pEditorPanel->OnSelectAllPressed();
1201                 }
1202         }
1203         else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1204         {
1205                 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1206                 if (pEditorPanel != null)
1207                 {
1208                         pEditorPanel->OnSelectAllPressed();
1209                 }
1210         }
1211         else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1212         {
1213                 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1214                 if (pEditorPanel != null)
1215                 {
1216                         pEditorPanel->OnSelectAllPressed();
1217                 }
1218         }
1219 }
1220
1221 void
1222 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1223 {
1224         if (__pPopUp != NULL)
1225         {
1226                 __pPopUp->SetShowState(false);
1227         }
1228
1229         SceneManager* pSceneManager = SceneManager::GetInstance();
1230
1231         if (index == 0)
1232         {
1233                 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1234                 {
1235                         AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1236                         if (pEditorPanel != null)
1237                         {
1238                                 pEditorPanel->OnRequestSlideShow();
1239                         }
1240                 }
1241                 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1242                 {
1243                         AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1244                                         (pSceneManager->GetCurrentScene()->GetPanel());
1245
1246                         if (pSelectionPanel != null)
1247                         {
1248                                 pSelectionPanel->OnRequestSlideShow();
1249                         }
1250                 }
1251         }
1252         else if (index == 1)
1253         {
1254                 SceneManager* pSceneManager = SceneManager::GetInstance();
1255                 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1256
1257                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1258         }
1259 }
1260
1261 void
1262 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1263 {
1264         AppLogDebug("ENTER");
1265         __pPresentationModel->RemoveContentEventListener(this);
1266         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1267 }
1268
1269 void
1270 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1271 {
1272         AppLogDebug("ENTER");
1273         __pPresentationModel->AddContentEventListener(this);
1274         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1275 }
1276