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;
170 if (_pIconListViewContextMenu != null)
172 delete _pIconListViewContextMenu;
176 SubBaseFolderEntryForm&
177 SubBaseFolderEntryForm::operator =(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
182 SubBaseFolderEntryForm::SubBaseFolderEntryForm(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
188 SubBaseFolderEntryForm::CreateFooterControls(void)
190 AppLogDebug("ENTER");
191 //Create Footer and controls contained within the footer
192 result r = E_SUCCESS;
194 AppResource* pAppResource = null;
198 ButtonItem footerItemMenu;
200 Bitmap* pBitmap = null;
201 Bitmap* pBitmapDisabled = null;
202 Bitmap* pBitmapPress = null;
204 pAppResource = Application::GetInstance()->GetAppResource();
206 if (pAppResource != null)
208 pAppResource->GetString(L"IDS_MF_SK3_EDIT", buttonEdit);
209 pAppResource->GetString(L"IDS_COM_BUTTON_SHARE", buttonShare);
210 pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);
211 pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888);
212 pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
215 footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);
216 //Construct the 4 FooterItems Copy, Create , Sort By and More
220 _pEdit = new (std::nothrow) FooterItem();
221 _pEdit->Construct(IDA_BTN_EDIT);
222 _pEdit->SetText(buttonEdit);
227 _pShare = new (std::nothrow) FooterItem();
228 _pShare->Construct(IDA_BTN_SHARE);
229 _pShare->SetText(buttonShare);
232 TryCatch(pBitmap != null, , "MfMyFilesApp::Bitmap pBitmap null");
233 TryCatch(pBitmapDisabled != null, , "MfMyFilesApp::Bitmap pBitmapDisabled null");
234 TryCatch(pBitmapPress != null, , "MfMyFilesApp::Bitmap pBitmapPress null");
236 pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
237 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);
239 pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
240 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled);
242 pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
243 footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);
246 //Get the Footer and set the FooterItems.
247 _pFooter = GetFooter();
248 if (_pFooter != null)
250 _pFooter->RemoveAllButtons();
251 _pFooter->RemoveAllItems();
253 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
254 _pFooter->AddItem(*_pEdit);
255 _pFooter->AddItem(*_pShare);
256 _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu);
258 //Set am ActionEventListener to the Footer
259 _pFooter->AddActionEventListener(*this);
260 _pFooter->SetBackButton();
261 _pFooter->SetItemEnabled(0, false);
262 _pFooter->SetItemEnabled(1, false);
263 _pFooter->SetBackButtonEnabled(true);
264 _pFooter->Invalidate(true);
269 delete pBitmapDisabled;
279 if (pBitmapDisabled != null)
281 delete pBitmapDisabled;
288 SubBaseFolderEntryForm::CreateDeleteConfirmationPopUp(void)
290 result r = E_SUCCESS;
291 Rectangle popupBounds;
293 //Create a new popup control
294 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
295 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
297 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
298 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
300 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
301 _pDeleteFile->AddActionEventListener(*this);
302 _pDeleteFile->SetShowState(true);
304 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
305 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
307 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
308 _pCancelDeletion->AddActionEventListener(*this);
309 _pCancelDeletion->SetShowState(true);
315 if (_pDeleteConfirmationPopUp != null)
317 delete _pDeleteConfirmationPopUp;
318 _pDeleteConfirmationPopUp = null;
325 SubBaseFolderEntryForm::ShowSortByPopup(void)
330 //Set the showstate of the popup to true. so that it's displayed on the form.
331 if (_pSortByPopup != null)
333 _pSortByPopup->SetShowState(true);
334 _pSortByPopup->Invalidate(true);
335 _pSortByPopup->Show();
338 SetDefaultSelectionForSortByPopUp();
343 SubBaseFolderEntryForm::HideSortByPopup(void)
345 //Set the showstate of the popup to false. so that it's hidden on the form.
346 if (_pSortByPopup != null && _pSortByPopup->IsVisible())
348 _pSortByPopup->SetShowState(false);
354 SubBaseFolderEntryForm::LoadRenameForm(int index)
356 result r = E_SUCCESS;
357 _renameOrCreate = SELECT_RENAME;
358 ArrayList* pArg = null;
359 Integer* pSourceSelected = null;
360 SceneManager* pSceneManager = null;
361 DirectoryEntry* pDirectory = null;
363 if(_pFilenames != null)
365 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
366 TryCatch(pDirectory != null, , "failed to allocate memeory to cast to DirectoryEntry");
369 pArg = new (std::nothrow) ArrayList();
370 r = pArg->Construct();
372 pSourceSelected = new (std::nothrow) Integer(_renameOrCreate);
374 pArg->Add(pSourceSelected);
375 TryCatch(r == E_SUCCESS, , "failed to construct parg");
377 //pArg->Add(__rootMediaPath);
378 pArg->Add(pDirectory);
379 TryCatch(r == E_SUCCESS, , "failed to construct parg");
381 pSceneManager = SceneManager::GetInstance();
382 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
384 //pSceneManager->GoForward(SCENE_RENAME_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
385 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
387 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
391 if (pSourceSelected != null)
393 delete pSourceSelected;
394 pSourceSelected = null;
396 if (pDirectory != null)
409 SubBaseFolderEntryForm::LoadSearchForm(void)
411 ArrayList* pTopLevelDirectoryList = null;
412 ArrayList* pFilepathList = null;
413 SceneManager* pSceneManager = null;
415 pTopLevelDirectoryList= new (std::nothrow) ArrayList();
416 if (pTopLevelDirectoryList != null && _pFilenames != null)
418 pFilepathList = new (std::nothrow) ArrayList();
419 if (pFilepathList != null)
421 pFilepathList->Construct();
422 pFilepathList->AddItems(*_pFilenames);
423 pTopLevelDirectoryList->Add(pFilepathList);
427 TryCatch(pTopLevelDirectoryList != null, , "failed to Get SceneManager instance");
429 pSceneManager = SceneManager::GetInstance();
430 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
432 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pTopLevelDirectoryList);
438 if (pFilepathList != null)
440 delete pFilepathList;
441 pFilepathList = null;
444 if (pTopLevelDirectoryList != null)
446 delete pTopLevelDirectoryList;
447 pTopLevelDirectoryList = null;
452 SubBaseFolderEntryForm::ShowViewAsPopup(void)
454 //Call functions to create the popups.
455 CreateViewAsPopupControl();
457 //Set the showstate of the popup to true. so that it's displayed on the form.
458 if (_pViewAsPopup != null)
460 _pViewAsPopup->SetShowState(true);
461 _pViewAsPopup->Show();
464 SetDefaultSelectionForViewAsPopUp();
468 SubBaseFolderEntryForm::HideViewAsPopup(void)
470 //Set the showstate of the popup to false. so that it's hidden on the form.
471 if (_pViewAsPopup != null && _pViewAsPopup->IsVisible())
473 _pViewAsPopup->SetShowState(false);
478 SubBaseFolderEntryForm::LoadCreateFolderForm(void)
480 //Load the CreateFolder view in the current directory.
481 result r = E_SUCCESS;
482 Integer* pSourceSelected = null;
483 SceneManager* pSceneManager = null;
484 ArrayList* pArg = null;
486 pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
488 pArg = new (std::nothrow) ArrayList();
489 r = pArg->Construct();
491 pArg->Add(pSourceSelected);
492 TryCatch(r == E_SUCCESS, , "failed to construct parg");
494 pSceneManager = SceneManager::GetInstance();
495 TryCatch(pSceneManager != null, , "failed to construct parg");
497 //pSceneManager->GoForward(SCENE_CREATE_FOLDER_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
498 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
503 if (pSourceSelected != null)
505 delete pSourceSelected;
515 SubBaseFolderEntryForm::LoadDetailForm(Tizen::Base::String& Fullpath)
517 result r = E_SUCCESS;
519 SceneManager* pSceneManager = null;
520 ArrayList* pList = null;
521 String* pFullFilePath = null;
523 pList = new (std::nothrow) ArrayList();
524 r = pList->Construct();
526 pFullFilePath = new (std::nothrow) String(Fullpath);
527 pList->Add(pFullFilePath);
529 pSceneManager = SceneManager::GetInstance();
530 TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
532 //pSceneManager->GoForward(SCENE_FILE_DETAIL_FORM, pList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
533 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
534 AppLogDebug("Exit: %s", GetErrorMessage(r));
538 AppLogDebug("Exit: %s", GetErrorMessage(r));
539 if (pFullFilePath != null)
541 delete pFullFilePath;
542 pFullFilePath = null;
554 SubBaseFolderEntryForm::LoadEditForm(void)
556 AppLogDebug("ENTER");
557 //__pFileListPM->SetFileEventListener(null);
558 SceneManager* pSceneManager = SceneManager::GetInstance();
559 ArrayList* pArgs = null;
561 pArgs = new (std::nothrow) ArrayList();
562 //pArgs->Construct();
568 pArgs->Add(* new (std::nothrow) Integer(_editOrShare));
570 pArgs->Add(*_pFolderEntryPM);
573 if (pSceneManager != null)
575 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
589 SubBaseFolderEntryForm::ShowFileProgressingPopup(void)
591 CreateFileProgressingPopup();
593 if (_pFileProgressingPopup != null)
595 _pFileProgressingPopup->SetShowState(true);
596 _pFileProgressingPopup->Show();
601 SubBaseFolderEntryForm::HideFileProgressingPopup(void)
603 if (_pFileProgressingPopup != null)
605 _pFileProgressingPopup->SetShowState(false);
607 if (_pFileProgressingPopup != null)
609 delete _pFileProgressingPopup;
610 _pFileProgressingPopup = null;
616 SubBaseFolderEntryForm::CreateFileProgressingPopup(void)
618 AppLogDebug("Enter");
619 result r = E_SUCCESS;
622 //String fileProgress;
624 if (_pFileProgressingPopup != null)
626 AppLogDebug("_pFileProgressingPopup is not null");
630 AppResource* pAppResource = null;
631 pAppResource = UiApp::GetInstance()->GetAppResource();
632 TryCatch(pAppResource != null, , "Failed to fetch AppResource");
634 //pAppResource->GetString(L"IDS_FILE_PROCESSING", popUpTitle);
635 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
636 //pAppResource->GetString(L"IDS_FILE_PROGRESS", fileProgress);
638 _pFileProgressingPopup = new (std::nothrow) Popup();
639 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
640 TryCatch(_pFileProgressingPopup != null, , "Failed to allocate memory to FileProgressing Popup.");
642 //_pFileProgressingPopup->SetTitleText(popUpTitle); //Not in UI
645 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
646 TryCatch(_pFileProgressingCancelButton != null, , "Failed to fetch _pFileProgressingCancelButton.");
648 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
649 _pFileProgressingCancelButton->AddActionEventListener(*this);
650 _pFileProgressingCancelButton->SetShowState(true);
652 _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
653 TryCatch(_pFileProgressingProgress != null, , "Failed to fetch _pFileProgressingProgress.");
655 _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
656 _pFileProgressingProgress->SetValue(0);
658 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
659 TryCatch(_pFileProgressingHeaderLabel != null, , "Failed to fetch _pFileProgressingHeaderLabel.");
661 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
662 _pFileProgressingHeaderLabel->SetText(deleting);
663 _pFileProgressingHeaderLabel->SetShowState(true);
664 _pFileProgressingHeaderLabel->Invalidate(true);
667 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
668 TryCatch(_pFileProgressingLabel != null, , "Failed to fetch _pFileProgressingLabel.");
670 _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
671 //_pFileProgressingLabel->SetText(fileProgress);
672 _pFileProgressingLabel->SetShowState(true);
679 if (_pFileProgressingPopup != null)
681 delete _pFileProgressingPopup;
682 _pFileProgressingPopup = null;
689 SubBaseFolderEntryForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
691 int x_FooterPosition = 0;
692 int y_FooterPosition = 0;
693 int x_ContextMenu = 0;
694 int y_ContextMenu = 0;
696 Rectangle listViewBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
697 Rectangle labelBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
699 _pFooter = GetFooter();
700 if (_pFooter != null)
702 _pFooter->GetPosition(x_FooterPosition, y_FooterPosition);
705 x_ContextMenu = x_FooterPosition + 3 * (listViewBounds.width / 4);
706 y_ContextMenu = y_FooterPosition;
708 switch (orientationStatus)
710 case ORIENTATION_STATUS_PORTRAIT:
712 if (_pListView != null)
714 _pListView->SetBounds(listViewBounds);
716 if (_pIconListView != null)
718 _pIconListView->SetBounds(listViewBounds);
720 if (_pMoreContextMenu != null)
722 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
724 /* if (__pLabelDisplayPath != null)
726 __pLabelDisplayPath->SetBounds(labelBounds);
731 case ORIENTATION_STATUS_LANDSCAPE:
733 if (_pListView != null)
735 _pListView->SetBounds(listViewBounds);
737 if (_pIconListView != null)
739 _pIconListView->SetBounds(listViewBounds);
741 if (_pMoreContextMenu != null)
743 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
745 /* if (__pLabelDisplayPath != null)
747 __pLabelDisplayPath->SetBounds(labelBounds);
763 SubBaseFolderEntryForm::OnFileManagingStart(void)
765 ShowFileProgressingPopup();
769 SubBaseFolderEntryForm::OnFileManagingStop(FileManagingResult fileManagingResult)
771 //Empty Implementation.
775 SubBaseFolderEntryForm::HideFileExtension(void)
777 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
778 String viewStyleKeyName(L"ListDisplayType");
780 result r = E_SUCCESS;
782 AppRegistry* pAppRegistry = null;
783 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
786 if (pAppRegistry != null)
788 r = pAppRegistry->Set(_extensionKeyName, _hideExtension);
789 r = pAppRegistry->Save();
791 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
793 if (_pMoreContextMenu != null)
795 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
796 AppLogDebug("error %s", GetErrorMessage(r));
799 //Update the corresponding List.
800 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
802 if (_pListView != null && _pListView->IsVisible())
804 _pListView->SetShowState(false);
806 if (_pIconListView != null)
808 _pIconListView->SetShowState(true);
809 _pIconListView->UpdateList();
814 if (_pIconListView != null && _pIconListView->IsVisible())
816 _pIconListView->SetShowState(false);
818 if (_pListView != null)
820 _pListView->UpdateList();
821 _pListView->SetShowState(true);
825 if (_pMoreContextMenu != null)
827 delete _pMoreContextMenu;
828 _pMoreContextMenu = null;
833 AppLogDebug("Exit : %s", GetErrorMessage(r));
837 SubBaseFolderEntryForm::ShowFileExtension(void)
839 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
840 String viewStyleKeyName(L"ListDisplayType");
842 result r = E_SUCCESS;
844 AppRegistry* pAppRegistry = null;
845 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
847 if (pAppRegistry != null)
849 r = pAppRegistry->Set(_extensionKeyName, _showExtension);
850 r = pAppRegistry->Save();
852 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
855 if (_pMoreContextMenu != null)
857 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
858 AppLogDebug("error %s", GetErrorMessage(r));
861 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
863 if (_pListView != null && _pListView->IsVisible())
865 _pListView->SetShowState(false);
867 if (_pIconListView != null)
869 _pIconListView->UpdateList();
870 _pIconListView->SetShowState(true);
875 if (_pIconListView != null && _pIconListView->IsVisible())
877 _pIconListView->SetShowState(false);
879 if (_pListView != null)
881 _pListView->UpdateList();
882 _pListView->SetShowState(true);
886 if (_pMoreContextMenu != null)
888 delete _pMoreContextMenu;
889 _pMoreContextMenu = null;
893 AppLogDebug("Exit: %s", GetErrorMessage(r));
898 SubBaseFolderEntryForm::HideDeleteConfirmationPopup(void)
900 if (_pDeleteConfirmationPopUp != null && _pDeleteConfirmationPopUp->IsVisible())
902 _pDeleteConfirmationPopUp->SetShowState(false);
907 SubBaseFolderEntryForm::ShowDeleteConfirmationPopup(void)
909 CreateDeleteConfirmationPopUp();
911 if (_pDeleteConfirmationPopUp != null)
913 _pDeleteConfirmationPopUp->SetShowState(true);
914 _pDeleteConfirmationPopUp->Show();
919 SubBaseFolderEntryForm::CreateViewAsPopupControl(void)
921 AppLogDebug("ENTER");
922 //Creates a popup control for the ViewAs context item asking which view is to be shown
924 result r = E_SUCCESS;
926 if (_pViewAsPopup != null)
928 AppLogDebug("_pViewAsPopup is not null");
932 String viewAsPopupTitle;
934 String sortByPopupTitle;
936 // Label* pViewAsPanelLabel = null;
938 // Label* pViewAsPopupLabel = null;
940 // Bitmap* pPanelBackground = null;
941 // Bitmap* pPopUpBackground = null;
943 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
944 // pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
946 //Create a new popup control
947 _pViewAsPopup = new (std::nothrow) Popup();
948 _pViewAsPopup->Construct(L"IDL_VIEW_AS_POPUP");
950 //The cancel button inside the popup, hides the popup when clicked.
951 _pCancelViewAs = static_cast< Button* >(_pViewAsPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
952 TryCatch(_pCancelViewAs != null, , "MfMyFilesApp::Button For Popup not created!");
954 _pCancelViewAs->SetActionId(IDA_BTN_POPUP_CANCEL);
955 _pCancelViewAs->AddActionEventListener(*this);
956 _pCancelViewAs->SetShowState(true);
958 // pViewAsPanelLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
959 // TryCatch(pViewAsPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
961 // pViewAsPopupLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
962 // TryCatch(pViewAsPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
964 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, pViewAsPanelLabel->GetWidth(), pViewAsPanelLabel->GetHeight());
965 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, pViewAsPopupLabel->GetWidth(), pViewAsPopupLabel->GetHeight());
967 // if (pPanelBackground != null)
969 // pViewAsPanelLabel->SetBackgroundBitmap(*pPanelBackground);
972 // if (pPopUpBackground != null)
974 // pViewAsPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
977 //The listview control which is to be added inside the popup. The itemprovider and listener are
978 //implemented in another class because this class already contains an instance of Listview control
979 //attached to an ItemProvider.
981 _pViewAsPopup->SetControlAlwaysOnTop(*_pCancelViewAs, true);
984 _pViewAsListView = static_cast< ListView* >(_pViewAsPopup->GetControl(L"IDC_LISTVIEW_VIEW_AS", true));
985 TryCatch(_pViewAsListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
987 _pViewAsListView->SetShowState(true);
988 _pViewAsListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
989 _pViewAsListView->SetItemProvider(*_pCustomListViewForPopup);
990 _pViewAsListView->SetName(L"VIEW_AS_LISTVIEW");
991 _pViewAsListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
993 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
995 // if (pPanelBackground != null)
997 // delete pPanelBackground;
998 // pPanelBackground = null;
1000 // if (pPopUpBackground != null)
1002 // delete pPopUpBackground;
1003 // pPopUpBackground = null;
1008 if (_pViewAsPopup != null)
1010 delete _pViewAsPopup;
1011 _pViewAsPopup = null;
1014 if (_pCustomListViewForPopup != null)
1016 delete _pCustomListViewForPopup;
1017 _pCustomListViewForPopup = null;
1020 // if (pPanelBackground != null)
1022 // delete pPanelBackground;
1023 // pPanelBackground = null;
1026 // if (pPopUpBackground != null)
1028 // delete pPopUpBackground;
1029 // pPopUpBackground = null;
1035 SubBaseFolderEntryForm::ShowMoreContextMenu(void)
1037 String extensionStatus;
1039 AppRegistry* pAppRegistry = null;
1040 result r = E_SUCCESS;
1041 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1043 //Show ContextMenu with More Options
1044 if (pAppRegistry != null)
1046 r = pAppRegistry->Get(_extensionKeyName, extensionStatus);
1049 if (_pMoreContextMenu != null)
1051 if (extensionStatus == _hideExtension)
1053 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1057 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1060 _pMoreContextMenu->SetShowState(true);
1061 _pMoreContextMenu->Show();
1064 AppLogDebug("Exit: %s", GetErrorMessage(r));
1068 SubBaseFolderEntryForm::OnListViewItemStateChangedNotify(ViewType listViewStyle)
1070 AppLogDebug("ENTER");
1072 int popupSource = POP_UP_VIEW_AS;
1073 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1074 int thumbnailRequestId = 0;
1076 AppRegistry* pAppRegistry = null;
1077 String sortByKeyName(L"SortBy");
1079 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1081 if (_pCustomListViewForPopup != null)
1083 popupSource = _pCustomListViewForPopup->GetSelectionPopup();
1086 pAppRegistry->Get(sortByKeyName, sortType);
1088 if (popupSource == POP_UP_VIEW_AS)
1090 _flagViewAsStatus = listViewStyle;
1100 if (_pFolderEntryPM != null)
1102 thumbnailRequestId = _pFolderEntryPM->GetCurrentReqId() + 1;
1103 _pFolderEntryPM->SetCurrentReqId(thumbnailRequestId);
1104 if (_pFolderEntryPM != null && _pFolderEntryPM->GetSourceForm() != CREATE_ITEM_SOURCE_SPLIT_PANEL_DIR_TREE)
1106 _pFolderEntryPM->SortFolderEntries();
1110 if (_pListView != null && _pListView->IsVisible())
1112 _pListView->UpdateList();
1116 if (_pIconListView != null && _pIconListView->IsVisible())
1118 _pIconListView->UpdateList();
1122 if (_pFolderEntryPM != null)
1124 _pFolderEntryPM->InitThumbnailManager();
1129 if (_pMoreContextMenu != null)
1131 delete _pMoreContextMenu;
1132 _pMoreContextMenu = null;
1136 SubBaseFolderEntryForm::OnIconListViewItemStateChangeNotify()
1138 if (_pIconListView != null && _pIconListView->IsVisible())
1140 _pIconListView->UpdateList();
1144 SubBaseFolderEntryForm::OnFooterStateChangeNotify(void)
1146 SetFooterVisibility();
1148 _pFooter = GetFooter();
1149 if (_pFooter != null)
1151 _pFooter->Invalidate(true);
1156 SubBaseFolderEntryForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1158 AppLogDebug("OnAppControlCompleteResponseReceived");
1159 result r = E_SUCCESS;
1160 CustomAppControl::GetInstance()->SetAppControlInUse(null);
1162 ContentType contentType = CONTENT_TYPE_UNKNOWN;
1163 contentType = ContentManagerUtil::CheckContentType(_pathOfSelectedFile);
1164 AppLogDebug("OnAppControlCompleteResponseReceived:%d", contentType);
1166 if (GetLastResult() == E_FILE_NOT_FOUND)
1168 _pFolderEntryPM->RefreshFolderEntries();
1169 if (_pListView != null && _pListView->IsVisible())
1171 r = _pListView->UpdateList();
1174 if (_pIconListView != null && _pIconListView->IsVisible())
1176 r = _pIconListView->UpdateList();
1178 _pFolderEntryPM->InitThumbnailManager();
1183 SubBaseFolderEntryForm::SetDefaultSelectionForSortByPopUp(void)
1185 result r = E_SUCCESS;
1187 int defaultSortPopUpSelect = 0;
1189 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1191 int uncheckItem1 = 0;
1192 int uncheckItem2 = 0;
1193 int uncheckItem3 = 0;
1194 int uncheckItem4 = 0;
1195 int uncheckItem5 = 0;
1197 String sortByKeyName(L"SortBy");
1199 AppRegistry* pAppRegistry = null;
1201 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1203 r = pAppRegistry->Get(sortByKeyName, sortType);
1204 TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
1209 case SORT_BY_TYPE_NAME_ASCENDING:
1211 defaultSortPopUpSelect = 0;
1220 case SORT_BY_TYPE_NAME_DESCENDING:
1222 defaultSortPopUpSelect = 1;
1231 case SORT_BY_TYPE_DATE_RECENT:
1233 defaultSortPopUpSelect = 2;
1243 case SORT_BY_TYPE_DATE_OLDEST:
1245 defaultSortPopUpSelect = 3;
1254 case SORT_BY_TYPE_SIZE_ASCENDING:
1256 defaultSortPopUpSelect = 4;
1265 case SORT_BY_TYPE_SIZE_DESCENDING:
1267 defaultSortPopUpSelect = 4;
1276 case SORT_BY_TYPE_ASCENDING:
1278 defaultSortPopUpSelect = 5;
1288 case SORT_BY_TYPE_DESCENDING:
1290 defaultSortPopUpSelect = 5;
1302 defaultSortPopUpSelect = 0;
1303 AppLogDebug("UnSupported case reached");
1308 if (_pCustomListViewForPopup != null)
1310 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1313 if (_pSortByPopup != null && _pSortByListView != null)
1315 _pSortByListView->UpdateList();
1316 _pSortByListView->SetItemChecked(defaultSortPopUpSelect, true);
1317 _pSortByListView->SetItemChecked(uncheckItem1, false);
1318 _pSortByListView->SetItemChecked(uncheckItem2, false);
1319 _pSortByListView->SetItemChecked(uncheckItem3, false);
1320 _pSortByListView->SetItemChecked(uncheckItem4, false);
1321 _pSortByListView->SetItemChecked(uncheckItem5, false);
1323 _pSortByListView->Invalidate(true);
1332 SubBaseFolderEntryForm::SwitchViewType(void)
1334 String viewStyleKeyName(L"ListDisplayType");
1336 switch (_flagViewAsStatus)
1339 case VIEW_TYPE_AS_DETAILED_LIST:
1341 if (_pIconListView != null && _pIconListView->IsVisible())
1343 _pIconListView->SetShowState(false);
1345 if (_pListView != null)
1347 _pListView->UpdateList();
1348 if (_selectedItemIndex == -1)
1349 _pListView->ScrollToItem(0);
1350 _pListView->SetShowState(true);
1356 case VIEW_TYPE_AS_NORMAL_LIST:
1358 if (_pIconListView != null && _pIconListView->IsVisible())
1360 _pIconListView->SetShowState(false);
1363 if (_pListView != null)
1365 _pListView->UpdateList();
1366 if (_selectedItemIndex == -1)
1367 _pListView->ScrollToItem(0);
1368 _pListView->SetShowState(true);
1373 case VIEW_TYPE_AS_THUMBNAILS:
1375 if (_pListView != null && _pListView->IsVisible())
1377 _pListView->SetShowState(false);
1379 if (_pIconListView != null)
1381 _pIconListView->UpdateList();
1382 if (_selectedItemIndex == -1)
1383 _pIconListView->ScrollToItem(0);
1384 _pIconListView->SetShowState(true);
1391 if (_pListView != null)
1393 _pListView->UpdateList();
1401 SubBaseFolderEntryForm::SetNextDisplayPath(void)
1408 fullPath = FolderNavigationPresentationModel::GetCurrentPath();
1410 StringTokenizer tokenizer(fullPath, delim);
1413 DataBindingContext* pContext = null;
1414 pContext = GetDataBindingContextN();
1418 switch (_storageType)
1420 case MEMORY_TYPE_PHONE:
1426 case MEMORY_TYPE_SD_CARD:
1439 //Use a string tokenizer to get the filepath until it's the last token, break the loop when
1440 //it is the last token
1441 while (tokenizer.HasMoreTokens())
1446 tokenizer.GetNextToken(token);
1450 tokenizer.GetNextToken(token);
1451 //dislayPath.Append(L"/");
1452 displayPath.Append(token);
1453 displayPath.Append(L"/");
1457 if (_pLabelDisplayPath != null)
1459 _displayPath.Append(displayPath);
1460 _pLabelDisplayPath->SetText(_displayPath);
1461 _pLabelDisplayPath->Invalidate(true);
1465 if (pContext != null)
1467 //UpdateBinding on the target label control.
1468 pContext->UpdateBinding(L"ID_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
1471 if (pContext != null)
1479 FolderEntryPresentationModel*
1480 SubBaseFolderEntryForm::GetFolderEntryPresentationModel(void)
1482 return _pFolderEntryPM;
1486 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1488 AppLogDebug("ENTER");
1489 result r = E_SUCCESS;
1491 //_pFolderEntryPM->SetFileEventListener(null);
1492 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1493 _pFileManager->DeleteFolderEntries(&filePath);
1495 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1500 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1502 AppLogDebug("ENTER");
1503 DirectoryEntry* pDirStr = null;
1510 _editOrShare = FILE_MANAGE_EDIT;
1511 //If filenames is not empty then Load the edit form.
1512 if (_pFilenames->GetCount() != 0)
1514 //_pFolderEntryPM->SetFileEventListener(null);
1523 AppLogDebug("Share Button Clicked!");
1525 _editOrShare = FILE_MANAGE_SHARE;
1526 if (_pFilenames->GetCount() != 0)
1528 //_pFolderEntryPM->SetFileEventListener(null);
1537 CreateMoreContextMenu();
1539 ShowMoreContextMenu();
1543 case IDA_CONTEXT_MENU_BTN_SORT_BY:
1545 //Show the SortBy PopUp.
1546 if (_pCustomListViewForPopup != null)
1548 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1554 case IDA_CONTEXT_MENU_CREATE_FOLDER:
1556 //Load the CreateFolder Form.
1557 //_pFolderEntryPM->SetFileEventListener(null);
1558 _renameOrCreate = SELECT_CREATE_FOLDER;
1560 if (_pMoreContextMenu != null)
1562 delete _pMoreContextMenu;
1563 _pMoreContextMenu = null;
1566 LoadCreateFolderForm();
1570 case IDA_CONTEXT_MENU_VIEW_AS:
1572 //Show the ViewAs Popup
1573 if (_pCustomListViewForPopup != null)
1575 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1582 case IDA_BTN_POPUP_CANCEL:
1584 //Hide the ViewAs PopUp and redraw the form.
1589 case IDA_BTN_SORT_POPUP_CANCEL:
1591 //Hide the SortBy PopUp and redraw the form.
1596 case IDA_CONTEXT_MENU_BTN_SEARCH:
1598 //Load the SearchForm
1603 case IDA_DELETE_FILE:
1605 HideDeleteConfirmationPopup();
1607 if (_pDeleteConfirmationPopUp != null)
1609 delete _pDeleteConfirmationPopUp;
1610 _pDeleteConfirmationPopUp = null;
1614 if (_pFilenames != null)
1616 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1618 if (pDirStr != null)
1620 _filePath = pDirStr->GetFullFilePath();
1622 _indexTracker = _indexToDelete;
1623 //Call the DeleteFile Function.
1624 DeleteFile(_filePath);
1628 case IDA_CANCEL_DELETION:
1630 HideDeleteConfirmationPopup();
1632 if (_pDeleteConfirmationPopUp != null)
1634 delete _pDeleteConfirmationPopUp;
1635 _pDeleteConfirmationPopUp = null;
1640 case IDA_BTN_ANIMATION_POPUP_CANCEL:
1642 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1643 HideFileProgressingPopup();
1644 _pFileManager->ForceStopWorkerThread();
1648 case IDA_ICONLISTVIEW_DETAILS:
1650 if (_pIconListViewContextMenu != null)
1652 delete _pIconListViewContextMenu;
1653 _pIconListViewContextMenu = null;
1656 if (_bIsTopLevelDirectory == false)
1658 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1660 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1662 if (pDirStr != null)
1664 fullPath = pDirStr->GetFullFilePath();
1670 switch (_currentIndex)
1673 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
1674 fullPath = FolderNavigationPresentationModel::GetMediaPath();
1675 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
1678 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
1679 fullPath = FolderNavigationPresentationModel::GetSdCardPath();
1680 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
1684 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
1685 fullPath = FolderNavigationPresentationModel::GetUsbPath();
1686 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
1691 LoadDetailForm(fullPath);
1695 case IDA_ICONLISTVIEW_DELETE:
1697 if (_pIconListViewContextMenu != null)
1699 delete _pIconListViewContextMenu;
1700 _pIconListViewContextMenu = null;
1703 ShowDeleteConfirmationPopup();
1705 _indexToDelete = _currentIndex;
1710 case IDA_ICONLISTVIEW_RENAME:
1712 if (_pIconListViewContextMenu != null)
1714 delete _pIconListViewContextMenu;
1715 _pIconListViewContextMenu = null;
1718 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1720 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1722 if (pDirStr != null)
1724 _currentFileName.Clear();
1725 _currentFileName = pDirStr->GetFileName();
1729 _renameIndex = _currentIndex;
1730 _renameOrCreate = SELECT_RENAME;
1732 //Load the Rename View of the item selected.
1733 LoadRenameForm(_currentIndex);
1746 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1748 DirectoryEntry* pDirStr = null;
1749 _selectedItemIndex = index;
1750 if (_pFilenames != null)
1752 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1754 if (pDirStr != null)
1758 case IDA_CONTEXT_DETAIL:
1761 _filePath = pDirStr->GetFullFilePath();
1762 LoadDetailForm(_filePath);
1766 case IDA_CONTEXT_RENAME:
1768 _currentFileName.Clear();
1769 _currentFileName = pDirStr->GetFileName();
1770 _renameIndex = index;
1771 _renameOrCreate = SELECT_RENAME;
1772 //Load the Rename View of the item selected.
1773 LoadRenameForm(index);
1777 case IDA_CONTEXT_DELETE:
1779 _indexToDelete = index;
1781 ShowDeleteConfirmationPopup();
1787 //Empty Implementation.
1796 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1798 result res = E_SUCCESS;
1799 AppLogDebug("Enter");
1801 if (_pFolderEntryPM)
1803 if (pThumbReq != null)
1805 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1807 if (pThumbReq->pBitmap != null)
1809 delete pThumbReq->pBitmap;
1815 if (pThumbReq != null)
1817 if (pThumbReq->GetCurrentRequestId() != _pFolderEntryPM->GetCurrentReqId())
1819 if (pThumbReq->pBitmap != null)
1821 delete pThumbReq->pBitmap;
1823 AppLogDebug("mismatch in id so returning");
1829 if (pThumbReq->iRquestId < _pFilenames->GetCount())
1831 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1832 if (_pListView && _pListView->IsVisible())
1834 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1836 else if (_pIconListView && _pIconListView->IsVisible())
1838 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1842 AppLogDebug("Thumbnail Request is not valid");
1846 _pFolderEntryPM->OnThumbnailResponseFailed();
1849 AppLogDebug("Exit %s", GetErrorMessage(res));
1854 SubBaseFolderEntryForm::CreateSortByPopup(void)
1856 result r = E_SUCCESS;
1858 if (_pSortByPopup != null)
1860 AppLogDebug("_pSortByPopup is not null");
1864 String cancelButton;
1865 String sortByPopupTitle;
1867 // Label* pSortByPanelLabel = null;
1868 // Label* pSortByPopupLabel = null;
1870 // Bitmap* pPanelBackground = null;
1871 // Bitmap* pPopUpBackground = null;
1873 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1874 //pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1875 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, 512, 632);
1876 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, 612, 96);
1878 _pSortByPopup = new (std::nothrow) Popup();
1879 _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1881 _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1882 TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1884 _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1885 _pCancelSortBy->AddActionEventListener(*this);
1886 _pCancelSortBy->SetShowState(true);
1888 // pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1889 // TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1891 // pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1892 // TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1894 // if (pPanelBackground != null)
1896 // pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1899 // if (pPopUpBackground != null)
1901 // pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1905 _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1906 TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1908 _pSortByListView->SetShowState(true);
1909 _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1910 _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1911 _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1912 _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1914 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1916 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1917 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1918 _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1919 _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1921 // if (pPanelBackground != null)
1923 // delete pPanelBackground;
1924 // pPanelBackground = null;
1926 // if (pPopUpBackground != null)
1928 // delete pPopUpBackground;
1929 // pPopUpBackground = null;
1934 if (_pCustomListViewForPopup != null)
1936 delete _pCustomListViewForPopup;
1937 _pCustomListViewForPopup = null;
1940 if (_pSortByPopup != null)
1942 delete _pSortByPopup;
1943 _pSortByPopup = null;
1946 // if (pPanelBackground != null)
1948 // delete pPanelBackground;
1949 // pPanelBackground = null;
1952 // if (pPopUpBackground != null)
1954 // delete pPopUpBackground;
1955 // pPopUpBackground = null;
1962 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1964 result r = E_SUCCESS;
1969 AppResource* pAppResource = null;
1970 AppRegistry* pAppRegistry = null;
1973 String extensionVisibility;
1976 String buttonCreateFolder;
1978 Bitmap* pBitmapSortbyContextItem = null;
1979 Bitmap* pBitmapSearchContextItem = null;
1980 Bitmap* pBitmapCreateFolderContextItem = null;
1982 pAppResource = Application::GetInstance()->GetAppResource();
1984 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1986 if (pAppResource != null)
1988 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1989 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
1990 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", search);
1991 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1992 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
1993 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
1994 pBitmapSortbyContextItem = pAppResource->GetBitmapN(IDB_POPUP_SORTBY_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1995 pBitmapSearchContextItem = pAppResource->GetBitmapN(IDB_POPUP_SEARCH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1996 pBitmapCreateFolderContextItem = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1999 pAppRegistry->Get(_extensionKeyName, extensionVisibility);
2001 _pFooter = GetFooter();
2002 if (_pFooter != null)
2004 _pFooter->GetPosition(xPosition, yPosition);
2007 xPosition += 3 * (GetClientAreaBounds().width / 4);
2009 //Create the ContextMenu
2010 _pMoreContextMenu = new (std::nothrow) ContextMenu();
2011 _pMoreContextMenu->Construct(Point(0, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
2012 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2013 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2015 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_TOP_LEVEL_DIRECTORY_FORM)
2017 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2021 if (_bIsDirectoryEmpty == false)
2023 if (CheckSearchHistory() == false)
2025 _pMoreContextMenu->AddItem(search, IDA_CONTEXT_MENU_BTN_SEARCH, *pBitmapSearchContextItem, null, null);
2028 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2029 _pMoreContextMenu->AddItem(sortBy, IDA_CONTEXT_MENU_BTN_SORT_BY, *pBitmapSortbyContextItem, null, null);
2031 if (extensionVisibility == _hideExtension)
2033 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
2037 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
2041 if (SceneManager::GetInstance()->GetCurrentSceneId() != IDSCN_CATEGORY_SEARCH_FORM)
2043 _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER, *pBitmapCreateFolderContextItem, null, null);
2047 //Set the ContextMenu's ActionEventListener
2048 _pMoreContextMenu->AddActionEventListener(*this);
2049 //_pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
2050 _pMoreContextMenu->SetShowState(true);
2052 delete pBitmapSortbyContextItem;
2053 delete pBitmapSearchContextItem;
2054 delete pBitmapCreateFolderContextItem;
2059 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
2061 result r = E_SUCCESS;
2063 int defaultViewAsPopUpSelect = 0;
2064 int uncheckItem1 = 0;
2065 int uncheckItem2 = 0;
2067 int viewType = VIEW_TYPE_AS_NONE;
2068 String viewStyleKeyName(L"ListDisplayType");
2070 AppRegistry* pAppRegistry = null;
2072 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2074 r = pAppRegistry->Get(viewStyleKeyName, viewType);
2079 case VIEW_TYPE_AS_DETAILED_LIST:
2081 defaultViewAsPopUpSelect = 1;
2087 case VIEW_TYPE_AS_NORMAL_LIST:
2089 defaultViewAsPopUpSelect = 0;
2095 case VIEW_TYPE_AS_THUMBNAILS:
2097 defaultViewAsPopUpSelect = 2;
2105 //Empty Implementation.
2111 if (_pCustomListViewForPopup != null)
2113 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
2116 if (_pViewAsPopup != null && _pViewAsListView != null)
2118 _pViewAsListView->UpdateList();
2119 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
2120 _pViewAsListView->SetItemChecked(uncheckItem1, false);
2121 _pViewAsListView->SetItemChecked(uncheckItem2, false);
2122 _pViewAsListView->Invalidate(true);
2129 SubBaseFolderEntryForm::SetFooterVisibility(void)
2131 AppLogDebug("Entry");
2132 int folderCount=0, fileCount=0;
2134 _pFooter = GetFooter();
2136 if( _pFolderEntryPM )
2137 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
2139 if (folderCount ==0 && fileCount == 0)
2141 _pFooter->SetItemEnabled(0, false);
2142 _pFooter->SetItemEnabled(1, false);
2146 _pFooter->SetItemEnabled(0, true);
2150 _pFooter->SetItemEnabled(1, true);
2154 _pFooter->SetItemEnabled(1, false);
2159 _pFooter->Invalidate(true);
2163 SubBaseFolderEntryForm::CheckSearchHistory(void)
2165 bool searchHistoryStatus = false;
2168 SceneManager* pSceneManager = SceneManager::GetInstance();
2169 IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2171 if (pSceneList != null)
2173 itemCount = pSceneList->GetCount() - 1;
2174 pSceneList->GetAt(itemCount, searchScene);
2175 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2178 pSceneList->GetAt(itemCount, searchScene);
2182 if (searchScene == IDSCN_SEARCH_FORM)
2184 AppLogDebug("Search scene present");
2185 searchHistoryStatus = true;
2189 AppLogDebug("Search scene not present");
2190 searchHistoryStatus = false;
2195 pSceneList->RemoveAll();
2199 return searchHistoryStatus;
2204 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
2206 //Empty Implementation
2210 SubBaseFolderEntryForm::OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2213 if (_currentIndex != INVALID_LIST_INDEX)
2215 ShowIconListViewContextMenu();
2220 SubBaseFolderEntryForm::OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2222 //Empty Implementation.
2226 SubBaseFolderEntryForm::CreateIconListViewContextMenu(void)
2228 if (_pIconListViewContextMenu != null)
2233 result r = E_SUCCESS;
2239 String buttonCreateFolder;
2241 AppResource* pAppResource = null;
2242 //AppRegistry* pAppRegistry = null;
2243 pAppResource = Application::GetInstance()->GetAppResource();
2245 //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2247 if (pAppResource != null)
2249 pAppResource->GetString(L"IDS_MF_SK_DETAILS", Details);
2250 pAppResource->GetString(L"IDS_MF_SK3_DELETE", Delete);
2251 pAppResource->GetString(L"IDS_MF_BODY_RENAME_ABB", Rename);
2254 //Create the ContextMenu
2255 _pIconListViewContextMenu = new (std::nothrow) ContextMenu();
2257 _pIconListViewContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_AUTO);
2258 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2259 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2262 _pIconListViewContextMenu->AddItem(Details, IDA_ICONLISTVIEW_DETAILS);
2263 if (_bIsTopLevelDirectory == false)
2265 _pIconListViewContextMenu->AddItem(Rename, IDA_ICONLISTVIEW_RENAME);
2266 _pIconListViewContextMenu->AddItem(Delete, IDA_ICONLISTVIEW_DELETE);
2269 //Set the ContextMenu's ActionEventListener
2270 _pIconListViewContextMenu->AddActionEventListener(*this);
2271 _pIconListViewContextMenu->SetShowState(true);
2277 SubBaseFolderEntryForm::ShowIconListViewContextMenu(void)
2280 CreateIconListViewContextMenu();
2281 int headerHeight = 0;
2283 int y_Anchor_Position = 0;
2285 Header* pHeader = GetHeader();
2286 headerHeight = pHeader->GetHeight();
2289 y_Anchor_Position = _currentPosition.y + headerHeight + H_DISPLAY_PATH_LABEL + 60;
2291 if (_bIsTopLevelDirectory)
2293 y_Anchor_Position = y_Anchor_Position + H_CATEGORY_PANEL;
2296 if (_pIconListViewContextMenu != null)
2298 _pIconListViewContextMenu->SetAnchorPosition(Point(_currentPosition.x, y_Anchor_Position));
2299 _pIconListViewContextMenu->SetShowState(true);
2300 _pIconListViewContextMenu->Show();
2305 SubBaseFolderEntryForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
2307 _currentPosition.x = currentPosition.x;
2308 _currentPosition.y = currentPosition.y;
2310 if (_pIconListView != null)
2312 _currentIndex = _pIconListView->GetItemIndexFromPosition(_currentPosition);
2319 SubBaseFolderEntryForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2321 //Empty Implementation
2325 SubBaseFolderEntryForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2327 //Empty Implementation
2331 SubBaseFolderEntryForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2333 //Empty Implementation
2336 SubBaseFolderEntryForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2338 //Empty Implementation
2342 SubBaseFolderEntryForm::SetCurrentDirectoryFlag(bool isTopDirectory)
2344 _bIsTopLevelDirectory = isTopDirectory;
2347 SubBaseFolderEntryForm::OnAppControlCompleted(void)
2349 AppLogDebug("Enter");
2350 if (_pFolderEntryPM!=null)
2352 if (_pFolderEntryPM->GetSourceForm() != CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM)
2354 SetFooterVisibility();
2358 if( !_bBackFromAppControl )
2361 if (_pListView != null && _pListView->IsVisible())
2363 _pListView->UpdateList();
2366 if (_pIconListView != null && _pIconListView->IsVisible())
2368 _pIconListView->UpdateList();
2371 if (_pFolderEntryPM!=null)
2373 _pFolderEntryPM->InitThumbnailManager();
2375 _pFileEventManager->RemovePath(_fileEventPath);
2376 _bBackFromAppControl = false;
2377 AppLogDebug("Exit");
2381 SubBaseFolderEntryForm::OnSceneIdChanged(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& previousSceneId)
2383 if ( _pFolderEntryPM !=null)
2385 if( currentSceneId.CompareTo(IDSCN_SUB_DIRECTORY_FORM))
2387 _pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SUB_FOLDER_FILE_LIST_TWO);
2389 else if (currentSceneId.CompareTo(IDSCN_SUB_DIRECTORY_FORM1))
2391 _pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SUB_FOLDER_FILE_LIST);