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);
174 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
177 SetFormBackEventListener(this);
182 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
183 SetFormMenuEventListener(this);
185 FooterItem footerShare;
186 r = footerShare.Construct(IDA_FOOTER_SHARE);
187 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
188 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
189 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
191 if (pBitmapShare != null && pBitmapShareDim != null)
193 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
194 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
197 r = pFooter->AddItem(footerShare);
199 delete pBitmapShareDim;
200 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
202 FooterItem footerDelete;
203 r = footerDelete.Construct(IDA_FOOTER_DELETE);
204 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
205 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
206 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
208 if (pBitmapDelete != null && pBitmapDeleteDim != null)
210 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
211 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
214 r = pFooter->AddItem(footerDelete);
215 delete pBitmapDelete;
216 delete pBitmapDeleteDim;
217 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
219 SetFormBackEventListener(this);
221 SceneManager* pSceneManager = SceneManager::GetInstance();
222 int checkedCount = 0;
224 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
226 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
227 if (pEditorPanel != null)
229 checkedCount = pEditorPanel->GetItemCheckedCount();
232 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
234 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
235 if (pSelectionPanel != null)
237 checkedCount = pSelectionPanel->GetItemCheckedCount();
241 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
243 if (__pOptionMenu != null)
245 delete __pOptionMenu;
246 __pOptionMenu = null;
249 __pOptionMenu = new (std::nothrow) OptionMenu();
250 __pOptionMenu->Construct();
251 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
252 IDA_CONTEXT_MENU_MORE_MOVE);
253 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
254 IDA_CONTEXT_MENU_MORE_COPY);
256 if (checkedCount > 1)
258 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
259 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
262 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
263 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
265 __pOptionMenu->AddActionEventListener(*this);
267 if (__pContentDirectoryNameList != null)
269 delete __pContentDirectoryNameList;
270 __pContentDirectoryNameList = null;
276 pFooter->AddActionEventListener(*this);
277 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
283 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
285 AppLogDebug("ENTER");
286 if (fullPath == null)
288 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
292 String delim(DIRECTORY_SEPARATOR);
293 StringTokenizer st(fullPath,delim);
295 while (st.HasMoreTokens())
297 st.GetNextToken(token);
299 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
305 FileListEditorForm::OnTerminating(void)
307 AppLogDebug("ENTER");
308 __pPresentationModel->RemoveContentEventListener(this);
310 if (__pOptionMenu != null)
312 __pOptionMenu->RemoveActionEventListener(*this);
313 delete __pOptionMenu;
314 __pOptionMenu = null;
317 if (__pContextMenuShare != null)
319 __pContextMenuShare->RemoveActionEventListener(*this);
320 delete __pContextMenuShare;
321 __pContextMenuShare = null;
324 if (__pDeletePopup != null)
326 delete __pDeletePopup;
327 __pDeletePopup = null;
330 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
336 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
338 AppLogDebug("ENTER(actionId=%d)", actionId);
339 SceneManager* pSceneManager = SceneManager::GetInstance();
340 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
344 case IDA_FILE_LIST_SELECT_ALL:
348 case IDA_FOOTER_SHARE:
350 if ( __pContextMenuShare != NULL)
352 delete __pContextMenuShare;
353 __pContextMenuShare = null;
356 __pContextMenuShare = new (std::nothrow) ContextMenu();
357 __pContextMenuShare->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
358 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
359 IDA_CONTEXT_MENU_SHARE_MESSAGE);
360 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
361 IDA_CONTEXT_MENU_SHARE_EMAIL);
362 __pContextMenuShare->AddActionEventListener(*this);
366 Rectangle rect = source.GetBounds();
367 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
369 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
373 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
376 __pContextMenuShare->SetShowState(true);
377 __pContextMenuShare->Show();
382 case IDA_FOOTER_DELETE:
384 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
386 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
387 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
389 __pDeletePopup->SetShowState(true);
390 __pDeletePopup->Show();
394 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
396 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
397 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
399 __pDeletePopup->SetShowState(true);
400 __pDeletePopup->Show();
404 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
406 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
407 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
409 __pDeletePopup->SetShowState(true);
410 __pDeletePopup->Show();
414 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
416 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
417 (pSceneManager->GetCurrentScene()->GetPanel());
418 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
420 __pDeletePopup->SetShowState(true);
421 __pDeletePopup->Show();
428 case IDA_CONTEXT_MENU_MORE_EDIT:
433 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
438 case IDA_CONTEXT_MENU_MORE_COPY:
440 case IDA_CONTEXT_MENU_MORE_MOVE:
442 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
444 __isCopyOperation = false;
446 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
448 __isCopyOperation = true;
453 __pOptionMenu->SetShowState(true);
454 __pOptionMenu->Show();
460 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
462 if (__pPopUp != null)
464 __pPopUp->SetShowState(true);
470 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
472 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
474 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
475 if (pEditorPanel != null)
477 pEditorPanel->OnRequestMessage();
480 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
482 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
483 if (pSelectionPanel != null)
485 pSelectionPanel->OnRequestMessage();
491 case IDA_CONTEXT_MENU_SHARE_EMAIL:
493 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
495 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
496 if (pEditorPanel != null)
498 pEditorPanel->OnRequestEmail();
501 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
503 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
504 if (pSelectionPanel != null)
506 pSelectionPanel->OnRequestEmail();
512 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
514 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
516 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
517 if (pListEditorPanel)
519 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
520 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
521 if (__isCopyOperation)
523 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
527 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
529 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
535 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
537 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
538 (pSceneManager->GetCurrentScene()->GetPanel());
540 if (pSelectionPanel != null)
542 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
543 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
544 if (__isCopyOperation)
546 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
550 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
552 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
559 case IDA_DELETE_POPUP_DEL:
562 __pDeletePopup->SetShowState(false);
563 __pDeletePopup->Invalidate(true);
565 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
567 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
568 if (pEditorPanel != null)
570 result r = pEditorPanel->OnRequestDelete();
573 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
577 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
579 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
580 (pSceneManager->GetCurrentScene()->GetPanel());
582 if (pSelectionPanel != null)
584 result r = pSelectionPanel->OnRequestDelete();
587 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
594 case IDA_DELETE_POPUP_CANCEL:
597 __pDeletePopup->SetShowState(false);
598 __pDeletePopup->Invalidate(true);
602 case IDA_CONTEXT_MENU_ROTATE_LEFT:
604 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
606 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
607 if (pEditorPanel != null)
609 RotateMode rotateMode = ROTATE_MODE_LEFT;
610 pEditorPanel->OnRequestRotate(rotateMode);
613 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
615 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
616 (pSceneManager->GetCurrentScene()->GetPanel());
618 if (pSelectionPanel != null)
620 RotateMode rotateMode = ROTATE_MODE_LEFT;
621 pSelectionPanel->OnRotateRequested(rotateMode);
627 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
629 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
631 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
632 if (pEditorPanel != null)
634 RotateMode rotateMode = ROTATE_MODE_RIGHT;
635 pEditorPanel->OnRequestRotate(rotateMode);
638 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
641 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
642 (pSceneManager->GetCurrentScene()->GetPanel());
644 if (pSelectionPanel != null)
646 RotateMode rotateMode = ROTATE_MODE_RIGHT;
647 pSelectionPanel->OnRotateRequested(rotateMode);
653 case IDA_FOOTER_CONFIRM:
655 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
657 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
658 if (pEditorPanel != null)
660 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
663 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
665 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
666 if (pEditorPanel != null)
668 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
676 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
678 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
679 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
681 if (__pContentDirectoryList == null)
685 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
687 String* pDirectory = static_cast<String*>
688 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
690 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
691 (pSceneManager->GetCurrentScene()->GetPanel());
693 if (pEditorPanel != null)
696 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
697 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
698 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
699 if (__isCopyOperation)
701 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
702 __pFileMove->SetCopy();
705 result r = __pFileMove->StartTimer();
710 __isCopyOperation = false;
720 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
722 if ((IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) &&
723 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
725 if (__pContentDirectoryList == null)
730 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START)
732 String* pDirectory = static_cast<String*>
733 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START));
735 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
736 (pSceneManager->GetCurrentScene()->GetPanel());
738 if (pSelectionPanel != null)
741 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
742 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
743 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
744 if (__isCopyOperation)
746 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
747 __pFileMove->SetCopy();
749 result r = __pFileMove->StartTimer();
754 __isCopyOperation = false;
767 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
771 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
777 FileListEditorForm::GetOverlayStatus(void) const
783 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
786 __pPresentationModel->SetUpdateProgressStatus(false);
787 if (res != COMPLETE_SUCCESS)
789 MessageBox messageBox;
790 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
793 messageBox.ShowAndWait(modalResult);
795 SceneManager* pSceneManager = SceneManager::GetInstance();
796 AppAssert(pSceneManager);
797 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
802 FileListEditorForm::OnContentUpdated()
804 AppLogDebug("ENTER");
806 SceneManager* pSceneManager = SceneManager::GetInstance();
808 if(__pDeletePopup != null)
810 if(__pDeletePopup->IsVisible() == true)
812 __pDeletePopup->Destroy();
813 __pDeletePopup = null;
819 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
821 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
822 if (pEditorPanel != null)
824 pEditorPanel->CancelUpdateProgress();
827 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
829 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
830 if (pSelectionPanel != null)
832 pSelectionPanel->CancelUpdateProgress();
836 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
837 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
839 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
840 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
843 else if (_overlayMsg == false)
845 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
846 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
849 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
853 FileListEditorForm::SetUpPopup(void)
855 AppLogDebug("ENTER");
856 result r = E_SUCCESS;
858 if (__pDeletePopup != null)
860 delete __pDeletePopup;
861 __pDeletePopup = null;
864 __pDeletePopup = new (std::nothrow) Popup();
865 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
867 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
869 Label* pLabelText = new (std::nothrow) Label();
870 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
871 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
872 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
873 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
874 __pDeletePopup->AddControl(pLabelText);
876 Button* pDeleteButton = new (std::nothrow) Button();
877 pDeleteButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
878 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
879 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
880 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
881 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
882 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
883 pDeleteButton->AddActionEventListener(*this);
884 __pDeletePopup->AddControl(pDeleteButton);
886 Button* pButtonCancel = new (std::nothrow) Button();
887 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
888 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
889 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
890 pButtonCancel->AddActionEventListener(*this);
891 __pDeletePopup->AddControl(pButtonCancel);
892 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
898 FileListEditorForm::SetTitleText(const String& titleText)
900 AppLogDebug("ENTER");
901 Header* pHeader = GetHeader();
902 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
903 pHeader->SetTitleText(titleText);
904 pHeader->Invalidate(true);
905 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
909 FileListEditorForm::RefreshFolderList(void)
911 AppLogDebug("ENTER");
912 ContentDirectory contentDirectory;
913 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
914 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
915 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
916 result r = contentDirectory.Construct(*pContentTypeList);
919 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
922 delete pContentTypeList;
924 if (__pContentDirectoryList != null)
926 delete __pContentDirectoryList;
928 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
929 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
930 String* pDirPath = null;
931 String* pDirName = null;
932 String mediaPath = RESERVED_MEDIA_PATH;
933 int length = mediaPath.GetLength();
934 mediaPath.Remove(length-1,1);
936 int loopCount = __pContentDirectoryList->GetCount();
937 for (int i = 0; i < loopCount; ++i)
939 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
940 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
942 if ( *pDirPath == mediaPath)
944 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
945 __pContentDirectoryNameList->Add(pDirName);
949 __pContentDirectoryNameList->Add(pDirName);
953 __pOptionMenu->RemoveAllItems();
954 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
955 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
957 loopCount = __pContentDirectoryNameList->GetCount();
959 for (int i = 0; i < loopCount; ++i)
961 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
963 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
965 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
966 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
971 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
975 FileListEditorForm::OnFormBackRequested(Form& source)
977 AppLogDebug("ENTER");
979 SceneManager* pSceneManager = SceneManager::GetInstance();
980 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
982 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
984 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
986 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
988 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
990 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
995 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
997 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
999 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1001 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1003 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1005 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1007 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1009 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1010 (pSceneManager->GetCurrentScene()->GetPanel());
1011 if (pSelectionPanel != null)
1013 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1016 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1019 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1020 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1025 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1028 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1032 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1034 AppLogDebug("ENTER");
1035 Footer* pFooter = GetFooter();
1036 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1038 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1040 if (enableState == true)
1042 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1043 pFooter->SetItemEnabled(0, true);
1047 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1048 pFooter->SetItemEnabled(0, false);
1053 if (enableState == true)
1055 pFooter->SetItemEnabled(0, true);
1056 pFooter->SetItemEnabled(1, true);
1060 pFooter->SetItemEnabled(0, false);
1061 pFooter->SetItemEnabled(1, false);
1064 pFooter->RequestRedraw(true);
1065 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1069 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1071 SceneManager* pSceneManager = SceneManager::GetInstance();
1072 pSceneManager->GetCurrentScene();
1074 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1076 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1077 if (pEditorPanel != null)
1079 pEditorPanel->ChangeOrientation();
1082 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1084 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1085 if (pEditorPanel != null)
1087 pEditorPanel->ChangeOrientation();
1090 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1092 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1093 if (pEditorPanel != null)
1095 pEditorPanel->ChangeOrientation();
1098 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1100 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1101 if (pEditorPanel != null)
1103 pEditorPanel->ChangeOrientation();
1110 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1112 AppLogDebug("ENTER");
1113 result r = E_FAILURE;
1114 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1115 if (albumName != EMPTY_SPACE)
1117 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1118 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1119 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1120 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1121 delete pDirectoryList;
1123 SceneManager* pSceneManager = SceneManager::GetInstance();
1124 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1127 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1133 FileListEditorForm::SelectAllPressed(void)
1135 SceneManager* pSceneManager = SceneManager::GetInstance();
1136 pSceneManager->GetCurrentScene();
1138 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1140 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1141 if (pEditorPanel != null)
1143 pEditorPanel->OnSelectAllPressed();
1146 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1148 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1149 if (pEditorPanel != null)
1151 pEditorPanel->OnSelectAllPressed();
1154 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1156 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1157 if (pEditorPanel != null)
1159 pEditorPanel->OnSelectAllPressed();
1162 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1164 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1165 if (pEditorPanel != null)
1167 pEditorPanel->OnSelectAllPressed();
1173 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1175 if (__pPopUp != NULL)
1177 __pPopUp->SetShowState(false);
1180 SceneManager* pSceneManager = SceneManager::GetInstance();
1184 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1186 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1187 if (pEditorPanel != null)
1189 pEditorPanel->OnRequestSlideShow();
1192 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1194 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1195 (pSceneManager->GetCurrentScene()->GetPanel());
1197 if (pSelectionPanel != null)
1199 pSelectionPanel->OnRequestSlideShow();
1203 else if (index == 1)
1205 SceneManager* pSceneManager = SceneManager::GetInstance();
1206 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1208 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1213 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1215 AppLogDebug("ENTER");
1216 __pPresentationModel->RemoveContentEventListener(this);
1217 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1221 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1223 AppLogDebug("ENTER");
1224 __pPresentationModel->AddContentEventListener(this);
1225 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1229 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1232 SceneManager* pSceneManager = SceneManager::GetInstance();
1233 int checkedCount = 0;
1235 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1237 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1238 if (pEditorPanel != null)
1240 checkedCount = pEditorPanel->GetItemCheckedCount();
1243 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1245 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1246 if (pSelectionPanel != null)
1248 checkedCount = pSelectionPanel->GetItemCheckedCount();
1252 if (__pContextMenuShare != null && __pContextMenuShare->GetShowState() == true )
1254 __pContextMenuShare->SetShowState(false);
1257 if ( checkedCount > 0)
1259 if ( __pOptionMenu == null )
1264 __pOptionMenu->RemoveAllItems();
1265 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1266 IDA_CONTEXT_MENU_MORE_MOVE);
1267 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1268 IDA_CONTEXT_MENU_MORE_COPY);
1270 if (checkedCount > 1)
1272 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1273 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1276 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1277 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1279 __pOptionMenu->SetShowState(true);
1280 __pOptionMenu->Show();