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 delete __pContentDirectoryNameList;
98 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
102 FileListEditorForm::Initialize(void)
104 AppLogDebug("ENTER");
105 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
106 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
112 FileListEditorForm::OnInitializing(void)
114 AppLogDebug("ENTER");
115 Header* pHeader = GetHeader();
116 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
118 SetOrientation(ORIENTATION_AUTOMATIC);
119 AddOrientationEventListener(*this);
121 __pPopUp = new (std::nothrow) SlideShowPopUp();
123 if (__pPopUp != null)
125 __pPopUp->Initialize();
126 __pPopUp->SetEventListner(this);
127 AddControl(__pPopUp);
130 __pPresentationModel = FileListPresentationModel::GetInstance();
131 __pPresentationModel->ClearThumbnailRequests();
133 pHeader->SetStyle(HEADER_STYLE_TITLE);
134 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
136 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
137 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
139 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
140 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
141 ButtonItem selectAll;
142 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
143 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
144 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
145 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
146 delete pNormalBitmap;
150 pHeader->AddActionEventListener(*this);
153 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
159 FileListEditorForm::InitializeFooter(void)
161 AppLogDebug("ENTER");
162 Footer* pFooter = GetFooter();
163 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
164 pFooter->RemoveAllItems();
166 result r = E_SUCCESS;
168 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
170 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
172 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
174 FooterItem footerConfirm;
175 footerConfirm.Construct(IDA_FOOTER_CONFIRM);
176 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
177 pFooter->AddItem(footerConfirm);
178 pFooter->SetItemEnabled(0, false);
179 pFooter->SetShowState(true);
180 pFooter->Invalidate(true);
184 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
185 pFooter->SetShowState(false);
186 pFooter->Invalidate(true);
189 SetFormBackEventListener(this);
194 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
195 SetFormMenuEventListener(this);
197 FooterItem footerShare;
198 r = footerShare.Construct(IDA_FOOTER_SHARE);
199 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
200 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
201 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
203 if (pBitmapShare != null && pBitmapShareDim != null)
205 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
206 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
209 r = pFooter->AddItem(footerShare);
211 delete pBitmapShareDim;
212 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
214 FooterItem footerDelete;
215 r = footerDelete.Construct(IDA_FOOTER_DELETE);
216 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
217 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
218 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
220 if (pBitmapDelete != null && pBitmapDeleteDim != null)
222 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
223 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
226 r = pFooter->AddItem(footerDelete);
227 delete pBitmapDelete;
228 delete pBitmapDeleteDim;
229 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
231 SetFormBackEventListener(this);
233 SceneManager* pSceneManager = SceneManager::GetInstance();
234 int checkedCount = 0;
236 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
238 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
239 if (pEditorPanel != null)
241 checkedCount = pEditorPanel->GetItemCheckedCount();
244 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
246 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
247 if (pSelectionPanel != null)
249 checkedCount = pSelectionPanel->GetItemCheckedCount();
253 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
255 if (__pOptionMenu != null)
257 delete __pOptionMenu;
258 __pOptionMenu = null;
261 __pOptionMenu = new (std::nothrow) OptionMenu();
262 __pOptionMenu->Construct();
263 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
264 IDA_CONTEXT_MENU_MORE_MOVE);
265 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
266 IDA_CONTEXT_MENU_MORE_COPY);
268 if (checkedCount > 1)
270 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
271 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
274 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
275 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
277 __pOptionMenu->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 (__pShareContextMenu != null)
331 __pShareContextMenu->RemoveActionEventListener(*this);
332 delete __pShareContextMenu;
333 __pShareContextMenu = 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 ( __pShareContextMenu != NULL)
364 delete __pShareContextMenu;
365 __pShareContextMenu = null;
368 __pShareContextMenu = new (std::nothrow) ContextMenu();
369 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
370 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
371 IDA_CONTEXT_MENU_SHARE_MESSAGE);
372 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
373 IDA_CONTEXT_MENU_SHARE_EMAIL);
374 __pShareContextMenu->SetFocusable(true);
375 __pShareContextMenu->AddActionEventListener(*this);
377 Rectangle rect = source.GetBounds();
378 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
380 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
384 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
387 __pShareContextMenu->SetShowState(true);
388 __pShareContextMenu->Show();
393 case IDA_FOOTER_DELETE:
395 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
397 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
398 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
400 __pDeletePopup->SetShowState(true);
401 __pDeletePopup->Show();
405 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
407 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
408 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
410 __pDeletePopup->SetShowState(true);
411 __pDeletePopup->Show();
415 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
417 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
418 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
420 __pDeletePopup->SetShowState(true);
421 __pDeletePopup->Show();
425 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
427 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
428 (pSceneManager->GetCurrentScene()->GetPanel());
429 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
431 __pDeletePopup->SetShowState(true);
432 __pDeletePopup->Show();
439 case IDA_CONTEXT_MENU_MORE_EDIT:
444 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
449 case IDA_CONTEXT_MENU_MORE_COPY:
451 case IDA_CONTEXT_MENU_MORE_MOVE:
453 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
455 __isCopyOperation = false;
457 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
459 __isCopyOperation = true;
464 __pOptionMenu->SetShowState(true);
465 __pOptionMenu->Show();
471 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
473 if (__pPopUp != null)
475 __pPopUp->SetShowState(true);
481 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
483 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
485 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
486 if (pEditorPanel != null)
488 pEditorPanel->OnRequestMessage();
491 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
493 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
494 if (pSelectionPanel != null)
496 pSelectionPanel->OnRequestMessage();
502 case IDA_CONTEXT_MENU_SHARE_EMAIL:
504 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
506 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
507 if (pEditorPanel != null)
509 pEditorPanel->OnRequestEmail();
512 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
514 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
515 if (pSelectionPanel != null)
517 pSelectionPanel->OnRequestEmail();
523 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
525 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
527 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
528 if (pListEditorPanel)
530 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
531 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
532 if (__isCopyOperation)
534 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
538 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
540 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
546 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
548 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
549 (pSceneManager->GetCurrentScene()->GetPanel());
551 if (pSelectionPanel != null)
553 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
554 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
555 if (__isCopyOperation)
557 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
561 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
563 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
570 case IDA_DELETE_POPUP_DEL:
573 __pDeletePopup->SetShowState(false);
574 __pDeletePopup->Invalidate(true);
576 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
578 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
579 if (pEditorPanel != null)
581 result r = pEditorPanel->OnRequestDelete();
584 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
588 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
590 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
591 (pSceneManager->GetCurrentScene()->GetPanel());
593 if (pSelectionPanel != null)
595 result r = pSelectionPanel->OnRequestDelete();
598 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
605 case IDA_DELETE_POPUP_CANCEL:
608 __pDeletePopup->SetShowState(false);
609 __pDeletePopup->Invalidate(true);
613 case IDA_CONTEXT_MENU_ROTATE_LEFT:
615 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
617 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
618 if (pEditorPanel != null)
620 RotateMode rotateMode = ROTATE_MODE_LEFT;
621 pEditorPanel->OnRequestRotate(rotateMode);
624 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
626 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
627 (pSceneManager->GetCurrentScene()->GetPanel());
629 if (pSelectionPanel != null)
631 RotateMode rotateMode = ROTATE_MODE_LEFT;
632 pSelectionPanel->OnRotateRequested(rotateMode);
638 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
640 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
642 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
643 if (pEditorPanel != null)
645 RotateMode rotateMode = ROTATE_MODE_RIGHT;
646 pEditorPanel->OnRequestRotate(rotateMode);
649 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
652 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
653 (pSceneManager->GetCurrentScene()->GetPanel());
655 if (pSelectionPanel != null)
657 RotateMode rotateMode = ROTATE_MODE_RIGHT;
658 pSelectionPanel->OnRotateRequested(rotateMode);
664 case IDA_FOOTER_CONFIRM:
666 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
668 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
669 if (pEditorPanel != null)
671 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
674 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
676 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
677 if (pEditorPanel != null)
679 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
687 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
689 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
690 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
692 if (__pContentDirectoryList == null)
696 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
698 String* pDirectory = static_cast<String*>
699 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
701 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
702 (pSceneManager->GetCurrentScene()->GetPanel());
704 if (pEditorPanel != null)
707 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
708 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
709 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
710 if (__isCopyOperation)
712 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
713 __pFileMove->SetCopy();
716 result r = __pFileMove->StartTimer();
721 __isCopyOperation = false;
731 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
733 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
734 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
736 if (__pContentDirectoryList == null)
741 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
743 String* pDirectory = static_cast<String*>
744 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
746 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
747 (pSceneManager->GetCurrentScene()->GetPanel());
749 if (pSelectionPanel != null)
752 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
753 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
754 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
755 if (__isCopyOperation)
757 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
758 __pFileMove->SetCopy();
760 result r = __pFileMove->StartTimer();
765 __isCopyOperation = false;
778 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
782 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
788 FileListEditorForm::GetOverlayStatus(void) const
794 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
797 __pPresentationModel->SetUpdateProgressStatus(false);
798 if (res != COMPLETE_SUCCESS)
800 MessageBox messageBox;
801 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
804 messageBox.ShowAndWait(modalResult);
806 SceneManager* pSceneManager = SceneManager::GetInstance();
807 AppAssert(pSceneManager);
808 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
813 FileListEditorForm::OnContentUpdated()
815 AppLogDebug("ENTER");
817 SceneManager* pSceneManager = SceneManager::GetInstance();
819 if(__pDeletePopup != null)
821 if(__pDeletePopup->IsVisible() == true)
823 __pDeletePopup->Destroy();
824 __pDeletePopup = null;
830 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
832 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
833 if (pEditorPanel != null)
835 pEditorPanel->CancelUpdateProgress();
838 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
840 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
841 if (pSelectionPanel != null)
843 pSelectionPanel->CancelUpdateProgress();
847 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
848 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
850 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
851 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
854 else if (_overlayMsg == false)
856 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
857 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
860 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
864 FileListEditorForm::SetUpPopup(void)
866 AppLogDebug("ENTER");
867 result r = E_SUCCESS;
869 if (__pDeletePopup != null)
871 delete __pDeletePopup;
872 __pDeletePopup = null;
875 __pDeletePopup = new (std::nothrow) Popup();
876 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
877 __pDeletePopup->SetPropagatedKeyEventListener(this);
879 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
881 Label* pLabelText = new (std::nothrow) Label();
882 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
883 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
884 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
885 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
886 __pDeletePopup->AddControl(pLabelText);
888 Button* pDeleteButton = new (std::nothrow) Button();
889 pDeleteButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
890 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
891 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
892 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
893 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
894 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
895 pDeleteButton->AddActionEventListener(*this);
896 __pDeletePopup->AddControl(pDeleteButton);
898 Button* pButtonCancel = new (std::nothrow) Button();
899 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
900 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
901 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
902 pButtonCancel->AddActionEventListener(*this);
903 __pDeletePopup->AddControl(pButtonCancel);
904 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
910 FileListEditorForm::SetTitleText(const String& titleText)
912 AppLogDebug("ENTER");
913 Header* pHeader = GetHeader();
914 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
915 pHeader->SetTitleText(titleText);
916 pHeader->Invalidate(true);
917 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
921 FileListEditorForm::RefreshFolderList(void)
923 AppLogDebug("ENTER");
924 ContentDirectory contentDirectory;
925 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
926 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
927 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
928 result r = contentDirectory.Construct(*pContentTypeList);
931 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
934 delete pContentTypeList;
936 if (__pContentDirectoryList != null)
938 __pContentDirectoryList->RemoveAll(true);
939 delete __pContentDirectoryList;
941 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
942 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
943 String* pDirPath = null;
944 String* pDirName = null;
945 String mediaPath = RESERVED_MEDIA_PATH;
946 int length = mediaPath.GetLength();
947 mediaPath.Remove(length-1,1);
949 int loopCount = __pContentDirectoryList->GetCount();
950 for (int i = 0; i < loopCount; ++i)
952 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
953 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
955 if ( *pDirPath == mediaPath)
957 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
958 __pContentDirectoryNameList->Add(pDirName);
962 __pContentDirectoryNameList->Add(pDirName);
966 __pOptionMenu->RemoveAllItems();
967 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
968 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
970 loopCount = __pContentDirectoryNameList->GetCount();
972 for (int i = 0; i < loopCount; ++i)
974 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
976 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
978 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
979 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
984 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
988 FileListEditorForm::OnFormBackRequested(Form& source)
990 AppLogDebug("ENTER");
992 SceneManager* pSceneManager = SceneManager::GetInstance();
993 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
995 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
997 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
999 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1001 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1003 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1008 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1010 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1012 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1014 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1016 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1018 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1020 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1022 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1024 __pShareContextMenu->SetShowState(false);
1028 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1029 (pSceneManager->GetCurrentScene()->GetPanel());
1030 if (pSelectionPanel != null)
1032 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1035 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1038 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1039 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1047 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1050 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1054 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1056 AppLogDebug("ENTER");
1057 Footer* pFooter = GetFooter();
1058 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1060 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1062 if (enableState == true)
1064 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1065 pFooter->SetItemEnabled(0, true);
1069 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1070 pFooter->SetItemEnabled(0, false);
1075 if (enableState == true)
1077 pFooter->SetItemEnabled(0, true);
1078 pFooter->SetItemEnabled(1, true);
1082 pFooter->SetItemEnabled(0, false);
1083 pFooter->SetItemEnabled(1, false);
1086 pFooter->RequestRedraw(true);
1087 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1091 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1093 SceneManager* pSceneManager = SceneManager::GetInstance();
1094 pSceneManager->GetCurrentScene();
1096 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1098 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1099 if (pEditorPanel != null)
1101 pEditorPanel->ChangeOrientation();
1104 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1106 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1107 if (pEditorPanel != null)
1109 pEditorPanel->ChangeOrientation();
1112 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1114 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1115 if (pEditorPanel != null)
1117 pEditorPanel->ChangeOrientation();
1120 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1122 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1123 if (pEditorPanel != null)
1125 pEditorPanel->ChangeOrientation();
1131 FileListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
1133 AppLogDebug("ENTER");
1135 if(keyEventInfo.GetKeyCode() == KEY_BACK)
1137 _overlayMsg = false;
1138 __pDeletePopup->SetShowState(false);
1139 __pDeletePopup->Invalidate(true);
1145 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1147 AppLogDebug("ENTER");
1148 result r = E_FAILURE;
1149 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1150 if (albumName != EMPTY_SPACE)
1152 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1153 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1154 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1155 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1156 delete pDirectoryList;
1158 SceneManager* pSceneManager = SceneManager::GetInstance();
1159 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1162 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1168 FileListEditorForm::SelectAllPressed(void)
1170 SceneManager* pSceneManager = SceneManager::GetInstance();
1171 pSceneManager->GetCurrentScene();
1173 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1175 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1176 if (pEditorPanel != null)
1178 pEditorPanel->OnSelectAllPressed();
1181 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1183 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1184 if (pEditorPanel != null)
1186 pEditorPanel->OnSelectAllPressed();
1189 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1191 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1192 if (pEditorPanel != null)
1194 pEditorPanel->OnSelectAllPressed();
1197 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1199 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1200 if (pEditorPanel != null)
1202 pEditorPanel->OnSelectAllPressed();
1208 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1210 if (__pPopUp != NULL)
1212 __pPopUp->SetShowState(false);
1215 SceneManager* pSceneManager = SceneManager::GetInstance();
1219 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1221 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1222 if (pEditorPanel != null)
1224 pEditorPanel->OnRequestSlideShow();
1227 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1229 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1230 (pSceneManager->GetCurrentScene()->GetPanel());
1232 if (pSelectionPanel != null)
1234 pSelectionPanel->OnRequestSlideShow();
1238 else if (index == 1)
1240 SceneManager* pSceneManager = SceneManager::GetInstance();
1241 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1243 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1248 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1250 AppLogDebug("ENTER");
1251 __pPresentationModel->RemoveContentEventListener(this);
1252 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1256 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1258 AppLogDebug("ENTER");
1259 __pPresentationModel->AddContentEventListener(this);
1260 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1264 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1267 SceneManager* pSceneManager = SceneManager::GetInstance();
1268 int checkedCount = 0;
1270 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1272 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1273 if (pEditorPanel != null)
1275 checkedCount = pEditorPanel->GetItemCheckedCount();
1278 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1280 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1281 if (pSelectionPanel != null)
1283 checkedCount = pSelectionPanel->GetItemCheckedCount();
1287 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1289 __pShareContextMenu->SetShowState(false);
1292 if ( checkedCount > 0)
1294 if ( __pOptionMenu == null )
1299 __pOptionMenu->RemoveAllItems();
1300 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1301 IDA_CONTEXT_MENU_MORE_MOVE);
1302 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1303 IDA_CONTEXT_MENU_MORE_COPY);
1305 if (checkedCount > 1)
1307 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1308 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1311 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1312 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1314 __pOptionMenu->SetShowState(true);
1315 __pOptionMenu->Show();