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