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 = 620;
48 static const int H_DELETE_POPUP = 300;
49 static const int H_DELETE_LABEL = 180;
50 static const int Y_DELETE_BUTTON = 180;
51 static const int H_DELETE_BUTTON = 80;
52 static const int H_TOAST_LABEL = 48;
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 : __pShareContextMenu(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 __pContentDirectoryList->RemoveAll(true);
83 delete __pContentDirectoryList;
84 __pContentDirectoryList = null;
93 if (__pContentDirectoryNameList != null)
95 __pContentDirectoryNameList->RemoveAll(true);
96 delete __pContentDirectoryNameList;
97 __pContentDirectoryNameList = null;
100 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
104 FileListEditorForm::Initialize(void)
106 AppLogDebug("ENTER");
107 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
108 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
114 FileListEditorForm::OnInitializing(void)
116 AppLogDebug("ENTER");
117 Header* pHeader = GetHeader();
118 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
120 SetOrientation(ORIENTATION_AUTOMATIC);
121 AddOrientationEventListener(*this);
123 __pPopUp = new (std::nothrow) SlideShowPopUp();
125 if (__pPopUp != null)
127 __pPopUp->Initialize();
128 __pPopUp->SetEventListner(this);
129 AddControl(__pPopUp);
132 __pPresentationModel = FileListPresentationModel::GetInstance();
133 __pPresentationModel->ClearThumbnailRequests();
135 pHeader->SetStyle(HEADER_STYLE_TITLE);
136 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
138 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
139 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
141 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
142 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
143 ButtonItem selectAll;
144 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
145 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
146 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
147 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
148 delete pNormalBitmap;
152 pHeader->AddActionEventListener(*this);
155 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
161 FileListEditorForm::InitializeFooter(void)
163 AppLogDebug("ENTER");
164 Footer* pFooter = GetFooter();
165 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
166 pFooter->RemoveAllItems();
168 result r = E_SUCCESS;
170 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
172 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
174 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
176 FooterItem footerConfirm;
177 footerConfirm.Construct(IDA_FOOTER_CONFIRM);
178 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
179 pFooter->AddItem(footerConfirm);
180 pFooter->SetItemEnabled(0, false);
181 pFooter->SetShowState(true);
182 pFooter->Invalidate(true);
186 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
187 pFooter->SetShowState(false);
188 pFooter->Invalidate(true);
191 SetFormBackEventListener(this);
196 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
197 SetFormMenuEventListener(this);
199 FooterItem footerShare;
200 r = footerShare.Construct(IDA_FOOTER_SHARE);
201 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
202 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
203 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
205 if (pBitmapShare != null && pBitmapShareDim != null)
207 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
208 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
211 r = pFooter->AddItem(footerShare);
213 delete pBitmapShareDim;
214 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
216 FooterItem footerDelete;
217 r = footerDelete.Construct(IDA_FOOTER_DELETE);
218 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
219 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
220 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
222 if (pBitmapDelete != null && pBitmapDeleteDim != null)
224 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
225 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
228 r = pFooter->AddItem(footerDelete);
229 delete pBitmapDelete;
230 delete pBitmapDeleteDim;
231 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
233 SetFormBackEventListener(this);
235 SceneManager* pSceneManager = SceneManager::GetInstance();
236 int checkedCount = 0;
238 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
240 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
241 if (pEditorPanel != null)
243 checkedCount = pEditorPanel->GetItemCheckedCount();
246 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
248 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
249 if (pSelectionPanel != null)
251 checkedCount = pSelectionPanel->GetItemCheckedCount();
255 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
257 if (__pOptionMenu != null)
259 delete __pOptionMenu;
260 __pOptionMenu = null;
263 __pOptionMenu = new (std::nothrow) OptionMenu();
264 __pOptionMenu->Construct();
265 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
266 IDA_CONTEXT_MENU_MORE_MOVE);
267 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
268 IDA_CONTEXT_MENU_MORE_COPY);
270 if (checkedCount > 1)
272 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
273 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
276 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
277 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
279 __pOptionMenu->AddActionEventListener(*this);
281 if (__pContentDirectoryNameList != null)
283 __pContentDirectoryNameList->RemoveAll(true);
284 delete __pContentDirectoryNameList;
285 __pContentDirectoryNameList = null;
291 pFooter->AddActionEventListener(*this);
292 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
298 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
300 AppLogDebug("ENTER");
301 if (fullPath == null)
303 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
307 String delim(DIRECTORY_SEPARATOR);
308 StringTokenizer st(fullPath,delim);
310 while (st.HasMoreTokens())
312 st.GetNextToken(token);
314 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
320 FileListEditorForm::OnTerminating(void)
322 AppLogDebug("ENTER");
323 __pPresentationModel->RemoveContentEventListener(this);
325 if (__pOptionMenu != null)
327 __pOptionMenu->RemoveActionEventListener(*this);
328 delete __pOptionMenu;
329 __pOptionMenu = null;
332 if (__pShareContextMenu != null)
334 __pShareContextMenu->RemoveActionEventListener(*this);
335 delete __pShareContextMenu;
336 __pShareContextMenu = null;
339 if (__pDeletePopup != null)
341 delete __pDeletePopup;
342 __pDeletePopup = null;
345 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
351 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
353 AppLogDebug("ENTER(actionId=%d)", actionId);
354 SceneManager* pSceneManager = SceneManager::GetInstance();
355 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
359 case IDA_FILE_LIST_SELECT_ALL:
363 case IDA_FOOTER_SHARE:
365 if ( __pShareContextMenu != NULL)
367 delete __pShareContextMenu;
368 __pShareContextMenu = null;
371 __pShareContextMenu = new (std::nothrow) ContextMenu();
372 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
373 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
374 IDA_CONTEXT_MENU_SHARE_MESSAGE);
375 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
376 IDA_CONTEXT_MENU_SHARE_EMAIL);
377 __pShareContextMenu->SetFocusable(true);
378 __pShareContextMenu->AddActionEventListener(*this);
380 Rectangle rect = source.GetBounds();
381 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
383 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
387 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
390 __pShareContextMenu->SetShowState(true);
391 __pShareContextMenu->Show();
396 case IDA_FOOTER_DELETE:
398 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
400 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
401 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
403 __pDeletePopup->SetShowState(true);
404 __pDeletePopup->Show();
408 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
410 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
411 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
413 __pDeletePopup->SetShowState(true);
414 __pDeletePopup->Show();
418 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
420 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
421 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
423 __pDeletePopup->SetShowState(true);
424 __pDeletePopup->Show();
428 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
430 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
431 (pSceneManager->GetCurrentScene()->GetPanel());
432 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
434 __pDeletePopup->SetShowState(true);
435 __pDeletePopup->Show();
442 case IDA_CONTEXT_MENU_MORE_EDIT:
447 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
452 case IDA_CONTEXT_MENU_MORE_COPY:
454 case IDA_CONTEXT_MENU_MORE_MOVE:
456 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
458 __isCopyOperation = false;
460 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
462 __isCopyOperation = true;
467 __pOptionMenu->SetShowState(true);
468 __pOptionMenu->Show();
474 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
476 if (__pPopUp != null)
478 __pPopUp->SetShowState(true);
484 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
486 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
488 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
489 if (pEditorPanel != null)
491 pEditorPanel->OnRequestMessage();
494 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
496 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
497 if (pSelectionPanel != null)
499 pSelectionPanel->OnRequestMessage();
505 case IDA_CONTEXT_MENU_SHARE_EMAIL:
507 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
509 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
510 if (pEditorPanel != null)
512 pEditorPanel->OnRequestEmail();
515 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
517 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
518 if (pSelectionPanel != null)
520 pSelectionPanel->OnRequestEmail();
526 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
528 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
530 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
531 if (pListEditorPanel)
533 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
534 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
535 if (__isCopyOperation)
537 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
541 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
543 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
549 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
551 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
552 (pSceneManager->GetCurrentScene()->GetPanel());
554 if (pSelectionPanel != null)
556 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
557 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
558 if (__isCopyOperation)
560 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
564 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
566 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
573 case IDA_DELETE_POPUP_DEL:
576 __pDeletePopup->SetShowState(false);
577 __pDeletePopup->Invalidate(true);
579 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
581 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
582 if (pEditorPanel != null)
584 result r = pEditorPanel->OnRequestDelete();
587 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
591 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
593 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
594 (pSceneManager->GetCurrentScene()->GetPanel());
596 if (pSelectionPanel != null)
598 result r = pSelectionPanel->OnRequestDelete();
601 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
608 case IDA_DELETE_POPUP_CANCEL:
611 __pDeletePopup->SetShowState(false);
612 __pDeletePopup->Invalidate(true);
616 case IDA_CONTEXT_MENU_ROTATE_LEFT:
618 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
620 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
621 if (pEditorPanel != null)
623 RotateMode rotateMode = ROTATE_MODE_LEFT;
624 pEditorPanel->OnRequestRotate(rotateMode);
627 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
629 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
630 (pSceneManager->GetCurrentScene()->GetPanel());
632 if (pSelectionPanel != null)
634 RotateMode rotateMode = ROTATE_MODE_LEFT;
635 pSelectionPanel->OnRotateRequested(rotateMode);
641 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
643 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
645 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
646 if (pEditorPanel != null)
648 RotateMode rotateMode = ROTATE_MODE_RIGHT;
649 pEditorPanel->OnRequestRotate(rotateMode);
652 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
655 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
656 (pSceneManager->GetCurrentScene()->GetPanel());
658 if (pSelectionPanel != null)
660 RotateMode rotateMode = ROTATE_MODE_RIGHT;
661 pSelectionPanel->OnRotateRequested(rotateMode);
667 case IDA_FOOTER_CONFIRM:
669 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
671 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
672 if (pEditorPanel != null)
674 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
677 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
679 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
680 if (pEditorPanel != null)
682 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
690 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
692 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
693 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
695 if (__pContentDirectoryList == null)
699 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
701 String* pDirectory = static_cast<String*>
702 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
704 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
705 (pSceneManager->GetCurrentScene()->GetPanel());
707 if (pEditorPanel != null)
710 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
711 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
712 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
713 if (__isCopyOperation)
715 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
716 __pFileMove->SetCopy();
719 result r = __pFileMove->StartTimer();
724 __isCopyOperation = false;
734 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
736 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
737 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
739 if (__pContentDirectoryList == null)
744 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
746 String* pDirectory = static_cast<String*>
747 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
749 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
750 (pSceneManager->GetCurrentScene()->GetPanel());
752 if (pSelectionPanel != null)
755 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
756 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
757 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
758 if (__isCopyOperation)
760 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
761 __pFileMove->SetCopy();
763 result r = __pFileMove->StartTimer();
768 __isCopyOperation = false;
781 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
785 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
791 FileListEditorForm::GetOverlayStatus(void) const
797 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
800 __pPresentationModel->SetUpdateProgressStatus(false);
801 if (res != COMPLETE_SUCCESS)
803 MessageBox messageBox;
804 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
807 messageBox.ShowAndWait(modalResult);
809 SceneManager* pSceneManager = SceneManager::GetInstance();
810 AppAssert(pSceneManager);
811 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
816 FileListEditorForm::OnContentUpdated()
818 AppLogDebug("ENTER");
820 SceneManager* pSceneManager = SceneManager::GetInstance();
822 if(__pDeletePopup != null)
824 if(__pDeletePopup->IsVisible() == true)
826 __pDeletePopup->Destroy();
827 __pDeletePopup = null;
833 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
835 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
836 if (pEditorPanel != null)
838 pEditorPanel->CancelUpdateProgress();
841 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
843 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
844 if (pSelectionPanel != null)
846 pSelectionPanel->CancelUpdateProgress();
850 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
851 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
853 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
854 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
857 else if (_overlayMsg == false)
859 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
860 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
863 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
867 FileListEditorForm::SetUpPopup(void)
869 AppLogDebug("ENTER");
870 result r = E_SUCCESS;
872 if (__pDeletePopup != null)
874 delete __pDeletePopup;
875 __pDeletePopup = null;
878 __pDeletePopup = new (std::nothrow) Popup();
879 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
880 __pDeletePopup->SetPropagatedKeyEventListener(this);
882 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
884 Label* pLabelText = new (std::nothrow) Label();
885 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
886 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
887 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
888 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
889 __pDeletePopup->AddControl(pLabelText);
891 Button* pDeleteButton = new (std::nothrow) Button();
892 pDeleteButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
893 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
894 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
895 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
896 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
897 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
898 pDeleteButton->AddActionEventListener(*this);
899 __pDeletePopup->AddControl(pDeleteButton);
901 Button* pButtonCancel = new (std::nothrow) Button();
902 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
903 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
904 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
905 pButtonCancel->AddActionEventListener(*this);
906 __pDeletePopup->AddControl(pButtonCancel);
907 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
913 FileListEditorForm::SetTitleText(const String& titleText)
915 AppLogDebug("ENTER");
916 Header* pHeader = GetHeader();
917 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
918 pHeader->SetTitleText(titleText);
919 pHeader->Invalidate(true);
920 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
924 FileListEditorForm::RefreshFolderList(void)
926 AppLogDebug("ENTER");
927 ContentDirectory contentDirectory;
928 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
929 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
930 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
931 result r = contentDirectory.Construct(*pContentTypeList);
934 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
937 delete pContentTypeList;
939 if (__pContentDirectoryList != null)
941 __pContentDirectoryList->RemoveAll(true);
942 delete __pContentDirectoryList;
943 __pContentDirectoryList = null;
945 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
947 if ( __pContentDirectoryNameList != NULL)
949 __pContentDirectoryNameList->RemoveAll(true);
950 delete __pContentDirectoryNameList;
951 __pContentDirectoryNameList = null;
954 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
955 String* pDirPath = null;
956 String* pDirName = null;
957 String mediaPath = RESERVED_MEDIA_PATH;
958 int length = mediaPath.GetLength();
959 mediaPath.Remove(length-1,1);
961 int loopCount = __pContentDirectoryList->GetCount();
962 for (int i = 0; i < loopCount; ++i)
964 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
965 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
967 if ( *pDirPath == mediaPath)
969 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
970 __pContentDirectoryNameList->Add(pDirName);
974 __pContentDirectoryNameList->Add(pDirName);
978 __pOptionMenu->RemoveAllItems();
979 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
980 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
982 loopCount = __pContentDirectoryNameList->GetCount();
984 for (int i = 0; i < loopCount; ++i)
986 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
988 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
990 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
991 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
996 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1000 FileListEditorForm::OnFormBackRequested(Form& source)
1002 AppLogDebug("ENTER");
1004 SceneManager* pSceneManager = SceneManager::GetInstance();
1005 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
1007 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1009 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1011 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1013 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1015 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1020 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1022 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1024 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1026 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1028 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1030 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1032 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1034 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1036 __pShareContextMenu->SetShowState(false);
1040 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1041 (pSceneManager->GetCurrentScene()->GetPanel());
1042 if (pSelectionPanel != null)
1044 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1047 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1050 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1051 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1057 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1060 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1064 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1066 AppLogDebug("ENTER");
1067 Footer* pFooter = GetFooter();
1068 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1070 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1072 if (enableState == true)
1074 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1075 pFooter->SetItemEnabled(0, true);
1079 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1080 pFooter->SetItemEnabled(0, false);
1085 if (enableState == true)
1087 pFooter->SetItemEnabled(0, true);
1088 pFooter->SetItemEnabled(1, true);
1092 pFooter->SetItemEnabled(0, false);
1093 pFooter->SetItemEnabled(1, false);
1096 pFooter->RequestRedraw(true);
1097 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1101 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1103 AppLogDebug("ENTER");
1104 SceneManager* pSceneManager = SceneManager::GetInstance();
1105 pSceneManager->GetCurrentScene();
1107 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1109 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1110 if (pEditorPanel != null)
1112 pEditorPanel->ChangeOrientation();
1115 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1117 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1118 if (pEditorPanel != null)
1120 pEditorPanel->ChangeOrientation();
1123 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1125 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1126 if (pEditorPanel != null)
1128 pEditorPanel->ChangeOrientation();
1131 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1133 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1134 if (pEditorPanel != null)
1136 pEditorPanel->ChangeOrientation();
1139 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1143 FileListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
1145 AppLogDebug("ENTER");
1147 if(keyEventInfo.GetKeyCode() == KEY_BACK)
1149 _overlayMsg = false;
1150 __pDeletePopup->SetShowState(false);
1151 __pDeletePopup->Invalidate(true);
1153 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1159 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1161 AppLogDebug("ENTER");
1162 result r = E_FAILURE;
1163 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1164 if (albumName != EMPTY_SPACE)
1166 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1167 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1168 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1169 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1170 delete pDirectoryList;
1172 SceneManager* pSceneManager = SceneManager::GetInstance();
1173 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1176 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1182 FileListEditorForm::SelectAllPressed(void)
1184 SceneManager* pSceneManager = SceneManager::GetInstance();
1185 pSceneManager->GetCurrentScene();
1187 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1189 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1190 if (pEditorPanel != null)
1192 pEditorPanel->OnSelectAllPressed();
1195 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1197 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1198 if (pEditorPanel != null)
1200 pEditorPanel->OnSelectAllPressed();
1203 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1205 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1206 if (pEditorPanel != null)
1208 pEditorPanel->OnSelectAllPressed();
1211 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1213 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1214 if (pEditorPanel != null)
1216 pEditorPanel->OnSelectAllPressed();
1222 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1224 if (__pPopUp != NULL)
1226 __pPopUp->SetShowState(false);
1229 SceneManager* pSceneManager = SceneManager::GetInstance();
1233 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1235 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1236 if (pEditorPanel != null)
1238 pEditorPanel->OnRequestSlideShow();
1241 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1243 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1244 (pSceneManager->GetCurrentScene()->GetPanel());
1246 if (pSelectionPanel != null)
1248 pSelectionPanel->OnRequestSlideShow();
1252 else if (index == 1)
1254 SceneManager* pSceneManager = SceneManager::GetInstance();
1255 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1257 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1262 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1264 AppLogDebug("ENTER");
1265 __pPresentationModel->RemoveContentEventListener(this);
1266 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1270 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1272 AppLogDebug("ENTER");
1273 __pPresentationModel->AddContentEventListener(this);
1274 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1278 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1281 SceneManager* pSceneManager = SceneManager::GetInstance();
1282 int checkedCount = 0;
1284 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1286 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1287 if (pEditorPanel != null)
1289 checkedCount = pEditorPanel->GetItemCheckedCount();
1292 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1294 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1295 if (pSelectionPanel != null)
1297 checkedCount = pSelectionPanel->GetItemCheckedCount();
1301 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1303 __pShareContextMenu->SetShowState(false);
1306 if ( checkedCount > 0)
1308 if ( __pOptionMenu == null )
1313 __pOptionMenu->RemoveAllItems();
1314 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1315 IDA_CONTEXT_MENU_MORE_MOVE);
1316 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1317 IDA_CONTEXT_MENU_MORE_COPY);
1319 if (checkedCount > 1)
1321 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1322 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1325 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1326 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1328 __pOptionMenu->SetShowState(true);
1329 __pOptionMenu->Show();