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