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"
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::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43 using namespace Tizen::Base::Utility;
45 static const int GAP_W_POPUP_ITEM = 5;
46 static const int W_DELETE_POPUP = 600;
47 static const int H_DELETE_POPUP = 300;
48 static const int H_DELETE_LABEL = 180;
49 static const int Y_DELETE_BUTTON = 180;
50 static const int H_DELETE_BUTTON = 80;
51 static const int H_TOAST_LABEL = 48;
53 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
54 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
55 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
57 FileListEditorForm::FileListEditorForm(void)
58 : __pContextMenuMore(null)
59 , __pContextMenuShare(null)
60 , __pContextEditorMenuMove(null)
61 , __pContextSelectionMenuMove(null)
62 , __pDeletePopup(null)
63 , __morePosition(Point(0, 0))
64 , __pContentDirectoryList(null)
65 , __pContentDirectoryNameList(null)
68 , __isCopyOperation(false)
69 , __pPresentationModel(null)
73 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
76 FileListEditorForm::~FileListEditorForm(void)
79 if (__pContentDirectoryList != null)
81 delete __pContentDirectoryList;
84 if (__pContentDirectoryNameList != null)
86 delete __pContentDirectoryNameList;
89 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
93 FileListEditorForm::Initialize(void)
96 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
97 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
103 FileListEditorForm::OnInitializing(void)
105 AppLogDebug("ENTER");
106 Header* pHeader = GetHeader();
107 TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
109 __pPopUp = new (std::nothrow) SlideShowPopUp();
111 if (__pPopUp != null)
113 __pPopUp->Initialize();
114 __pPopUp->SetEventListner(this);
115 AddControl(*__pPopUp);
118 __pPresentationModel = FileListPresentationModel::GetInstance();
119 __pPresentationModel->ClearThumbnailRequests();
121 pHeader->SetStyle(HEADER_STYLE_TITLE);
122 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
124 if ((__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
125 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE) == false)
127 Bitmap* pNormalBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
128 Bitmap* pPressBitmap = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
129 ButtonItem selectAll;
130 selectAll.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FILE_LIST_SELECT_ALL);
131 selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pNormalBitmap);
132 selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pPressBitmap);
133 pHeader->SetButton(BUTTON_POSITION_LEFT, selectAll);
134 delete pNormalBitmap;
138 pHeader->AddActionEventListener(*this);
141 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
147 FileListEditorForm::InitializeFooter(void)
149 AppLogDebug("ENTER");
150 Footer* pFooter = GetFooter();
151 TryReturn(pFooter != null, E_FAILURE, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
152 pFooter->RemoveAllItems();
154 result r = E_SUCCESS;
156 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
158 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
160 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
162 FooterItem footerConfirm;
163 footerConfirm.Construct(IDA_FOOTER_CONFIRM);
164 footerConfirm.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
165 pFooter->AddItem(footerConfirm);
166 pFooter->SetItemEnabled(0, false);
170 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
172 pFooter->SetBackButton();
173 SetFormBackEventListener(this);
177 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
179 ButtonItem footerMore;
180 footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE);
181 Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE);
182 Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED);
184 if (pBitmapMore != null && pBitmapMoreDim != NULL)
186 footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore);
187 footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim);
189 pFooter->SetButton(BUTTON_POSITION_LEFT,footerMore);
192 delete pBitmapMoreDim;
194 FooterItem footerShare;
195 r = footerShare.Construct(IDA_FOOTER_SHARE);
196 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
197 Bitmap* pBitmapShare = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
198 Bitmap* pBitmapShareDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
200 if (pBitmapShare != null && pBitmapShareDim != null)
202 footerShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapShare);
203 footerShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapShareDim);
206 r = pFooter->AddItem(footerShare);
208 delete pBitmapShareDim;
209 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
211 FooterItem footerDelete;
212 r = footerDelete.Construct(IDA_FOOTER_DELETE);
213 TryReturn(r == E_SUCCESS, r, "[%s] Unable to construct footer item", GetErrorMessage(r));
214 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
215 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
217 if (pBitmapDelete != null && pBitmapDeleteDim != null)
219 footerDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
220 footerDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
223 r = pFooter->AddItem(footerDelete);
224 delete pBitmapDelete;
225 delete pBitmapDeleteDim;
226 TryReturn(r == E_SUCCESS, r, "[%s] Unable to add item", GetErrorMessage(r));
228 pFooter->SetBackButton();
229 SetFormBackEventListener(this);
231 SceneManager* pSceneManager = SceneManager::GetInstance();
232 int checkedCount = 0;
234 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
236 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
237 if (pEditorPanel != null)
239 checkedCount = pEditorPanel->GetItemCheckedCount();
242 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
244 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
245 if (pSelectionPanel != null)
247 checkedCount = pSelectionPanel->GetItemCheckedCount();
251 AppLogDebug("GetItemCheckedCount(%d)", checkedCount);
253 if (__pContextMenuMore != null)
255 delete __pContextMenuMore;
256 __pContextMenuMore = null;
259 __pContextMenuMore = new (std::nothrow) ContextMenu();
260 __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
262 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"),
263 IDA_CONTEXT_MENU_MORE_MOVE);
264 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"),
265 IDA_CONTEXT_MENU_MORE_COPY);
267 if (checkedCount > 1)
269 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_BUTTON_SLIDE_SHOW"),
270 IDA_CONTEXT_MENU_MORE_SLIDE_SHOW);
273 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT);
274 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT);
276 __pContextMenuMore->SetShowState(false);
277 __pContextMenuMore->AddActionEventListener(*this);
279 __pContextMenuShare = new (std::nothrow) ContextMenu();
280 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
281 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
282 IDA_CONTEXT_MENU_SHARE_MESSAGE);
283 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
284 IDA_CONTEXT_MENU_SHARE_EMAIL);
285 __pContextMenuShare->SetShowState(false);
286 __pContextMenuShare->AddActionEventListener(*this);
288 __pContextEditorMenuMove = new (std::nothrow) ContextMenu();
289 __pContextEditorMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
290 __pContextEditorMenuMove->AddActionEventListener(*this);
292 __pContextSelectionMenuMove = new (std::nothrow) ContextMenu();
293 __pContextSelectionMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
294 __pContextSelectionMenuMove->AddActionEventListener(*this);
296 if (__pContentDirectoryNameList != null)
298 delete __pContentDirectoryNameList;
299 __pContentDirectoryNameList = null;
305 pFooter->AddActionEventListener(*this);
306 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
312 FileListEditorForm::GetDirecotyNameFromFullPath(const String& fullPath)const
314 AppLogDebug("ENTER");
315 if (fullPath == null)
317 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
321 String delim(DIRECTORY_SEPARATOR);
322 StringTokenizer st(fullPath,delim);
324 while (st.HasMoreTokens())
326 st.GetNextToken(token);
328 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
334 FileListEditorForm::OnTerminating(void)
336 AppLogDebug("ENTER");
338 if (__pContextMenuMore != null)
340 __pContextMenuMore->RemoveActionEventListener(*this);
341 delete __pContextMenuMore;
342 __pContextMenuMore = null;
345 if (__pContextMenuShare != null)
347 __pContextMenuShare->RemoveActionEventListener(*this);
348 delete __pContextMenuShare;
349 __pContextMenuShare = null;
352 if (__pContextEditorMenuMove != null)
354 __pContextEditorMenuMove->RemoveActionEventListener(*this);
355 delete __pContextEditorMenuMove;
356 __pContextEditorMenuMove = null;
359 if (__pContextSelectionMenuMove != null)
361 __pContextSelectionMenuMove->RemoveActionEventListener(*this);
362 delete __pContextSelectionMenuMove;
363 __pContextSelectionMenuMove = null;
366 if (__pDeletePopup != null)
368 delete __pDeletePopup;
369 __pDeletePopup = null;
372 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
378 FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
380 AppLogDebug("ENTER(actionId=%d)", actionId);
381 SceneManager* pSceneManager = SceneManager::GetInstance();
382 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
386 case IDA_FILE_LIST_SELECT_ALL:
390 case IDA_FOOTER_MORE:
394 if (__pContextMenuMore->GetShowState() == false)
396 Rectangle rect = source.GetBounds();
397 __morePosition = Point(rect.width / 8, rect.y);
398 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
400 __pContextMenuMore->SetAnchorPosition(Point(rect.width / 10, rect.y));
404 __pContextMenuMore->SetAnchorPosition(Point(rect.width / 10, rect.y - H_TOAST_LABEL));
406 __pContextMenuMore->SetShowState(true);
407 __pContextMenuMore->Show();
411 __pContextMenuMore->SetShowState(false);
416 case IDA_FOOTER_SHARE:
418 if (__pContextMenuShare->GetShowState() == false)
420 Rectangle rect = source.GetBounds();
421 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
423 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y));
427 __pContextMenuShare->SetAnchorPosition(Point(rect.width / 8 * 3, rect.y - H_TOAST_LABEL));
429 __pContextMenuShare->SetShowState(true);
430 __pContextMenuShare->Show();
434 __pContextMenuShare->SetShowState(false);
439 case IDA_FOOTER_DELETE:
441 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
443 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
444 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
446 __pDeletePopup->SetShowState(true);
447 __pDeletePopup->Show();
451 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
453 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
454 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
456 __pDeletePopup->SetShowState(true);
457 __pDeletePopup->Show();
461 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
463 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
464 if (pEditorPanel != null && pEditorPanel->GetItemCheckedCount() > 0)
466 __pDeletePopup->SetShowState(true);
467 __pDeletePopup->Show();
471 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
473 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
474 (pSceneManager->GetCurrentScene()->GetPanel());
475 if (pSelectionPanel != null && pSelectionPanel->GetItemCheckedCount() > 0)
477 __pDeletePopup->SetShowState(true);
478 __pDeletePopup->Show();
485 case IDA_CONTEXT_MENU_MORE_EDIT:
490 case IDA_CONTEXT_MENU_MORE_ADD_TAG:
495 case IDA_CONTEXT_MENU_MORE_COPY:
497 case IDA_CONTEXT_MENU_MORE_MOVE:
499 if (actionId == IDA_CONTEXT_MENU_MORE_MOVE)
501 __isCopyOperation = false;
503 else if (actionId == IDA_CONTEXT_MENU_MORE_COPY)
505 __isCopyOperation = true;
508 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
510 if (__pContextEditorMenuMove->GetShowState() == false)
512 __pContextEditorMenuMove->SetAnchorPosition(__morePosition);
513 __pContextEditorMenuMove->SetShowState(true);
514 __pContextEditorMenuMove->Show();
518 __pContextEditorMenuMove->SetShowState(false);
521 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
523 if (__pContextSelectionMenuMove->GetShowState() == false)
525 __pContextSelectionMenuMove->SetAnchorPosition(__morePosition);
526 __pContextSelectionMenuMove->SetShowState(true);
527 __pContextSelectionMenuMove->Show();
531 __pContextSelectionMenuMove->SetShowState(false);
537 case IDA_CONTEXT_MENU_MORE_SLIDE_SHOW:
539 if (__pPopUp != null)
541 __pPopUp->SetShowState(true);
547 case IDA_CONTEXT_MENU_SHARE_MESSAGE:
549 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
551 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
552 if (pEditorPanel != null)
554 pEditorPanel->OnRequestMessage();
557 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
559 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
560 if (pSelectionPanel != null)
562 pSelectionPanel->OnRequestMessage();
568 case IDA_CONTEXT_MENU_SHARE_EMAIL:
570 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
572 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
573 if (pEditorPanel != null)
575 pEditorPanel->OnRequestEmail();
578 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
580 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
581 if (pSelectionPanel != null)
583 pSelectionPanel->OnRequestEmail();
589 case IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM:
591 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
593 AllListEditorPanel* pListEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
594 if (pListEditorPanel)
596 IList* pList = pListEditorPanel->GetItemCheckedIndexListN();
597 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
598 if (__isCopyOperation)
600 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
604 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
606 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
613 case IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM:
615 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
617 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
618 (pSceneManager->GetCurrentScene()->GetPanel());
619 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
620 pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT);
621 if (__isCopyOperation)
623 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT);
627 pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT);
629 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList);
634 case IDA_DELETE_POPUP_DEL:
637 __pDeletePopup->SetShowState(false);
638 __pDeletePopup->Invalidate(true);
640 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
642 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
643 if (pEditorPanel != null)
645 result r = pEditorPanel->OnRequestDelete();
648 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
652 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
654 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
655 (pSceneManager->GetCurrentScene()->GetPanel());
657 if (pSelectionPanel != null)
659 result r = pSelectionPanel->OnRequestDelete();
662 AppLogDebug("OnRequestDelete failed with %s", GetErrorMessage(r));
669 case IDA_DELETE_POPUP_CANCEL:
672 __pDeletePopup->SetShowState(false);
673 __pDeletePopup->Invalidate(true);
677 case IDA_CONTEXT_MENU_ROTATE_LEFT:
679 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
681 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
682 if (pEditorPanel != null)
684 RotateMode rotateMode = ROTATE_MODE_LEFT;
685 pEditorPanel->OnRequestRotate(rotateMode);
688 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
690 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
691 (pSceneManager->GetCurrentScene()->GetPanel());
693 if (pSelectionPanel != null)
695 RotateMode rotateMode = ROTATE_MODE_LEFT;
696 pSelectionPanel->OnRotateRequested(rotateMode);
702 case IDA_CONTEXT_MENU_ROTATE_RIGHT:
704 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
706 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
707 if (pEditorPanel != null)
709 RotateMode rotateMode = ROTATE_MODE_RIGHT;
710 pEditorPanel->OnRequestRotate(rotateMode);
713 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
716 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
717 (pSceneManager->GetCurrentScene()->GetPanel());
719 if (pSelectionPanel != null)
721 RotateMode rotateMode = ROTATE_MODE_RIGHT;
722 pSelectionPanel->OnRotateRequested(rotateMode);
728 case IDA_FOOTER_CONFIRM:
730 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
732 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
733 if (pEditorPanel != null)
735 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
738 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
740 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
741 if (pEditorPanel != null)
743 pEditorPanel->OnRequestAppExitWithMultipleSelectionAppControlResult();
751 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
753 if ((IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START <= actionId) &&
754 (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000))
756 if (__pContentDirectoryList == null)
760 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START)
762 String* pDirectory = static_cast<String*>
763 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START));
765 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>
766 (pSceneManager->GetCurrentScene()->GetPanel());
768 if (pEditorPanel != null)
771 IList* pItemIndexList = pEditorPanel->GetItemCheckedIndexListN();
772 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
773 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
774 if (__isCopyOperation)
776 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
777 __pFileMove->SetCopy();
780 result r = __pFileMove->StartTimer();
785 __isCopyOperation = false;
795 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
797 if ((IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) &&
798 (actionId <= IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM + 1000))
800 if (__pContentDirectoryList == null)
805 if (__pContentDirectoryList->GetCount() > actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START)
807 String* pDirectory = static_cast<String*>
808 (__pContentDirectoryList->GetAt(actionId - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START));
810 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
811 (pSceneManager->GetCurrentScene()->GetPanel());
813 if (pSelectionPanel != null)
816 IList* pItemIndexList = pSelectionPanel->GetItemCheckedIndexListN();
817 GetMoveFileIndexList(*pDirectory, pItemIndexList, __pPresentationModel);
818 __pFileMove = new (std::nothrow) FileMoveTimer(*pDirectory, pItemIndexList, __pPresentationModel, this);
819 if (__isCopyOperation)
821 AppLogDebug("Rash: Setting to Copy in FileListEditorForm");
822 __pFileMove->SetCopy();
824 result r = __pFileMove->StartTimer();
829 __isCopyOperation = false;
842 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
846 FileListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
852 FileListEditorForm::GetOverlayStatus(void) const
858 FileListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
861 __pPresentationModel->SetUpdateProgressStatus(false);
862 if (res != COMPLETE_SUCCESS)
864 MessageBox messageBox;
865 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_BODY_OPERATION_FAILED"), MSGBOX_STYLE_OK, 3000);
868 messageBox.ShowAndWait(modalResult);
870 SceneManager* pSceneManager = SceneManager::GetInstance();
871 AppAssert(pSceneManager);
872 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
877 FileListEditorForm::OnContentUpdated()
879 AppLogDebug("ENTER");
881 SceneManager* pSceneManager = SceneManager::GetInstance();
883 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
884 && pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
886 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
889 else if (_overlayMsg == false)
891 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
894 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
898 FileListEditorForm::SetUpPopup(void)
900 AppLogDebug("ENTER");
901 result r = E_SUCCESS;
903 if (__pDeletePopup != null)
905 delete __pDeletePopup;
906 __pDeletePopup = null;
909 __pDeletePopup = new (std::nothrow) Popup();
910 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
912 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
914 Label* pLabelText = new (std::nothrow) Label();
915 pLabelText->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
916 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
917 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
918 __pDeletePopup->AddControl(*pLabelText);
920 Button* pDeleteButton = new (std::nothrow) Button();
921 pDeleteButton->Construct(Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
922 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
923 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
924 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
925 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
926 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
927 pDeleteButton->AddActionEventListener(*this);
928 __pDeletePopup->AddControl(*pDeleteButton);
930 Button* pButtonCancel = new (std::nothrow) Button();
931 pButtonCancel->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
932 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
933 pButtonCancel->SetActionId(IDA_DELETE_POPUP_CANCEL);
934 pButtonCancel->AddActionEventListener(*this);
935 __pDeletePopup->AddControl(*pButtonCancel);
936 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
942 FileListEditorForm::SetTitleText(const String& titleText)
944 AppLogDebug("ENTER");
945 Header* pHeader = GetHeader();
946 TryReturnVoid(pHeader != null, "[%s] fail to get the header.", GetErrorMessage(GetLastResult()));
947 pHeader->SetTitleText(titleText);
948 pHeader->Invalidate(true);
949 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
953 FileListEditorForm::RefreshFolderList(void)
955 AppLogDebug("ENTER");
956 ContentDirectory contentDirectory;
957 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
958 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
959 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
960 result r = contentDirectory.Construct(*pContentTypeList);
963 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
966 delete pContentTypeList;
968 if (__pContentDirectoryList != null)
970 delete __pContentDirectoryList;
972 __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
973 __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
974 String* pDirPath = null;
975 String* pDirName = null;
977 int loopCount = __pContentDirectoryList->GetCount();
978 for (int i = 0; i < loopCount; ++i)
980 pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
981 pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
982 __pContentDirectoryNameList->Add(pDirName);
984 __pContextEditorMenuMove->RemoveAllItems();
985 __pContextEditorMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
986 IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM);
987 __pContextSelectionMenuMove->RemoveAllItems();
988 __pContextSelectionMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"),
989 IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM);
991 loopCount = __pContentDirectoryNameList->GetCount();
992 for (int i = 0; i < loopCount; ++i)
994 pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
995 __pContextEditorMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
996 IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
997 __pContextSelectionMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)),
998 IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START + i);
1000 __pContextEditorMenuMove->SetShowState(false);
1001 __pContextSelectionMenuMove->SetShowState(false);
1002 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1006 FileListEditorForm::OnFormBackRequested(Form& source)
1008 AppLogDebug("ENTER");
1010 SceneManager* pSceneManager = SceneManager::GetInstance();
1011 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
1013 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1015 if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1017 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1019 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1021 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
1026 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1028 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1030 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1032 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_IMAGE_LIST));
1034 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1036 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_VIDEO_LIST));
1038 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1040 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1041 (pSceneManager->GetCurrentScene()->GetPanel());
1042 if (pSelectionPanel != null)
1044 IList* pList = pSelectionPanel->GetItemCheckedIndexListN();
1047 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1050 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST_EDITOR), pList);
1055 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALL_LIST));
1058 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1062 FileListEditorForm::SetFooterButtonsState(const bool enableState)
1064 AppLogDebug("ENTER");
1065 Footer* pFooter = GetFooter();
1066 TryReturnVoid(pFooter != null, "[%s] fail to get the footer.", GetErrorMessage(GetLastResult()));
1068 if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
1070 if (enableState == true)
1072 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1073 pFooter->SetItemEnabled(0, true);
1077 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1078 pFooter->SetItemEnabled(0, false);
1084 if (enableState == true)
1086 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1087 pFooter->SetItemEnabled(0, true);
1088 pFooter->SetItemEnabled(1, true);
1092 pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1093 pFooter->SetItemEnabled(0, false);
1094 pFooter->SetItemEnabled(1, false);
1097 pFooter->RequestRedraw(true);
1098 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1102 FileListEditorForm::MoveToAlbum(const String& destDirectory)
1104 AppLogDebug("ENTER");
1105 result r = E_FAILURE;
1106 String albumName = __pPresentationModel->ConvertToAlbumName(destDirectory);
1107 if (albumName != EMPTY_SPACE)
1109 IList* pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1110 pDirectoryList->Add(new (std::nothrow) String(destDirectory));
1111 __pPresentationModel->SetCurrentAlbumInfo(albumName, *pDirectoryList);
1112 __pPresentationModel->SetCurrentAlbumContentType(CONTENT_TYPE_ALL);
1113 delete pDirectoryList;
1115 SceneManager* pSceneManager = SceneManager::GetInstance();
1116 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
1119 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1125 FileListEditorForm::SelectAllPressed(void)
1127 SceneManager* pSceneManager = SceneManager::GetInstance();
1128 pSceneManager->GetCurrentScene();
1130 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1132 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1133 if (pEditorPanel != null)
1135 pEditorPanel->OnSelectAllPressed();
1138 else if (pSceneManager->GetCurrentSceneId() == IDSCN_IMAGE_LIST_EDITOR)
1140 ImageListEditorPanel* pEditorPanel = dynamic_cast<ImageListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1141 if (pEditorPanel != null)
1143 pEditorPanel->OnSelectAllPressed();
1146 else if (pSceneManager->GetCurrentSceneId() == IDSCN_VIDEO_LIST_EDITOR)
1148 VideoListEditorPanel* pEditorPanel = dynamic_cast<VideoListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1149 if (pEditorPanel != null)
1151 pEditorPanel->OnSelectAllPressed();
1154 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1156 AllListSelectionPanel* pEditorPanel = dynamic_cast<AllListSelectionPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1157 if (pEditorPanel != null)
1159 pEditorPanel->OnSelectAllPressed();
1165 FileListEditorForm::OnSlideSettingPopUpItemSelected(int index)
1167 if (__pPopUp != NULL)
1169 __pPopUp->SetShowState(false);
1172 SceneManager* pSceneManager = SceneManager::GetInstance();
1176 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
1178 AllListEditorPanel* pEditorPanel = dynamic_cast<AllListEditorPanel*>(pSceneManager->GetCurrentScene()->GetPanel());
1179 if (pEditorPanel != null)
1181 pEditorPanel->OnRequestSlideShow();
1184 else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
1186 AllListSelectionPanel* pSelectionPanel = dynamic_cast<AllListSelectionPanel*>
1187 (pSceneManager->GetCurrentScene()->GetPanel());
1189 if (pSelectionPanel != null)
1191 pSelectionPanel->OnRequestSlideShow();
1195 else if (index == 1)
1197 SceneManager* pSceneManager = SceneManager::GetInstance();
1198 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
1200 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN));
1205 FileListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1207 AppLogDebug("ENTER");
1208 __pPresentationModel->RemoveContentEventListener(this);
1209 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1213 FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1215 AppLogDebug("ENTER");
1216 __pPresentationModel->AddContentEventListener(this);
1217 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));