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 : __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 SetOrientation(ORIENTATION_AUTOMATIC);
111 AddOrientationEventListener(*this);
113 __pPopUp = new (std::nothrow) SlideShowPopUp();
115 if (__pPopUp != null)
117 __pPopUp->Initialize();
118 __pPopUp->SetEventListner(this);
119 AddControl(__pPopUp);
122 __pPresentationModel = FileListPresentationModel::GetInstance();
123 __pPresentationModel->ClearThumbnailRequests();
125 pHeader->SetStyle(HEADER_STYLE_TITLE);
126 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
128 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
129 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
131 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
132 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
133 ButtonItem selectAll;
134 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
135 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
136 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
137 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
138 delete pNormalBitmap;
142 pHeader->AddActionEventListener(*this);
145 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
151 FileListEditorForm::InitializeFooter(void)
153 AppLogDebug("ENTER");
154 Footer* pFooter = GetFooter();
155 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
156 pFooter->RemoveAllItems();
158 result r = E_SUCCESS;
160 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
162 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
164 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
166 FooterItem footerConfirm;
167 footerConfirm.Construct(IDA_FOOTER_CONFIRM);
168 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
169 pFooter->AddItem(footerConfirm);
170 pFooter->SetItemEnabled(0, false);
171 pFooter->SetShowState(true);
172 pFooter->Invalidate(true);
176 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
177 pFooter->SetShowState(false);
178 pFooter->Invalidate(true);
181 SetFormBackEventListener(this);
186 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
187 SetFormMenuEventListener(this);
189 FooterItem footerShare;
190 r = footerShare.Construct(IDA_FOOTER_SHARE);
191 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
192 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
193 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
195 if (pBitmapShare != null && pBitmapShareDim != null)
197 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
198 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
201 r = pFooter->AddItem(footerShare);
203 delete pBitmapShareDim;
204 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
206 FooterItem footerDelete;
207 r = footerDelete.Construct(IDA_FOOTER_DELETE);
208 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
209 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
210 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
212 if (pBitmapDelete != null && pBitmapDeleteDim != null)
214 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
215 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
218 r = pFooter->AddItem(footerDelete);
219 delete pBitmapDelete;
220 delete pBitmapDeleteDim;
221 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
223 SetFormBackEventListener(this);
225 SceneManager* pSceneManager = SceneManager::GetInstance();
226 int checkedCount = 0;
228 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
230 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
231 if (pEditorPanel != null)
233 checkedCount = pEditorPanel->GetItemCheckedCount();
236 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
238 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
239 if (pSelectionPanel != null)
241 checkedCount = pSelectionPanel->GetItemCheckedCount();
245 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
247 if (__pOptionMenu != null)
249 delete __pOptionMenu;
250 __pOptionMenu = null;
253 __pOptionMenu = new (std::nothrow) OptionMenu();
254 __pOptionMenu->Construct();
255 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
256 IDA_CONTEXT_MENU_MORE_MOVE);
257 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
258 IDA_CONTEXT_MENU_MORE_COPY);
260 if (checkedCount > 1)
262 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
263 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
266 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
267 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
269 __pOptionMenu->AddActionEventListener(*this);
271 if (__pContentDirectoryNameList != null)
273 delete __pContentDirectoryNameList;
274 __pContentDirectoryNameList = null;
280 pFooter->AddActionEventListener(*this);
281 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
287 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
289 AppLogDebug("ENTER");
290 if (fullPath == null)
292 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
296 String delim(DIRECTORY_SEPARATOR);
297 StringTokenizer st(fullPath,delim);
299 while (st.HasMoreTokens())
301 st.GetNextToken(token);
303 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
309 FileListEditorForm::OnTerminating(void)
311 AppLogDebug("ENTER");
312 __pPresentationModel->RemoveContentEventListener(this);
314 if (__pOptionMenu != null)
316 __pOptionMenu->RemoveActionEventListener(*this);
317 delete __pOptionMenu;
318 __pOptionMenu = null;
321 if (__pContextMenuShare != null)
323 __pContextMenuShare->RemoveActionEventListener(*this);
324 delete __pContextMenuShare;
325 __pContextMenuShare = null;
328 if (__pDeletePopup != null)
330 delete __pDeletePopup;
331 __pDeletePopup = null;
334 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
340 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
342 AppLogDebug("ENTER(actionId=%d)", actionId);
343 SceneManager* pSceneManager = SceneManager::GetInstance();
344 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
348 case IDA_FILE_LIST_SELECT_ALL:
352 case IDA_FOOTER_SHARE:
354 if ( __pContextMenuShare != NULL)
356 delete __pContextMenuShare;
357 __pContextMenuShare = null;
360 __pContextMenuShare = new (std::nothrow) ContextMenu();
361 __pContextMenuShare->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
362 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
363 IDA_CONTEXT_MENU_SHARE_MESSAGE);
364 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
365 IDA_CONTEXT_MENU_SHARE_EMAIL);
366 __pContextMenuShare->AddActionEventListener(*this);
370 Rectangle rect = source.GetBounds();
371 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
373 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
377 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
380 __pContextMenuShare->SetShowState(true);
381 __pContextMenuShare->Show();
386 case IDA_FOOTER_DELETE:
388 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
390 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
391 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
393 __pDeletePopup->SetShowState(true);
394 __pDeletePopup->Show();
398 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
400 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
401 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
403 __pDeletePopup->SetShowState(true);
404 __pDeletePopup->Show();
408 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
410 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
411 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
413 __pDeletePopup->SetShowState(true);
414 __pDeletePopup->Show();
418 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
420 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
421 (pSceneManager->GetCurrentScene()->GetPanel());
422 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
424 __pDeletePopup->SetShowState(true);
425 __pDeletePopup->Show();
432 case IDA_CONTEXT_MENU_MORE_EDIT:
437 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
442 case IDA_CONTEXT_MENU_MORE_COPY:
444 case IDA_CONTEXT_MENU_MORE_MOVE:
446 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
448 __isCopyOperation = false;
450 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
452 __isCopyOperation = true;
457 __pOptionMenu->SetShowState(true);
458 __pOptionMenu->Show();
464 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
466 if (__pPopUp != null)
468 __pPopUp->SetShowState(true);
474 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
476 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
478 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
479 if (pEditorPanel != null)
481 pEditorPanel->OnRequestMessage();
484 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
486 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
487 if (pSelectionPanel != null)
489 pSelectionPanel->OnRequestMessage();
495 case IDA_CONTEXT_MENU_SHARE_EMAIL:
497 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
499 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
500 if (pEditorPanel != null)
502 pEditorPanel->OnRequestEmail();
505 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
507 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
508 if (pSelectionPanel != null)
510 pSelectionPanel->OnRequestEmail();
516 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
518 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
520 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
521 if (pListEditorPanel)
523 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
524 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
525 if (__isCopyOperation)
527 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
531 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
533 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
539 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
541 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
542 (pSceneManager->GetCurrentScene()->GetPanel());
544 if (pSelectionPanel != null)
546 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
547 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
548 if (__isCopyOperation)
550 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
554 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
556 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
563 case IDA_DELETE_POPUP_DEL:
566 __pDeletePopup->SetShowState(false);
567 __pDeletePopup->Invalidate(true);
569 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
571 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
572 if (pEditorPanel != null)
574 result r = pEditorPanel->OnRequestDelete();
577 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
581 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
583 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
584 (pSceneManager->GetCurrentScene()->GetPanel());
586 if (pSelectionPanel != null)
588 result r = pSelectionPanel->OnRequestDelete();
591 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
598 case IDA_DELETE_POPUP_CANCEL:
601 __pDeletePopup->SetShowState(false);
602 __pDeletePopup->Invalidate(true);
606 case IDA_CONTEXT_MENU_ROTATE_LEFT:
608 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
610 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
611 if (pEditorPanel != null)
613 RotateMode rotateMode = ROTATE_MODE_LEFT;
614 pEditorPanel->OnRequestRotate(rotateMode);
617 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
619 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
620 (pSceneManager->GetCurrentScene()->GetPanel());
622 if (pSelectionPanel != null)
624 RotateMode rotateMode = ROTATE_MODE_LEFT;
625 pSelectionPanel->OnRotateRequested(rotateMode);
631 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
633 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
635 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
636 if (pEditorPanel != null)
638 RotateMode rotateMode = ROTATE_MODE_RIGHT;
639 pEditorPanel->OnRequestRotate(rotateMode);
642 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
645 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
646 (pSceneManager->GetCurrentScene()->GetPanel());
648 if (pSelectionPanel != null)
650 RotateMode rotateMode = ROTATE_MODE_RIGHT;
651 pSelectionPanel->OnRotateRequested(rotateMode);
657 case IDA_FOOTER_CONFIRM:
659 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
661 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
662 if (pEditorPanel != null)
664 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
667 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
669 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
670 if (pEditorPanel != null)
672 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
680 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
682 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
683 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
685 if (__pContentDirectoryList == null)
689 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
691 String* pDirectory = static_cast<String*>
692 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
694 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
695 (pSceneManager->GetCurrentScene()->GetPanel());
697 if (pEditorPanel != null)
700 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
701 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
702 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
703 if (__isCopyOperation)
705 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
706 __pFileMove->SetCopy();
709 result r = __pFileMove->StartTimer();
714 __isCopyOperation = false;
724 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
726 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
727 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
729 if (__pContentDirectoryList == null)
734 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
736 String* pDirectory = static_cast<String*>
737 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
739 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
740 (pSceneManager->GetCurrentScene()->GetPanel());
742 if (pSelectionPanel != null)
745 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
746 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
747 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
748 if (__isCopyOperation)
750 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
751 __pFileMove->SetCopy();
753 result r = __pFileMove->StartTimer();
758 __isCopyOperation = false;
771 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
775 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
781 FileListEditorForm::GetOverlayStatus(void) const
787 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
790 __pPresentationModel->SetUpdateProgressStatus(false);
791 if (res != COMPLETE_SUCCESS)
793 MessageBox messageBox;
794 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
797 messageBox.ShowAndWait(modalResult);
799 SceneManager* pSceneManager = SceneManager::GetInstance();
800 AppAssert(pSceneManager);
801 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
806 FileListEditorForm::OnContentUpdated()
808 AppLogDebug("ENTER");
810 SceneManager* pSceneManager = SceneManager::GetInstance();
812 if(__pDeletePopup != null)
814 if(__pDeletePopup->IsVisible() == true)
816 __pDeletePopup->Destroy();
817 __pDeletePopup = null;
823 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
825 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
826 if (pEditorPanel != null)
828 pEditorPanel->CancelUpdateProgress();
831 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
833 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
834 if (pSelectionPanel != null)
836 pSelectionPanel->CancelUpdateProgress();
840 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
841 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
843 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
844 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
847 else if (_overlayMsg == false)
849 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
850 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
853 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
857 FileListEditorForm::SetUpPopup(void)
859 AppLogDebug("ENTER");
860 result r = E_SUCCESS;
862 if (__pDeletePopup != null)
864 delete __pDeletePopup;
865 __pDeletePopup = null;
868 __pDeletePopup = new (std::nothrow) Popup();
869 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
871 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
873 Label* pLabelText = new (std::nothrow) Label();
874 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
875 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
876 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
877 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
878 __pDeletePopup->AddControl(pLabelText);
880 Button* pDeleteButton = new (std::nothrow) Button();
881 pDeleteButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
882 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
883 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
884 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
885 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
886 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
887 pDeleteButton->AddActionEventListener(*this);
888 __pDeletePopup->AddControl(pDeleteButton);
890 Button* pButtonCancel = new (std::nothrow) Button();
891 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
892 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
893 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
894 pButtonCancel->AddActionEventListener(*this);
895 __pDeletePopup->AddControl(pButtonCancel);
896 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
902 FileListEditorForm::SetTitleText(const String& titleText)
904 AppLogDebug("ENTER");
905 Header* pHeader = GetHeader();
906 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
907 pHeader->SetTitleText(titleText);
908 pHeader->Invalidate(true);
909 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
913 FileListEditorForm::RefreshFolderList(void)
915 AppLogDebug("ENTER");
916 ContentDirectory contentDirectory;
917 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
918 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
919 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
920 result r = contentDirectory.Construct(*pContentTypeList);
923 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
926 delete pContentTypeList;
928 if (__pContentDirectoryList != null)
930 delete __pContentDirectoryList;
932 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
933 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
934 String* pDirPath = null;
935 String* pDirName = null;
936 String mediaPath = RESERVED_MEDIA_PATH;
937 int length = mediaPath.GetLength();
938 mediaPath.Remove(length-1,1);
940 int loopCount = __pContentDirectoryList->GetCount();
941 for (int i = 0; i < loopCount; ++i)
943 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
944 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
946 if ( *pDirPath == mediaPath)
948 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
949 __pContentDirectoryNameList->Add(pDirName);
953 __pContentDirectoryNameList->Add(pDirName);
957 __pOptionMenu->RemoveAllItems();
958 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
959 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
961 loopCount = __pContentDirectoryNameList->GetCount();
963 for (int i = 0; i < loopCount; ++i)
965 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
967 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
969 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
970 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
975 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
979 FileListEditorForm::OnFormBackRequested(Form& source)
981 AppLogDebug("ENTER");
983 SceneManager* pSceneManager = SceneManager::GetInstance();
984 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
986 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
988 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
990 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
992 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
994 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
999 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1001 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1003 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1005 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1007 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1009 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1011 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1013 if (__pContextMenuShare != null && __pContextMenuShare->GetShowState() == true )
1015 __pContextMenuShare->SetShowState(false);
1019 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1020 (pSceneManager->GetCurrentScene()->GetPanel());
1021 if (pSelectionPanel != null)
1023 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1026 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1029 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1030 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1038 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1041 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1045 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1047 AppLogDebug("ENTER");
1048 Footer* pFooter = GetFooter();
1049 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1051 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1053 if (enableState == true)
1055 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1056 pFooter->SetItemEnabled(0, true);
1060 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1061 pFooter->SetItemEnabled(0, false);
1066 if (enableState == true)
1068 pFooter->SetItemEnabled(0, true);
1069 pFooter->SetItemEnabled(1, true);
1073 pFooter->SetItemEnabled(0, false);
1074 pFooter->SetItemEnabled(1, false);
1077 pFooter->RequestRedraw(true);
1078 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1082 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1084 SceneManager* pSceneManager = SceneManager::GetInstance();
1085 pSceneManager->GetCurrentScene();
1087 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1089 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1090 if (pEditorPanel != null)
1092 pEditorPanel->ChangeOrientation();
1095 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1097 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1098 if (pEditorPanel != null)
1100 pEditorPanel->ChangeOrientation();
1103 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1105 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1106 if (pEditorPanel != null)
1108 pEditorPanel->ChangeOrientation();
1111 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1113 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1114 if (pEditorPanel != null)
1116 pEditorPanel->ChangeOrientation();
1123 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1125 AppLogDebug("ENTER");
1126 result r = E_FAILURE;
1127 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1128 if (albumName != EMPTY_SPACE)
1130 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1131 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1132 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1133 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1134 delete pDirectoryList;
1136 SceneManager* pSceneManager = SceneManager::GetInstance();
1137 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1140 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1146 FileListEditorForm::SelectAllPressed(void)
1148 SceneManager* pSceneManager = SceneManager::GetInstance();
1149 pSceneManager->GetCurrentScene();
1151 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1153 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1154 if (pEditorPanel != null)
1156 pEditorPanel->OnSelectAllPressed();
1159 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1161 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1162 if (pEditorPanel != null)
1164 pEditorPanel->OnSelectAllPressed();
1167 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1169 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1170 if (pEditorPanel != null)
1172 pEditorPanel->OnSelectAllPressed();
1175 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1177 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1178 if (pEditorPanel != null)
1180 pEditorPanel->OnSelectAllPressed();
1186 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1188 if (__pPopUp != NULL)
1190 __pPopUp->SetShowState(false);
1193 SceneManager* pSceneManager = SceneManager::GetInstance();
1197 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1199 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1200 if (pEditorPanel != null)
1202 pEditorPanel->OnRequestSlideShow();
1205 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1207 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1208 (pSceneManager->GetCurrentScene()->GetPanel());
1210 if (pSelectionPanel != null)
1212 pSelectionPanel->OnRequestSlideShow();
1216 else if (index == 1)
1218 SceneManager* pSceneManager = SceneManager::GetInstance();
1219 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1221 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1226 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1228 AppLogDebug("ENTER");
1229 __pPresentationModel->RemoveContentEventListener(this);
1230 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1234 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1236 AppLogDebug("ENTER");
1237 __pPresentationModel->AddContentEventListener(this);
1238 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1242 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1245 SceneManager* pSceneManager = SceneManager::GetInstance();
1246 int checkedCount = 0;
1248 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1250 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1251 if (pEditorPanel != null)
1253 checkedCount = pEditorPanel->GetItemCheckedCount();
1256 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1258 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1259 if (pSelectionPanel != null)
1261 checkedCount = pSelectionPanel->GetItemCheckedCount();
1265 if (__pContextMenuShare != null && __pContextMenuShare->GetShowState() == true )
1267 __pContextMenuShare->SetShowState(false);
1270 if ( checkedCount > 0)
1272 if ( __pOptionMenu == null )
1277 __pOptionMenu->RemoveAllItems();
1278 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1279 IDA_CONTEXT_MENU_MORE_MOVE);
1280 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1281 IDA_CONTEXT_MENU_MORE_COPY);
1283 if (checkedCount > 1)
1285 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1286 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1289 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1290 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1292 __pOptionMenu->SetShowState(true);
1293 __pOptionMenu->Show();