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