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->SetBackButtonEnabled(true);
262 _pFooter->Invalidate(true);
267 delete pBitmapDisabled;
277 if (pBitmapDisabled != null)
279 delete pBitmapDisabled;
286 SubBaseFolderEntryForm::CreateDeleteConfirmationPopUp(void)
288 result r = E_SUCCESS;
289 Rectangle popupBounds;
291 //Create a new popup control
292 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
293 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
295 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
296 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
298 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
299 _pDeleteFile->AddActionEventListener(*this);
300 _pDeleteFile->SetShowState(true);
302 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
303 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
305 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
306 _pCancelDeletion->AddActionEventListener(*this);
307 _pCancelDeletion->SetShowState(true);
313 if (_pDeleteConfirmationPopUp != null)
315 delete _pDeleteConfirmationPopUp;
316 _pDeleteConfirmationPopUp = null;
323 SubBaseFolderEntryForm::ShowSortByPopup(void)
328 //Set the showstate of the popup to true. so that it's displayed on the form.
329 if (_pSortByPopup != null)
331 _pSortByPopup->SetShowState(true);
332 _pSortByPopup->Invalidate(true);
333 _pSortByPopup->Show();
336 SetDefaultSelectionForSortByPopUp();
341 SubBaseFolderEntryForm::HideSortByPopup(void)
343 //Set the showstate of the popup to false. so that it's hidden on the form.
344 if (_pSortByPopup != null && _pSortByPopup->IsVisible())
346 _pSortByPopup->SetShowState(false);
352 SubBaseFolderEntryForm::LoadRenameForm(int index)
354 result r = E_SUCCESS;
355 _renameOrCreate = SELECT_RENAME;
356 ArrayList* pArg = null;
357 Integer* pSourceSelected = null;
358 SceneManager* pSceneManager = null;
359 DirectoryEntry* pDirectory = null;
361 if(_pFilenames != null)
363 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
364 TryCatch(pDirectory != null, , "failed to allocate memeory to cast to DirectoryEntry");
367 pArg = new (std::nothrow) ArrayList();
368 r = pArg->Construct();
370 pSourceSelected = new (std::nothrow) Integer(_renameOrCreate);
372 pArg->Add(pSourceSelected);
373 TryCatch(r == E_SUCCESS, , "failed to construct parg");
375 //pArg->Add(__rootMediaPath);
376 pArg->Add(pDirectory);
377 TryCatch(r == E_SUCCESS, , "failed to construct parg");
379 pSceneManager = SceneManager::GetInstance();
380 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
382 //pSceneManager->GoForward(SCENE_RENAME_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
383 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
385 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
389 if (pSourceSelected != null)
391 delete pSourceSelected;
392 pSourceSelected = null;
394 if (pDirectory != null)
407 SubBaseFolderEntryForm::LoadSearchForm(void)
409 ArrayList* pTopLevelDirectoryList = null;
410 ArrayList* pFilepathList = null;
411 SceneManager* pSceneManager = null;
413 pTopLevelDirectoryList= new (std::nothrow) ArrayList();
414 if (pTopLevelDirectoryList != null && _pFilenames != null)
416 pFilepathList = new (std::nothrow) ArrayList();
417 if (pFilepathList != null)
419 pFilepathList->Construct();
420 pFilepathList->AddItems(*_pFilenames);
421 pTopLevelDirectoryList->Add(pFilepathList);
425 TryCatch(pTopLevelDirectoryList != null, , "failed to Get SceneManager instance");
427 pSceneManager = SceneManager::GetInstance();
428 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
430 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pTopLevelDirectoryList);
436 if (pFilepathList != null)
438 delete pFilepathList;
439 pFilepathList = null;
442 if (pTopLevelDirectoryList != null)
444 delete pTopLevelDirectoryList;
445 pTopLevelDirectoryList = null;
450 SubBaseFolderEntryForm::ShowViewAsPopup(void)
452 //Call functions to create the popups.
453 CreateViewAsPopupControl();
455 //Set the showstate of the popup to true. so that it's displayed on the form.
456 if (_pViewAsPopup != null)
458 _pViewAsPopup->SetShowState(true);
459 _pViewAsPopup->Show();
462 SetDefaultSelectionForViewAsPopUp();
466 SubBaseFolderEntryForm::HideViewAsPopup(void)
468 //Set the showstate of the popup to false. so that it's hidden on the form.
469 if (_pViewAsPopup != null && _pViewAsPopup->IsVisible())
471 _pViewAsPopup->SetShowState(false);
476 SubBaseFolderEntryForm::LoadCreateFolderForm(void)
478 //Load the CreateFolder view in the current directory.
479 result r = E_SUCCESS;
480 Integer* pSourceSelected = null;
481 SceneManager* pSceneManager = null;
482 ArrayList* pArg = null;
484 pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
486 pArg = new (std::nothrow) ArrayList();
487 r = pArg->Construct();
489 pArg->Add(pSourceSelected);
490 TryCatch(r == E_SUCCESS, , "failed to construct parg");
492 pSceneManager = SceneManager::GetInstance();
493 TryCatch(pSceneManager != null, , "failed to construct parg");
495 //pSceneManager->GoForward(SCENE_CREATE_FOLDER_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
496 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
501 if (pSourceSelected != null)
503 delete pSourceSelected;
513 SubBaseFolderEntryForm::LoadDetailForm(Tizen::Base::String& Fullpath)
515 result r = E_SUCCESS;
517 SceneManager* pSceneManager = null;
518 ArrayList* pList = null;
519 String* pFullFilePath = null;
521 pList = new (std::nothrow) ArrayList();
522 r = pList->Construct();
524 pFullFilePath = new (std::nothrow) String(Fullpath);
525 pList->Add(pFullFilePath);
527 pSceneManager = SceneManager::GetInstance();
528 TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
530 //pSceneManager->GoForward(SCENE_FILE_DETAIL_FORM, pList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
531 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
532 AppLogDebug("Exit: %s", GetErrorMessage(r));
536 AppLogDebug("Exit: %s", GetErrorMessage(r));
537 if (pFullFilePath != null)
539 delete pFullFilePath;
540 pFullFilePath = null;
552 SubBaseFolderEntryForm::LoadEditForm(void)
554 AppLogDebug("ENTER");
555 //__pFileListPM->SetFileEventListener(null);
556 SceneManager* pSceneManager = SceneManager::GetInstance();
557 ArrayList* pArgs = null;
559 pArgs = new (std::nothrow) ArrayList();
560 //pArgs->Construct();
566 pArgs->Add(* new (std::nothrow) Integer(_editOrShare));
568 pArgs->Add(*_pFolderEntryPM);
571 if (pSceneManager != null)
573 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
587 SubBaseFolderEntryForm::ShowFileProgressingPopup(void)
589 CreateFileProgressingPopup();
591 if (_pFileProgressingPopup != null)
593 _pFileProgressingPopup->SetShowState(true);
594 _pFileProgressingPopup->Show();
599 SubBaseFolderEntryForm::HideFileProgressingPopup(void)
601 if (_pFileProgressingPopup != null)
603 _pFileProgressingPopup->SetShowState(false);
605 if (_pFileProgressingPopup != null)
607 delete _pFileProgressingPopup;
608 _pFileProgressingPopup = null;
614 SubBaseFolderEntryForm::CreateFileProgressingPopup(void)
616 AppLogDebug("Enter");
617 result r = E_SUCCESS;
620 //String fileProgress;
622 if (_pFileProgressingPopup != null)
624 AppLogDebug("_pFileProgressingPopup is not null");
628 AppResource* pAppResource = null;
629 pAppResource = UiApp::GetInstance()->GetAppResource();
630 TryCatch(pAppResource != null, , "Failed to fetch AppResource");
632 //pAppResource->GetString(L"IDS_FILE_PROCESSING", popUpTitle);
633 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
634 //pAppResource->GetString(L"IDS_FILE_PROGRESS", fileProgress);
636 _pFileProgressingPopup = new (std::nothrow) Popup();
637 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
638 TryCatch(_pFileProgressingPopup != null, , "Failed to allocate memory to FileProgressing Popup.");
640 //_pFileProgressingPopup->SetTitleText(popUpTitle); //Not in UI
643 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
644 TryCatch(_pFileProgressingCancelButton != null, , "Failed to fetch _pFileProgressingCancelButton.");
646 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
647 _pFileProgressingCancelButton->AddActionEventListener(*this);
648 _pFileProgressingCancelButton->SetShowState(true);
650 _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
651 TryCatch(_pFileProgressingProgress != null, , "Failed to fetch _pFileProgressingProgress.");
653 _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
654 _pFileProgressingProgress->SetValue(0);
656 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
657 TryCatch(_pFileProgressingHeaderLabel != null, , "Failed to fetch _pFileProgressingHeaderLabel.");
659 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
660 _pFileProgressingHeaderLabel->SetText(deleting);
661 _pFileProgressingHeaderLabel->SetShowState(true);
662 _pFileProgressingHeaderLabel->Invalidate(true);
665 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
666 TryCatch(_pFileProgressingLabel != null, , "Failed to fetch _pFileProgressingLabel.");
668 _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
669 //_pFileProgressingLabel->SetText(fileProgress);
670 _pFileProgressingLabel->SetShowState(true);
677 if (_pFileProgressingPopup != null)
679 delete _pFileProgressingPopup;
680 _pFileProgressingPopup = null;
687 SubBaseFolderEntryForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
689 int x_FooterPosition = 0;
690 int y_FooterPosition = 0;
691 int x_ContextMenu = 0;
692 int y_ContextMenu = 0;
694 Rectangle listViewBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
695 Rectangle labelBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
697 _pFooter = GetFooter();
698 if (_pFooter != null)
700 _pFooter->GetPosition(x_FooterPosition, y_FooterPosition);
703 x_ContextMenu = x_FooterPosition + 3 * (listViewBounds.width / 4);
704 y_ContextMenu = y_FooterPosition;
706 switch (orientationStatus)
708 case ORIENTATION_STATUS_PORTRAIT:
710 if (_pListView != null)
712 _pListView->SetBounds(listViewBounds);
714 if (_pIconListView != null)
716 _pIconListView->SetBounds(listViewBounds);
718 if (_pMoreContextMenu != null)
720 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
722 /* if (__pLabelDisplayPath != null)
724 __pLabelDisplayPath->SetBounds(labelBounds);
729 case ORIENTATION_STATUS_LANDSCAPE:
731 if (_pListView != null)
733 _pListView->SetBounds(listViewBounds);
735 if (_pIconListView != null)
737 _pIconListView->SetBounds(listViewBounds);
739 if (_pMoreContextMenu != null)
741 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
743 /* if (__pLabelDisplayPath != null)
745 __pLabelDisplayPath->SetBounds(labelBounds);
761 SubBaseFolderEntryForm::OnFileManagingStart(void)
763 ShowFileProgressingPopup();
767 SubBaseFolderEntryForm::OnFileManagingStop(FileManagingResult fileManagingResult)
769 //Empty Implementation.
773 SubBaseFolderEntryForm::HideFileExtension(void)
775 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
776 String viewStyleKeyName(L"ListDisplayType");
778 result r = E_SUCCESS;
780 AppRegistry* pAppRegistry = null;
781 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
784 if (pAppRegistry != null)
786 r = pAppRegistry->Set(_extensionKeyName, _hideExtension);
787 r = pAppRegistry->Save();
789 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
791 if (_pMoreContextMenu != null)
793 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
794 AppLogDebug("error %s", GetErrorMessage(r));
797 //Update the corresponding List.
798 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
800 if (_pListView != null && _pListView->IsVisible())
802 _pListView->SetShowState(false);
804 if (_pIconListView != null)
806 _pIconListView->SetShowState(true);
807 _pIconListView->UpdateList();
812 if (_pIconListView != null && _pIconListView->IsVisible())
814 _pIconListView->SetShowState(false);
816 if (_pListView != null)
818 _pListView->UpdateList();
819 _pListView->SetShowState(true);
823 if (_pMoreContextMenu != null)
825 delete _pMoreContextMenu;
826 _pMoreContextMenu = null;
831 AppLogDebug("Exit : %s", GetErrorMessage(r));
835 SubBaseFolderEntryForm::ShowFileExtension(void)
837 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
838 String viewStyleKeyName(L"ListDisplayType");
840 result r = E_SUCCESS;
842 AppRegistry* pAppRegistry = null;
843 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
845 if (pAppRegistry != null)
847 r = pAppRegistry->Set(_extensionKeyName, _showExtension);
848 r = pAppRegistry->Save();
850 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
853 if (_pMoreContextMenu != null)
855 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
856 AppLogDebug("error %s", GetErrorMessage(r));
859 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
861 if (_pListView != null && _pListView->IsVisible())
863 _pListView->SetShowState(false);
865 if (_pIconListView != null)
867 _pIconListView->UpdateList();
868 _pIconListView->SetShowState(true);
873 if (_pIconListView != null && _pIconListView->IsVisible())
875 _pIconListView->SetShowState(false);
877 if (_pListView != null)
879 _pListView->UpdateList();
880 _pListView->SetShowState(true);
884 if (_pMoreContextMenu != null)
886 delete _pMoreContextMenu;
887 _pMoreContextMenu = null;
891 AppLogDebug("Exit: %s", GetErrorMessage(r));
896 SubBaseFolderEntryForm::HideDeleteConfirmationPopup(void)
898 if (_pDeleteConfirmationPopUp != null && _pDeleteConfirmationPopUp->IsVisible())
900 _pDeleteConfirmationPopUp->SetShowState(false);
905 SubBaseFolderEntryForm::ShowDeleteConfirmationPopup(void)
907 CreateDeleteConfirmationPopUp();
909 if (_pDeleteConfirmationPopUp != null)
911 _pDeleteConfirmationPopUp->SetShowState(true);
912 _pDeleteConfirmationPopUp->Show();
917 SubBaseFolderEntryForm::CreateViewAsPopupControl(void)
919 AppLogDebug("ENTER");
920 //Creates a popup control for the ViewAs context item asking which view is to be shown
922 result r = E_SUCCESS;
924 if (_pViewAsPopup != null)
926 AppLogDebug("_pViewAsPopup is not null");
930 String viewAsPopupTitle;
932 String sortByPopupTitle;
934 // Label* pViewAsPanelLabel = null;
936 // Label* pViewAsPopupLabel = null;
938 // Bitmap* pPanelBackground = null;
939 // Bitmap* pPopUpBackground = null;
941 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
942 // pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
944 //Create a new popup control
945 _pViewAsPopup = new (std::nothrow) Popup();
946 _pViewAsPopup->Construct(L"IDL_VIEW_AS_POPUP");
948 //The cancel button inside the popup, hides the popup when clicked.
949 _pCancelViewAs = static_cast< Button* >(_pViewAsPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
950 TryCatch(_pCancelViewAs != null, , "MfMyFilesApp::Button For Popup not created!");
952 _pCancelViewAs->SetActionId(IDA_BTN_POPUP_CANCEL);
953 _pCancelViewAs->AddActionEventListener(*this);
954 _pCancelViewAs->SetShowState(true);
956 // pViewAsPanelLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
957 // TryCatch(pViewAsPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
959 // pViewAsPopupLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
960 // TryCatch(pViewAsPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
962 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, pViewAsPanelLabel->GetWidth(), pViewAsPanelLabel->GetHeight());
963 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, pViewAsPopupLabel->GetWidth(), pViewAsPopupLabel->GetHeight());
965 // if (pPanelBackground != null)
967 // pViewAsPanelLabel->SetBackgroundBitmap(*pPanelBackground);
970 // if (pPopUpBackground != null)
972 // pViewAsPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
975 //The listview control which is to be added inside the popup. The itemprovider and listener are
976 //implemented in another class because this class already contains an instance of Listview control
977 //attached to an ItemProvider.
979 _pViewAsPopup->SetControlAlwaysOnTop(*_pCancelViewAs, true);
982 _pViewAsListView = static_cast< ListView* >(_pViewAsPopup->GetControl(L"IDC_LISTVIEW_VIEW_AS", true));
983 TryCatch(_pViewAsListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
985 _pViewAsListView->SetShowState(true);
986 _pViewAsListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
987 _pViewAsListView->SetItemProvider(*_pCustomListViewForPopup);
988 _pViewAsListView->SetName(L"VIEW_AS_LISTVIEW");
989 _pViewAsListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
991 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
993 // if (pPanelBackground != null)
995 // delete pPanelBackground;
996 // pPanelBackground = null;
998 // if (pPopUpBackground != null)
1000 // delete pPopUpBackground;
1001 // pPopUpBackground = null;
1006 if (_pViewAsPopup != null)
1008 delete _pViewAsPopup;
1009 _pViewAsPopup = null;
1012 if (_pCustomListViewForPopup != null)
1014 delete _pCustomListViewForPopup;
1015 _pCustomListViewForPopup = null;
1018 // if (pPanelBackground != null)
1020 // delete pPanelBackground;
1021 // pPanelBackground = null;
1024 // if (pPopUpBackground != null)
1026 // delete pPopUpBackground;
1027 // pPopUpBackground = null;
1033 SubBaseFolderEntryForm::ShowMoreContextMenu(void)
1035 String extensionStatus;
1037 AppRegistry* pAppRegistry = null;
1038 result r = E_SUCCESS;
1039 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1041 //Show ContextMenu with More Options
1042 if (pAppRegistry != null)
1044 r = pAppRegistry->Get(_extensionKeyName, extensionStatus);
1047 if (_pMoreContextMenu != null)
1049 if (extensionStatus == _hideExtension)
1051 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1055 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1058 _pMoreContextMenu->SetShowState(true);
1059 _pMoreContextMenu->Show();
1062 AppLogDebug("Exit: %s", GetErrorMessage(r));
1066 SubBaseFolderEntryForm::OnListViewItemStateChangedNotify(ViewType listViewStyle)
1068 AppLogDebug("ENTER");
1070 int popupSource = POP_UP_VIEW_AS;
1071 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1072 int thumbnailRequestId = 0;
1074 AppRegistry* pAppRegistry = null;
1075 String sortByKeyName(L"SortBy");
1077 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1079 if (_pCustomListViewForPopup != null)
1081 popupSource = _pCustomListViewForPopup->GetSelectionPopup();
1084 pAppRegistry->Get(sortByKeyName, sortType);
1086 if (popupSource == POP_UP_VIEW_AS)
1088 _flagViewAsStatus = listViewStyle;
1098 if (_pFolderEntryPM != null)
1100 thumbnailRequestId = _pFolderEntryPM->GetCurrentReqId() + 1;
1101 _pFolderEntryPM->SetCurrentReqId(thumbnailRequestId);
1102 if (_pFolderEntryPM != null && _pFolderEntryPM->GetSourceForm() != CREATE_ITEM_SOURCE_SPLIT_PANEL_DIR_TREE)
1104 _pFolderEntryPM->SortFolderEntries();
1108 if (_pListView != null && _pListView->IsVisible())
1110 _pListView->UpdateList();
1114 if (_pIconListView != null && _pIconListView->IsVisible())
1116 _pIconListView->UpdateList();
1120 if (_pFolderEntryPM != null)
1122 _pFolderEntryPM->InitThumbnailManager();
1127 if (_pMoreContextMenu != null)
1129 delete _pMoreContextMenu;
1130 _pMoreContextMenu = null;
1134 SubBaseFolderEntryForm::OnIconListViewItemStateChangeNotify()
1136 if (_pIconListView != null && _pIconListView->IsVisible())
1138 _pIconListView->UpdateList();
1142 SubBaseFolderEntryForm::OnFooterStateChangeNotify(void)
1144 SetFooterVisibility();
1146 _pFooter = GetFooter();
1147 if (_pFooter != null)
1149 _pFooter->Invalidate(true);
1154 SubBaseFolderEntryForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1156 AppLogDebug("OnAppControlCompleteResponseReceived");
1157 result r = E_SUCCESS;
1158 CustomAppControl::GetInstance()->SetAppControlInUse(null);
1160 ContentType contentType = CONTENT_TYPE_UNKNOWN;
1161 contentType = ContentManagerUtil::CheckContentType(_pathOfSelectedFile);
1162 AppLogDebug("OnAppControlCompleteResponseReceived:%d", contentType);
1164 if (GetLastResult() == E_FILE_NOT_FOUND)
1166 _pFolderEntryPM->RefreshFolderEntries();
1167 if (_pListView != null && _pListView->IsVisible())
1169 r = _pListView->UpdateList();
1172 if (_pIconListView != null && _pIconListView->IsVisible())
1174 r = _pIconListView->UpdateList();
1176 _pFolderEntryPM->InitThumbnailManager();
1181 SubBaseFolderEntryForm::SetDefaultSelectionForSortByPopUp(void)
1183 result r = E_SUCCESS;
1185 int defaultSortPopUpSelect = 0;
1187 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1189 int uncheckItem1 = 0;
1190 int uncheckItem2 = 0;
1191 int uncheckItem3 = 0;
1192 int uncheckItem4 = 0;
1193 int uncheckItem5 = 0;
1195 String sortByKeyName(L"SortBy");
1197 AppRegistry* pAppRegistry = null;
1199 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1201 r = pAppRegistry->Get(sortByKeyName, sortType);
1202 TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
1207 case SORT_BY_TYPE_NAME_ASCENDING:
1209 defaultSortPopUpSelect = 0;
1218 case SORT_BY_TYPE_NAME_DESCENDING:
1220 defaultSortPopUpSelect = 1;
1229 case SORT_BY_TYPE_DATE_RECENT:
1231 defaultSortPopUpSelect = 2;
1241 case SORT_BY_TYPE_DATE_OLDEST:
1243 defaultSortPopUpSelect = 3;
1252 case SORT_BY_TYPE_SIZE_ASCENDING:
1254 defaultSortPopUpSelect = 4;
1263 case SORT_BY_TYPE_SIZE_DESCENDING:
1265 defaultSortPopUpSelect = 4;
1274 case SORT_BY_TYPE_ASCENDING:
1276 defaultSortPopUpSelect = 5;
1286 case SORT_BY_TYPE_DESCENDING:
1288 defaultSortPopUpSelect = 5;
1300 defaultSortPopUpSelect = 0;
1301 AppLogDebug("UnSupported case reached");
1306 if (_pCustomListViewForPopup != null)
1308 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1311 if (_pSortByPopup != null && _pSortByListView != null)
1313 _pSortByListView->UpdateList();
1314 _pSortByListView->SetItemChecked(defaultSortPopUpSelect, true);
1315 _pSortByListView->SetItemChecked(uncheckItem1, false);
1316 _pSortByListView->SetItemChecked(uncheckItem2, false);
1317 _pSortByListView->SetItemChecked(uncheckItem3, false);
1318 _pSortByListView->SetItemChecked(uncheckItem4, false);
1319 _pSortByListView->SetItemChecked(uncheckItem5, false);
1321 _pSortByListView->Invalidate(true);
1330 SubBaseFolderEntryForm::SwitchViewType(void)
1332 String viewStyleKeyName(L"ListDisplayType");
1334 switch (_flagViewAsStatus)
1337 case VIEW_TYPE_AS_DETAILED_LIST:
1339 if (_pIconListView != null && _pIconListView->IsVisible())
1341 _pIconListView->SetShowState(false);
1343 if (_pListView != null)
1345 _pListView->UpdateList();
1346 if (_selectedItemIndex == -1)
1347 _pListView->ScrollToItem(0);
1348 _pListView->SetShowState(true);
1354 case VIEW_TYPE_AS_NORMAL_LIST:
1356 if (_pIconListView != null && _pIconListView->IsVisible())
1358 _pIconListView->SetShowState(false);
1361 if (_pListView != null)
1363 _pListView->UpdateList();
1364 if (_selectedItemIndex == -1)
1365 _pListView->ScrollToItem(0);
1366 _pListView->SetShowState(true);
1371 case VIEW_TYPE_AS_THUMBNAILS:
1373 if (_pListView != null && _pListView->IsVisible())
1375 _pListView->SetShowState(false);
1377 if (_pIconListView != null)
1379 _pIconListView->UpdateList();
1380 if (_selectedItemIndex == -1)
1381 _pIconListView->ScrollToItem(0);
1382 _pIconListView->SetShowState(true);
1389 if (_pListView != null)
1391 _pListView->UpdateList();
1399 SubBaseFolderEntryForm::SetNextDisplayPath(void)
1406 fullPath = FolderNavigationPresentationModel::GetCurrentPath();
1408 StringTokenizer tokenizer(fullPath, delim);
1411 DataBindingContext* pContext = null;
1412 pContext = GetDataBindingContextN();
1416 switch (_storageType)
1418 case MEMORY_TYPE_PHONE:
1424 case MEMORY_TYPE_SD_CARD:
1437 //Use a string tokenizer to get the filepath until it's the last token, break the loop when
1438 //it is the last token
1439 while (tokenizer.HasMoreTokens())
1444 tokenizer.GetNextToken(token);
1448 tokenizer.GetNextToken(token);
1449 //dislayPath.Append(L"/");
1450 displayPath.Append(token);
1451 displayPath.Append(L"/");
1455 if (_pLabelDisplayPath != null)
1457 _displayPath.Append(displayPath);
1458 _pLabelDisplayPath->SetText(_displayPath);
1459 _pLabelDisplayPath->Invalidate(true);
1463 if (pContext != null)
1465 //UpdateBinding on the target label control.
1466 pContext->UpdateBinding(L"ID_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);
1469 if (pContext != null)
1477 FolderEntryPresentationModel*
1478 SubBaseFolderEntryForm::GetFolderEntryPresentationModel(void)
1480 return _pFolderEntryPM;
1484 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1486 AppLogDebug("ENTER");
1487 result r = E_SUCCESS;
1489 //_pFolderEntryPM->SetFileEventListener(null);
1490 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1491 _pFileManager->DeleteFolderEntries(&filePath);
1493 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1498 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1500 AppLogDebug("ENTER");
1501 DirectoryEntry* pDirStr = null;
1508 _editOrShare = FILE_MANAGE_EDIT;
1509 //If filenames is not empty then Load the edit form.
1510 if (_pFilenames->GetCount() != 0)
1512 //_pFolderEntryPM->SetFileEventListener(null);
1521 AppLogDebug("Share Button Clicked!");
1523 _editOrShare = FILE_MANAGE_SHARE;
1524 if (_pFilenames->GetCount() != 0)
1526 //_pFolderEntryPM->SetFileEventListener(null);
1535 CreateMoreContextMenu();
1537 ShowMoreContextMenu();
1541 case IDA_CONTEXT_MENU_BTN_SORT_BY:
1543 //Show the SortBy PopUp.
1544 if (_pCustomListViewForPopup != null)
1546 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1552 case IDA_CONTEXT_MENU_CREATE_FOLDER:
1554 //Load the CreateFolder Form.
1555 //_pFolderEntryPM->SetFileEventListener(null);
1556 _renameOrCreate = SELECT_CREATE_FOLDER;
1558 if (_pMoreContextMenu != null)
1560 delete _pMoreContextMenu;
1561 _pMoreContextMenu = null;
1564 LoadCreateFolderForm();
1568 case IDA_CONTEXT_MENU_VIEW_AS:
1570 //Show the ViewAs Popup
1571 if (_pCustomListViewForPopup != null)
1573 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1580 case IDA_BTN_POPUP_CANCEL:
1582 //Hide the ViewAs PopUp and redraw the form.
1587 case IDA_BTN_SORT_POPUP_CANCEL:
1589 //Hide the SortBy PopUp and redraw the form.
1594 case IDA_CONTEXT_MENU_BTN_SEARCH:
1596 //Load the SearchForm
1601 case IDA_DELETE_FILE:
1603 HideDeleteConfirmationPopup();
1605 if (_pDeleteConfirmationPopUp != null)
1607 delete _pDeleteConfirmationPopUp;
1608 _pDeleteConfirmationPopUp = null;
1612 if (_pFilenames != null)
1614 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1616 if (pDirStr != null)
1618 _filePath = pDirStr->GetFullFilePath();
1620 _indexTracker = _indexToDelete;
1621 //Call the DeleteFile Function.
1622 DeleteFile(_filePath);
1626 case IDA_CANCEL_DELETION:
1628 HideDeleteConfirmationPopup();
1630 if (_pDeleteConfirmationPopUp != null)
1632 delete _pDeleteConfirmationPopUp;
1633 _pDeleteConfirmationPopUp = null;
1638 case IDA_BTN_ANIMATION_POPUP_CANCEL:
1640 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1641 HideFileProgressingPopup();
1642 _pFileManager->ForceStopWorkerThread();
1646 case IDA_ICONLISTVIEW_DETAILS:
1648 if (_pIconListViewContextMenu != null)
1650 delete _pIconListViewContextMenu;
1651 _pIconListViewContextMenu = null;
1654 if (_bIsTopLevelDirectory == false)
1656 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1658 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1660 if (pDirStr != null)
1662 fullPath = pDirStr->GetFullFilePath();
1668 switch (_currentIndex)
1671 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetMediaPath());
1672 fullPath = FolderNavigationPresentationModel::GetMediaPath();
1673 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_PHONE);
1676 FolderNavigationPresentationModel::SetCurrentFilePath(FolderNavigationPresentationModel::GetSdCardPath());
1677 fullPath = FolderNavigationPresentationModel::GetSdCardPath();
1678 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_SD_CARD);
1682 FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetUsbPath());
1683 fullPath = FolderNavigationPresentationModel::GetUsbPath();
1684 FolderNavigationPresentationModel::SetStorageType(MEMORY_TYPE_EXTERNAL);
1689 LoadDetailForm(fullPath);
1693 case IDA_ICONLISTVIEW_DELETE:
1695 if (_pIconListViewContextMenu != null)
1697 delete _pIconListViewContextMenu;
1698 _pIconListViewContextMenu = null;
1701 ShowDeleteConfirmationPopup();
1703 _indexToDelete = _currentIndex;
1708 case IDA_ICONLISTVIEW_RENAME:
1710 if (_pIconListViewContextMenu != null)
1712 delete _pIconListViewContextMenu;
1713 _pIconListViewContextMenu = null;
1716 if (_currentIndex != INVALID_LIST_INDEX && _pFilenames != null)
1718 pDirStr = static_cast <DirectoryEntry*>(_pFilenames->GetAt(_currentIndex));
1720 if (pDirStr != null)
1722 _currentFileName.Clear();
1723 _currentFileName = pDirStr->GetFileName();
1727 _renameIndex = _currentIndex;
1728 _renameOrCreate = SELECT_RENAME;
1730 //Load the Rename View of the item selected.
1731 LoadRenameForm(_currentIndex);
1744 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1746 DirectoryEntry* pDirStr = null;
1747 _selectedItemIndex = index;
1748 if (_pFilenames != null)
1750 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1752 if (pDirStr != null)
1756 case IDA_CONTEXT_DETAIL:
1759 _filePath = pDirStr->GetFullFilePath();
1760 LoadDetailForm(_filePath);
1764 case IDA_CONTEXT_RENAME:
1766 _currentFileName.Clear();
1767 _currentFileName = pDirStr->GetFileName();
1768 _renameIndex = index;
1769 _renameOrCreate = SELECT_RENAME;
1770 //Load the Rename View of the item selected.
1771 LoadRenameForm(index);
1775 case IDA_CONTEXT_DELETE:
1777 _indexToDelete = index;
1779 ShowDeleteConfirmationPopup();
1785 //Empty Implementation.
1794 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1796 result res = E_SUCCESS;
1797 AppLogDebug("Enter");
1799 if (_pFolderEntryPM)
1801 if (pThumbReq != null)
1803 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1805 if (pThumbReq->pBitmap != null)
1807 delete pThumbReq->pBitmap;
1813 if (pThumbReq != null)
1815 if (pThumbReq->GetCurrentRequestId() != _pFolderEntryPM->GetCurrentReqId())
1817 if (pThumbReq->pBitmap != null)
1819 delete pThumbReq->pBitmap;
1821 AppLogDebug("mismatch in id so returning");
1827 if (pThumbReq->iRquestId < _pFilenames->GetCount())
1829 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1830 if (_pListView && _pListView->IsVisible())
1832 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1834 else if (_pIconListView && _pIconListView->IsVisible())
1836 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1840 AppLogDebug("Thumbnail Request is not valid");
1844 _pFolderEntryPM->OnThumbnailResponseFailed();
1847 AppLogDebug("Exit %s", GetErrorMessage(res));
1852 SubBaseFolderEntryForm::CreateSortByPopup(void)
1854 result r = E_SUCCESS;
1856 if (_pSortByPopup != null)
1858 AppLogDebug("_pSortByPopup is not null");
1862 String cancelButton;
1863 String sortByPopupTitle;
1865 // Label* pSortByPanelLabel = null;
1866 // Label* pSortByPopupLabel = null;
1868 // Bitmap* pPanelBackground = null;
1869 // Bitmap* pPopUpBackground = null;
1871 // pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1872 //pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1873 // pPopUpBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_CENTER, 512, 632);
1874 // pPanelBackground = MfUtility::GetNinepatchedBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, 612, 96);
1876 _pSortByPopup = new (std::nothrow) Popup();
1877 _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1879 _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1880 TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1882 _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1883 _pCancelSortBy->AddActionEventListener(*this);
1884 _pCancelSortBy->SetShowState(true);
1886 // pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1887 // TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1889 // pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1890 // TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1892 // if (pPanelBackground != null)
1894 // pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1897 // if (pPopUpBackground != null)
1899 // pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1903 _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1904 TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1906 _pSortByListView->SetShowState(true);
1907 _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1908 _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1909 _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1910 _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1912 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1914 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1915 // _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1916 _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1917 _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1919 // if (pPanelBackground != null)
1921 // delete pPanelBackground;
1922 // pPanelBackground = null;
1924 // if (pPopUpBackground != null)
1926 // delete pPopUpBackground;
1927 // pPopUpBackground = null;
1932 if (_pCustomListViewForPopup != null)
1934 delete _pCustomListViewForPopup;
1935 _pCustomListViewForPopup = null;
1938 if (_pSortByPopup != null)
1940 delete _pSortByPopup;
1941 _pSortByPopup = null;
1944 // if (pPanelBackground != null)
1946 // delete pPanelBackground;
1947 // pPanelBackground = null;
1950 // if (pPopUpBackground != null)
1952 // delete pPopUpBackground;
1953 // pPopUpBackground = null;
1960 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1962 result r = E_SUCCESS;
1967 AppResource* pAppResource = null;
1968 AppRegistry* pAppRegistry = null;
1971 String extensionVisibility;
1974 String buttonCreateFolder;
1976 Bitmap* pBitmapSortbyContextItem = null;
1977 Bitmap* pBitmapSearchContextItem = null;
1978 Bitmap* pBitmapCreateFolderContextItem = null;
1980 pAppResource = Application::GetInstance()->GetAppResource();
1982 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1984 if (pAppResource != null)
1986 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1987 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", sortBy);
1988 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", search);
1989 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1990 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
1991 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
1992 pBitmapSortbyContextItem = pAppResource->GetBitmapN(IDB_POPUP_SORTBY_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1993 pBitmapSearchContextItem = pAppResource->GetBitmapN(IDB_POPUP_SEARCH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1994 pBitmapCreateFolderContextItem = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1997 pAppRegistry->Get(_extensionKeyName, extensionVisibility);
1999 _pFooter = GetFooter();
2000 if (_pFooter != null)
2002 _pFooter->GetPosition(xPosition, yPosition);
2005 xPosition += 3 * (GetClientAreaBounds().width / 4);
2007 //Create the ContextMenu
2008 _pMoreContextMenu = new (std::nothrow) ContextMenu();
2009 _pMoreContextMenu->Construct(Point(0, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
2010 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2011 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2013 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_TOP_LEVEL_DIRECTORY_FORM)
2015 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2019 if (_bIsDirectoryEmpty == false)
2021 if (CheckSearchHistory() == false)
2023 _pMoreContextMenu->AddItem(search, IDA_CONTEXT_MENU_BTN_SEARCH, *pBitmapSearchContextItem, null, null);
2026 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
2027 _pMoreContextMenu->AddItem(sortBy, IDA_CONTEXT_MENU_BTN_SORT_BY, *pBitmapSortbyContextItem, null, null);
2029 if (extensionVisibility == _hideExtension)
2031 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
2035 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
2039 if (SceneManager::GetInstance()->GetCurrentSceneId() != IDSCN_CATEGORY_SEARCH_FORM)
2041 _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER, *pBitmapCreateFolderContextItem, null, null);
2045 //Set the ContextMenu's ActionEventListener
2046 _pMoreContextMenu->AddActionEventListener(*this);
2047 //_pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
2048 _pMoreContextMenu->SetShowState(true);
2050 delete pBitmapSortbyContextItem;
2051 delete pBitmapSearchContextItem;
2052 delete pBitmapCreateFolderContextItem;
2057 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
2059 result r = E_SUCCESS;
2061 int defaultViewAsPopUpSelect = 0;
2062 int uncheckItem1 = 0;
2063 int uncheckItem2 = 0;
2065 int viewType = VIEW_TYPE_AS_NONE;
2066 String viewStyleKeyName(L"ListDisplayType");
2068 AppRegistry* pAppRegistry = null;
2070 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2072 r = pAppRegistry->Get(viewStyleKeyName, viewType);
2077 case VIEW_TYPE_AS_DETAILED_LIST:
2079 defaultViewAsPopUpSelect = 1;
2085 case VIEW_TYPE_AS_NORMAL_LIST:
2087 defaultViewAsPopUpSelect = 0;
2093 case VIEW_TYPE_AS_THUMBNAILS:
2095 defaultViewAsPopUpSelect = 2;
2103 //Empty Implementation.
2109 if (_pCustomListViewForPopup != null)
2111 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
2114 if (_pViewAsPopup != null && _pViewAsListView != null)
2116 _pViewAsListView->UpdateList();
2117 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
2118 _pViewAsListView->SetItemChecked(uncheckItem1, false);
2119 _pViewAsListView->SetItemChecked(uncheckItem2, false);
2120 _pViewAsListView->Invalidate(true);
2127 SubBaseFolderEntryForm::SetFooterVisibility(void)
2129 AppLogDebug("Entry");
2130 int folderCount=0, fileCount=0;
2132 _pFooter = GetFooter();
2134 if( _pFolderEntryPM )
2135 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
2137 if (folderCount ==0 && fileCount == 0)
2139 _pFooter->SetItemEnabled(0, false);
2143 _pFooter->SetItemEnabled(0, true);
2145 if (fileCount == 0 )
2147 _pFooter->SetItemEnabled(1, false);
2151 _pFooter->SetItemEnabled(1, true);
2154 _pFooter->Invalidate(true);
2158 SubBaseFolderEntryForm::CheckSearchHistory(void)
2160 bool searchHistoryStatus = false;
2163 SceneManager* pSceneManager = SceneManager::GetInstance();
2164 IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2166 if (pSceneList != null)
2168 itemCount = pSceneList->GetCount() - 1;
2169 pSceneList->GetAt(itemCount, searchScene);
2170 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2173 pSceneList->GetAt(itemCount, searchScene);
2177 if (searchScene == IDSCN_SEARCH_FORM)
2179 AppLogDebug("Search scene present");
2180 searchHistoryStatus = true;
2184 AppLogDebug("Search scene not present");
2185 searchHistoryStatus = false;
2190 pSceneList->RemoveAll();
2194 return searchHistoryStatus;
2199 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
2201 //Empty Implementation
2205 SubBaseFolderEntryForm::OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2208 if (_currentIndex != INVALID_LIST_INDEX)
2210 ShowIconListViewContextMenu();
2215 SubBaseFolderEntryForm::OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector)
2217 //Empty Implementation.
2221 SubBaseFolderEntryForm::CreateIconListViewContextMenu(void)
2223 if (_pIconListViewContextMenu != null)
2228 result r = E_SUCCESS;
2234 String buttonCreateFolder;
2236 AppResource* pAppResource = null;
2237 //AppRegistry* pAppRegistry = null;
2238 pAppResource = Application::GetInstance()->GetAppResource();
2240 //pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
2242 if (pAppResource != null)
2244 pAppResource->GetString(L"IDS_MF_SK_DETAILS", Details);
2245 pAppResource->GetString(L"IDS_MF_SK3_DELETE", Delete);
2246 pAppResource->GetString(L"IDS_MF_BODY_RENAME_ABB", Rename);
2249 //Create the ContextMenu
2250 _pIconListViewContextMenu = new (std::nothrow) ContextMenu();
2252 _pIconListViewContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_AUTO);
2253 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
2254 _pIconListViewContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
2257 _pIconListViewContextMenu->AddItem(Details, IDA_ICONLISTVIEW_DETAILS);
2258 if (_bIsTopLevelDirectory == false)
2260 _pIconListViewContextMenu->AddItem(Rename, IDA_ICONLISTVIEW_RENAME);
2261 _pIconListViewContextMenu->AddItem(Delete, IDA_ICONLISTVIEW_DELETE);
2264 //Set the ContextMenu's ActionEventListener
2265 _pIconListViewContextMenu->AddActionEventListener(*this);
2266 _pIconListViewContextMenu->SetShowState(true);
2272 SubBaseFolderEntryForm::ShowIconListViewContextMenu(void)
2275 CreateIconListViewContextMenu();
2276 int headerHeight = 0;
2278 int y_Anchor_Position = 0;
2280 Header* pHeader = GetHeader();
2281 headerHeight = pHeader->GetHeight();
2284 y_Anchor_Position = _currentPosition.y + headerHeight + H_DISPLAY_PATH_LABEL + 60;
2286 if (_bIsTopLevelDirectory)
2288 y_Anchor_Position = y_Anchor_Position + H_CATEGORY_PANEL;
2291 if (_pIconListViewContextMenu != null)
2293 _pIconListViewContextMenu->SetAnchorPosition(Point(_currentPosition.x, y_Anchor_Position));
2294 _pIconListViewContextMenu->SetShowState(true);
2295 _pIconListViewContextMenu->Show();
2300 SubBaseFolderEntryForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
2302 _currentPosition.x = currentPosition.x;
2303 _currentPosition.y = currentPosition.y;
2305 if (_pIconListView != null)
2307 _currentIndex = _pIconListView->GetItemIndexFromPosition(_currentPosition);
2314 SubBaseFolderEntryForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2316 //Empty Implementation
2320 SubBaseFolderEntryForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2322 //Empty Implementation
2326 SubBaseFolderEntryForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2328 //Empty Implementation
2331 SubBaseFolderEntryForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
2333 //Empty Implementation
2337 SubBaseFolderEntryForm::SetCurrentDirectoryFlag(bool isTopDirectory)
2339 _bIsTopLevelDirectory = isTopDirectory;
2342 SubBaseFolderEntryForm::OnAppControlCompleted(void)
2344 AppLogDebug("Enter");
2345 // int fileCount = 0;
2346 // int folderCount = 0;
2348 // _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(),folderCount, fileCount);
2350 // SetFooterVisibility(ENABLE_FOOTER_ITEM);
2351 SetFooterVisibility();
2353 if( !_bBackFromAppControl )
2356 if (_pListView != null && _pListView->IsVisible())
2358 _pListView->UpdateList();
2361 if (_pIconListView != null && _pIconListView->IsVisible())
2363 _pIconListView->UpdateList();
2366 if (_pFolderEntryPM!=null)
2368 _pFolderEntryPM->InitThumbnailManager();
2370 _pFileEventManager->RemovePath(_fileEventPath);
2371 _bBackFromAppControl = false;
2372 AppLogDebug("Exit");