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: MfSubBaseFolderEntryForm.cpp
19 * @brief: This file contains the implementation of SubBaseFolderEntryForm class, which acts as a base form for
20 * the TopMostFileFolderListForm and SubFileFolderListForm.
23 #include "MfSubBaseFolderEntryForm.h"
25 using namespace Tizen::App;
26 using namespace Tizen::App::Package;
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Collection;
29 using namespace Tizen::Base::Utility;
30 using namespace Tizen::Content;
31 using namespace Tizen::Graphics;
32 using namespace Tizen::Io;
33 using namespace Tizen::Locales;
34 using namespace Tizen::Media;
35 using namespace Tizen::System;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
40 SubBaseFolderEntryForm::SubBaseFolderEntryForm(void)
41 : _pFileEventManager(null)
42 , _pPackageManager(null)
44 , _pCancelDeletion(null)
45 , _pCancelSortBy(null)
46 , _pCancelViewAs(null)
48 , _pFileProgressingCancelButton(null)
49 , _pIconListViewContextMenu(null)
50 , _pMoreContextMenu(null)
57 , _pIconListView(null)
58 , _pFileProgressingHeaderLabel(null)
59 , _pFileProgressingLabel(null)
60 , _pLabelDisplayPath(null)
63 , _pSortByListView(null)
64 , _pViewAsListView(null)
65 , _pDeleteConfirmationPopUp(null)
66 , _pFileProgressingPopup(null)
69 , _pLongPressGestureDetector(null)
70 , _pBaseItemProvider(null)
71 , _pCustomListViewForPopup(null)
73 , _pFolderEntryPM(null)
74 , _pMediaMetaData(null)
75 , _pThumbnailItemProvider(null)
76 , _pThumbnailManager(null)
78 _bIsTopLevelDirectory = false;
79 _bIsDirectoryEmpty = false;
80 _bBackFromAppControl = false;
81 _flagViewAsStatus = 0;
88 _selectedItemIndex = -1;
91 SubBaseFolderEntryForm::~SubBaseFolderEntryForm(void)
95 if (_pFolderEntryPM != null)
97 delete _pFolderEntryPM;
100 if (_pMoreContextMenu != null)
102 delete _pMoreContextMenu;
105 if (_pViewAsPopup != null)
107 delete _pViewAsPopup;
110 if (_pDeleteConfirmationPopUp != null)
112 delete _pDeleteConfirmationPopUp;
115 if (_pCustomListViewForPopup != null)
117 delete _pCustomListViewForPopup;
120 if (_pMediaMetaData != null)
122 delete _pMediaMetaData;
125 if (_pSortByPopup != null)
127 delete _pSortByPopup;
130 if (_pFileProgressingPopup != null)
132 delete _pFileProgressingPopup;
135 if (_pThumbnailItemProvider != null)
137 delete _pThumbnailItemProvider;
140 if (_pBaseItemProvider != null)
142 delete _pBaseItemProvider;
150 if (_pSortBy != null)
155 if (_pSearch != null)
165 if (_pFileEventManager != null)
167 delete _pFileEventManager;
171 SubBaseFolderEntryForm&
172 SubBaseFolderEntryForm::operator =(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
177 SubBaseFolderEntryForm::SubBaseFolderEntryForm(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
183 SubBaseFolderEntryForm::CreateFooterControls(void)
185 AppLogDebug("ENTER");
186 //Create Footer and controls contained within the footer
187 result r = E_SUCCESS;
189 AppResource* pAppResource = null;
193 ButtonItem footerItemMenu;
195 Bitmap* pBitmap = null;
196 Bitmap* pBitmapDisabled = null;
197 Bitmap* pBitmapPress = null;
199 pAppResource = Application::GetInstance()->GetAppResource();
201 if (pAppResource != null)
203 pAppResource->GetString(L"IDS_MF_SK3_EDIT", buttonEdit);
204 pAppResource->GetString(L"IDS_COM_BUTTON_SHARE", buttonShare);
205 pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);
206 pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888);
207 pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
210 footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);
211 //Construct the 4 FooterItems Copy, Create , Sort By and More
215 _pEdit = new (std::nothrow) FooterItem();
216 _pEdit->Construct(IDA_BTN_EDIT);
217 _pEdit->SetText(buttonEdit);
222 _pShare = new (std::nothrow) FooterItem();
223 _pShare->Construct(IDA_BTN_SHARE);
224 _pShare->SetText(buttonShare);
227 TryCatch(pBitmap != null, , "MfMyFilesApp::Bitmap pBitmap null");
228 TryCatch(pBitmapDisabled != null, , "MfMyFilesApp::Bitmap pBitmapDisabled null");
229 TryCatch(pBitmapPress != null, , "MfMyFilesApp::Bitmap pBitmapPress null");
231 pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
232 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);
234 pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
235 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled);
237 pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
238 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);
241 //Get the Footer and set the FooterItems.
242 _pFooter = GetFooter();
243 if (_pFooter != null)
245 _pFooter->RemoveAllButtons();
246 _pFooter->RemoveAllItems();
248 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
249 _pFooter->AddItem(*_pEdit);
250 _pFooter->AddItem(*_pShare);
251 _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu);
253 //Set am ActionEventListener to the Footer
254 _pFooter->AddActionEventListener(*this);
255 _pFooter->SetBackButton();
256 _pFooter->SetBackButtonEnabled(true);
257 _pFooter->Invalidate(true);
262 delete pBitmapDisabled;
272 if (pBitmapDisabled != null)
274 delete pBitmapDisabled;
281 SubBaseFolderEntryForm::CreateDeleteConfirmationPopUp(void)
283 result r = E_SUCCESS;
284 Rectangle popupBounds;
286 //Create a new popup control
287 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
288 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
290 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
291 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
293 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
294 _pDeleteFile->AddActionEventListener(*this);
295 _pDeleteFile->SetShowState(true);
297 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
298 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
300 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
301 _pCancelDeletion->AddActionEventListener(*this);
302 _pCancelDeletion->SetShowState(true);
308 if (_pDeleteConfirmationPopUp != null)
310 delete _pDeleteConfirmationPopUp;
311 _pDeleteConfirmationPopUp = null;
318 SubBaseFolderEntryForm::ShowSortByPopup(void)
323 //Set the showstate of the popup to true. so that it's displayed on the form.
324 if (_pSortByPopup != null)
326 _pSortByPopup->SetShowState(true);
327 _pSortByPopup->Invalidate(true);
328 _pSortByPopup->Show();
331 SetDefaultSelectionForSortByPopUp();
336 SubBaseFolderEntryForm::HideSortByPopup(void)
338 //Set the showstate of the popup to false. so that it's hidden on the form.
339 if (_pSortByPopup != null && _pSortByPopup->IsVisible())
341 _pSortByPopup->SetShowState(false);
347 SubBaseFolderEntryForm::LoadRenameForm(int index)
349 result r = E_SUCCESS;
350 _renameOrCreate = SELECT_RENAME;
351 ArrayList* pArg = null;
352 Integer* pSourceSelected = null;
353 SceneManager* pSceneManager = null;
354 DirectoryEntry* pDirectory = null;
356 if(_pFilenames != null)
358 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
359 TryCatch(pDirectory != null, , "failed to allocate memeory to cast to DirectoryEntry");
362 pArg = new (std::nothrow) ArrayList();
363 r = pArg->Construct();
365 pSourceSelected = new (std::nothrow) Integer(_renameOrCreate);
367 pArg->Add(pSourceSelected);
368 TryCatch(r == E_SUCCESS, , "failed to construct parg");
370 //pArg->Add(__rootMediaPath);
371 pArg->Add(pDirectory);
372 TryCatch(r == E_SUCCESS, , "failed to construct parg");
374 pSceneManager = SceneManager::GetInstance();
375 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
377 //pSceneManager->GoForward(SCENE_RENAME_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
378 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
380 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
384 if (pSourceSelected != null)
386 delete pSourceSelected;
387 pSourceSelected = null;
389 if (pDirectory != null)
402 SubBaseFolderEntryForm::LoadSearchForm(void)
404 ArrayList* pTopLevelDirectoryList = null;
405 ArrayList* pFilepathList = null;
406 SceneManager* pSceneManager = null;
408 pTopLevelDirectoryList= new (std::nothrow) ArrayList();
409 if (pTopLevelDirectoryList != null && _pFilenames != null)
411 pFilepathList = new (std::nothrow) ArrayList();
412 if (pFilepathList != null)
414 pFilepathList->Construct();
415 pFilepathList->AddItems(*_pFilenames);
416 pTopLevelDirectoryList->Add(pFilepathList);
420 TryCatch(pTopLevelDirectoryList != null, , "failed to Get SceneManager instance");
422 pSceneManager = SceneManager::GetInstance();
423 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
425 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pTopLevelDirectoryList);
431 if (pFilepathList != null)
433 delete pFilepathList;
434 pFilepathList = null;
437 if (pTopLevelDirectoryList != null)
439 delete pTopLevelDirectoryList;
440 pTopLevelDirectoryList = null;
445 SubBaseFolderEntryForm::ShowViewAsPopup(void)
447 //Call functions to create the popups.
448 CreateViewAsPopupControl();
450 //Set the showstate of the popup to true. so that it's displayed on the form.
451 if (_pViewAsPopup != null)
453 _pViewAsPopup->SetShowState(true);
454 _pViewAsPopup->Show();
457 SetDefaultSelectionForViewAsPopUp();
461 SubBaseFolderEntryForm::HideViewAsPopup(void)
463 //Set the showstate of the popup to false. so that it's hidden on the form.
464 if (_pViewAsPopup != null && _pViewAsPopup->IsVisible())
466 _pViewAsPopup->SetShowState(false);
471 SubBaseFolderEntryForm::LoadCreateFolderForm(void)
473 //Load the CreateFolder view in the current directory.
474 result r = E_SUCCESS;
475 Integer* pSourceSelected = null;
476 SceneManager* pSceneManager = null;
477 ArrayList* pArg = null;
479 pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
481 pArg = new (std::nothrow) ArrayList();
482 r = pArg->Construct();
484 pArg->Add(pSourceSelected);
485 TryCatch(r == E_SUCCESS, , "failed to construct parg");
487 pSceneManager = SceneManager::GetInstance();
488 TryCatch(pSceneManager != null, , "failed to construct parg");
490 //pSceneManager->GoForward(SCENE_CREATE_FOLDER_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
491 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
496 if (pSourceSelected != null)
498 delete pSourceSelected;
508 SubBaseFolderEntryForm::LoadDetailForm(Tizen::Base::String& Fullpath)
510 result r = E_SUCCESS;
512 SceneManager* pSceneManager = null;
513 ArrayList* pList = null;
514 String* pFullFilePath = null;
516 pList = new (std::nothrow) ArrayList();
517 r = pList->Construct();
519 pFullFilePath = new (std::nothrow) String(Fullpath);
520 pList->Add(pFullFilePath);
522 pSceneManager = SceneManager::GetInstance();
523 TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
525 //pSceneManager->GoForward(SCENE_FILE_DETAIL_FORM, pList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
526 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
527 AppLogDebug("Exit: %s", GetErrorMessage(r));
531 AppLogDebug("Exit: %s", GetErrorMessage(r));
532 if (pFullFilePath != null)
534 delete pFullFilePath;
535 pFullFilePath = null;
547 SubBaseFolderEntryForm::LoadEditForm(void)
549 AppLogDebug("ENTER");
550 //__pFileListPM->SetFileEventListener(null);
551 SceneManager* pSceneManager = SceneManager::GetInstance();
552 ArrayList* pArgs = null;
554 pArgs = new (std::nothrow) ArrayList();
555 //pArgs->Construct();
561 pArgs->Add(* new (std::nothrow) Integer(_editOrShare));
563 pArgs->Add(*_pFolderEntryPM);
566 if (pSceneManager != null)
568 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
582 SubBaseFolderEntryForm::ShowFileProgressingPopup(void)
584 CreateFileProgressingPopup();
586 if (_pFileProgressingPopup != null)
588 _pFileProgressingPopup->SetShowState(true);
589 _pFileProgressingPopup->Show();
594 SubBaseFolderEntryForm::HideFileProgressingPopup(void)
596 if (_pFileProgressingPopup != null)
598 _pFileProgressingPopup->SetShowState(false);
600 if (_pFileProgressingPopup != null)
602 delete _pFileProgressingPopup;
603 _pFileProgressingPopup = null;
609 SubBaseFolderEntryForm::CreateFileProgressingPopup(void)
611 AppLogDebug("Enter");
612 result r = E_SUCCESS;
615 //String fileProgress;
617 if (_pFileProgressingPopup != null)
619 AppLogDebug("_pFileProgressingPopup is not null");
623 AppResource* pAppResource = null;
624 pAppResource = UiApp::GetInstance()->GetAppResource();
625 TryCatch(pAppResource != null, , "Failed to fetch AppResource");
627 //pAppResource->GetString(L"IDS_FILE_PROCESSING", popUpTitle);
628 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
629 //pAppResource->GetString(L"IDS_FILE_PROGRESS", fileProgress);
631 _pFileProgressingPopup = new (std::nothrow) Popup();
632 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
633 TryCatch(_pFileProgressingPopup != null, , "Failed to allocate memory to FileProgressing Popup.");
635 //_pFileProgressingPopup->SetTitleText(popUpTitle); //Not in UI
638 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
639 TryCatch(_pFileProgressingCancelButton != null, , "Failed to fetch _pFileProgressingCancelButton.");
641 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
642 _pFileProgressingCancelButton->AddActionEventListener(*this);
643 _pFileProgressingCancelButton->SetShowState(true);
645 _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
646 TryCatch(_pFileProgressingProgress != null, , "Failed to fetch _pFileProgressingProgress.");
648 _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
649 _pFileProgressingProgress->SetValue(0);
651 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
652 TryCatch(_pFileProgressingHeaderLabel != null, , "Failed to fetch _pFileProgressingHeaderLabel.");
654 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
655 _pFileProgressingHeaderLabel->SetText(deleting);
656 _pFileProgressingHeaderLabel->SetShowState(true);
657 _pFileProgressingHeaderLabel->Invalidate(true);
660 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
661 TryCatch(_pFileProgressingLabel != null, , "Failed to fetch _pFileProgressingLabel.");
663 _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
664 //_pFileProgressingLabel->SetText(fileProgress);
665 _pFileProgressingLabel->SetShowState(true);
672 if (_pFileProgressingPopup != null)
674 delete _pFileProgressingPopup;
675 _pFileProgressingPopup = null;
682 SubBaseFolderEntryForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
684 int x_FooterPosition = 0;
685 int y_FooterPosition = 0;
686 int x_ContextMenu = 0;
687 int y_ContextMenu = 0;
689 Rectangle listViewBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
690 Rectangle labelBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
692 _pFooter = GetFooter();
693 if (_pFooter != null)
695 _pFooter->GetPosition(x_FooterPosition, y_FooterPosition);
698 x_ContextMenu = x_FooterPosition + 3 * (listViewBounds.width / 4);
699 y_ContextMenu = y_FooterPosition;
701 switch (orientationStatus)
703 case ORIENTATION_STATUS_PORTRAIT:
705 if (_pListView != null)
707 _pListView->SetBounds(listViewBounds);
709 if (_pIconListView != null)
711 _pIconListView->SetBounds(listViewBounds);
713 if (_pMoreContextMenu != null)
715 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
717 /* if (__pLabelDisplayPath != null)
719 __pLabelDisplayPath->SetBounds(labelBounds);
724 case ORIENTATION_STATUS_LANDSCAPE:
726 if (_pListView != null)
728 _pListView->SetBounds(listViewBounds);
730 if (_pIconListView != null)
732 _pIconListView->SetBounds(listViewBounds);
734 if (_pMoreContextMenu != null)
736 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
738 /* if (__pLabelDisplayPath != null)
740 __pLabelDisplayPath->SetBounds(labelBounds);
756 SubBaseFolderEntryForm::OnFileManagingStart(void)
758 ShowFileProgressingPopup();
762 SubBaseFolderEntryForm::OnFileManagingStop(FileManagingResult fileManagingResult)
764 //Empty Implementation.
768 SubBaseFolderEntryForm::HideFileExtension(void)
770 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
771 String viewStyleKeyName(L"ListDisplayType");
773 result r = E_SUCCESS;
775 AppRegistry* pAppRegistry = null;
776 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
779 if (pAppRegistry != null)
781 r = pAppRegistry->Set(_extensionKeyName, _hideExtension);
782 r = pAppRegistry->Save();
784 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
786 if (_pMoreContextMenu != null)
788 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
789 AppLogDebug("error %s", GetErrorMessage(r));
792 //Update the corresponding List.
793 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
795 if (_pListView != null && _pListView->IsVisible())
797 _pListView->SetShowState(false);
799 if (_pIconListView != null)
801 _pIconListView->SetShowState(true);
802 _pIconListView->UpdateList();
807 if (_pIconListView != null && _pIconListView->IsVisible())
809 _pIconListView->SetShowState(false);
811 if (_pListView != null)
813 _pListView->UpdateList();
814 _pListView->SetShowState(true);
818 if (_pMoreContextMenu != null)
820 delete _pMoreContextMenu;
821 _pMoreContextMenu = null;
826 AppLogDebug("Exit : %s", GetErrorMessage(r));
830 SubBaseFolderEntryForm::ShowFileExtension(void)
832 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
833 String viewStyleKeyName(L"ListDisplayType");
835 result r = E_SUCCESS;
837 AppRegistry* pAppRegistry = null;
838 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
840 if (pAppRegistry != null)
842 r = pAppRegistry->Set(_extensionKeyName, _showExtension);
843 r = pAppRegistry->Save();
845 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
848 if (_pMoreContextMenu != null)
850 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
851 AppLogDebug("error %s", GetErrorMessage(r));
854 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
856 if (_pListView != null && _pListView->IsVisible())
858 _pListView->SetShowState(false);
860 if (_pIconListView != null)
862 _pIconListView->UpdateList();
863 _pIconListView->SetShowState(true);
868 if (_pIconListView != null && _pIconListView->IsVisible())
870 _pIconListView->SetShowState(false);
872 if (_pListView != null)
874 _pListView->UpdateList();
875 _pListView->SetShowState(true);
879 if (_pMoreContextMenu != null)
881 delete _pMoreContextMenu;
882 _pMoreContextMenu = null;
886 AppLogDebug("Exit: %s", GetErrorMessage(r));
891 SubBaseFolderEntryForm::HideDeleteConfirmationPopup(void)
893 if (_pDeleteConfirmationPopUp != null && _pDeleteConfirmationPopUp->IsVisible())
895 _pDeleteConfirmationPopUp->SetShowState(false);
900 SubBaseFolderEntryForm::ShowDeleteConfirmationPopup(void)
902 CreateDeleteConfirmationPopUp();
904 if (_pDeleteConfirmationPopUp != null)
906 _pDeleteConfirmationPopUp->SetShowState(true);
907 _pDeleteConfirmationPopUp->Show();
912 SubBaseFolderEntryForm::CreateViewAsPopupControl(void)
914 AppLogDebug("ENTER");
915 //Creates a popup control for the ViewAs context item asking which view is to be shown
917 result r = E_SUCCESS;
919 if (_pViewAsPopup != null)
921 AppLogDebug("_pViewAsPopup is not null");
925 String viewAsPopupTitle;
927 String sortByPopupTitle;
929 // Label* pViewAsPanelLabel = null;
931 // Label* pViewAsPopupLabel = null;
933 // Bitmap* pPanelBackground = null;
934 // Bitmap* pPopUpBackground = null;
936 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
937 // pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
939 //Create a new popup control
940 _pViewAsPopup = new (std::nothrow) Popup();
941 _pViewAsPopup->Construct(L"IDL_VIEW_AS_POPUP");
943 //The cancel button inside the popup, hides the popup when clicked.
944 _pCancelViewAs = static_cast< Button* >(_pViewAsPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
945 TryCatch(_pCancelViewAs != null, , "MfMyFilesApp::Button For Popup not created!");
947 _pCancelViewAs->SetActionId(IDA_BTN_POPUP_CANCEL);
948 _pCancelViewAs->AddActionEventListener(*this);
949 _pCancelViewAs->SetShowState(true);
951 // pViewAsPanelLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
952 // TryCatch(pViewAsPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
954 // pViewAsPopupLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
955 // TryCatch(pViewAsPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
957 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, pViewAsPanelLabel->GetWidth(), pViewAsPanelLabel->GetHeight());
958 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, pViewAsPopupLabel->GetWidth(), pViewAsPopupLabel->GetHeight());
960 // if (pPanelBackground != null)
962 // pViewAsPanelLabel->SetBackgroundBitmap(*pPanelBackground);
965 // if (pPopUpBackground != null)
967 // pViewAsPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
970 //The listview control which is to be added inside the popup. The itemprovider and listener are
971 //implemented in another class because this class already contains an instance of Listview control
972 //attached to an ItemProvider.
974 _pViewAsPopup->SetControlAlwaysOnTop(*_pCancelViewAs, true);
977 _pViewAsListView = static_cast< ListView* >(_pViewAsPopup->GetControl(L"IDC_LISTVIEW_VIEW_AS", true));
978 TryCatch(_pViewAsListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
980 _pViewAsListView->SetShowState(true);
981 _pViewAsListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
982 _pViewAsListView->SetItemProvider(*_pCustomListViewForPopup);
983 _pViewAsListView->SetName(L"VIEW_AS_LISTVIEW");
984 _pViewAsListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
986 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
988 // if (pPanelBackground != null)
990 // delete pPanelBackground;
991 // pPanelBackground = null;
993 // if (pPopUpBackground != null)
995 // delete pPopUpBackground;
996 // pPopUpBackground = null;
1001 if (_pViewAsPopup != null)
1003 delete _pViewAsPopup;
1004 _pViewAsPopup = null;
1007 if (_pCustomListViewForPopup != null)
1009 delete _pCustomListViewForPopup;
1010 _pCustomListViewForPopup = null;
1013 // if (pPanelBackground != null)
1015 // delete pPanelBackground;
1016 // pPanelBackground = null;
1019 // if (pPopUpBackground != null)
1021 // delete pPopUpBackground;
1022 // pPopUpBackground = null;
1028 SubBaseFolderEntryForm::ShowMoreContextMenu(void)
1030 String extensionStatus;
1032 AppRegistry* pAppRegistry = null;
1033 result r = E_SUCCESS;
1034 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1036 //Show ContextMenu with More Options
1037 if (pAppRegistry != null)
1039 r = pAppRegistry->Get(_extensionKeyName, extensionStatus);
1042 if (_pMoreContextMenu != null)
1044 if (extensionStatus == _hideExtension)
1046 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1050 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1053 _pMoreContextMenu->SetShowState(true);
1054 _pMoreContextMenu->Show();
1057 AppLogDebug("Exit: %s", GetErrorMessage(r));
1061 SubBaseFolderEntryForm::OnListViewItemStateChangedNotify(ViewType listViewStyle)
1063 AppLogDebug("ENTER");
1065 int popupSource = POP_UP_VIEW_AS;
1066 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1067 int thumbnailRequestId = 0;
1069 AppRegistry* pAppRegistry = null;
1070 String sortByKeyName(L"SortBy");
1072 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1074 if (_pCustomListViewForPopup != null)
1076 popupSource = _pCustomListViewForPopup->GetSelectionPopup();
1079 pAppRegistry->Get(sortByKeyName, sortType);
1081 if (popupSource == POP_UP_VIEW_AS)
1083 _flagViewAsStatus = listViewStyle;
1093 if (_pFolderEntryPM != null)
1095 thumbnailRequestId = _pFolderEntryPM->GetCurrentReqId() + 1;
1096 _pFolderEntryPM->SetCurrentReqId(thumbnailRequestId);
1097 if (_pFolderEntryPM != null && _pFolderEntryPM->GetSourceForm() != CREATE_ITEM_SOURCE_SPLIT_PANEL_DIR_TREE)
1099 _pFolderEntryPM->SortFolderEntries();
1103 if (_pListView != null && _pListView->IsVisible())
1105 _pListView->UpdateList();
1109 if (_pIconListView != null && _pIconListView->IsVisible())
1111 _pIconListView->UpdateList();
1115 if (_pFolderEntryPM != null)
1117 _pFolderEntryPM->InitThumbnailManager();
1122 if (_pMoreContextMenu != null)
1124 delete _pMoreContextMenu;
1125 _pMoreContextMenu = null;
1129 SubBaseFolderEntryForm::OnIconListViewItemStateChangeNotify()
1131 if (_pIconListView != null && _pIconListView->IsVisible())
1133 _pIconListView->UpdateList();
1137 SubBaseFolderEntryForm::OnFooterStateChangeNotify(void)
1139 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1141 _pFooter = GetFooter();
1142 if (_pFooter != null)
1144 _pFooter->Invalidate(true);
1149 SubBaseFolderEntryForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1151 AppLogDebug("OnAppControlCompleteResponseReceived");
1152 result r = E_SUCCESS;
1153 CustomAppControl::GetInstance()->SetAppControlInUse(null);
1155 ContentType contentType = CONTENT_TYPE_UNKNOWN;
1156 contentType = ContentManagerUtil::CheckContentType(_pathOfSelectedFile);
1157 AppLogDebug("OnAppControlCompleteResponseReceived:%d", contentType);
1159 if (GetLastResult() == E_FILE_NOT_FOUND)
1161 _pFolderEntryPM->RefreshFolderEntries();
1162 if (_pListView != null && _pListView->IsVisible())
1164 r = _pListView->UpdateList();
1167 if (_pIconListView != null && _pIconListView->IsVisible())
1169 r = _pIconListView->UpdateList();
1171 _pFolderEntryPM->InitThumbnailManager();
1176 SubBaseFolderEntryForm::SetDefaultSelectionForSortByPopUp(void)
1178 result r = E_SUCCESS;
1180 int defaultSortPopUpSelect = 0;
1182 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1184 int uncheckItem1 = 0;
1185 int uncheckItem2 = 0;
1186 int uncheckItem3 = 0;
1187 int uncheckItem4 = 0;
1188 int uncheckItem5 = 0;
1190 String sortByKeyName(L"SortBy");
1192 AppRegistry* pAppRegistry = null;
1194 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1196 r = pAppRegistry->Get(sortByKeyName, sortType);
1197 TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
1202 case SORT_BY_TYPE_NAME_ASCENDING:
1204 defaultSortPopUpSelect = 0;
1213 case SORT_BY_TYPE_NAME_DESCENDING:
1215 defaultSortPopUpSelect = 1;
1224 case SORT_BY_TYPE_DATE_RECENT:
1226 defaultSortPopUpSelect = 2;
1236 case SORT_BY_TYPE_DATE_OLDEST:
1238 defaultSortPopUpSelect = 3;
1247 case SORT_BY_TYPE_SIZE_ASCENDING:
1249 defaultSortPopUpSelect = 4;
1258 case SORT_BY_TYPE_SIZE_DESCENDING:
1260 defaultSortPopUpSelect = 4;
1269 case SORT_BY_TYPE_ASCENDING:
1271 defaultSortPopUpSelect = 5;
1281 case SORT_BY_TYPE_DESCENDING:
1283 defaultSortPopUpSelect = 5;
1295 defaultSortPopUpSelect = 0;
1296 AppLogDebug("UnSupported case reached");
1301 if (_pCustomListViewForPopup != null)
1303 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1306 if (_pSortByPopup != null && _pSortByListView != null)
1308 _pSortByListView->UpdateList();
1309 _pSortByListView->SetItemChecked(defaultSortPopUpSelect, true);
1310 _pSortByListView->SetItemChecked(uncheckItem1, false);
1311 _pSortByListView->SetItemChecked(uncheckItem2, false);
1312 _pSortByListView->SetItemChecked(uncheckItem3, false);
1313 _pSortByListView->SetItemChecked(uncheckItem4, false);
1314 _pSortByListView->SetItemChecked(uncheckItem5, false);
1316 _pSortByListView->Invalidate(true);
1325 SubBaseFolderEntryForm::SwitchViewType(void)
1327 String viewStyleKeyName(L"ListDisplayType");
1329 switch (_flagViewAsStatus)
1332 case VIEW_TYPE_AS_DETAILED_LIST:
1334 if (_pIconListView != null && _pIconListView->IsVisible())
1336 _pIconListView->SetShowState(false);
1338 if (_pListView != null)
1340 _pListView->UpdateList();
1341 if (_selectedItemIndex == -1)
1342 _pListView->ScrollToItem(0);
1343 _pListView->SetShowState(true);
1349 case VIEW_TYPE_AS_NORMAL_LIST:
1351 if (_pIconListView != null && _pIconListView->IsVisible())
1353 _pIconListView->SetShowState(false);
1356 if (_pListView != null)
1358 _pListView->UpdateList();
1359 if (_selectedItemIndex == -1)
1360 _pListView->ScrollToItem(0);
1361 _pListView->SetShowState(true);
1366 case VIEW_TYPE_AS_THUMBNAILS:
1368 if (_pListView != null && _pListView->IsVisible())
1370 _pListView->SetShowState(false);
1372 if (_pIconListView != null)
1374 _pIconListView->UpdateList();
1375 if (_selectedItemIndex == -1)
1376 _pIconListView->ScrollToItem(0);
1377 _pIconListView->SetShowState(true);
1384 if (_pListView != null)
1386 _pListView->UpdateList();
1394 SubBaseFolderEntryForm::SetNextDisplayPath(void)
1401 fullPath = FolderNavigationPresentationModel::GetCurrentPath();
1403 StringTokenizer tokenizer(fullPath, delim);
1406 DataBindingContext* pContext = null;
1407 pContext = GetDataBindingContextN();
1411 switch (_storageType)
1413 case MEMORY_TYPE_PHONE:
1419 case MEMORY_TYPE_SD_CARD:
1432 //Use a string tokenizer to get the filepath until it's the last token, break the loop when
1433 //it is the last token
1434 while (tokenizer.HasMoreTokens())
1439 tokenizer.GetNextToken(token);
1443 tokenizer.GetNextToken(token);
1444 //dislayPath.Append(L"/");
1445 displayPath.Append(token);
1446 displayPath.Append(L"/");
1450 if (_pLabelDisplayPath != null)
1452 _displayPath.Append(displayPath);
1453 _pLabelDisplayPath->SetText(_displayPath);
1454 _pLabelDisplayPath->Invalidate(true);
1458 if (pContext != null)
1460 //UpdateBinding on the target label control.
1461 pContext->UpdateBinding(L"ID_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
1464 if (pContext != null)
1472 FolderEntryPresentationModel*
1473 SubBaseFolderEntryForm::GetFolderEntryPresentationModel(void)
1475 return _pFolderEntryPM;
1479 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1481 AppLogDebug("ENTER");
1482 result r = E_SUCCESS;
1484 //_pFolderEntryPM->SetFileEventListener(null);
1485 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1486 _pFileManager->DeleteFolderEntries(&filePath);
1488 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1493 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1495 AppLogDebug("ENTER");
1496 DirectoryEntry* pDirStr = null;
1503 _editOrShare = FILE_MANAGE_EDIT;
1504 //If filenames is not empty then Load the edit form.
1505 if (_pFilenames->GetCount() != 0)
1507 //_pFolderEntryPM->SetFileEventListener(null);
1516 AppLogDebug("Share Button Clicked!");
1518 _editOrShare = FILE_MANAGE_SHARE;
1519 if (_pFilenames->GetCount() != 0)
1521 //_pFolderEntryPM->SetFileEventListener(null);
1530 CreateMoreContextMenu();
1532 ShowMoreContextMenu();
1536 case IDA_CONTEXT_MENU_BTN_SORT_BY:
1538 //Show the SortBy PopUp.
1539 if (_pCustomListViewForPopup != null)
1541 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1547 case IDA_CONTEXT_MENU_CREATE_FOLDER:
1549 //Load the CreateFolder Form.
1550 //_pFolderEntryPM->SetFileEventListener(null);
1551 _renameOrCreate = SELECT_CREATE_FOLDER;
1553 if (_pMoreContextMenu != null)
1555 delete _pMoreContextMenu;
1556 _pMoreContextMenu = null;
1559 LoadCreateFolderForm();
1563 case IDA_CONTEXT_MENU_VIEW_AS:
1565 //Show the ViewAs Popup
1566 if (_pCustomListViewForPopup != null)
1568 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1575 case IDA_BTN_POPUP_CANCEL:
1577 //Hide the ViewAs PopUp and redraw the form.
1582 case IDA_BTN_SORT_POPUP_CANCEL:
1584 //Hide the SortBy PopUp and redraw the form.
1589 case IDA_CONTEXT_MENU_BTN_SEARCH:
1591 //Load the SearchForm
1596 case IDA_DELETE_FILE:
1598 HideDeleteConfirmationPopup();
1600 if (_pDeleteConfirmationPopUp != null)
1602 delete _pDeleteConfirmationPopUp;
1603 _pDeleteConfirmationPopUp = null;
1607 if (_pFilenames != null)
1609 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1611 if (pDirStr != null)
1613 _filePath = pDirStr->GetFullFilePath();
1615 _indexTracker = _indexToDelete;
1616 //Call the DeleteFile Function.
1617 DeleteFile(_filePath);
1621 case IDA_CANCEL_DELETION:
1623 HideDeleteConfirmationPopup();
1625 if (_pDeleteConfirmationPopUp != null)
1627 delete _pDeleteConfirmationPopUp;
1628 _pDeleteConfirmationPopUp = null;
1633 case IDA_BTN_ANIMATION_POPUP_CANCEL:
1635 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1636 HideFileProgressingPopup();
1637 _pFileManager->ForceStopWorkerThread();
1641 case IDA_ICONLISTVIEW_DETAILS:
1643 if (_pIconListViewContextMenu != null)
1645 delete _pIconListViewContextMenu;
1646 _pIconListViewContextMenu = null;
1649 if (_bIsTopLevelDirectory == false)
1651 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1653 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1655 if (pDirStr != null)
1657 fullPath = pDirStr->GetFullFilePath();
1663 switch (_currentIndex)
1666 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
1667 fullPath = FolderNavigationPresentationModel::GetMediaPath();
1668 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
1671 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
1672 fullPath = FolderNavigationPresentationModel::GetSdCardPath();
1673 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
1677 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
1678 fullPath = FolderNavigationPresentationModel::GetUsbPath();
1679 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
1684 LoadDetailForm(fullPath);
1688 case IDA_ICONLISTVIEW_DELETE:
1690 if (_pIconListViewContextMenu != null)
1692 delete _pIconListViewContextMenu;
1693 _pIconListViewContextMenu = null;
1696 ShowDeleteConfirmationPopup();
1698 _indexToDelete = _currentIndex;
1703 case IDA_ICONLISTVIEW_RENAME:
1705 if (_pIconListViewContextMenu != null)
1707 delete _pIconListViewContextMenu;
1708 _pIconListViewContextMenu = null;
1711 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1713 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1715 if (pDirStr != null)
1717 _currentFileName.Clear();
1718 _currentFileName = pDirStr->GetFileName();
1722 _renameIndex = _currentIndex;
1723 _renameOrCreate = SELECT_RENAME;
1725 //Load the Rename View of the item selected.
1726 LoadRenameForm(_currentIndex);
1739 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1741 DirectoryEntry* pDirStr = null;
1742 _selectedItemIndex = index;
1743 if (_pFilenames != null)
1745 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1747 if (pDirStr != null)
1751 case IDA_CONTEXT_DETAIL:
1754 _filePath = pDirStr->GetFullFilePath();
1755 LoadDetailForm(_filePath);
1759 case IDA_CONTEXT_RENAME:
1761 _currentFileName.Clear();
1762 _currentFileName = pDirStr->GetFileName();
1763 _renameIndex = index;
1764 _renameOrCreate = SELECT_RENAME;
1765 //Load the Rename View of the item selected.
1766 LoadRenameForm(index);
1770 case IDA_CONTEXT_DELETE:
1772 _indexToDelete = index;
1774 ShowDeleteConfirmationPopup();
1780 //Empty Implementation.
1789 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1791 result res = E_SUCCESS;
1792 AppLogDebug("Enter");
1794 if (_pFolderEntryPM)
1796 if (pThumbReq != null)
1798 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1800 if (pThumbReq->pBitmap != null)
1802 delete pThumbReq->pBitmap;
1808 if (pThumbReq != null)
1810 if (pThumbReq->GetCurrentRequestId() != _pFolderEntryPM->GetCurrentReqId())
1812 if (pThumbReq->pBitmap != null)
1814 delete pThumbReq->pBitmap;
1816 AppLogDebug("mismatch in id so returning");
1822 if (pThumbReq->iRquestId < _pFilenames->GetCount())
1824 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1825 if (_pListView && _pListView->IsVisible())
1827 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1829 else if (_pIconListView && _pIconListView->IsVisible())
1831 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1835 AppLogDebug("Thumbnail Request is not valid");
1839 _pFolderEntryPM->OnThumbnailResponseFailed();
1842 AppLogDebug("Exit %s", GetErrorMessage(res));
1847 SubBaseFolderEntryForm::CreateSortByPopup(void)
1849 result r = E_SUCCESS;
1851 if (_pSortByPopup != null)
1853 AppLogDebug("_pSortByPopup is not null");
1857 String cancelButton;
1858 String sortByPopupTitle;
1860 // Label* pSortByPanelLabel = null;
1861 // Label* pSortByPopupLabel = null;
1863 // Bitmap* pPanelBackground = null;
1864 // Bitmap* pPopUpBackground = null;
1866 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1867 //pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1868 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, 512, 632);
1869 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, 612, 96);
1871 _pSortByPopup = new (std::nothrow) Popup();
1872 _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1874 _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1875 TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1877 _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1878 _pCancelSortBy->AddActionEventListener(*this);
1879 _pCancelSortBy->SetShowState(true);
1881 // pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1882 // TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1884 // pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1885 // TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1887 // if (pPanelBackground != null)
1889 // pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1892 // if (pPopUpBackground != null)
1894 // pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1898 _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1899 TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1901 _pSortByListView->SetShowState(true);
1902 _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1903 _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1904 _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1905 _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1907 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1909 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1910 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1911 _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1912 _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1914 // if (pPanelBackground != null)
1916 // delete pPanelBackground;
1917 // pPanelBackground = null;
1919 // if (pPopUpBackground != null)
1921 // delete pPopUpBackground;
1922 // pPopUpBackground = null;
1927 if (_pCustomListViewForPopup != null)
1929 delete _pCustomListViewForPopup;
1930 _pCustomListViewForPopup = null;
1933 if (_pSortByPopup != null)
1935 delete _pSortByPopup;
1936 _pSortByPopup = null;
1939 // if (pPanelBackground != null)
1941 // delete pPanelBackground;
1942 // pPanelBackground = null;
1945 // if (pPopUpBackground != null)
1947 // delete pPopUpBackground;
1948 // pPopUpBackground = null;
1955 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1957 result r = E_SUCCESS;
1962 AppResource* pAppResource = null;
1963 AppRegistry* pAppRegistry = null;
1966 String extensionVisibility;
1969 String buttonCreateFolder;
1971 Bitmap* pBitmapSortbyContextItem = null;
1972 Bitmap* pBitmapSearchContextItem = null;
1973 Bitmap* pBitmapCreateFolderContextItem = null;
1975 pAppResource = Application::GetInstance()->GetAppResource();
1977 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1979 if (pAppResource != null)
1981 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1982 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
1983 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", search);
1984 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1985 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
1986 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
1987 pBitmapSortbyContextItem = pAppResource->GetBitmapN(IDB_POPUP_SORTBY_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1988 pBitmapSearchContextItem = pAppResource->GetBitmapN(IDB_POPUP_SEARCH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1989 pBitmapCreateFolderContextItem = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1992 pAppRegistry->Get(_extensionKeyName, extensionVisibility);
1994 _pFooter = GetFooter();
1995 if (_pFooter != null)
1997 _pFooter->GetPosition(xPosition, yPosition);
2000 xPosition += 3 * (GetClientAreaBounds().width / 4);
2002 //Create the ContextMenu
2003 _pMoreContextMenu = new (std::nothrow) ContextMenu();
2004 _pMoreContextMenu->Construct(Point(0, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
2005 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2006 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2008 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_TOP_LEVEL_DIRECTORY_FORM)
2010 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2014 if (_bIsDirectoryEmpty == false)
2016 if (CheckSearchHistory() == false)
2018 _pMoreContextMenu->AddItem(search, IDA_CONTEXT_MENU_BTN_SEARCH, *pBitmapSearchContextItem, null, null);
2021 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2022 _pMoreContextMenu->AddItem(sortBy, IDA_CONTEXT_MENU_BTN_SORT_BY, *pBitmapSortbyContextItem, null, null);
2024 if (extensionVisibility == _hideExtension)
2026 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
2030 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
2034 if (SceneManager::GetInstance()->GetCurrentSceneId() != IDSCN_CATEGORY_SEARCH_FORM)
2036 _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER, *pBitmapCreateFolderContextItem, null, null);
2040 //Set the ContextMenu's ActionEventListener
2041 _pMoreContextMenu->AddActionEventListener(*this);
2042 //_pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
2043 _pMoreContextMenu->SetShowState(true);
2045 delete pBitmapSortbyContextItem;
2046 delete pBitmapSearchContextItem;
2047 delete pBitmapCreateFolderContextItem;
2052 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
2054 result r = E_SUCCESS;
2056 int defaultViewAsPopUpSelect = 0;
2057 int uncheckItem1 = 0;
2058 int uncheckItem2 = 0;
2060 int viewType = VIEW_TYPE_AS_NONE;
2061 String viewStyleKeyName(L"ListDisplayType");
2063 AppRegistry* pAppRegistry = null;
2065 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2067 r = pAppRegistry->Get(viewStyleKeyName, viewType);
2072 case VIEW_TYPE_AS_DETAILED_LIST:
2074 defaultViewAsPopUpSelect = 1;
2080 case VIEW_TYPE_AS_NORMAL_LIST:
2082 defaultViewAsPopUpSelect = 0;
2088 case VIEW_TYPE_AS_THUMBNAILS:
2090 defaultViewAsPopUpSelect = 2;
2098 //Empty Implementation.
2104 if (_pCustomListViewForPopup != null)
2106 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
2109 if (_pViewAsPopup != null && _pViewAsListView != null)
2111 _pViewAsListView->UpdateList();
2112 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
2113 _pViewAsListView->SetItemChecked(uncheckItem1, false);
2114 _pViewAsListView->SetItemChecked(uncheckItem2, false);
2115 _pViewAsListView->Invalidate(true);
2122 SubBaseFolderEntryForm::SetFooterVisibility(int mode)
2124 AppLogDebug("Entry");
2125 int folderCount=0, fileCount=0;
2127 _pFooter = GetFooter();
2129 if( _pFolderEntryPM )
2130 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
2132 if (mode == DISABLE_FOOTER_ITEM)
2134 if (folderCount ==0 && fileCount == 0)
2135 _pFooter->SetItemEnabled(0, false);
2136 if (fileCount == 0 )
2137 _pFooter->SetItemEnabled(1, false);
2141 if(folderCount!=0 || fileCount!=0)
2142 _pFooter->SetItemEnabled(0, true);
2144 _pFooter->SetItemEnabled(1, true);
2146 _pFooter->Invalidate(true);
2150 SubBaseFolderEntryForm::CheckSearchHistory(void)
2152 bool searchHistoryStatus = false;
2155 SceneManager* pSceneManager = SceneManager::GetInstance();
2156 IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2158 if (pSceneList != null)
2160 itemCount = pSceneList->GetCount() - 1;
2161 pSceneList->GetAt(itemCount, searchScene);
2162 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2165 pSceneList->GetAt(itemCount, searchScene);
2169 if (searchScene == IDSCN_SEARCH_FORM)
2171 AppLogDebug("Search scene present");
2172 searchHistoryStatus = true;
2176 AppLogDebug("Search scene not present");
2177 searchHistoryStatus = false;
2182 pSceneList->RemoveAll();
2186 return searchHistoryStatus;
2191 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
2193 //Empty Implementation
2197 SubBaseFolderEntryForm::OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2200 if (_currentIndex != INVALID_LIST_INDEX)
2202 ShowIconListViewContextMenu();
2207 SubBaseFolderEntryForm::OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2209 //Empty Implementation.
2213 SubBaseFolderEntryForm::CreateIconListViewContextMenu(void)
2215 if (_pIconListViewContextMenu != null)
2220 result r = E_SUCCESS;
2226 String buttonCreateFolder;
2228 AppResource* pAppResource = null;
2229 //AppRegistry* pAppRegistry = null;
2230 pAppResource = Application::GetInstance()->GetAppResource();
2232 //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2234 if (pAppResource != null)
2236 pAppResource->GetString(L"IDS_MF_SK_DETAILS", Details);
2237 pAppResource->GetString(L"IDS_MF_SK3_DELETE", Delete);
2238 pAppResource->GetString(L"IDS_MF_BODY_RENAME_ABB", Rename);
2241 //Create the ContextMenu
2242 _pIconListViewContextMenu = new (std::nothrow) ContextMenu();
2244 _pIconListViewContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_AUTO);
2245 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2246 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2249 _pIconListViewContextMenu->AddItem(Details, IDA_ICONLISTVIEW_DETAILS);
2250 if (_bIsTopLevelDirectory == false)
2252 _pIconListViewContextMenu->AddItem(Rename, IDA_ICONLISTVIEW_RENAME);
2253 _pIconListViewContextMenu->AddItem(Delete, IDA_ICONLISTVIEW_DELETE);
2256 //Set the ContextMenu's ActionEventListener
2257 _pIconListViewContextMenu->AddActionEventListener(*this);
2258 _pIconListViewContextMenu->SetShowState(true);
2264 SubBaseFolderEntryForm::ShowIconListViewContextMenu(void)
2267 CreateIconListViewContextMenu();
2268 int headerHeight = 0;
2270 int y_Anchor_Position = 0;
2272 Header* pHeader = GetHeader();
2273 headerHeight = pHeader->GetHeight();
2275 y_Anchor_Position = _currentPosition.y + headerHeight + H_DISPLAY_PATH_LABEL;
2277 if (_bIsTopLevelDirectory)
2279 y_Anchor_Position = y_Anchor_Position + H_CATEGORY_PANEL;
2282 if (_pIconListViewContextMenu != null)
2284 _pIconListViewContextMenu->SetAnchorPosition(Point(_currentPosition.x, y_Anchor_Position));
2285 _pIconListViewContextMenu->SetShowState(true);
2286 _pIconListViewContextMenu->Show();
2291 SubBaseFolderEntryForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
2293 _currentPosition.x = currentPosition.x;
2294 _currentPosition.y = currentPosition.y;
2296 if (_pIconListView != null)
2298 _currentIndex = _pIconListView->GetItemIndexFromPosition(_currentPosition);
2305 SubBaseFolderEntryForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2307 //Empty Implementation
2311 SubBaseFolderEntryForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2313 //Empty Implementation
2317 SubBaseFolderEntryForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2319 //Empty Implementation
2322 SubBaseFolderEntryForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2324 //Empty Implementation
2328 SubBaseFolderEntryForm::SetCurrentDirectoryFlag(bool isTopDirectory)
2330 _bIsTopLevelDirectory = isTopDirectory;
2333 SubBaseFolderEntryForm::OnAppControlCompleted(void)
2335 AppLogDebug("Enter");
2336 // int fileCount = 0;
2337 // int folderCount = 0;
2339 // _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(),folderCount, fileCount);
2341 SetFooterVisibility(ENABLE_FOOTER_ITEM);
2343 if( !_bBackFromAppControl )
2346 if (_pListView != null && _pListView->IsVisible())
2348 _pListView->UpdateList();
2351 if (_pIconListView != null && _pIconListView->IsVisible())
2353 _pIconListView->UpdateList();
2356 if (_pFolderEntryPM!=null)
2358 _pFolderEntryPM->InitThumbnailManager();
2360 _pFileEventManager->RemovePath(_fileEventPath);
2361 _bBackFromAppControl = false;
2362 AppLogDebug("Exit");