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: MfSubBaseMoveCopy.cpp
19 * @brief: This file contains the implementation of SubBaseMoveCopy class, which acts as a base view for TopMostMoveCopy
20 * and SubMoveCopy forms.
23 #include "MfSubBaseMoveCopy.h"
25 using namespace Tizen::App;
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28 using namespace Tizen::Base::Utility;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Io;
31 using namespace Tizen::Media;
32 using namespace Tizen::Locales;
33 using namespace Tizen::System;
34 using namespace Tizen::Ui;
35 using namespace Tizen::Ui::Controls;
36 using namespace Tizen::Ui::Scenes;
38 Integer SubBaseMoveCopy::sourceFormOption;
40 SubBaseMoveCopy::SubBaseMoveCopy(void)
42 , _pCopyCancelButton(null)
43 , _pCopyRenameButton(null)
44 , _pCopyReplaceButton(null)
45 , _pFileProgressingCancelButton(null)
46 , _pMoreContextMenu(null)
51 , _pIconListView(null)
52 , _pDisplayPathLabel(null)
53 , _pFileProgressingHeaderLabel(null)
54 , _pFileProgressingLabel(null)
56 , _pFileExistingPopup(null)
57 , _pFileProgressingPopup(null)
58 , _pFileProgressingProgress(null)
59 , _pBaseItemProvider(null)
61 , _pFolderEntryPM(null)
62 , _pMediaMetaData(null)
63 , _pThumbnailItemProvider(null)
64 , _pThumbnailManager(null)
66 _fileManagedCount = 0;
67 _moveCopySource = MOVE_COPY_SOURCE_NONE;
71 SubBaseMoveCopy::~SubBaseMoveCopy(void)
73 if (_pFileExistingPopup != null)
75 delete _pFileExistingPopup;
78 if (_pFileProgressingPopup != null)
80 delete _pFileProgressingPopup;
93 if (_pMoreContextMenu != null)
95 delete _pMoreContextMenu;
103 /* if (_pCreateFolder != null)
105 delete _pCreateFolder;
108 if (_pFolderEntryPM != null)
110 delete _pFolderEntryPM;
113 if (_pBaseItemProvider != null)
115 delete _pBaseItemProvider;
118 if (_pThumbnailItemProvider != null)
120 delete _pThumbnailItemProvider;
125 SubBaseMoveCopy::operator =(const SubBaseMoveCopy& pSubBaseMoveCopy)
130 SubBaseMoveCopy::SubBaseMoveCopy(const SubBaseMoveCopy& pSubBaseMoveCopy)
136 SubBaseMoveCopy::CreateFileExistingPopup(void)
138 AppLogDebug("ENTER");
139 result r = E_SUCCESS;
140 // Label* pPopupLabel = null;
141 // Label* pBottomPanelLabel = null;
142 // Label* pLabelTitleText = null;
144 // Bitmap* pPopUpBackground = null;
145 // Bitmap* pBottomPanelBackground = null;
147 // pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
148 // pBottomPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
150 _pFileExistingPopup = new (std::nothrow) Popup;
151 r = _pFileExistingPopup->Construct(L"IDL_FILE_EXISTING_POPUP");
153 // pPopupLabel = static_cast< Label* >(_pFileExistingPopup->GetControl(L"IDC_LABEL_POPUP_CENTER_BACKGROUND", true));
154 // TryCatch(pPopupLabel != null, , "__pCopyRenameButton Popup Could Not be Created!");
156 // pBottomPanelLabel = static_cast< Label* >(_pFileExistingPopup->GetControl(L"IDC_LABEL_POPUP_BOTTOM_BACKGROUND", true));
157 // TryCatch(pBottomPanelLabel != null, , "__pCopyRenameButton Popup Could Not be Created!");
159 // pLabelTitleText = static_cast< Label* >(_pFileExistingPopup->GetControl(L"IDC_LABEL_TITLE_TEXT", true));
160 // TryCatch(pLabelTitleText != null, , "__pCopyRenameButton Popup Could Not be Created!");
162 // pBottomPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, pBottomPanelLabel->GetWidth(), pBottomPanelLabel->GetHeight());;
163 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, pPopupLabel->GetWidth(), pPopupLabel->GetHeight());
165 // if (pPopUpBackground != null)
167 // pPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
169 // if (pBottomPanelBackground != null)
171 // pBottomPanelLabel->SetBackgroundBitmap(*pBottomPanelBackground);
174 _pCopyRenameButton = static_cast< Button* >(_pFileExistingPopup->GetControl(L"IDC_FILE_EXISTING_RENAME", true));
175 TryCatch(_pCopyRenameButton != null, , "::__pCopyRenameButton Popup Could Not be Created!");
177 _pCopyRenameButton->SetActionId(IDA_BTN_POPUP_COPY_RENAME);
178 _pCopyRenameButton->AddActionEventListener(*this);
179 _pCopyRenameButton->SetShowState(true);
181 _pCopyReplaceButton = static_cast< Button* >(_pFileExistingPopup->GetControl(L"IDC_FILE_EXISTING_REPLACE", true));
182 TryCatch(_pCopyReplaceButton != null, , "::__pCopyReplaceButton Could Not be Created!");
184 _pCopyReplaceButton->SetActionId(IDA_BTN_POPUP_COPY_REPLACE);
185 _pCopyReplaceButton->AddActionEventListener(*this);
186 _pCopyReplaceButton->SetShowState(true);
189 _pCopyCancelButton = static_cast< Button* >(_pFileExistingPopup->GetControl(L"IDC_FILE_EXISTING_CANCEL", true));
190 TryCatch(_pCopyCancelButton != null, , " __pCopyCancelButton Could Not be Created!");
192 _pCopyCancelButton->SetActionId(IDA_BTN_POPUP_COPY_CANCEL);
193 _pCopyCancelButton->AddActionEventListener(*this);
194 _pCopyCancelButton->SetShowState(true);
196 _pFileExistingPopup->SetControlAlwaysOnTop(*_pCopyRenameButton, true);
197 _pFileExistingPopup->SetControlAlwaysOnTop(*_pCopyReplaceButton, true);
198 _pFileExistingPopup->SetControlAlwaysOnTop(*_pCopyCancelButton, true);
199 // _pFileExistingPopup->SetControlAlwaysOnTop(*pLabelTitleText, true);
200 // _pFileExistingPopup->SetControlAlwaysAtBottom(*pPopupLabel, true);
201 // _pFileExistingPopup->SetControlAlwaysAtBottom(*pBottomPanelLabel, true);
203 // if (pPopUpBackground != null)
205 // delete pPopUpBackground;
206 // pPopUpBackground = null;
209 // if (pBottomPanelBackground != null)
211 // delete pBottomPanelBackground;
212 // pBottomPanelBackground = null;
214 AppLogDebug(":: CreateFileExistingPopup--");
218 // if (pPopUpBackground != null)
220 // delete pPopUpBackground;
221 // pPopUpBackground = null;
223 // if (pBottomPanelBackground != null)
225 // delete pBottomPanelBackground;
226 // pBottomPanelBackground = null;
228 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
233 SubBaseMoveCopy::CreateFileProgressingPopup(void)
235 AppLogDebug("Entry");
236 result r = E_SUCCESS;
237 _pFileProgressingPopup = new (std::nothrow) Popup();
238 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
239 if (_pFileProgressingPopup != null)
241 _pFileProgressingPopup->SetTitleText(L"FileProcessing");
243 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
244 if (_pFileProgressingCancelButton != null)
246 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
247 _pFileProgressingCancelButton->AddActionEventListener(*this);
248 _pFileProgressingCancelButton->SetShowState(true);
251 _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
252 if (_pFileProgressingProgress != null)
254 _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
255 _pFileProgressingProgress->SetValue(0);
258 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
259 if (_pFileProgressingHeaderLabel != null)
261 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
262 _pFileProgressingHeaderLabel->SetShowState(true);
265 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
266 if (_pFileProgressingLabel != null)
268 _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
269 _pFileProgressingLabel->SetShowState(true);
272 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
277 SubBaseMoveCopy::CreateFooterItems(void)
279 AppLogDebug("ENTER");
280 result r = E_SUCCESS;
281 _pFooter = GetFooter();
282 int xPos = 0, yPos = 0;
288 //String btnCreateFolder;
290 ButtonItem footerItemMenu;
292 Bitmap* pBitmap = null;
293 Bitmap* pBitmapPress = null;
294 AppResource* pAppResource = null;
295 pAppResource = UiApp::GetInstance()->GetAppResource();
296 TryCatch(pAppResource != null, , "Resource manager not found!");
298 pAppResource->GetString(L"IDS_MF_SK3_MOVE_HERE", btnMoveHere);
299 pAppResource->GetString(L"IDS_MF_SK3_PASTE_HERE", btnPasteHere);
300 //pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", btnCreateFolder);
302 footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);
303 _pFooter = GetFooter();
305 pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);
306 pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
309 pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
310 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);
312 if (pBitmapPress != null)
314 pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
315 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);
318 if (_pFooter != null)
320 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
323 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
327 _pMove = new (std::nothrow) FooterItem();
328 r = _pMove->Construct(IDA_BTN_MOVE);
329 _pMove->SetText(btnMoveHere);
331 if (_pFooter != null)
333 r = _pFooter->AddItem(*_pMove);
340 _pPaste = new (std::nothrow) FooterItem();
341 r = _pPaste->Construct(IDA_BTN_PASTE);
342 _pPaste->SetText(btnPasteHere);
344 if (_pFooter != null)
346 r = _pFooter->AddItem(*_pPaste);
350 /* if (_pCreateFolder == null)
352 _pCreateFolder = new (std::nothrow) FooterItem();
353 r = _pCreateFolder->Construct(IDA_BTN_CREATE_FOLDER);
354 _pCreateFolder->SetText(btnCreateFolder);
356 /* if (_pFooter != null)
358 r = _pFooter->AddItem(*_pCreateFolder);
361 if (_pFooter != null)
363 _pFooter->AddActionEventListener(*this);
364 _pFooter->SetBackButton();
365 _pFooter->SetBackButtonEnabled(true);
366 _pFooter->SetShowState(true);
367 _pFooter->Invalidate(true);
368 SetFormBackEventListener(this);
369 _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu);
370 _pFooter->GetPosition(xPos, yPos);
372 _pMoreContextMenu = new (std::nothrow) ContextMenu();
373 _pMoreContextMenu->Construct(Point(0, yPos), CONTEXT_MENU_STYLE_LIST);
374 _pMoreContextMenu->AddActionEventListener(*this);
378 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
381 if (_pFooter != null)
383 _pFooter->RemoveAllItems();
386 AppLogDebug("CreateFooterCustomControls--");
389 FolderEntryPresentationModel*
390 SubBaseMoveCopy::GetFolderEntryPresentationModel(void)
392 return _pFolderEntryPM;
396 SubBaseMoveCopy::HideFileExistingPopup(void)
398 if (_pFileExistingPopup != null && _pFileExistingPopup->IsVisible())
400 _pFileExistingPopup->SetShowState(false);
402 delete _pFileExistingPopup;
403 _pFileExistingPopup = null;
408 SubBaseMoveCopy::HideFileProgressingPopup(void)
410 if (_pFileProgressingPopup != null && _pFileProgressingPopup->IsVisible())
412 _pFileProgressingPopup->SetShowState(false);
414 delete _pFileProgressingPopup;
415 _pFileProgressingPopup = null;
420 SubBaseMoveCopy::LoadCreateFolderForm(void)
422 //Load the CreateFolder view in the current directory.
423 AppLogDebug("ENTER");
424 result r = E_SUCCESS;
425 ArrayList* pArg = null;
426 Integer* pSourceSelected = null;
427 SceneManager* pSceneManager = null;
429 pSceneManager = SceneManager::GetInstance();
430 //TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
432 pArg = new (std::nothrow) ArrayList();
433 r = pArg->Construct();
435 pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
436 pArg->Add(pSourceSelected);
438 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
439 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
445 SubBaseMoveCopy::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
447 AppLogDebug("ENTER");
450 String __StoragePath;
452 Bitmap* pBitmapCreateFolderContextItem = null;
454 AppResource* pAppResource = null;
455 pAppResource = UiApp::GetInstance()->GetAppResource();
457 if (pAppResource != null)
459 pAppResource->GetString(L"IDS_COM_BODY_CREATE_FOLDER", createFolder);
460 pBitmapCreateFolderContextItem = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
467 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
468 _rootPath = FolderNavigationPresentationModel::GetCurrentPath();
469 _pFileManager->MoveFolderEntries(FILE_EXISTING_OPERATIONID_NONE);
475 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
476 _rootPath = FolderNavigationPresentationModel::GetCurrentPath();
477 _pFileManager->CopyFolderEntries(FILE_EXISTING_OPERATIONID_NONE);
481 case IDA_BTN_CREATE_FOLDER:
483 LoadCreateFolderForm();
489 SceneManager* pSceneManager = SceneManager::GetInstance();
490 if (pSceneManager != null)
492 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_DESTROY_OPTION_DESTROY), null);
499 _pMoreContextMenu->RemoveAllItems();
500 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
501 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
502 _pMoreContextMenu->AddItem(createFolder, IDA_BTN_CREATE_FOLDER, *pBitmapCreateFolderContextItem, null, null);
503 _pMoreContextMenu->SetShowState(true);
504 _pMoreContextMenu->Show();
508 case IDA_BTN_ANIMATION_POPUP_CANCEL:
510 //HideFileProgressingPopup();
511 _pFileManager->ForceStopWorkerThread();
515 case IDA_BTN_POPUP_COPY_RENAME:
517 HideFileExistingPopup();
518 if (sourceFormOption.ToInt() == SELECT_COPY_BUTTON)
520 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
521 _pFileManager->CopyFolderEntries(FILE_EXISTING_OPERATIONID_RENAME);
525 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
527 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
528 _pFileManager->MoveFolderEntries(FILE_EXISTING_OPERATIONID_RENAME);
534 case IDA_BTN_POPUP_COPY_REPLACE:
536 HideFileExistingPopup();
537 if (sourceFormOption.ToInt() == SELECT_COPY_BUTTON)
539 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
540 _pFileManager->CopyFolderEntries(FILE_EXISTING_OPERATIONID_REPLACE);
544 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
546 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
547 _pFileManager->MoveFolderEntries(FILE_EXISTING_OPERATIONID_REPLACE);
553 case IDA_BTN_POPUP_COPY_CANCEL:
555 //HideFileProgressingPopup();
556 HideFileExistingPopup();
568 if (pBitmapCreateFolderContextItem != null)
570 delete pBitmapCreateFolderContextItem;
571 pBitmapCreateFolderContextItem = null;
579 SubBaseMoveCopy::OnFileManagingStart(void)
581 ShowFileProgressingPopup();
585 SubBaseMoveCopy::ShowFileProgressingPopup(void)
587 String movingLabelText;
588 String copyingLabelText;
589 AppResource* pAppResource = null;
590 pAppResource = Application::GetInstance()->GetAppResource();
592 pAppResource->GetString("IDS_COM_POP_MOVING", movingLabelText);
593 pAppResource->GetString("IDS_MF_POP_COPYING", copyingLabelText);
595 CreateFileProgressingPopup();
597 if (_pFileProgressingPopup != null)
600 if (_pFileProgressingHeaderLabel != null)
602 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
604 _pFileProgressingHeaderLabel->SetText(movingLabelText);
605 _pFileProgressingHeaderLabel->Invalidate(true);
608 if (sourceFormOption.ToInt() == SELECT_COPY_BUTTON)
610 _pFileProgressingHeaderLabel->SetText(copyingLabelText);
611 _pFileProgressingHeaderLabel->Invalidate(true);
615 _pFileProgressingPopup->SetShowState(true);
616 _pFileProgressingPopup->Show();
621 SubBaseMoveCopy::OnFileManagingStop(FileManagingResult fileProcessingResult)
623 //Empty Implementation.
627 SubBaseMoveCopy::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
629 //Empty Implementation.
633 SubBaseMoveCopy::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
635 //Empty Implementation.
639 SubBaseMoveCopy::OnListViewItemStateChangedNotify(ViewType viewType)
641 //Empty Implementation.
645 SubBaseMoveCopy::OnThumbnailReceived(ThumbRequest* pThumbReq)
647 result res = E_SUCCESS;
648 ArrayList* pFileList = null;
649 AppLogDebug("Enter");
656 pFileList = _pFolderEntryPM->GetFolderEntryList();
657 if (pThumbReq != null)
659 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
661 if (pThumbReq->pBitmap != null)
663 AppLogDebug("This Bitmap is not requested from same form");
664 delete pThumbReq->pBitmap;
672 if (pThumbReq->iRquestId < pFileList->GetCount())
675 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
677 if (_pListView && _pListView->IsVisible())
679 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
681 else if (_pIconListView && _pIconListView->IsVisible())
683 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
689 _pFolderEntryPM->OnThumbnailResponseFailed();
692 AppLogDebug("Exit %s", GetErrorMessage(res));
697 SubBaseMoveCopy::OnTerminating(void)
699 result r = E_SUCCESS;
701 _pFooter = GetFooter();
702 if (_pFooter != null)
704 _pFooter->RemoveAllButtons();
705 _pFooter->RemoveAllItems();
711 SubBaseMoveCopy::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
712 const Tizen::Ui::Scenes::SceneId& nextSceneId)
714 //Empty Implementation.
715 ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);
716 if (_pFolderEntryPM != null)
718 _pFolderEntryPM->StopThumbnailManager(true);
723 SubBaseMoveCopy::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
725 //empty Implementation
729 SubBaseMoveCopy::ShowFileExistingPopup(void)
731 CreateFileExistingPopup();
733 if (_pFileExistingPopup != null)
735 _pFileExistingPopup->SetShowState(true);
736 _pFileExistingPopup->Show();
741 SubBaseMoveCopy::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
744 AppLogDebug("ENTER");
745 Rectangle listViewBounds;
746 Rectangle labelBounds;
749 if (_moveCopySource == MOVE_COPY_SOURCE_SUB_FOLDER)
751 listViewBounds.SetBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
752 labelBounds.SetBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
756 listViewBounds.SetBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, GetClientAreaBounds().height);
759 switch (orientationStatus)
761 case ORIENTATION_STATUS_PORTRAIT:
763 if (_pListView != null)
765 _pListView->SetBounds(listViewBounds);
768 if (_pIconListView != null)
770 _pIconListView->SetBounds(listViewBounds);
773 if (_moveCopySource == MOVE_COPY_SOURCE_SUB_FOLDER)
775 if (_pDisplayPathLabel != null)
777 _pDisplayPathLabel->SetBounds(labelBounds);
784 case ORIENTATION_STATUS_LANDSCAPE:
786 if (_pListView != null)
788 _pListView->SetBounds(listViewBounds);
791 if (_pIconListView != null)
793 _pIconListView->SetBounds(listViewBounds);
796 if (_moveCopySource == MOVE_COPY_SOURCE_SUB_FOLDER)
798 if (_pDisplayPathLabel != null)
800 _pDisplayPathLabel->SetBounds(labelBounds);
814 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
818 SubBaseMoveCopy::OnFormBackRequested(Form& source)
821 SceneManager* pSceneManager = SceneManager::GetInstance();
822 if (pSceneManager != null)
824 pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_DESTROY_OPTION_DESTROY), null);
830 SubBaseMoveCopy::OnNotificationReceived(ArrayList* pArgs)
832 AppLogDebug("ENTER");
834 int fileProcessingResult = 0;
835 Integer* pfileProcessingResult = null;
837 TryCatch(pArgs != null, , "Argument list received is invalid");
839 pfileProcessingResult = (Integer*) pArgs->GetAt(0);
840 if (pfileProcessingResult != null)
842 //TryCatch(pArgs!=null ,,"Argument list received is invalid");
843 fileProcessingResult = pfileProcessingResult->ToInt();
845 delete pfileProcessingResult;
847 switch (fileProcessingResult)
849 case FILE_MANAGING_RESULT_COPYING_SUCCESS:
851 HideFileProgressingPopup();
856 case FILE_MANAGING_RESULT_MOVING_SUCCESS:
858 HideFileProgressingPopup();
863 case FILE_MANAGING_RESULT_DUPLICITY:
865 HideFileProgressingPopup();
866 ShowFileExistingPopup();
870 case FILE_MANAGING_RESULT_SOURCE_SAME_AS_DESTINATION:
872 HideFileProgressingPopup();
873 MessageBox messageBox;
874 String moveFailedErrorMessage;
875 String copyFailedErrorMessage;
877 AppResource::GetInstance()->GetString(L"IDS_MF_POP_UNABLE_TO_MOVE_DESTINATION_FOLDER_SAME_AS_SOURCE_FOLDER", moveFailedErrorMessage);
878 AppResource::GetInstance()->GetString(L"IDS_MF_POP_UNABLE_TO_COPY_DESTINATION_FOLDER_SAME_AS_SOURCE_FOLDER", copyFailedErrorMessage);
880 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
882 messageBox.Construct(L"", moveFailedErrorMessage, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
886 messageBox.Construct(L"", copyFailedErrorMessage, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
889 // Call ShowAndWait - draw, show itself and process events
891 messageBox.ShowAndWait(modalResult);
895 case FILE_MANAGING_RESULT_CURRENT_STATUS:
897 String movingLabelText;
898 String copyingLabelText;
899 AppResource* pAppResource = null;
900 pAppResource = Application::GetInstance()->GetAppResource();
902 pAppResource->GetString("IDS_COM_POP_MOVING", movingLabelText);
903 pAppResource->GetString("IDS_MF_POP_COPYING", copyingLabelText);
905 String strFileProcessCount(L"");
906 if (pArgs->GetCount() > 1)
908 Integer* pCurrentStatus = (Integer*) pArgs->GetAt(1);
909 Integer* pTotalFileCount = (Integer*) pArgs->GetAt(2);
910 if (pCurrentStatus != null && pTotalFileCount != null)
912 value = (_fileManagedCount * 100) / (pTotalFileCount->ToInt());
914 _fileManagedCount = pCurrentStatus->ToInt();
915 strFileProcessCount.Append(_fileManagedCount);
916 strFileProcessCount.Append(L"/");
917 strFileProcessCount.Append(pTotalFileCount->ToInt());
918 delete pCurrentStatus;
919 delete pTotalFileCount;
922 if (_pFileProgressingPopup != null)
924 Progress* pProgrssAnimation = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_PROGRESS", true));
925 if (_pFileProgressingHeaderLabel != null)
927 if (sourceFormOption.ToInt() == SELECT_MOVE_BUTTON)
929 _pFileProgressingHeaderLabel->SetText(movingLabelText);
930 _pFileProgressingHeaderLabel->Invalidate(true);
933 if (sourceFormOption.ToInt() == SELECT_COPY_BUTTON)
935 _pFileProgressingHeaderLabel->SetText(copyingLabelText);
936 _pFileProgressingHeaderLabel->Invalidate(true);
939 if (pProgrssAnimation != null)
941 pProgrssAnimation->SetValue(value);
942 pProgrssAnimation->Invalidate(true);
945 Label* pLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_FILE_COUNT_LABEL", true));
948 pLabel->SetText(strFileProcessCount);
949 pLabel->Invalidate(true);
957 case FILE_MANAGING_RESULT_COPYING_FAILED:
959 String copyingFailed;
960 AppResource* pAppResource = null;
961 pAppResource = Application::GetInstance()->GetAppResource();
962 pAppResource->GetString("IDS_COPY_FAILED_MESSAGE", copyingFailed);
964 HideFileProgressingPopup();
966 MessageBox messageBox;
967 //messageBox.Construct(L"", L"Not enough memory.\n Delete some items and try again", MSGBOX_STYLE_NONE, 1000);
968 messageBox.Construct(L"", copyingFailed, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
969 // Call ShowAndWait - draw, show itself and process events
971 messageBox.ShowAndWait(modalResult);
973 String tempDeviceState;
975 DeviceManager::GetState(DEVICE_TYPE_STORAGE_CARD,tempDeviceState);
976 if(tempDeviceState == sdCardStatusUnmounted && deviceState == sdCardStatusMounted)
978 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
988 case FILE_MANAGING_RESULT_MOVING_FAILED:
991 AppResource* pAppResource = null;
992 pAppResource = Application::GetInstance()->GetAppResource();
993 pAppResource->GetString("IDS_COM_POP_MOVING_FAILED", movingFailed);
995 HideFileProgressingPopup();
997 MessageBox messageBox;
998 //messageBox.Construct(L"", L"Not enough memory.\n Delete some items and try again", MSGBOX_STYLE_NONE, 1000);
999 messageBox.Construct(L"", movingFailed, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
1000 // Call ShowAndWait - draw, show itself and process events
1001 int modalResult = 0;
1002 messageBox.ShowAndWait(modalResult);
1004 String tempDeviceState;
1005 DeviceManager::GetState(DEVICE_TYPE_STORAGE_CARD,tempDeviceState);
1006 AppLogDebug("cureent %ls",tempDeviceState.GetPointer());
1007 AppLogDebug("old device %ls",deviceState.GetPointer());
1008 if(tempDeviceState == sdCardStatusUnmounted && deviceState == sdCardStatusMounted)
1010 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
1014 LoadDirectoryForm();
1019 case FILE_MANAGING_RESULT_STORAGE_FULL:
1022 AppResource* pAppResource = null;
1023 pAppResource = Application::GetInstance()->GetAppResource();
1024 pAppResource->GetString("IIDS_STORAGE_FULL", storageFull);
1026 HideFileProgressingPopup();
1027 MessageBox messageBox;
1028 //messageBox.Construct(L"", L"Not enough memory.\n Delete some items and try again", MSGBOX_STYLE_NONE, 1000);
1029 messageBox.Construct(L"", storageFull, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
1030 // Call ShowAndWait - draw, show itself and process events
1031 int modalResult = 0;
1032 messageBox.ShowAndWait(modalResult);
1034 LoadDirectoryForm();
1045 pArgs->RemoveAll(false);
1050 AppLogDebug("EXIT");
1054 SubBaseMoveCopy::LoadDirectoryForm(void)
1056 AppLogDebug("ENTER");
1057 result r = E_SUCCESS;
1058 ArrayList* pArg = null;
1060 SceneManager* pSceneManager = null;
1061 pSceneManager = SceneManager::GetInstance();
1063 FolderNavigationPresentationModel::SetCurrentFilePath(_rootPath);
1064 if (_moveCopySource == MOVE_COPY_SOURCE_SUB_FOLDER)
1068 StringTokenizer strTok(_rootPath, delim);
1069 while (strTok.HasMoreTokens())
1071 strTok.GetNextToken(token);
1073 fileName.Append(token);
1074 pArg = new (std::nothrow) ArrayList();
1075 r = pArg->Construct();
1076 pArg->Add(&fileName);
1079 if (_moveCopySource == MOVE_COPY_SOURCE_TOP_MOST)
1081 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
1085 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SUB_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pArg);
1087 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));