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