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