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 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 (__pShareContextMenu != null)
323 __pShareContextMenu->RemoveActionEventListener(*this);
324 delete __pShareContextMenu;
325 __pShareContextMenu = 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 ( __pShareContextMenu != NULL)
356 delete __pShareContextMenu;
357 __pShareContextMenu = null;
360 __pShareContextMenu = new (std::nothrow) ContextMenu();
361 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
362 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
363 IDA_CONTEXT_MENU_SHARE_MESSAGE);
364 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
365 IDA_CONTEXT_MENU_SHARE_EMAIL);
366 __pShareContextMenu->SetFocusable(true);
367 __pShareContextMenu->AddActionEventListener(*this);
369 Rectangle rect = source.GetBounds();
370 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
372 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
376 __pShareContextMenu->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
379 __pShareContextMenu->SetShowState(true);
380 __pShareContextMenu->Show();
385 case IDA_FOOTER_DELETE:
387 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
389 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
390 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
392 __pDeletePopup->SetShowState(true);
393 __pDeletePopup->Show();
397 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
399 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
400 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
402 __pDeletePopup->SetShowState(true);
403 __pDeletePopup->Show();
407 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
409 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
410 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
412 __pDeletePopup->SetShowState(true);
413 __pDeletePopup->Show();
417 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
419 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
420 (pSceneManager->GetCurrentScene()->GetPanel());
421 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
423 __pDeletePopup->SetShowState(true);
424 __pDeletePopup->Show();
431 case IDA_CONTEXT_MENU_MORE_EDIT:
436 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
441 case IDA_CONTEXT_MENU_MORE_COPY:
443 case IDA_CONTEXT_MENU_MORE_MOVE:
445 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
447 __isCopyOperation = false;
449 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
451 __isCopyOperation = true;
456 __pOptionMenu->SetShowState(true);
457 __pOptionMenu->Show();
463 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
465 if (__pPopUp != null)
467 __pPopUp->SetShowState(true);
473 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
475 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
477 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
478 if (pEditorPanel != null)
480 pEditorPanel->OnRequestMessage();
483 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
485 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
486 if (pSelectionPanel != null)
488 pSelectionPanel->OnRequestMessage();
494 case IDA_CONTEXT_MENU_SHARE_EMAIL:
496 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
498 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
499 if (pEditorPanel != null)
501 pEditorPanel->OnRequestEmail();
504 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
506 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
507 if (pSelectionPanel != null)
509 pSelectionPanel->OnRequestEmail();
515 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
517 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
519 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
520 if (pListEditorPanel)
522 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
523 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
524 if (__isCopyOperation)
526 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
530 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
532 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
538 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
540 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
541 (pSceneManager->GetCurrentScene()->GetPanel());
543 if (pSelectionPanel != null)
545 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
546 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
547 if (__isCopyOperation)
549 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
553 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
555 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
562 case IDA_DELETE_POPUP_DEL:
565 __pDeletePopup->SetShowState(false);
566 __pDeletePopup->Invalidate(true);
568 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
570 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
571 if (pEditorPanel != null)
573 result r = pEditorPanel->OnRequestDelete();
576 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
580 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
582 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
583 (pSceneManager->GetCurrentScene()->GetPanel());
585 if (pSelectionPanel != null)
587 result r = pSelectionPanel->OnRequestDelete();
590 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
597 case IDA_DELETE_POPUP_CANCEL:
600 __pDeletePopup->SetShowState(false);
601 __pDeletePopup->Invalidate(true);
605 case IDA_CONTEXT_MENU_ROTATE_LEFT:
607 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
609 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
610 if (pEditorPanel != null)
612 RotateMode rotateMode = ROTATE_MODE_LEFT;
613 pEditorPanel->OnRequestRotate(rotateMode);
616 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
618 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
619 (pSceneManager->GetCurrentScene()->GetPanel());
621 if (pSelectionPanel != null)
623 RotateMode rotateMode = ROTATE_MODE_LEFT;
624 pSelectionPanel->OnRotateRequested(rotateMode);
630 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
632 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
634 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
635 if (pEditorPanel != null)
637 RotateMode rotateMode = ROTATE_MODE_RIGHT;
638 pEditorPanel->OnRequestRotate(rotateMode);
641 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
644 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
645 (pSceneManager->GetCurrentScene()->GetPanel());
647 if (pSelectionPanel != null)
649 RotateMode rotateMode = ROTATE_MODE_RIGHT;
650 pSelectionPanel->OnRotateRequested(rotateMode);
656 case IDA_FOOTER_CONFIRM:
658 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
660 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
661 if (pEditorPanel != null)
663 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
666 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
668 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
669 if (pEditorPanel != null)
671 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
679 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
681 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
682 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
684 if (__pContentDirectoryList == null)
688 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
690 String* pDirectory = static_cast<String*>
691 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
693 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
694 (pSceneManager->GetCurrentScene()->GetPanel());
696 if (pEditorPanel != null)
699 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
700 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
701 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
702 if (__isCopyOperation)
704 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
705 __pFileMove->SetCopy();
708 result r = __pFileMove->StartTimer();
713 __isCopyOperation = false;
723 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
725 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
726 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
728 if (__pContentDirectoryList == null)
733 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
735 String* pDirectory = static_cast<String*>
736 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
738 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
739 (pSceneManager->GetCurrentScene()->GetPanel());
741 if (pSelectionPanel != null)
744 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
745 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
746 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
747 if (__isCopyOperation)
749 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
750 __pFileMove->SetCopy();
752 result r = __pFileMove->StartTimer();
757 __isCopyOperation = false;
770 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
774 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
780 FileListEditorForm::GetOverlayStatus(void) const
786 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
789 __pPresentationModel->SetUpdateProgressStatus(false);
790 if (res != COMPLETE_SUCCESS)
792 MessageBox messageBox;
793 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
796 messageBox.ShowAndWait(modalResult);
798 SceneManager* pSceneManager = SceneManager::GetInstance();
799 AppAssert(pSceneManager);
800 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
805 FileListEditorForm::OnContentUpdated()
807 AppLogDebug("ENTER");
809 SceneManager* pSceneManager = SceneManager::GetInstance();
811 if(__pDeletePopup != null)
813 if(__pDeletePopup->IsVisible() == true)
815 __pDeletePopup->Destroy();
816 __pDeletePopup = null;
822 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
824 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
825 if (pEditorPanel != null)
827 pEditorPanel->CancelUpdateProgress();
830 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
832 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
833 if (pSelectionPanel != null)
835 pSelectionPanel->CancelUpdateProgress();
839 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
840 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
842 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
843 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
846 else if (_overlayMsg == false)
848 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
849 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
852 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
856 FileListEditorForm::SetUpPopup(void)
858 AppLogDebug("ENTER");
859 result r = E_SUCCESS;
861 if (__pDeletePopup != null)
863 delete __pDeletePopup;
864 __pDeletePopup = null;
867 __pDeletePopup = new (std::nothrow) Popup();
868 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
870 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
872 Label* pLabelText = new (std::nothrow) Label();
873 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
874 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
875 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
876 pLabelText->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
877 __pDeletePopup->AddControl(pLabelText);
879 Button* pDeleteButton = new (std::nothrow) Button();
880 pDeleteButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
881 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
882 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
883 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
884 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
885 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
886 pDeleteButton->AddActionEventListener(*this);
887 __pDeletePopup->AddControl(pDeleteButton);
889 Button* pButtonCancel = new (std::nothrow) Button();
890 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
891 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
892 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
893 pButtonCancel->AddActionEventListener(*this);
894 __pDeletePopup->AddControl(pButtonCancel);
895 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
901 FileListEditorForm::SetTitleText(const String& titleText)
903 AppLogDebug("ENTER");
904 Header* pHeader = GetHeader();
905 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
906 pHeader->SetTitleText(titleText);
907 pHeader->Invalidate(true);
908 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
912 FileListEditorForm::RefreshFolderList(void)
914 AppLogDebug("ENTER");
915 ContentDirectory contentDirectory;
916 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
917 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
918 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
919 result r = contentDirectory.Construct(*pContentTypeList);
922 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
925 delete pContentTypeList;
927 if (__pContentDirectoryList != null)
929 delete __pContentDirectoryList;
931 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
932 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
933 String* pDirPath = null;
934 String* pDirName = null;
935 String mediaPath = RESERVED_MEDIA_PATH;
936 int length = mediaPath.GetLength();
937 mediaPath.Remove(length-1,1);
939 int loopCount = __pContentDirectoryList->GetCount();
940 for (int i = 0; i < loopCount; ++i)
942 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
943 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
945 if ( *pDirPath == mediaPath)
947 *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
948 __pContentDirectoryNameList->Add(pDirName);
952 __pContentDirectoryNameList->Add(pDirName);
956 __pOptionMenu->RemoveAllItems();
957 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
958 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
960 loopCount = __pContentDirectoryNameList->GetCount();
962 for (int i = 0; i < loopCount; ++i)
964 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
966 if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
968 __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
969 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
974 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
978 FileListEditorForm::OnFormBackRequested(Form& source)
980 AppLogDebug("ENTER");
982 SceneManager* pSceneManager = SceneManager::GetInstance();
983 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
985 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
987 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
989 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
991 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
993 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
998 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1000 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1002 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1004 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1006 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1008 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1010 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1012 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1014 __pShareContextMenu->SetShowState(false);
1018 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1019 (pSceneManager->GetCurrentScene()->GetPanel());
1020 if (pSelectionPanel != null)
1022 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1025 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1028 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1029 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
1037 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1040 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1044 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1046 AppLogDebug("ENTER");
1047 Footer* pFooter = GetFooter();
1048 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1050 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1052 if (enableState == true)
1054 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1055 pFooter->SetItemEnabled(0, true);
1059 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1060 pFooter->SetItemEnabled(0, false);
1065 if (enableState == true)
1067 pFooter->SetItemEnabled(0, true);
1068 pFooter->SetItemEnabled(1, true);
1072 pFooter->SetItemEnabled(0, false);
1073 pFooter->SetItemEnabled(1, false);
1076 pFooter->RequestRedraw(true);
1077 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1081 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1083 SceneManager* pSceneManager = SceneManager::GetInstance();
1084 pSceneManager->GetCurrentScene();
1086 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1088 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1089 if (pEditorPanel != null)
1091 pEditorPanel->ChangeOrientation();
1094 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1096 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1097 if (pEditorPanel != null)
1099 pEditorPanel->ChangeOrientation();
1102 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1104 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1105 if (pEditorPanel != null)
1107 pEditorPanel->ChangeOrientation();
1110 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1112 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1113 if (pEditorPanel != null)
1115 pEditorPanel->ChangeOrientation();
1122 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1124 AppLogDebug("ENTER");
1125 result r = E_FAILURE;
1126 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1127 if (albumName != EMPTY_SPACE)
1129 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1130 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1131 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1132 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1133 delete pDirectoryList;
1135 SceneManager* pSceneManager = SceneManager::GetInstance();
1136 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1139 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1145 FileListEditorForm::SelectAllPressed(void)
1147 SceneManager* pSceneManager = SceneManager::GetInstance();
1148 pSceneManager->GetCurrentScene();
1150 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1152 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1153 if (pEditorPanel != null)
1155 pEditorPanel->OnSelectAllPressed();
1158 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1160 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1161 if (pEditorPanel != null)
1163 pEditorPanel->OnSelectAllPressed();
1166 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1168 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1169 if (pEditorPanel != null)
1171 pEditorPanel->OnSelectAllPressed();
1174 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1176 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1177 if (pEditorPanel != null)
1179 pEditorPanel->OnSelectAllPressed();
1185 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1187 if (__pPopUp != NULL)
1189 __pPopUp->SetShowState(false);
1192 SceneManager* pSceneManager = SceneManager::GetInstance();
1196 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1198 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1199 if (pEditorPanel != null)
1201 pEditorPanel->OnRequestSlideShow();
1204 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1206 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1207 (pSceneManager->GetCurrentScene()->GetPanel());
1209 if (pSelectionPanel != null)
1211 pSelectionPanel->OnRequestSlideShow();
1215 else if (index == 1)
1217 SceneManager* pSceneManager = SceneManager::GetInstance();
1218 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1220 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1225 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1227 AppLogDebug("ENTER");
1228 __pPresentationModel->RemoveContentEventListener(this);
1229 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1233 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1235 AppLogDebug("ENTER");
1236 __pPresentationModel->AddContentEventListener(this);
1237 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1241 FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
1244 SceneManager* pSceneManager = SceneManager::GetInstance();
1245 int checkedCount = 0;
1247 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1249 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1250 if (pEditorPanel != null)
1252 checkedCount = pEditorPanel->GetItemCheckedCount();
1255 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1257 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1258 if (pSelectionPanel != null)
1260 checkedCount = pSelectionPanel->GetItemCheckedCount();
1264 if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
1266 __pShareContextMenu->SetShowState(false);
1269 if ( checkedCount > 0)
1271 if ( __pOptionMenu == null )
1276 __pOptionMenu->RemoveAllItems();
1277 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
1278 IDA_CONTEXT_MENU_MORE_MOVE);
1279 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
1280 IDA_CONTEXT_MENU_MORE_COPY);
1282 if (checkedCount > 1)
1284 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"),
1285 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
1288 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
1289 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
1291 __pOptionMenu->SetShowState(true);
1292 __pOptionMenu->Show();