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