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