2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file GlFileListEditorForm.cpp
19 * @brief This is the implementation file for FileListEditorForm class.
22 #include "GlAllListEditorPanel.h"
23 #include "GlAllListSelectionPanel.h"
24 #include "GlFileListEditorForm.h"
25 #include "GlFileListPresentationModel.h"
26 #include "GlGalleryApp.h"
27 #include "GlImageListEditorPanel.h"
28 #include "GlResourceManager.h"
29 #include "GlSlideSettingListener.h"
30 #include "GlSlideShowPopUp.h"
32 #include "GlVideoListEditorPanel.h"
33 #include "GlFileMoveTimer.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Content;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::System;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
44 using namespace Tizen::Base::Utility;
46 static const int GAP_W_POPUP_ITEM = 5;
47 static const int W_DELETE_POPUP = 620;
48 static const int H_DELETE_POPUP = 300;
49 static const int H_DELETE_LABEL = 180;
50 static const int Y_DELETE_BUTTON = 180;
51 static const int H_DELETE_BUTTON = 80;
52 static const int H_TOAST_LABEL = 48;
54 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
55 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
56 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
58 static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
60 FileListEditorForm::FileListEditorForm(void)
61 : __pShareContextMenu(null)
63 , __pDeletePopup(null)
64 , __morePosition(Point(0, 0))
65 , __pContentDirectoryList(null)
66 , __pContentDirectoryNameList(null)
69 , __isCopyOperation(false)
70 , __pPresentationModel(null)
74 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
77 FileListEditorForm::~FileListEditorForm(void)
80 if (__pContentDirectoryList != null)
82 __pContentDirectoryList->RemoveAll(true);
83 delete __pContentDirectoryList;
84 __pContentDirectoryList = null;
93 if (__pContentDirectoryNameList != null)
95 __pContentDirectoryNameList->RemoveAll(true);
96 delete __pContentDirectoryNameList;
97 __pContentDirectoryNameList = null;
100 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
104 FileListEditorForm::Initialize(void)
106 AppLogDebug("ENTER");
107 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
108 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
114 FileListEditorForm::OnInitializing(void)
116 AppLogDebug("ENTER");
117 Header* pHeader = GetHeader();
118 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
120 SetOrientation(ORIENTATION_AUTOMATIC);
121 AddOrientationEventListener(*this);
123 __pPopUp = new (std::nothrow) SlideShowPopUp();
125 if (__pPopUp != null)
127 __pPopUp->Initialize();
128 __pPopUp->SetEventListner(this);
129 AddControl(__pPopUp);
132 __pPresentationModel = FileListPresentationModel::GetInstance();
133 __pPresentationModel->ClearThumbnailRequests();
135 pHeader->SetStyle(HEADER_STYLE_TITLE);
136 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
138 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
139 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
141 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
142 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
143 ButtonItem selectAll;
144 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
145 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
146 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
147 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
148 delete pNormalBitmap;
152 pHeader->AddActionEventListener(*this);
155 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
161 FileListEditorForm::InitializeFooter(void)
163 AppLogDebug("ENTER");
164 Footer* pFooter = GetFooter();
165 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
166 pFooter->RemoveAllItems();
168 result r = E_SUCCESS;
170 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
172 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
174 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
176 FooterItem footerConfirm;
177 footerConfirm.Construct(IDA_FOOTER_CONFIRM);
178 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
179 pFooter->AddItem(footerConfirm);
180 pFooter->SetItemEnabled(0, false);
181 pFooter->SetShowState(true);
182 pFooter->Invalidate(true);
186 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
187 pFooter->SetShowState(false);
188 pFooter->Invalidate(true);
191 SetFormBackEventListener(this);
196 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
197 SetFormMenuEventListener(this);
199 FooterItem footerShare;
200 r = footerShare.Construct(IDA_FOOTER_SHARE);
201 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
202 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
203 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
205 if (pBitmapShare != null && pBitmapShareDim != null)
207 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
208 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
211 r = pFooter->AddItem(footerShare);
213 delete pBitmapShareDim;
214 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
216 FooterItem footerDelete;
217 r = footerDelete.Construct(IDA_FOOTER_DELETE);
218 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
219 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
220 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
222 if (pBitmapDelete != null && pBitmapDeleteDim != null)
224 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
225 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
228 r = pFooter->AddItem(footerDelete);
229 delete pBitmapDelete;
230 delete pBitmapDeleteDim;
231 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
233 SetFormBackEventListener(this);
235 SceneManager* pSceneManager = SceneManager::GetInstance();
236 int checkedCount = 0;
238 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
240 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
241 if (pEditorPanel != null)
243 checkedCount = pEditorPanel->GetItemCheckedCount();
246 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
248 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
249 if (pSelectionPanel != null)
251 checkedCount = pSelectionPanel->GetItemCheckedCount();
255 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
257 if (__pOptionMenu != null)
259 delete __pOptionMenu;
260 __pOptionMenu = null;
263 __pOptionMenu = new (std::nothrow) OptionMenu();
264 __pOptionMenu->Construct();
265 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
266 IDA_CONTEXT_MENU_MORE_MOVE);
267 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
268 IDA_CONTEXT_MENU_MORE_COPY);
270 if (checkedCount > 1)
272 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
273 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
276 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
277 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
279 __pOptionMenu->AddActionEventListener(*this);
281 if (__pContentDirectoryNameList != null)
283 __pContentDirectoryNameList->RemoveAll(true);
284 delete __pContentDirectoryNameList;
285 __pContentDirectoryNameList = null;
291 pFooter->AddActionEventListener(*this);
292 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
298 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
300 AppLogDebug("ENTER");
301 if (fullPath == null)
303 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
307 String delim(DIRECTORY_SEPARATOR);
308 StringTokenizer st(fullPath,delim);
310 while (st.HasMoreTokens())
312 st.GetNextToken(token);
314 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
320 FileListEditorForm::OnTerminating(void)
322 AppLogDebug("ENTER");
323 __pPresentationModel->RemoveContentEventListener(this);
325 if (__pOptionMenu != null)
327 __pOptionMenu->RemoveActionEventListener(*this);
328 delete __pOptionMenu;
329 __pOptionMenu = null;
332 if (__pShareContextMenu != null)
334 __pShareContextMenu->RemoveActionEventListener(*this);
335 delete __pShareContextMenu;
336 __pShareContextMenu = null;
339 if (__pDeletePopup != null)
341 delete __pDeletePopup;
342 __pDeletePopup = null;
345 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
351 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
353 AppLogDebug("ENTER(actionId=%d)", actionId);
354 SceneManager* pSceneManager = SceneManager::GetInstance();
355 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
359 case IDA_FILE_LIST_SELECT_ALL:
363 case IDA_FOOTER_SHARE:
365 if (__pShareContextMenu != NULL)
367 delete __pShareContextMenu;
368 __pShareContextMenu = null;
371 __pShareContextMenu = new (std::nothrow) ContextMenu();
372 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height),
373 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
374 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
375 IDA_CONTEXT_MENU_SHARE_MESSAGE);
376 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
377 IDA_CONTEXT_MENU_SHARE_EMAIL);
378 __pShareContextMenu->SetFocusable(true);
379 __pShareContextMenu->AddActionEventListener(*this);
381 Rectangle rect = source.GetBounds();
382 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
384 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
388 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
391 __pShareContextMenu->SetShowState(true);
392 __pShareContextMenu->Show();
397 case IDA_FOOTER_DELETE:
399 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
401 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
402 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
404 __pDeletePopup->SetShowState(true);
405 __pDeletePopup->Show();
409 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
411 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
412 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
414 __pDeletePopup->SetShowState(true);
415 __pDeletePopup->Show();
419 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
421 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
422 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
424 __pDeletePopup->SetShowState(true);
425 __pDeletePopup->Show();
429 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
431 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
432 (pSceneManager->GetCurrentScene()->GetPanel());
433 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
435 __pDeletePopup->SetShowState(true);
436 __pDeletePopup->Show();
443 case IDA_CONTEXT_MENU_MORE_EDIT:
448 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
453 case IDA_CONTEXT_MENU_MORE_COPY:
455 case IDA_CONTEXT_MENU_MORE_MOVE:
457 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
459 __isCopyOperation = false;
461 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
463 __isCopyOperation = true;
468 __pOptionMenu->SetShowState(true);
469 __pOptionMenu->Show();
475 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
477 if (__pPopUp != null)
479 __pPopUp->SetShowState(true);
485 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
487 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
489 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
490 if (pEditorPanel != null)
492 pEditorPanel->OnRequestMessage();
495 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
497 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
498 if (pSelectionPanel != null)
500 pSelectionPanel->OnRequestMessage();
506 case IDA_CONTEXT_MENU_SHARE_EMAIL:
508 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
510 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
511 if (pEditorPanel != null)
513 pEditorPanel->OnRequestEmail();
516 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
518 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
519 if (pSelectionPanel != null)
521 pSelectionPanel->OnRequestEmail();
527 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
529 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
531 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
532 if (pListEditorPanel)
534 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
535 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
536 if (__isCopyOperation)
538 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
542 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
544 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
550 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
552 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
553 (pSceneManager->GetCurrentScene()->GetPanel());
555 if (pSelectionPanel != null)
557 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
558 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
559 if (__isCopyOperation)
561 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
565 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
567 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
574 case IDA_DELETE_POPUP_DEL:
577 __pDeletePopup->SetShowState(false);
578 __pDeletePopup->Invalidate(true);
580 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
582 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
583 if (pEditorPanel != null)
585 result r = pEditorPanel->OnRequestDelete();
588 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
592 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
594 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
595 (pSceneManager->GetCurrentScene()->GetPanel());
597 if (pSelectionPanel != null)
599 result r = pSelectionPanel->OnRequestDelete();
602 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
609 case IDA_DELETE_POPUP_CANCEL:
612 __pDeletePopup->SetShowState(false);
613 __pDeletePopup->Invalidate(true);
617 case IDA_CONTEXT_MENU_ROTATE_LEFT:
619 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
621 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
622 if (pEditorPanel != null)
624 RotateMode rotateMode = ROTATE_MODE_LEFT;
625 pEditorPanel->OnRequestRotate(rotateMode);
628 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
630 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
631 (pSceneManager->GetCurrentScene()->GetPanel());
633 if (pSelectionPanel != null)
635 RotateMode rotateMode = ROTATE_MODE_LEFT;
636 pSelectionPanel->OnRotateRequested(rotateMode);
642 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
644 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
646 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
647 if (pEditorPanel != null)
649 RotateMode rotateMode = ROTATE_MODE_RIGHT;
650 pEditorPanel->OnRequestRotate(rotateMode);
653 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
656 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
657 (pSceneManager->GetCurrentScene()->GetPanel());
659 if (pSelectionPanel != null)
661 RotateMode rotateMode = ROTATE_MODE_RIGHT;
662 pSelectionPanel->OnRotateRequested(rotateMode);
668 case IDA_FOOTER_CONFIRM:
670 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
672 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
673 if (pEditorPanel != null)
675 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
678 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
680 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
681 if (pEditorPanel != null)
683 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
691 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
693 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
694 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
696 if (__pContentDirectoryList == null)
700 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
702 String* pDirectory = static_cast<String*>
703 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
705 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
706 (pSceneManager->GetCurrentScene()->GetPanel());
708 if (pEditorPanel != null)
711 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
712 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
713 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
714 if (__isCopyOperation)
716 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
717 __pFileMove->SetCopy();
720 result r = __pFileMove->StartTimer();
725 __isCopyOperation = false;
735 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
737 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
738 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
740 if (__pContentDirectoryList == null)
745 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
747 String* pDirectory = static_cast<String*>
748 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
750 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
751 (pSceneManager->GetCurrentScene()->GetPanel());
753 if (pSelectionPanel != null)
756 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
757 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
758 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
759 if (__isCopyOperation)
761 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
762 __pFileMove->SetCopy();
764 result r = __pFileMove->StartTimer();
769 __isCopyOperation = false;
782 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
786 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
792 FileListEditorForm::GetOverlayStatus(void) const
798 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
801 __pPresentationModel->SetUpdateProgressStatus(false);
802 if (res != COMPLETE_SUCCESS)
804 MessageBox messageBox;
805 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
808 messageBox.ShowAndWait(modalResult);
810 SceneManager* pSceneManager = SceneManager::GetInstance();
811 AppAssert(pSceneManager);
812 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
817 FileListEditorForm::OnContentUpdated()
819 AppLogDebug("ENTER");
821 SceneManager* pSceneManager = SceneManager::GetInstance();
823 if(__pDeletePopup != null)
825 if(__pDeletePopup->IsVisible() == true)
827 __pDeletePopup->Destroy();
828 __pDeletePopup = null;
834 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
836 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
837 if (pEditorPanel != null)
839 pEditorPanel->CancelUpdateProgress();
842 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
844 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
845 if (pSelectionPanel != null)
847 pSelectionPanel->CancelUpdateProgress();
851 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
852 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
854 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
855 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
858 else if (_overlayMsg == false)
860 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
861 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
864 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
868 FileListEditorForm::SetUpPopup(void)
870 AppLogDebug("ENTER");
871 result r = E_SUCCESS;
873 if (__pDeletePopup != null)
875 delete __pDeletePopup;
876 __pDeletePopup = null;
879 __pDeletePopup = new (std::nothrow) Popup();
880 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
881 __pDeletePopup->SetPropagatedKeyEventListener(this);
883 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
885 Label* pLabelText = new (std::nothrow) Label();
886 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
887 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
888 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
889 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
890 __pDeletePopup->AddControl(pLabelText);
892 Button* pDeleteButton = new (std::nothrow) Button();
893 pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
894 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
895 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
896 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
897 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
898 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
899 pDeleteButton->AddActionEventListener(*this);
900 __pDeletePopup->AddControl(pDeleteButton);
902 Button* pButtonCancel = new (std::nothrow) Button();
903 pButtonCancel->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
904 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
905 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
906 pButtonCancel->AddActionEventListener(*this);
907 __pDeletePopup->AddControl(pButtonCancel);
908 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
914 FileListEditorForm::SetTitleText(const String& titleText)
916 AppLogDebug("ENTER");
917 Header* pHeader = GetHeader();
918 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
919 pHeader->SetTitleText(titleText);
920 pHeader->Invalidate(true);
921 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
925 FileListEditorForm::RefreshFolderList(void)
927 AppLogDebug("ENTER");
928 ContentDirectory contentDirectory;
929 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
930 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
931 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
932 result r = contentDirectory.Construct(*pContentTypeList);
935 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
938 delete pContentTypeList;
940 if (__pContentDirectoryList != null)
942 __pContentDirectoryList->RemoveAll(true);
943 delete __pContentDirectoryList;
944 __pContentDirectoryList = null;
946 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
948 if (__pContentDirectoryNameList != NULL)
950 __pContentDirectoryNameList->RemoveAll(true);
951 delete __pContentDirectoryNameList;
952 __pContentDirectoryNameList = null;
955 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
956 String* pDirPath = null;
957 String* pDirName = null;
958 String mediaPath = RESERVED_MEDIA_PATH;
959 int length = mediaPath.GetLength();
960 mediaPath.Remove(length-1,1);
962 int loopCount = __pContentDirectoryList->GetCount();
963 for (int i = 0; i < loopCount; ++i)
965 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
966 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
968 if (*pDirPath == mediaPath)
970 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
971 __pContentDirectoryNameList->Add(pDirName);
975 __pContentDirectoryNameList->Add(pDirName);
979 __pOptionMenu->RemoveAllItems();
980 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
981 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
983 loopCount = __pContentDirectoryNameList->GetCount();
985 for (int i = 0; i < loopCount; ++i)
987 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
989 if (*pDirName != __pPresentationModel->GetCurrentAlbumName())
991 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
992 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
997 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1001 FileListEditorForm::OnFormBackRequested(Form& source)
1003 AppLogDebug("ENTER");
1005 SceneManager* pSceneManager = SceneManager::GetInstance();
1006 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
1008 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1010 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1012 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1014 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1016 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1021 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1023 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1025 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1027 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1029 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1031 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1033 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1035 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true)
1037 __pShareContextMenu->SetShowState(false);
1041 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1042 (pSceneManager->GetCurrentScene()->GetPanel());
1043 if (pSelectionPanel != null)
1045 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1048 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1051 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1052 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1058 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1061 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1065 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1067 AppLogDebug("ENTER");
1068 Footer* pFooter = GetFooter();
1069 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1071 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1073 if (enableState == true)
1075 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1076 pFooter->SetItemEnabled(0, true);
1080 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1081 pFooter->SetItemEnabled(0, false);
1086 if (enableState == true)
1088 pFooter->SetItemEnabled(0, true);
1089 pFooter->SetItemEnabled(1, true);
1093 pFooter->SetItemEnabled(0, false);
1094 pFooter->SetItemEnabled(1, false);
1097 pFooter->RequestRedraw(true);
1098 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1102 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1104 AppLogDebug("ENTER");
1105 SceneManager* pSceneManager = SceneManager::GetInstance();
1106 pSceneManager->GetCurrentScene();
1108 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1110 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1111 if (pEditorPanel != null)
1113 pEditorPanel->ChangeOrientation();
1116 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1118 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1119 if (pEditorPanel != null)
1121 pEditorPanel->ChangeOrientation();
1124 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1126 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1127 if (pEditorPanel != null)
1129 pEditorPanel->ChangeOrientation();
1132 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1134 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1135 if (pEditorPanel != null)
1137 pEditorPanel->ChangeOrientation();
1140 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1144 FileListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
1146 AppLogDebug("ENTER");
1148 if(keyEventInfo.GetKeyCode() == KEY_BACK)
1150 _overlayMsg = false;
1151 __pDeletePopup->SetShowState(false);
1152 __pDeletePopup->Invalidate(true);
1154 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1160 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1162 AppLogDebug("ENTER");
1163 result r = E_FAILURE;
1164 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1165 if (albumName != EMPTY_SPACE)
1167 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1168 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1169 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1170 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1171 delete pDirectoryList;
1173 SceneManager* pSceneManager = SceneManager::GetInstance();
1174 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1177 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1183 FileListEditorForm::SelectAllPressed(void)
1185 SceneManager* pSceneManager = SceneManager::GetInstance();
1186 pSceneManager->GetCurrentScene();
1188 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1190 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1191 if (pEditorPanel != null)
1193 pEditorPanel->OnSelectAllPressed();
1196 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1198 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1199 if (pEditorPanel != null)
1201 pEditorPanel->OnSelectAllPressed();
1204 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1206 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1207 if (pEditorPanel != null)
1209 pEditorPanel->OnSelectAllPressed();
1212 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1214 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1215 if (pEditorPanel != null)
1217 pEditorPanel->OnSelectAllPressed();
1223 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1225 if (__pPopUp != NULL)
1227 __pPopUp->SetShowState(false);
1230 SceneManager* pSceneManager = SceneManager::GetInstance();
1234 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1236 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1237 if (pEditorPanel != null)
1239 pEditorPanel->OnRequestSlideShow();
1242 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1244 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1245 (pSceneManager->GetCurrentScene()->GetPanel());
1247 if (pSelectionPanel != null)
1249 pSelectionPanel->OnRequestSlideShow();
1253 else if (index == 1)
1255 SceneManager* pSceneManager = SceneManager::GetInstance();
1256 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1258 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1263 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1265 AppLogDebug("ENTER");
1266 __pPresentationModel->RemoveContentEventListener(this);
1267 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1271 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1273 AppLogDebug("ENTER");
1274 __pPresentationModel->AddContentEventListener(this);
1275 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1279 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1282 SceneManager* pSceneManager = SceneManager::GetInstance();
1283 int checkedCount = 0;
1285 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1287 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1288 if (pEditorPanel != null)
1290 checkedCount = pEditorPanel->GetItemCheckedCount();
1293 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1295 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1296 if (pSelectionPanel != null)
1298 checkedCount = pSelectionPanel->GetItemCheckedCount();
1302 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true)
1304 __pShareContextMenu->SetShowState(false);
1307 if (checkedCount > 0)
1309 if (__pOptionMenu == null)
1314 __pOptionMenu->RemoveAllItems();
1315 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1316 IDA_CONTEXT_MENU_MORE_MOVE);
1317 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1318 IDA_CONTEXT_MENU_MORE_COPY);
1320 if (checkedCount > 1)
1322 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1323 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1326 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1327 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1329 __pOptionMenu->SetShowState(true);
1330 __pOptionMenu->Show();