2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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"
30 #include "GlVideoListEditorPanel.h"
31 #include "GlFileMoveTimer.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Content;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Ui;
40 using namespace Tizen::Ui::Controls;
41 using namespace Tizen::Ui::Scenes;
42 using namespace Tizen::Base::Utility;
44 static const int GAP_W_POPUP_ITEM = 5;
45 static const int W_DELETE_POPUP = 600;
46 static const int H_DELETE_POPUP = 300;
47 static const int H_DELETE_LABEL = 180;
48 static const int Y_DELETE_BUTTON = 180;
49 static const int H_DELETE_BUTTON = 80;
51 FileListEditorForm::FileListEditorForm(void)
52 : __pContextMenuMore(null)
53 , __pContextMenuShare(null)
54 , __pContextEditorMenuMove(null)
55 , __pContextSelectionMenuMove(null)
56 , __pDeletePopup(null)
57 , __morePosition(Point(0, 0))
58 , __pContentDirectoryList(null)
59 , __pContentDirectoryNameList(null)
60 , __pPresentationModel(null)
62 ,__moveInProgress(false)
65 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
68 FileListEditorForm::~FileListEditorForm(void)
71 if (__pContentDirectoryList != null)
73 delete __pContentDirectoryList;
75 if (__pContentDirectoryNameList != null)
77 delete __pContentDirectoryNameList;
80 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
84 FileListEditorForm::Initialize(void)
87 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
88 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
93 FileListEditorForm::OnInitializing(void)
96 Header* pHeader = GetHeader();
97 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
99 __pPresentationModel = FileListPresentationModel::GetInstance();
100 __pPresentationModel->ClearThumbnailRequests();
102 pHeader->SetStyle(HEADER_STYLE_TITLE);
103 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
104 pHeader->AddActionEventListener(*this);
107 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
113 FileListEditorForm::InitializeFooter(void)
115 AppLogDebug("ENTER");
116 Footer* pFooter = GetFooter();
117 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
118 pFooter->RemoveAllItems();
120 result r = E_SUCCESS;
122 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
124 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
126 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
128 FooterItem footerConfirm;
129 r = footerConfirm.Construct(ACTION_ID_FOOTER_CONFIRM);
130 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
131 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_POP_DONE"));
132 r = pFooter->AddItem(footerConfirm);
133 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
135 pFooter->SetBackButton();
136 SetFormBackEventListener(this);
140 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
141 pFooter->SetBackButton();
142 SetFormBackEventListener(this);
147 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
149 ButtonItem footerMore;
150 footerMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
151 Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE);
152 if (pBitmapMore != null)
154 footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore);
156 pFooter->SetButton(BUTTON_POSITION_LEFT,footerMore);
158 FooterItem footerShare;
159 r = footerShare.Construct(ACTION_ID_FOOTER_SHARE);
160 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
161 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
162 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
164 if (pBitmapShare != null && pBitmapShareDim != null )
166 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
167 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
170 r = pFooter->AddItem(footerShare);
172 delete pBitmapShareDim;
173 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
175 FooterItem footerDelete;
176 r = footerDelete.Construct(ACTION_ID_FOOTER_DELETE);
177 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
178 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
179 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
181 if (pBitmapDelete != null && pBitmapDeleteDim != null)
183 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
184 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
187 r = pFooter->AddItem(footerDelete);
188 delete pBitmapDelete;
189 delete pBitmapDeleteDim;
190 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
192 pFooter->SetBackButton();
193 SetFormBackEventListener(this);
195 SceneManager* pSceneManager = SceneManager::GetInstance();
196 int checkedCount = 0;
198 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
200 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
201 if (pEditorPanel != null)
203 checkedCount = pEditorPanel->GetItemCheckedCount();
206 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
208 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
209 if (pSelectionPanel != null)
211 checkedCount = pSelectionPanel->GetItemCheckedCount();
215 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
217 if(__pContextMenuMore != null)
219 delete __pContextMenuMore;
220 __pContextMenuMore = null;
223 __pContextMenuMore = new (std::nothrow) ContextMenu();
224 __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
226 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
227 ACTION_ID_CONTEXT_MENU_MORE_MOVE);
229 if (checkedCount > 1)
231 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_BUTTON_SLIDE_SHOW"),
232 ACTION_ID_CONTEXT_MENU_MORE_SLIDE_SHOW);
235 __pContextMenuMore->SetShowState(false);
236 __pContextMenuMore->AddActionEventListener(*this);
238 __pContextMenuShare = new (std::nothrow) ContextMenu();
239 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
240 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
241 ACTION_ID_CONTEXT_MENU_SHARE_MESSAGE);
242 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
243 ACTION_ID_CONTEXT_MENU_SHARE_EMAIL);
244 __pContextMenuShare->SetShowState(false);
245 __pContextMenuShare->AddActionEventListener(*this);
247 __pContextEditorMenuMove = new (std::nothrow) ContextMenu();
248 __pContextEditorMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
249 __pContextEditorMenuMove->AddActionEventListener(*this);
251 __pContextSelectionMenuMove = new (std::nothrow) ContextMenu();
252 __pContextSelectionMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
253 __pContextSelectionMenuMove->AddActionEventListener(*this);
255 if (__pContentDirectoryNameList != null)
257 delete __pContentDirectoryNameList;
258 __pContentDirectoryNameList = null;
264 pFooter->AddActionEventListener(*this);
265 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
271 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
273 AppLogDebug("ENTER");
274 if (fullPath == null)
276 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
280 String delim(DIRECTORY_SEPARATOR);
281 StringTokenizer st(fullPath,delim);
283 while (st.HasMoreTokens())
285 st.GetNextToken(token);
287 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
293 FileListEditorForm::OnTerminating(void)
295 AppLogDebug("ENTER");
297 if (__pContextMenuMore != null)
299 __pContextMenuMore->RemoveActionEventListener(*this);
300 delete __pContextMenuMore;
301 __pContextMenuMore = null;
304 if (__pContextMenuShare != null)
306 __pContextMenuShare->RemoveActionEventListener(*this);
307 delete __pContextMenuShare;
308 __pContextMenuShare = null;
311 if (__pContextEditorMenuMove != null)
313 __pContextEditorMenuMove->RemoveActionEventListener(*this);
314 delete __pContextEditorMenuMove;
315 __pContextEditorMenuMove = null;
318 if (__pContextSelectionMenuMove != null)
320 __pContextSelectionMenuMove->RemoveActionEventListener(*this);
321 delete __pContextSelectionMenuMove;
322 __pContextSelectionMenuMove = null;
325 if (__pDeletePopup != null)
327 delete __pDeletePopup;
328 __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 ACTION_ID_FOOTER_MORE:
349 if (__pContextMenuMore->GetShowState() == false)
351 Rectangle rect = source.GetBounds();
352 __morePosition = Point(rect.width/8,rect.y);
353 __pContextMenuMore->SetAnchorPosition(Point(rect.width/8,rect.y));
354 __pContextMenuMore->SetShowState(true);
355 __pContextMenuMore->Show();
359 __pContextMenuMore->SetShowState(false);
363 case ACTION_ID_FOOTER_SHARE:
365 if (__pContextMenuShare->GetShowState() == false)
367 Rectangle rect = source.GetBounds();
368 __pContextMenuShare->SetAnchorPosition(Point(rect.width/8*3 ,rect.y));
369 __pContextMenuShare->SetShowState(true);
370 __pContextMenuShare->Show();
374 __pContextMenuShare->SetShowState(false);
378 case ACTION_ID_FOOTER_DELETE:
380 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
382 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
383 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
385 __pDeletePopup->SetShowState(true);
386 __pDeletePopup->Show();
389 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
391 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
392 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
394 __pDeletePopup->SetShowState(true);
395 __pDeletePopup->Show();
398 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
400 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
401 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
403 __pDeletePopup->SetShowState(true);
404 __pDeletePopup->Show();
407 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
409 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
410 (pSceneManager->GetCurrentScene()->GetPanel());
411 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
413 __pDeletePopup->SetShowState(true);
414 __pDeletePopup->Show();
419 case ACTION_ID_CONTEXT_MENU_MORE_EDIT:
423 case ACTION_ID_CONTEXT_MENU_MORE_ADD_TAG:
427 case ACTION_ID_CONTEXT_MENU_MORE_MOVE:
430 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
432 if (__pContextEditorMenuMove->GetShowState() == false)
434 __pContextEditorMenuMove->SetAnchorPosition(__morePosition);
435 __pContextEditorMenuMove->SetShowState(true);
436 __pContextEditorMenuMove->Show();
440 __pContextEditorMenuMove->SetShowState(false);
443 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
445 if (__pContextSelectionMenuMove->GetShowState() == false)
447 __pContextSelectionMenuMove->SetAnchorPosition(__morePosition);
448 __pContextSelectionMenuMove->SetShowState(true);
449 __pContextSelectionMenuMove->Show();
453 __pContextSelectionMenuMove->SetShowState(false);
459 case ACTION_ID_CONTEXT_MENU_MORE_SLIDE_SHOW:
461 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
463 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
464 if (pEditorPanel != null)
466 pEditorPanel->OnRequestSlideShow();
469 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
471 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
472 if (pSelectionPanel != null)
474 pSelectionPanel->OnRequestSlideShow();
480 case ACTION_ID_CONTEXT_MENU_SHARE_MESSAGE:
482 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
484 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
485 if (pEditorPanel != null)
487 pEditorPanel->OnRequestMessage();
490 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
492 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
493 if (pEditorPanel != null)
495 pEditorPanel->OnRequestMessage();
498 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
500 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
501 if (pEditorPanel != null)
503 pEditorPanel->OnRequestMessage();
507 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
509 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
510 if (pSelectionPanel != null)
512 pSelectionPanel->OnRequestMessage();
517 case ACTION_ID_CONTEXT_MENU_SHARE_EMAIL:
519 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
521 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
522 if (pEditorPanel != null)
524 pEditorPanel->OnRequestEmail();
527 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
529 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
530 if (pEditorPanel != null)
532 pEditorPanel->OnRequestEmail();
535 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
537 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
538 if (pEditorPanel != null)
540 pEditorPanel->OnRequestEmail();
544 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
546 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
547 if (pSelectionPanel != null)
549 pSelectionPanel->OnRequestEmail();
554 case ACTION_ID_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
556 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
558 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
559 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
561 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
565 case ACTION_ID_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM:
567 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
569 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
570 (pSceneManager->GetCurrentScene()->GetPanel());
571 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
572 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
576 case ACTION_ID_DELETE_POPUP_DEL:
578 __pDeletePopup->SetShowState(false);
579 __pDeletePopup->Invalidate(true);
581 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
583 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
584 if (pEditorPanel != null)
586 result r = pEditorPanel->OnRequestDelete();
589 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
593 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
595 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
596 if (pEditorPanel != null)
598 pEditorPanel->OnRequestDelete();
601 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
603 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>
604 (pSceneManager->GetCurrentScene()->GetPanel());
606 if (pEditorPanel != null)
608 pEditorPanel->OnRequestDelete();
611 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
613 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
614 (pSceneManager->GetCurrentScene()->GetPanel());
616 if (pSelectionPanel != null)
618 result r = pSelectionPanel->OnRequestDelete();
621 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
628 case ACTION_ID_DELETE_POPUP_CANCEL:
630 __pDeletePopup->SetShowState(false);
631 __pDeletePopup->Invalidate(true);
634 case ACTION_ID_FOOTER_CONFIRM:
636 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
638 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
639 if (pEditorPanel != null)
641 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
644 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
646 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
647 if (pEditorPanel != null)
649 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
656 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
658 if ((ACTION_ID_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
659 (actionId <= ACTION_ID_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
661 if (__pContentDirectoryList == null)
666 if (__pContentDirectoryList->GetCount() > actionId - ACTION_ID_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
668 String* pDirectory = static_cast<String*>
669 (__pContentDirectoryList->GetAt(actionId - ACTION_ID_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
671 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
672 (pSceneManager->GetCurrentScene()->GetPanel());
674 if (pEditorPanel != null)
677 __pFileMove = new FileMoveTimer(*pDirectory, pEditorPanel->GetItemCheckedIndexListN(),
678 __pPresentationModel, this );
679 result r = __pFileMove->StartTimer();
686 __moveInProgress = true;
692 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
694 if ((ACTION_ID_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) &&
695 (actionId <= ACTION_ID_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM + 1000))
697 if (__pContentDirectoryList == null)
702 if (__pContentDirectoryList->GetCount() > actionId - ACTION_ID_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START)
704 String* pDirectory = static_cast<String*>
705 (__pContentDirectoryList->GetAt(actionId - ACTION_ID_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START));
707 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
708 (pSceneManager->GetCurrentScene()->GetPanel());
710 if (pSelectionPanel != null)
713 __pFileMove = new FileMoveTimer(*pDirectory, pSelectionPanel->GetItemCheckedIndexListN(),
714 __pPresentationModel, this );
715 result r = __pFileMove->StartTimer();
723 __moveInProgress = true;
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
736 void FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
741 bool FileListEditorForm::GetFileMoveProgress()
743 return __moveInProgress;
746 void FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, result res)
748 __moveInProgress = false;
752 FileListEditorForm::OnUpdateContentList()
754 AppLogDebug("ENTER");
755 SceneManager* pSceneManager = SceneManager::GetInstance();
756 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
757 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
761 FileListEditorForm::SetUpPopup(void)
763 AppLogDebug("ENTER");
764 result r = E_SUCCESS;
766 if (__pDeletePopup != null)
768 delete __pDeletePopup;
769 __pDeletePopup = null;
772 __pDeletePopup = new (std::nothrow) Popup();
773 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
775 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
777 Label* pLabelText = new (std::nothrow) Label();
778 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
779 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
780 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
781 __pDeletePopup->AddControl(*pLabelText);
783 Button* pButtonDel = new (std::nothrow) Button();
784 pButtonDel->Construct(Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
785 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
786 pButtonDel->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
787 pButtonDel->AddActionEventListener(*this);
788 __pDeletePopup->AddControl(*pButtonDel);
790 Button* pButtonCancel = new (std::nothrow) Button();
791 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
792 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
793 pButtonCancel->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
794 pButtonCancel->AddActionEventListener(*this);
795 __pDeletePopup->AddControl(*pButtonCancel);
796 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
802 FileListEditorForm::SetTitleText(const String& titleText)
804 AppLogDebug("ENTER");
805 Header* pHeader = GetHeader();
806 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
807 pHeader->SetTitleText(titleText);
808 pHeader->Invalidate(true);
809 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
813 FileListEditorForm::RefreshFolderList(void)
815 AppLogDebug("ENTER");
816 ContentDirectory contentDirectory;
817 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
818 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
819 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
820 contentDirectory.Construct(*pContentTypeList);
821 delete pContentTypeList;
822 pContentTypeList = null;
824 if (__pContentDirectoryList != null)
826 delete __pContentDirectoryList;
827 __pContentDirectoryList = null;
829 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
830 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
831 String* pDirPath = null;
832 String* pDirName = null;
834 int loopCount = __pContentDirectoryList->GetCount();
835 for (int i = 0; i < loopCount; ++i)
837 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
838 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
839 __pContentDirectoryNameList->Add(pDirName);
841 __pContextEditorMenuMove->RemoveAllItems();
842 __pContextEditorMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
843 ACTION_ID_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
844 __pContextSelectionMenuMove->RemoveAllItems();
845 __pContextSelectionMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
846 ACTION_ID_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM);
848 loopCount = __pContentDirectoryNameList->GetCount();
849 for (int i = 0; i < loopCount; ++i)
851 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
852 __pContextEditorMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
853 ACTION_ID_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
854 __pContextSelectionMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
855 ACTION_ID_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START + i);
857 __pContextEditorMenuMove->SetShowState(false);
858 __pContextSelectionMenuMove->SetShowState(false);
859 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
863 FileListEditorForm::OnFormBackRequested(Form& source)
865 AppLogDebug("ENTER");
867 SceneManager* pSceneManager = SceneManager::GetInstance();
868 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
870 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
872 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
874 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
876 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
878 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
883 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
885 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
887 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
889 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
891 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
893 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
895 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
897 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
898 (pSceneManager->GetCurrentScene()->GetPanel());
899 if (pSelectionPanel != null)
901 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
904 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
907 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST_EDITOR), pList);
912 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
915 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
919 FileListEditorForm::SetFooterButtonsState(bool enableState)
921 AppLogDebug("ENTER");
922 Footer* pFooter = GetFooter();
923 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
925 if (enableState == true)
927 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
928 pFooter->SetItemEnabled(0, true);
929 pFooter->SetItemEnabled(1, true);
933 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
934 pFooter->SetItemEnabled(0, false);
935 pFooter->SetItemEnabled(1, false);
938 pFooter->RequestRedraw(true);
939 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
943 FileListEditorForm::MoveToAlbum(String& destDirectory)
945 AppLogDebug("ENTER");
946 result r = E_FAILURE;
947 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
948 if (albumName != EMPTY_SPACE)
950 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
951 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
952 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
953 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
954 delete pDirectoryList;
956 SceneManager* pSceneManager = SceneManager::GetInstance();
957 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
960 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));