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