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 //displayPath.Append(L"\x200E");
1452 displayPath.Append(token);
1453 displayPath.Append(L"/");
1458 if (_pLabelDisplayPath != null)
1461 //_displayPath.Append(L"\x200E");
1462 _displayPath.Append(displayPath);
1463 _displayPath.Append(L"\x200E");
1465 AppLogDebug("SubBaseFolderEntryForm::SetNextDisplayPath:%S", _displayPath.GetPointer());
1467 _pLabelDisplayPath->SetText(_displayPath);
1468 _pLabelDisplayPath->Invalidate(true);
1472 if (pContext != null)
1474 //UpdateBinding on the target label control.
1475 pContext->UpdateBinding(L"ID_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
1478 if (pContext != null)
1486 FolderEntryPresentationModel*
1487 SubBaseFolderEntryForm::GetFolderEntryPresentationModel(void)
1489 return _pFolderEntryPM;
1493 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1495 AppLogDebug("ENTER");
1496 result r = E_SUCCESS;
1498 //_pFolderEntryPM->SetFileEventListener(null);
1499 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1500 _pFileManager->DeleteFolderEntries(&filePath);
1502 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1507 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1509 AppLogDebug("ENTER");
1510 DirectoryEntry* pDirStr = null;
1517 _editOrShare = FILE_MANAGE_EDIT;
1518 //If filenames is not empty then Load the edit form.
1519 if (_pFilenames->GetCount() != 0)
1521 //_pFolderEntryPM->SetFileEventListener(null);
1530 AppLogDebug("Share Button Clicked!");
1532 _editOrShare = FILE_MANAGE_SHARE;
1533 if (_pFilenames->GetCount() != 0)
1535 //_pFolderEntryPM->SetFileEventListener(null);
1544 CreateMoreContextMenu();
1546 ShowMoreContextMenu();
1550 case IDA_CONTEXT_MENU_BTN_SORT_BY:
1552 //Show the SortBy PopUp.
1553 if (_pCustomListViewForPopup != null)
1555 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1561 case IDA_CONTEXT_MENU_CREATE_FOLDER:
1563 //Load the CreateFolder Form.
1564 //_pFolderEntryPM->SetFileEventListener(null);
1565 _renameOrCreate = SELECT_CREATE_FOLDER;
1567 if (_pMoreContextMenu != null)
1569 delete _pMoreContextMenu;
1570 _pMoreContextMenu = null;
1573 LoadCreateFolderForm();
1577 case IDA_CONTEXT_MENU_VIEW_AS:
1579 //Show the ViewAs Popup
1580 if (_pCustomListViewForPopup != null)
1582 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1589 case IDA_BTN_POPUP_CANCEL:
1591 //Hide the ViewAs PopUp and redraw the form.
1596 case IDA_BTN_SORT_POPUP_CANCEL:
1598 //Hide the SortBy PopUp and redraw the form.
1603 case IDA_CONTEXT_MENU_BTN_SEARCH:
1605 //Load the SearchForm
1610 case IDA_DELETE_FILE:
1612 HideDeleteConfirmationPopup();
1614 if (_pDeleteConfirmationPopUp != null)
1616 delete _pDeleteConfirmationPopUp;
1617 _pDeleteConfirmationPopUp = null;
1621 if (_pFilenames != null)
1623 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1625 if (pDirStr != null)
1627 _filePath = pDirStr->GetFullFilePath();
1629 _indexTracker = _indexToDelete;
1630 //Call the DeleteFile Function.
1631 DeleteFile(_filePath);
1635 case IDA_CANCEL_DELETION:
1637 HideDeleteConfirmationPopup();
1639 if (_pDeleteConfirmationPopUp != null)
1641 delete _pDeleteConfirmationPopUp;
1642 _pDeleteConfirmationPopUp = null;
1647 case IDA_BTN_ANIMATION_POPUP_CANCEL:
1649 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1650 HideFileProgressingPopup();
1651 _pFileManager->ForceStopWorkerThread();
1655 case IDA_ICONLISTVIEW_DETAILS:
1657 if (_pIconListViewContextMenu != null)
1659 delete _pIconListViewContextMenu;
1660 _pIconListViewContextMenu = null;
1663 if (_bIsTopLevelDirectory == false)
1665 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1667 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1669 if (pDirStr != null)
1671 fullPath = pDirStr->GetFullFilePath();
1677 switch (_currentIndex)
1680 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
1681 fullPath = FolderNavigationPresentationModel::GetMediaPath();
1682 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
1685 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
1686 fullPath = FolderNavigationPresentationModel::GetSdCardPath();
1687 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
1691 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
1692 fullPath = FolderNavigationPresentationModel::GetUsbPath();
1693 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
1698 LoadDetailForm(fullPath);
1702 case IDA_ICONLISTVIEW_DELETE:
1704 if (_pIconListViewContextMenu != null)
1706 delete _pIconListViewContextMenu;
1707 _pIconListViewContextMenu = null;
1710 ShowDeleteConfirmationPopup();
1712 _indexToDelete = _currentIndex;
1717 case IDA_ICONLISTVIEW_RENAME:
1719 if (_pIconListViewContextMenu != null)
1721 delete _pIconListViewContextMenu;
1722 _pIconListViewContextMenu = null;
1725 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1727 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1729 if (pDirStr != null)
1731 _currentFileName.Clear();
1732 _currentFileName = pDirStr->GetFileName();
1736 _renameIndex = _currentIndex;
1737 _renameOrCreate = SELECT_RENAME;
1739 //Load the Rename View of the item selected.
1740 LoadRenameForm(_currentIndex);
1753 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1755 DirectoryEntry* pDirStr = null;
1756 _selectedItemIndex = index;
1757 if (_pFilenames != null)
1759 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1761 if (pDirStr != null)
1765 case IDA_CONTEXT_DETAIL:
1768 _filePath = pDirStr->GetFullFilePath();
1769 LoadDetailForm(_filePath);
1773 case IDA_CONTEXT_RENAME:
1775 _currentFileName.Clear();
1776 _currentFileName = pDirStr->GetFileName();
1777 _renameIndex = index;
1778 _renameOrCreate = SELECT_RENAME;
1779 //Load the Rename View of the item selected.
1780 LoadRenameForm(index);
1784 case IDA_CONTEXT_DELETE:
1786 _indexToDelete = index;
1788 ShowDeleteConfirmationPopup();
1794 //Empty Implementation.
1803 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1805 result res = E_SUCCESS;
1806 AppLogDebug("Enter");
1808 if (_pFolderEntryPM)
1810 if (pThumbReq != null)
1812 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1814 if (pThumbReq->pBitmap != null)
1816 delete pThumbReq->pBitmap;
1822 if (pThumbReq != null)
1824 if (pThumbReq->GetCurrentRequestId() != _pFolderEntryPM->GetCurrentReqId())
1826 if (pThumbReq->pBitmap != null)
1828 delete pThumbReq->pBitmap;
1830 AppLogDebug("mismatch in id so returning");
1836 if (pThumbReq->iRquestId < _pFilenames->GetCount())
1838 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1839 if (_pListView && _pListView->IsVisible())
1841 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1843 else if (_pIconListView && _pIconListView->IsVisible())
1845 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1849 AppLogDebug("Thumbnail Request is not valid");
1853 _pFolderEntryPM->OnThumbnailResponseFailed();
1856 AppLogDebug("Exit %s", GetErrorMessage(res));
1861 SubBaseFolderEntryForm::CreateSortByPopup(void)
1863 result r = E_SUCCESS;
1865 if (_pSortByPopup != null)
1867 AppLogDebug("_pSortByPopup is not null");
1871 String cancelButton;
1872 String sortByPopupTitle;
1874 // Label* pSortByPanelLabel = null;
1875 // Label* pSortByPopupLabel = null;
1877 // Bitmap* pPanelBackground = null;
1878 // Bitmap* pPopUpBackground = null;
1880 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1881 //pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1882 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, 512, 632);
1883 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, 612, 96);
1885 _pSortByPopup = new (std::nothrow) Popup();
1886 _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1888 _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1889 TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1891 _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1892 _pCancelSortBy->AddActionEventListener(*this);
1893 _pCancelSortBy->SetShowState(true);
1895 // pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1896 // TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1898 // pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1899 // TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1901 // if (pPanelBackground != null)
1903 // pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1906 // if (pPopUpBackground != null)
1908 // pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1912 _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1913 TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1915 _pSortByListView->SetShowState(true);
1916 _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1917 _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1918 _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1919 _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1921 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1923 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1924 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1925 _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1926 _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1928 // if (pPanelBackground != null)
1930 // delete pPanelBackground;
1931 // pPanelBackground = null;
1933 // if (pPopUpBackground != null)
1935 // delete pPopUpBackground;
1936 // pPopUpBackground = null;
1941 if (_pCustomListViewForPopup != null)
1943 delete _pCustomListViewForPopup;
1944 _pCustomListViewForPopup = null;
1947 if (_pSortByPopup != null)
1949 delete _pSortByPopup;
1950 _pSortByPopup = null;
1953 // if (pPanelBackground != null)
1955 // delete pPanelBackground;
1956 // pPanelBackground = null;
1959 // if (pPopUpBackground != null)
1961 // delete pPopUpBackground;
1962 // pPopUpBackground = null;
1969 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1971 result r = E_SUCCESS;
1976 AppResource* pAppResource = null;
1977 AppRegistry* pAppRegistry = null;
1980 String extensionVisibility;
1983 String buttonCreateFolder;
1985 Bitmap* pBitmapSortbyContextItem = null;
1986 Bitmap* pBitmapSearchContextItem = null;
1987 Bitmap* pBitmapCreateFolderContextItem = null;
1989 pAppResource = Application::GetInstance()->GetAppResource();
1991 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1993 if (pAppResource != null)
1995 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1996 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
1997 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", search);
1998 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1999 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
2000 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
2001 pBitmapSortbyContextItem = pAppResource->GetBitmapN(IDB_POPUP_SORTBY_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
2002 pBitmapSearchContextItem = pAppResource->GetBitmapN(IDB_POPUP_SEARCH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
2003 pBitmapCreateFolderContextItem = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
2006 pAppRegistry->Get(_extensionKeyName, extensionVisibility);
2008 _pFooter = GetFooter();
2009 if (_pFooter != null)
2011 _pFooter->GetPosition(xPosition, yPosition);
2014 xPosition += 3 * (GetClientAreaBounds().width / 4);
2016 //Create the ContextMenu
2017 _pMoreContextMenu = new (std::nothrow) ContextMenu();
2018 _pMoreContextMenu->Construct(Point(0, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
2019 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2020 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2022 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_TOP_LEVEL_DIRECTORY_FORM)
2024 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2028 if (_bIsDirectoryEmpty == false)
2030 if (CheckSearchHistory() == false)
2032 _pMoreContextMenu->AddItem(search, IDA_CONTEXT_MENU_BTN_SEARCH, *pBitmapSearchContextItem, null, null);
2035 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2036 _pMoreContextMenu->AddItem(sortBy, IDA_CONTEXT_MENU_BTN_SORT_BY, *pBitmapSortbyContextItem, null, null);
2038 if (extensionVisibility == _hideExtension)
2040 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
2044 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
2048 if (SceneManager::GetInstance()->GetCurrentSceneId() != IDSCN_CATEGORY_SEARCH_FORM)
2050 _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER, *pBitmapCreateFolderContextItem, null, null);
2054 //Set the ContextMenu's ActionEventListener
2055 _pMoreContextMenu->AddActionEventListener(*this);
2056 //_pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
2057 _pMoreContextMenu->SetShowState(true);
2059 delete pBitmapSortbyContextItem;
2060 delete pBitmapSearchContextItem;
2061 delete pBitmapCreateFolderContextItem;
2066 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
2068 result r = E_SUCCESS;
2070 int defaultViewAsPopUpSelect = 0;
2071 int uncheckItem1 = 0;
2072 int uncheckItem2 = 0;
2074 int viewType = VIEW_TYPE_AS_NONE;
2075 String viewStyleKeyName(L"ListDisplayType");
2077 AppRegistry* pAppRegistry = null;
2079 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2081 r = pAppRegistry->Get(viewStyleKeyName, viewType);
2086 case VIEW_TYPE_AS_DETAILED_LIST:
2088 defaultViewAsPopUpSelect = 1;
2094 case VIEW_TYPE_AS_NORMAL_LIST:
2096 defaultViewAsPopUpSelect = 0;
2102 case VIEW_TYPE_AS_THUMBNAILS:
2104 defaultViewAsPopUpSelect = 2;
2112 //Empty Implementation.
2118 if (_pCustomListViewForPopup != null)
2120 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
2123 if (_pViewAsPopup != null && _pViewAsListView != null)
2125 _pViewAsListView->UpdateList();
2126 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
2127 _pViewAsListView->SetItemChecked(uncheckItem1, false);
2128 _pViewAsListView->SetItemChecked(uncheckItem2, false);
2129 _pViewAsListView->Invalidate(true);
2136 SubBaseFolderEntryForm::SetFooterVisibility(void)
2138 AppLogDebug("Entry");
2139 int folderCount=0, fileCount=0;
2141 _pFooter = GetFooter();
2143 if( _pFolderEntryPM )
2144 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
2146 if (folderCount ==0 && fileCount == 0)
2148 _pFooter->SetItemEnabled(0, false);
2149 _pFooter->SetItemEnabled(1, false);
2153 _pFooter->SetItemEnabled(0, true);
2157 _pFooter->SetItemEnabled(1, true);
2161 _pFooter->SetItemEnabled(1, false);
2166 _pFooter->Invalidate(true);
2170 SubBaseFolderEntryForm::CheckSearchHistory(void)
2172 bool searchHistoryStatus = false;
2175 SceneManager* pSceneManager = SceneManager::GetInstance();
2176 IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2178 if (pSceneList != null)
2180 itemCount = pSceneList->GetCount() - 1;
2181 pSceneList->GetAt(itemCount, searchScene);
2182 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2185 pSceneList->GetAt(itemCount, searchScene);
2189 if (searchScene == IDSCN_SEARCH_FORM)
2191 AppLogDebug("Search scene present");
2192 searchHistoryStatus = true;
2196 AppLogDebug("Search scene not present");
2197 searchHistoryStatus = false;
2202 pSceneList->RemoveAll();
2206 return searchHistoryStatus;
2211 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
2213 //Empty Implementation
2217 SubBaseFolderEntryForm::OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2220 if (_currentIndex != INVALID_LIST_INDEX)
2222 ShowIconListViewContextMenu();
2227 SubBaseFolderEntryForm::OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2229 //Empty Implementation.
2233 SubBaseFolderEntryForm::CreateIconListViewContextMenu(void)
2235 if (_pIconListViewContextMenu != null)
2240 result r = E_SUCCESS;
2246 String buttonCreateFolder;
2248 AppResource* pAppResource = null;
2249 //AppRegistry* pAppRegistry = null;
2250 pAppResource = Application::GetInstance()->GetAppResource();
2252 //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2254 if (pAppResource != null)
2256 pAppResource->GetString(L"IDS_MF_SK_DETAILS", Details);
2257 pAppResource->GetString(L"IDS_MF_SK3_DELETE", Delete);
2258 pAppResource->GetString(L"IDS_MF_BODY_RENAME_ABB", Rename);
2261 //Create the ContextMenu
2262 _pIconListViewContextMenu = new (std::nothrow) ContextMenu();
2264 _pIconListViewContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_AUTO);
2265 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2266 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2269 _pIconListViewContextMenu->AddItem(Details, IDA_ICONLISTVIEW_DETAILS);
2270 if (_bIsTopLevelDirectory == false)
2272 _pIconListViewContextMenu->AddItem(Rename, IDA_ICONLISTVIEW_RENAME);
2273 _pIconListViewContextMenu->AddItem(Delete, IDA_ICONLISTVIEW_DELETE);
2276 //Set the ContextMenu's ActionEventListener
2277 _pIconListViewContextMenu->AddActionEventListener(*this);
2278 _pIconListViewContextMenu->SetShowState(true);
2284 SubBaseFolderEntryForm::ShowIconListViewContextMenu(void)
2287 CreateIconListViewContextMenu();
2288 int headerHeight = 0;
2290 int y_Anchor_Position = 0;
2292 Header* pHeader = GetHeader();
2293 headerHeight = pHeader->GetHeight();
2296 y_Anchor_Position = _currentPosition.y + headerHeight + H_DISPLAY_PATH_LABEL + 60;
2298 if (_bIsTopLevelDirectory)
2300 y_Anchor_Position = y_Anchor_Position + H_CATEGORY_PANEL;
2303 if (_pIconListViewContextMenu != null)
2305 _pIconListViewContextMenu->SetAnchorPosition(Point(_currentPosition.x, y_Anchor_Position));
2306 _pIconListViewContextMenu->SetShowState(true);
2307 _pIconListViewContextMenu->Show();
2312 SubBaseFolderEntryForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
2314 _currentPosition.x = currentPosition.x;
2315 _currentPosition.y = currentPosition.y;
2317 if (_pIconListView != null)
2319 _currentIndex = _pIconListView->GetItemIndexFromPosition(_currentPosition);
2326 SubBaseFolderEntryForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2328 //Empty Implementation
2332 SubBaseFolderEntryForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2334 //Empty Implementation
2338 SubBaseFolderEntryForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2340 //Empty Implementation
2343 SubBaseFolderEntryForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2345 //Empty Implementation
2349 SubBaseFolderEntryForm::SetCurrentDirectoryFlag(bool isTopDirectory)
2351 _bIsTopLevelDirectory = isTopDirectory;
2354 SubBaseFolderEntryForm::OnAppControlCompleted(void)
2356 AppLogDebug("Enter");
2357 if (_pFolderEntryPM!=null)
2359 if (_pFolderEntryPM->GetSourceForm() != CREATE_ITEM_SOURCE_CATEGORY_SEARCH_FORM)
2361 SetFooterVisibility();
2365 if( !_bBackFromAppControl )
2368 if (_pListView != null && _pListView->IsVisible())
2370 _pListView->UpdateList();
2373 if (_pIconListView != null && _pIconListView->IsVisible())
2375 _pIconListView->UpdateList();
2378 if (_pFolderEntryPM!=null)
2380 _pFolderEntryPM->InitThumbnailManager();
2382 _pFileEventManager->RemovePath(_fileEventPath);
2383 _bBackFromAppControl = false;
2384 AppLogDebug("Exit");
2388 SubBaseFolderEntryForm::OnSceneIdChanged(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& previousSceneId)
2390 if ( _pFolderEntryPM !=null)
2392 if( currentSceneId.CompareTo(IDSCN_SUB_DIRECTORY_FORM))
2394 _pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SUB_FOLDER_FILE_LIST_TWO);
2396 else if (currentSceneId.CompareTo(IDSCN_SUB_DIRECTORY_FORM1))
2398 _pFolderEntryPM->SetSourceForm(CREATE_ITEM_SOURCE_SUB_FOLDER_FILE_LIST);
2404 SubBaseFolderEntryForm::OnSettingValueChanged(void)
2406 AppLogDebug("Entry");
2407 if (_pListView != null && _pListView->IsVisible())
2409 _pListView->UpdateList();
2412 if (_pIconListView != null && _pIconListView->IsVisible())
2414 _pIconListView->UpdateList();