2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file GlFileListEditorForm.cpp
19 * @brief This is the implementation file for FileListEditorForm class.
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"
32 #include "GlVideoListEditorPanel.h"
33 #include "GlFileMoveTimer.h"
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;
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;
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;
58 static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
60 FileListEditorForm::FileListEditorForm(void)
61 : __pContextMenuShare(null)
63 , __pDeletePopup(null)
64 , __morePosition(Point(0, 0))
65 , __pContentDirectoryList(null)
66 , __pContentDirectoryNameList(null)
69 , __isCopyOperation(false)
70 , __pPresentationModel(null)
74 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
77 FileListEditorForm::~FileListEditorForm(void)
80 if (__pContentDirectoryList != null)
82 delete __pContentDirectoryList;
85 if (__pContentDirectoryNameList != null)
87 delete __pContentDirectoryNameList;
90 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
94 FileListEditorForm::Initialize(void)
97 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
98 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
104 FileListEditorForm::OnInitializing(void)
106 AppLogDebug("ENTER");
107 Header* pHeader = GetHeader();
108 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
110 __pPopUp = new (std::nothrow) SlideShowPopUp();
112 if (__pPopUp != null)
114 __pPopUp->Initialize();
115 __pPopUp->SetEventListner(this);
116 AddControl(__pPopUp);
119 __pPresentationModel = FileListPresentationModel::GetInstance();
120 __pPresentationModel->ClearThumbnailRequests();
122 pHeader->SetStyle(HEADER_STYLE_TITLE);
123 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
125 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
126 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
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;
139 pHeader->AddActionEventListener(*this);
142 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
148 FileListEditorForm::InitializeFooter(void)
150 AppLogDebug("ENTER");
151 Footer* pFooter = GetFooter();
152 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
153 pFooter->RemoveAllItems();
155 result r = E_SUCCESS;
157 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
159 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
161 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
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);
171 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
173 pFooter->SetBackButton();
174 SetFormBackEventListener(this);
179 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
180 pFooter->SetMenuButton();
181 SetFormMenuEventListener(this);
183 FooterItem footerShare;
184 r = footerShare.Construct(IDA_FOOTER_SHARE);
185 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
186 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
187 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
189 if (pBitmapShare != null && pBitmapShareDim != null)
191 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
192 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
195 r = pFooter->AddItem(footerShare);
197 delete pBitmapShareDim;
198 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
200 FooterItem footerDelete;
201 r = footerDelete.Construct(IDA_FOOTER_DELETE);
202 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
203 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
204 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
206 if (pBitmapDelete != null && pBitmapDeleteDim != null)
208 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
209 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
212 r = pFooter->AddItem(footerDelete);
213 delete pBitmapDelete;
214 delete pBitmapDeleteDim;
215 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
217 pFooter->SetBackButton();
218 SetFormBackEventListener(this);
220 SceneManager* pSceneManager = SceneManager::GetInstance();
221 int checkedCount = 0;
223 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
225 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
226 if (pEditorPanel != null)
228 checkedCount = pEditorPanel->GetItemCheckedCount();
231 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
233 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
234 if (pSelectionPanel != null)
236 checkedCount = pSelectionPanel->GetItemCheckedCount();
240 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
242 if (__pOptionMenu != null)
244 delete __pOptionMenu;
245 __pOptionMenu = null;
248 __pOptionMenu = new (std::nothrow) OptionMenu();
249 __pOptionMenu->Construct();
250 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
251 IDA_CONTEXT_MENU_MORE_MOVE);
252 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
253 IDA_CONTEXT_MENU_MORE_COPY);
255 if (checkedCount > 1)
257 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
258 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
261 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
262 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
264 __pOptionMenu->AddActionEventListener(*this);
268 __pContextMenuShare = new (std::nothrow) ContextMenu();
269 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
270 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
271 IDA_CONTEXT_MENU_SHARE_MESSAGE);
272 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
273 IDA_CONTEXT_MENU_SHARE_EMAIL);
274 __pContextMenuShare->SetShowState(false);
275 __pContextMenuShare->AddActionEventListener(*this);
279 if (__pContentDirectoryNameList != null)
281 delete __pContentDirectoryNameList;
282 __pContentDirectoryNameList = null;
288 pFooter->AddActionEventListener(*this);
289 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
295 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
297 AppLogDebug("ENTER");
298 if (fullPath == null)
300 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
304 String delim(DIRECTORY_SEPARATOR);
305 StringTokenizer st(fullPath,delim);
307 while (st.HasMoreTokens())
309 st.GetNextToken(token);
311 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
317 FileListEditorForm::OnTerminating(void)
319 AppLogDebug("ENTER");
320 __pPresentationModel->RemoveContentEventListener(this);
322 if (__pOptionMenu != null)
324 __pOptionMenu->RemoveActionEventListener(*this);
325 delete __pOptionMenu;
326 __pOptionMenu = null;
329 if (__pContextMenuShare != null)
331 __pContextMenuShare->RemoveActionEventListener(*this);
332 delete __pContextMenuShare;
333 __pContextMenuShare = null;
336 if (__pDeletePopup != null)
338 delete __pDeletePopup;
339 __pDeletePopup = null;
342 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
348 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
350 AppLogDebug("ENTER(actionId=%d)", actionId);
351 SceneManager* pSceneManager = SceneManager::GetInstance();
352 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
356 case IDA_FILE_LIST_SELECT_ALL:
360 case IDA_FOOTER_SHARE:
362 if (__pContextMenuShare->GetShowState() == false)
364 Rectangle rect = source.GetBounds();
365 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
367 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
371 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
373 __pContextMenuShare->SetShowState(true);
374 __pContextMenuShare->Show();
378 __pContextMenuShare->SetShowState(false);
383 case IDA_FOOTER_DELETE:
385 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
387 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
388 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
390 __pDeletePopup->SetShowState(true);
391 __pDeletePopup->Show();
395 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
397 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
398 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
400 __pDeletePopup->SetShowState(true);
401 __pDeletePopup->Show();
405 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
407 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
408 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
410 __pDeletePopup->SetShowState(true);
411 __pDeletePopup->Show();
415 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
417 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
418 (pSceneManager->GetCurrentScene()->GetPanel());
419 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
421 __pDeletePopup->SetShowState(true);
422 __pDeletePopup->Show();
429 case IDA_CONTEXT_MENU_MORE_EDIT:
434 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
439 case IDA_CONTEXT_MENU_MORE_COPY:
441 case IDA_CONTEXT_MENU_MORE_MOVE:
443 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
445 __isCopyOperation = false;
447 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
449 __isCopyOperation = true;
454 __pOptionMenu->SetShowState(true);
455 __pOptionMenu->Show();
461 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
463 if (__pPopUp != null)
465 __pPopUp->SetShowState(true);
471 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
473 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
475 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
476 if (pEditorPanel != null)
478 pEditorPanel->OnRequestMessage();
481 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
483 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
484 if (pSelectionPanel != null)
486 pSelectionPanel->OnRequestMessage();
492 case IDA_CONTEXT_MENU_SHARE_EMAIL:
494 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
496 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
497 if (pEditorPanel != null)
499 pEditorPanel->OnRequestEmail();
502 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
504 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
505 if (pSelectionPanel != null)
507 pSelectionPanel->OnRequestEmail();
513 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
515 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
517 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
518 if (pListEditorPanel)
520 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
521 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
522 if (__isCopyOperation)
524 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
528 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
530 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
536 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
538 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
539 (pSceneManager->GetCurrentScene()->GetPanel());
541 if (pSelectionPanel != null)
543 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
544 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
545 if (__isCopyOperation)
547 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
551 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
553 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
560 case IDA_DELETE_POPUP_DEL:
563 __pDeletePopup->SetShowState(false);
564 __pDeletePopup->Invalidate(true);
566 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
568 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
569 if (pEditorPanel != null)
571 result r = pEditorPanel->OnRequestDelete();
574 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
578 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
580 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
581 (pSceneManager->GetCurrentScene()->GetPanel());
583 if (pSelectionPanel != null)
585 result r = pSelectionPanel->OnRequestDelete();
588 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
595 case IDA_DELETE_POPUP_CANCEL:
598 __pDeletePopup->SetShowState(false);
599 __pDeletePopup->Invalidate(true);
603 case IDA_CONTEXT_MENU_ROTATE_LEFT:
605 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
607 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
608 if (pEditorPanel != null)
610 RotateMode rotateMode = ROTATE_MODE_LEFT;
611 pEditorPanel->OnRequestRotate(rotateMode);
614 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
616 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
617 (pSceneManager->GetCurrentScene()->GetPanel());
619 if (pSelectionPanel != null)
621 RotateMode rotateMode = ROTATE_MODE_LEFT;
622 pSelectionPanel->OnRotateRequested(rotateMode);
628 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
630 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
632 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
633 if (pEditorPanel != null)
635 RotateMode rotateMode = ROTATE_MODE_RIGHT;
636 pEditorPanel->OnRequestRotate(rotateMode);
639 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
642 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
643 (pSceneManager->GetCurrentScene()->GetPanel());
645 if (pSelectionPanel != null)
647 RotateMode rotateMode = ROTATE_MODE_RIGHT;
648 pSelectionPanel->OnRotateRequested(rotateMode);
654 case IDA_FOOTER_CONFIRM:
656 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
658 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
659 if (pEditorPanel != null)
661 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
664 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
666 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
667 if (pEditorPanel != null)
669 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
677 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
679 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
680 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
682 if (__pContentDirectoryList == null)
686 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
688 String* pDirectory = static_cast<String*>
689 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
691 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
692 (pSceneManager->GetCurrentScene()->GetPanel());
694 if (pEditorPanel != null)
697 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
698 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
699 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
700 if (__isCopyOperation)
702 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
703 __pFileMove->SetCopy();
706 result r = __pFileMove->StartTimer();
711 __isCopyOperation = false;
721 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
723 if ((IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) &&
724 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
726 if (__pContentDirectoryList == null)
731 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START)
733 String* pDirectory = static_cast<String*>
734 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START));
736 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
737 (pSceneManager->GetCurrentScene()->GetPanel());
739 if (pSelectionPanel != null)
742 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
743 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
744 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
745 if (__isCopyOperation)
747 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
748 __pFileMove->SetCopy();
750 result r = __pFileMove->StartTimer();
755 __isCopyOperation = false;
768 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
772 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
778 FileListEditorForm::GetOverlayStatus(void) const
784 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
787 __pPresentationModel->SetUpdateProgressStatus(false);
788 if (res != COMPLETE_SUCCESS)
790 MessageBox messageBox;
791 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
794 messageBox.ShowAndWait(modalResult);
796 SceneManager* pSceneManager = SceneManager::GetInstance();
797 AppAssert(pSceneManager);
798 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
803 FileListEditorForm::OnContentUpdated()
805 AppLogDebug("ENTER");
807 SceneManager* pSceneManager = SceneManager::GetInstance();
809 if(__pDeletePopup != null)
811 if(__pDeletePopup->IsVisible() == true)
813 __pDeletePopup->Destroy();
814 __pDeletePopup = null;
820 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
822 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
823 if (pEditorPanel != null)
825 pEditorPanel->CancelUpdateProgress();
828 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
830 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
831 if (pSelectionPanel != null)
833 pSelectionPanel->CancelUpdateProgress();
837 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
838 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
840 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
841 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
844 else if (_overlayMsg == false)
846 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
847 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
850 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
854 FileListEditorForm::SetUpPopup(void)
856 AppLogDebug("ENTER");
857 result r = E_SUCCESS;
859 if (__pDeletePopup != null)
861 delete __pDeletePopup;
862 __pDeletePopup = null;
865 __pDeletePopup = new (std::nothrow) Popup();
866 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
868 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
870 Label* pLabelText = new (std::nothrow) Label();
871 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
872 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
873 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
874 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
875 __pDeletePopup->AddControl(pLabelText);
877 Button* pDeleteButton = new (std::nothrow) Button();
878 pDeleteButton->Construct(Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
879 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
880 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
881 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
882 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
883 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
884 pDeleteButton->AddActionEventListener(*this);
885 __pDeletePopup->AddControl(pDeleteButton);
887 Button* pButtonCancel = new (std::nothrow) Button();
888 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
889 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
890 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
891 pButtonCancel->AddActionEventListener(*this);
892 __pDeletePopup->AddControl(pButtonCancel);
893 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
899 FileListEditorForm::SetTitleText(const String& titleText)
901 AppLogDebug("ENTER");
902 Header* pHeader = GetHeader();
903 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
904 pHeader->SetTitleText(titleText);
905 pHeader->Invalidate(true);
906 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
910 FileListEditorForm::RefreshFolderList(void)
912 AppLogDebug("ENTER");
913 ContentDirectory contentDirectory;
914 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
915 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
916 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
917 result r = contentDirectory.Construct(*pContentTypeList);
920 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
923 delete pContentTypeList;
925 if (__pContentDirectoryList != null)
927 delete __pContentDirectoryList;
929 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
930 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
931 String* pDirPath = null;
932 String* pDirName = null;
933 String mediaPath = RESERVED_MEDIA_PATH;
934 int length = mediaPath.GetLength();
935 mediaPath.Remove(length-1,1);
937 int loopCount = __pContentDirectoryList->GetCount();
938 for (int i = 0; i < loopCount; ++i)
940 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
941 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
943 if ( *pDirPath == mediaPath)
945 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
946 __pContentDirectoryNameList->Add(pDirName);
950 __pContentDirectoryNameList->Add(pDirName);
954 __pOptionMenu->RemoveAllItems();
955 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
956 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
958 loopCount = __pContentDirectoryNameList->GetCount();
960 for (int i = 0; i < loopCount; ++i)
962 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
964 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
966 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
967 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
972 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
976 FileListEditorForm::OnFormBackRequested(Form& source)
978 AppLogDebug("ENTER");
980 SceneManager* pSceneManager = SceneManager::GetInstance();
981 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
983 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
985 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
987 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
989 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
991 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
996 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
998 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1000 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1002 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1004 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1006 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1008 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1010 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1011 (pSceneManager->GetCurrentScene()->GetPanel());
1012 if (pSelectionPanel != null)
1014 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1017 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1020 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1021 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1026 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1029 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1033 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1035 AppLogDebug("ENTER");
1036 Footer* pFooter = GetFooter();
1037 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1039 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1041 if (enableState == true)
1043 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1044 pFooter->SetItemEnabled(0, true);
1048 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1049 pFooter->SetItemEnabled(0, false);
1054 if (enableState == true)
1056 pFooter->SetMenuButtonEnabled(true);
1057 pFooter->SetItemEnabled(0, true);
1058 pFooter->SetItemEnabled(1, true);
1062 pFooter->SetMenuButtonEnabled(false);
1063 pFooter->SetItemEnabled(0, false);
1064 pFooter->SetItemEnabled(1, false);
1067 pFooter->RequestRedraw(true);
1068 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1072 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1074 AppLogDebug("ENTER");
1075 result r = E_FAILURE;
1076 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1077 if (albumName != EMPTY_SPACE)
1079 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1080 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1081 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1082 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1083 delete pDirectoryList;
1085 SceneManager* pSceneManager = SceneManager::GetInstance();
1086 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1089 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1095 FileListEditorForm::SelectAllPressed(void)
1097 SceneManager* pSceneManager = SceneManager::GetInstance();
1098 pSceneManager->GetCurrentScene();
1100 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1102 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1103 if (pEditorPanel != null)
1105 pEditorPanel->OnSelectAllPressed();
1108 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1110 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1111 if (pEditorPanel != null)
1113 pEditorPanel->OnSelectAllPressed();
1116 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1118 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1119 if (pEditorPanel != null)
1121 pEditorPanel->OnSelectAllPressed();
1124 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1126 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1127 if (pEditorPanel != null)
1129 pEditorPanel->OnSelectAllPressed();
1135 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1137 if (__pPopUp != NULL)
1139 __pPopUp->SetShowState(false);
1142 SceneManager* pSceneManager = SceneManager::GetInstance();
1146 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1148 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1149 if (pEditorPanel != null)
1151 pEditorPanel->OnRequestSlideShow();
1154 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1156 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1157 (pSceneManager->GetCurrentScene()->GetPanel());
1159 if (pSelectionPanel != null)
1161 pSelectionPanel->OnRequestSlideShow();
1165 else if (index == 1)
1167 SceneManager* pSceneManager = SceneManager::GetInstance();
1168 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1170 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1175 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1177 AppLogDebug("ENTER");
1178 __pPresentationModel->RemoveContentEventListener(this);
1179 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1183 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1185 AppLogDebug("ENTER");
1186 __pPresentationModel->AddContentEventListener(this);
1187 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1191 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1194 SceneManager* pSceneManager = SceneManager::GetInstance();
1195 int checkedCount = 0;
1197 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1199 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1200 if (pEditorPanel != null)
1202 checkedCount = pEditorPanel->GetItemCheckedCount();
1205 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1207 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1208 if (pSelectionPanel != null)
1210 checkedCount = pSelectionPanel->GetItemCheckedCount();
1214 if (__pContextMenuShare != null && __pContextMenuShare->GetShowState() == true )
1216 __pContextMenuShare->SetShowState(false);
1219 if ( checkedCount > 0)
1221 if ( __pOptionMenu == null )
1226 __pOptionMenu->RemoveAllItems();
1227 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1228 IDA_CONTEXT_MENU_MORE_MOVE);
1229 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1230 IDA_CONTEXT_MENU_MORE_COPY);
1232 if (checkedCount > 1)
1234 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1235 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1238 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1239 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1241 __pOptionMenu->SetShowState(true);
1242 __pOptionMenu->Show();