2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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 , _pCancelInstallation(null)
46 , _pCancelSortBy(null)
47 , _pCancelViewAs(null)
49 , _pFileProgressingCancelButton(null)
51 , _pMoreContextMenu(null)
57 , _pIconListView(null)
58 , _pFileProgressingHeaderLabel(null)
59 , _pFileProgressingLabel(null)
60 , __pItemContext(null)
62 , _pSortByListView(null)
63 , _pViewAsListView(null)
64 , _pDeleteConfirmationPopUp(null)
65 , _pFileProgressingPopup(null)
66 , _pInstallationConfirmationPopUp(null)
67 , _pInstallationProgressPopup(null)
70 , _pBaseItemProvider(null)
71 , _pCustomListViewForPopup(null)
73 , _pFolderEntryPM(null)
74 , _pMediaMetaData(null)
75 , _pThumbnailItemProvider(null)
76 , _pThumbnailManager(null)
79 _flagViewAsStatus = 0;
88 SubBaseFolderEntryForm::~SubBaseFolderEntryForm(void)
92 if (_pFolderEntryPM != null)
94 delete _pFolderEntryPM;
97 if (_pMoreContextMenu != null)
99 delete _pMoreContextMenu;
102 if (_pViewAsPopup != null)
104 delete _pViewAsPopup;
107 if (_pDeleteConfirmationPopUp != null)
109 delete _pDeleteConfirmationPopUp;
112 if (_pCustomListViewForPopup != null)
114 delete _pCustomListViewForPopup;
117 if (_pMediaMetaData != null)
119 delete _pMediaMetaData;
122 if (_pSortByPopup != null)
124 delete _pSortByPopup;
127 if (_pFileProgressingPopup != null)
129 delete _pFileProgressingPopup;
132 if (_pThumbnailItemProvider != null)
134 delete _pThumbnailItemProvider;
137 if (_pBaseItemProvider != null)
139 delete _pBaseItemProvider;
147 if (_pSortBy != null)
152 if (_pSearch != null)
162 if (_pFileEventManager != null)
164 delete _pFileEventManager;
169 SubBaseFolderEntryForm&
170 SubBaseFolderEntryForm::operator =(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
175 SubBaseFolderEntryForm::SubBaseFolderEntryForm(const SubBaseFolderEntryForm& pSubBaseFolderEntryForm)
181 SubBaseFolderEntryForm::CreateFooterControls(void)
183 AppLogDebug("ENTER");
184 //Create Footer and controls contained within the footer
185 result r = E_SUCCESS;
194 AppResource* pAppResource = null;
195 pAppResource = Application::GetInstance()->GetAppResource();
197 if (pAppResource != null)
199 //Get the Title texts for all the FooterItems
200 pAppResource->GetString(L"IDS_MF_SK3_EDIT", buttonEdit);
201 pAppResource->GetString(L"IDS_MF_SK3_SORT_BY", buttonSortBy);
202 pAppResource->GetString(L"IDS_MORE", buttonMore);
203 pAppResource->GetString(L"IDS_MF_SK3_SEARCH", buttonSearch);
204 pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel);
207 //Construct the 4 FooterItems Copy, Create , Sort By and More
211 _pEdit = new (std::nothrow) FooterItem();
212 _pEdit->Construct(IDA_BTN_EDIT);
213 _pEdit->SetText(buttonEdit);
219 _pSortBy = new (std::nothrow) FooterItem();
220 _pSortBy->Construct(IDA_BTN_SORT_BY);
221 _pSortBy->SetText(buttonSortBy);
227 _pMore = new (std::nothrow) FooterItem();
228 _pMore->Construct(IDA_BTN_MORE);
229 _pMore->SetText(buttonMore);
233 if (CheckSearchHistory() == false)
237 _pSearch = new (std::nothrow) FooterItem();
238 _pSearch->Construct(IDA_BTN_SEARCH);
239 _pSearch->SetText(buttonSearch);
243 //Get the Footer and set the FooterItems.
244 _pFooter = GetFooter();
245 if (_pFooter != null)
247 _pFooter->RemoveAllButtons();
248 _pFooter->RemoveAllItems();
250 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
251 _pFooter->AddItem(*_pEdit);
252 _pFooter->AddItem(*_pSortBy);
253 if (CheckSearchHistory() == false)
255 _pFooter->AddItem(*_pSearch);
258 _pFooter->AddItem(*_pMore);
261 //Set am ActionEventListener to the Footer
262 _pFooter->AddActionEventListener(*this);
263 _pFooter->SetBackButton();
264 _pFooter->SetBackButtonEnabled(true);
265 _pFooter->Invalidate(true);
272 SubBaseFolderEntryForm::CreateDeleteConfirmationPopUp(void)
274 result r = E_SUCCESS;
275 Rectangle popupBounds;
277 Label* pPanelLabel = null;
278 Label* pPopupLabel = null;
280 Bitmap* pPanelBackground = null;
281 Bitmap* pPopUpBackground = null;
283 String deleteLabel = L"";
285 pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
286 pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
288 //Create a new popup control
289 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
290 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
292 pPanelLabel = static_cast< Label* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
293 TryCatch(pPanelLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
295 pPopupLabel = static_cast< Label* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_LABEL_DELETE", true));
296 TryCatch(pPopupLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
298 if (pPanelBackground != null)
300 pPanelLabel->SetBackgroundBitmap(*pPanelBackground);
302 if (pPopUpBackground != null)
304 pPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
307 AppResource::GetInstance()->GetString(L"IDS_MF_SK3_DELETE", deleteLabel);
309 if(deleteLabel.IsEmpty() == false)
311 deleteLabel.Append("?");
312 pPopupLabel->SetText(deleteLabel);
315 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
316 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
318 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
319 _pDeleteFile->AddActionEventListener(*this);
320 _pDeleteFile->SetShowState(true);
322 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
323 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
325 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
326 _pCancelDeletion->AddActionEventListener(*this);
327 _pCancelDeletion->SetShowState(true);
329 if (pPopUpBackground != null)
331 delete pPopUpBackground;
332 pPopUpBackground = null;
334 if (pPanelBackground != null)
336 delete pPanelBackground;
337 pPanelBackground = null;
342 if (pPopUpBackground != null)
344 delete pPopUpBackground;
345 pPopUpBackground = null;
347 if (pPanelBackground != null)
349 delete pPanelBackground;
350 pPanelBackground = null;
352 if (_pDeleteConfirmationPopUp != null)
354 delete _pDeleteConfirmationPopUp;
355 _pDeleteConfirmationPopUp = null;
362 SubBaseFolderEntryForm::ShowSortByPopup(void)
367 //Set the showstate of the popup to true. so that it's displayed on the form.
368 if (_pSortByPopup != null)
370 _pSortByPopup->SetShowState(true);
371 _pSortByPopup->Show();
374 SetDefaultSelectionForSortByPopUp();
379 SubBaseFolderEntryForm::HideSortByPopup(void)
381 //Set the showstate of the popup to false. so that it's hidden on the form.
382 if (_pSortByPopup != null && _pSortByPopup->IsVisible())
384 _pSortByPopup->SetShowState(false);
390 SubBaseFolderEntryForm::LoadRenameForm(int index)
392 result r = E_SUCCESS;
393 _renameOrCreate = SELECT_RENAME;
394 ArrayList* pArg = null;
395 Integer* pSourceSelected = null;
396 SceneManager* pSceneManager = null;
397 DirectoryEntry* pDirectory = null;
399 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
400 TryCatch(pDirectory != null, , "failed to allocate memeory to cast to DirectoryEntry");
402 pArg = new (std::nothrow) ArrayList();
403 r = pArg->Construct();
405 pSourceSelected = new (std::nothrow) Integer(_renameOrCreate);
407 pArg->Add(pSourceSelected);
408 TryCatch(r == E_SUCCESS, , "failed to construct parg");
410 //pArg->Add(__rootMediaPath);
411 pArg->Add(pDirectory);
412 TryCatch(r == E_SUCCESS, , "failed to construct parg");
414 pSceneManager = SceneManager::GetInstance();
415 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
417 //pSceneManager->GoForward(SCENE_RENAME_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
418 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
420 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
424 if (pSourceSelected != null)
426 delete pSourceSelected;
427 pSourceSelected = null;
429 if (pDirectory != null)
442 SubBaseFolderEntryForm::LoadSearchForm(void)
444 ArrayList* pTopLevelDirectoryList = new (std::nothrow) ArrayList();
446 //String* pDirectoryPath = null;
447 //String* pTabSelected = null;
448 ArrayList* pFilepathList = null;
449 SceneManager* pSceneManager = null;
451 //pDirectoryPath = new (std::nothrow) String();
452 //pDirectoryPath->Append(FolderNavigationPresentationModel::GetCurrentPath());
454 //pTabSelected = new (std::nothrow) String();
455 //pTabSelected->Append(tabSelected);
457 if (pTopLevelDirectoryList != null && _pFilenames != null)
459 //pTopLevelDirectoryList->Add(*pDirectoryPath);
460 pFilepathList = new (std::nothrow) ArrayList();
461 if (pFilepathList != null)
463 pFilepathList->Construct();
464 pFilepathList->AddItems(*_pFilenames);
465 pTopLevelDirectoryList->Add(pFilepathList);
467 //pTopLevelDirectoryList->Add(*pTabSelected);
470 TryCatch(pTopLevelDirectoryList != null, , "failed to Get SceneManager instance");
472 pSceneManager = SceneManager::GetInstance();
473 TryCatch(pSceneManager != null, , "failed to Get SceneManager instance");
475 //pSceneManager->GoForward(SCENE_SEARCH_FORM, pTopLevelDirectoryList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
476 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SEARCH_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pTopLevelDirectoryList);
481 /*if (pDirectoryPath != null)
483 delete pDirectoryPath;
484 pDirectoryPath = null;
487 if (pTabSelected != null)
492 if (pFilepathList != null)
494 delete pFilepathList;
495 pFilepathList = null;
498 if (pTopLevelDirectoryList != null)
500 delete pTopLevelDirectoryList;
501 pTopLevelDirectoryList = null;
506 SubBaseFolderEntryForm::ShowViewAsPopup(void)
508 //Call functions to create the popups.
509 CreateViewAsPopupControl();
511 //Set the showstate of the popup to true. so that it's displayed on the form.
512 if (_pViewAsPopup != null)
514 _pViewAsPopup->SetShowState(true);
515 _pViewAsPopup->Show();
518 SetDefaultSelectionForViewAsPopUp();
522 SubBaseFolderEntryForm::HideViewAsPopup(void)
524 //Set the showstate of the popup to false. so that it's hidden on the form.
525 if (_pViewAsPopup != null && _pViewAsPopup->IsVisible())
527 _pViewAsPopup->SetShowState(false);
532 SubBaseFolderEntryForm::LoadCreateFolderForm(void)
534 //Load the CreateFolder view in the current directory.
535 result r = E_SUCCESS;
536 Integer* pSourceSelected = null;
537 SceneManager* pSceneManager = null;
538 ArrayList* pArg = null;
540 pSourceSelected = new (std::nothrow) Integer(SELECT_CREATE_FOLDER);
542 pArg = new (std::nothrow) ArrayList();
543 r = pArg->Construct();
545 pArg->Add(pSourceSelected);
546 TryCatch(r == E_SUCCESS, , "failed to construct parg");
548 pSceneManager = SceneManager::GetInstance();
549 TryCatch(pSceneManager != null, , "failed to construct parg");
551 //pSceneManager->GoForward(SCENE_CREATE_FOLDER_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
552 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
557 if (pSourceSelected != null)
559 delete pSourceSelected;
569 SubBaseFolderEntryForm::LoadDetailForm(Tizen::Base::String& Fullpath)
571 result r = E_SUCCESS;
573 SceneManager* pSceneManager = null;
574 ArrayList* pList = null;
575 String* pFullFilePath = null;
577 pList = new (std::nothrow) ArrayList();
578 r = pList->Construct();
580 pFullFilePath = new (std::nothrow) String(Fullpath);
581 pList->Add(pFullFilePath);
583 pSceneManager = SceneManager::GetInstance();
584 TryCatch(pSceneManager != null, , "Failed to allocate Memory to pSceneManager");
586 //pSceneManager->GoForward(SCENE_FILE_DETAIL_FORM, pList, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
587 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FILE_DETAIL_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
588 AppLogDebug("Exit: %s", GetErrorMessage(r));
592 AppLogDebug("Exit: %s", GetErrorMessage(r));
593 if (pFullFilePath != null)
595 delete pFullFilePath;
596 pFullFilePath = null;
608 SubBaseFolderEntryForm::LoadEditForm(void)
610 //__pFileListPM->SetFileEventListener(null);
611 SceneManager* pSceneManager = SceneManager::GetInstance();
612 if (pSceneManager != null)
614 //pSceneManager->GoForward(SCENE_EDIT_FORM, pArg, SCENE_TRANSITION_ANIMATION_TYPE_LEFT);
615 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), null);
621 SubBaseFolderEntryForm::ShowFileProgressingPopup(void)
623 CreateFileProgressingPopup();
625 if (_pFileProgressingPopup != null)
627 _pFileProgressingPopup->SetShowState(true);
628 _pFileProgressingPopup->Show();
633 SubBaseFolderEntryForm::HideFileProgressingPopup(void)
635 if (_pFileProgressingPopup != null)
637 _pFileProgressingPopup->SetShowState(false);
639 if (_pFileProgressingPopup != null)
641 delete _pFileProgressingPopup;
642 _pFileProgressingPopup = null;
648 SubBaseFolderEntryForm::CreateFileProgressingPopup(void)
650 AppLogDebug("Enter");
651 result r = E_SUCCESS;
654 //String fileProgress;
656 if (_pFileProgressingPopup != null)
658 AppLogDebug("_pFileProgressingPopup is not null");
662 AppResource* pAppResource = null;
663 pAppResource = UiApp::GetInstance()->GetAppResource();
664 TryCatch(pAppResource != null, , "Failed to fetch AppResource");
666 //pAppResource->GetString(L"IDS_FILE_PROCESSING", popUpTitle);
667 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
668 //pAppResource->GetString(L"IDS_FILE_PROGRESS", fileProgress);
670 _pFileProgressingPopup = new (std::nothrow) Popup();
671 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
672 TryCatch(_pFileProgressingPopup != null, , "Failed to allocate memory to FileProgressing Popup.");
674 //_pFileProgressingPopup->SetTitleText(popUpTitle); //Not in UI
677 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
678 TryCatch(_pFileProgressingCancelButton != null, , "Failed to fetch _pFileProgressingCancelButton.");
680 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
681 _pFileProgressingCancelButton->AddActionEventListener(*this);
682 _pFileProgressingCancelButton->SetShowState(true);
684 _pFileProgressingProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
685 TryCatch(_pFileProgressingProgress != null, , "Failed to fetch _pFileProgressingProgress.");
687 _pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
688 _pFileProgressingProgress->SetValue(0);
690 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
691 TryCatch(_pFileProgressingHeaderLabel != null, , "Failed to fetch _pFileProgressingHeaderLabel.");
693 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
694 _pFileProgressingHeaderLabel->SetText(deleting);
695 _pFileProgressingHeaderLabel->SetShowState(true);
696 _pFileProgressingHeaderLabel->Invalidate(true);
699 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
700 TryCatch(_pFileProgressingLabel != null, , "Failed to fetch _pFileProgressingLabel.");
702 _pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
703 //_pFileProgressingLabel->SetText(fileProgress);
704 _pFileProgressingLabel->SetShowState(true);
711 if (_pFileProgressingPopup != null)
713 delete _pFileProgressingPopup;
714 _pFileProgressingPopup = null;
721 SubBaseFolderEntryForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
723 int x_FooterPosition = 0;
724 int y_FooterPosition = 0;
725 int x_ContextMenu = 0;
726 int y_ContextMenu = 0;
728 Rectangle listViewBounds(GetClientAreaBounds().x, H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, GetClientAreaBounds().height);
729 Rectangle labelBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL);
731 _pFooter = GetFooter();
732 if (_pFooter != null)
734 _pFooter->GetPosition(x_FooterPosition, y_FooterPosition);
737 x_ContextMenu = x_FooterPosition + 3 * (listViewBounds.width / 4);
738 y_ContextMenu = y_FooterPosition;
740 switch (orientationStatus)
742 case ORIENTATION_STATUS_PORTRAIT:
744 if (_pListView != null)
746 _pListView->SetBounds(listViewBounds);
748 if (_pIconListView != null)
750 _pIconListView->SetBounds(listViewBounds);
752 if (_pMoreContextMenu != null)
754 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
756 /* if (__pLabelDisplayPath != null)
758 __pLabelDisplayPath->SetBounds(labelBounds);
763 case ORIENTATION_STATUS_LANDSCAPE:
765 if (_pListView != null)
767 _pListView->SetBounds(listViewBounds);
769 if (_pIconListView != null)
771 _pIconListView->SetBounds(listViewBounds);
773 if (_pMoreContextMenu != null)
775 _pMoreContextMenu->SetAnchorPosition(Point(x_ContextMenu, y_ContextMenu));
777 /* if (__pLabelDisplayPath != null)
779 __pLabelDisplayPath->SetBounds(labelBounds);
795 SubBaseFolderEntryForm::OnFileManagingStart(void)
797 ShowFileProgressingPopup();
801 SubBaseFolderEntryForm::OnFileManagingStop(FileManagingResult fileManagingResult)
803 //Empty Implementation.
807 SubBaseFolderEntryForm::HideFileExtension(void)
809 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
810 String viewStyleKeyName(L"ListDisplayType");
812 result r = E_SUCCESS;
814 AppRegistry* pAppRegistry = null;
815 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
818 if (pAppRegistry != null)
820 r = pAppRegistry->Set(_extensionKeyName, _hideExtension);
821 r = pAppRegistry->Save();
823 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
825 if (_pMoreContextMenu != null)
827 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
828 AppLogDebug("error %s", GetErrorMessage(r));
831 //Update the corresponding List.
832 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
834 if (_pListView != null && _pListView->IsVisible())
836 _pListView->SetShowState(false);
838 if (_pIconListView != null)
840 _pIconListView->SetShowState(true);
841 _pIconListView->UpdateList();
846 if (_pIconListView != null && _pIconListView->IsVisible())
848 _pIconListView->SetShowState(false);
850 if (_pListView != null)
852 _pListView->UpdateList();
853 _pListView->SetShowState(true);
857 if (_pMoreContextMenu != null)
859 delete _pMoreContextMenu;
860 _pMoreContextMenu = null;
865 AppLogDebug("Exit : %s", GetErrorMessage(r));
869 SubBaseFolderEntryForm::ShowFileExtension(void)
871 int listViewDisplayType = VIEW_TYPE_AS_NORMAL_LIST;
872 String viewStyleKeyName(L"ListDisplayType");
874 result r = E_SUCCESS;
876 AppRegistry* pAppRegistry = null;
877 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
879 if (pAppRegistry != null)
881 r = pAppRegistry->Set(_extensionKeyName, _showExtension);
882 r = pAppRegistry->Save();
884 r = pAppRegistry->Get(viewStyleKeyName, listViewDisplayType);
887 if (_pMoreContextMenu != null)
889 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
890 AppLogDebug("error %s", GetErrorMessage(r));
893 if (listViewDisplayType == VIEW_TYPE_AS_THUMBNAILS)
895 if (_pListView != null && _pListView->IsVisible())
897 _pListView->SetShowState(false);
899 if (_pIconListView != null)
901 _pIconListView->UpdateList();
902 _pIconListView->SetShowState(true);
907 if (_pIconListView != null && _pIconListView->IsVisible())
909 _pIconListView->SetShowState(false);
911 if (_pListView != null)
913 _pListView->UpdateList();
914 _pListView->SetShowState(true);
918 if (_pMoreContextMenu != null)
920 delete _pMoreContextMenu;
921 _pMoreContextMenu = null;
925 AppLogDebug("Exit: %s", GetErrorMessage(r));
930 SubBaseFolderEntryForm::HideDeleteConfirmationPopup(void)
932 if (_pDeleteConfirmationPopUp != null && _pDeleteConfirmationPopUp->IsVisible())
934 _pDeleteConfirmationPopUp->SetShowState(false);
939 SubBaseFolderEntryForm::ShowDeleteConfirmationPopup(void)
941 CreateDeleteConfirmationPopUp();
943 if (_pDeleteConfirmationPopUp != null)
945 _pDeleteConfirmationPopUp->SetShowState(true);
946 _pDeleteConfirmationPopUp->Show();
951 SubBaseFolderEntryForm::CreateViewAsPopupControl(void)
953 AppLogDebug("ENTER");
954 //Creates a popup control for the ViewAs context item asking which view is to be shown
956 result r = E_SUCCESS;
958 if (_pViewAsPopup != null)
960 AppLogDebug("_pViewAsPopup is not null");
964 String viewAsPopupTitle;
966 String sortByPopupTitle;
968 Label* pViewAsPanelLabel = null;
970 Label* pViewAsPopupLabel = null;
972 Bitmap* pPanelBackground = null;
973 Bitmap* pPopUpBackground = null;
975 pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
976 pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
978 //Create a new popup control
979 _pViewAsPopup = new (std::nothrow) Popup();
980 _pViewAsPopup->Construct(L"IDL_VIEW_AS_POPUP");
982 //The cancel button inside the popup, hides the popup when clicked.
983 _pCancelViewAs = static_cast< Button* >(_pViewAsPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
984 TryCatch(_pCancelViewAs != null, , "MfMyFilesApp::Button For Popup not created!");
986 _pCancelViewAs->SetActionId(IDA_BTN_POPUP_CANCEL);
987 _pCancelViewAs->AddActionEventListener(*this);
988 _pCancelViewAs->SetShowState(true);
990 pViewAsPanelLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_BOTTOM_BACKGROUND", true));
991 TryCatch(pViewAsPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
993 pViewAsPopupLabel = static_cast< Label* >(_pViewAsPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
994 TryCatch(pViewAsPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
997 if (pPanelBackground != null)
999 pViewAsPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1002 if (pPopUpBackground != null)
1004 pViewAsPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1007 //The listview control which is to be added inside the popup. The itemprovider and listener are
1008 //implemented in another class because this class already contains an instance of Listview control
1009 //attached to an ItemProvider.
1011 _pViewAsPopup->SetControlAlwaysOnTop(*_pCancelViewAs, true);
1014 _pViewAsListView = static_cast< ListView* >(_pViewAsPopup->GetControl(L"IDC_LISTVIEW_VIEW_AS", true));
1015 TryCatch(_pViewAsListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1017 _pViewAsListView->SetShowState(true);
1018 _pViewAsListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1019 _pViewAsListView->SetItemProvider(*_pCustomListViewForPopup);
1020 _pViewAsListView->SetName(L"VIEW_AS_LISTVIEW");
1021 _pViewAsListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1023 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1025 if (pPanelBackground != null)
1027 delete pPanelBackground;
1028 pPanelBackground = null;
1030 if (pPopUpBackground != null)
1032 delete pPopUpBackground;
1033 pPopUpBackground = null;
1038 if (_pViewAsPopup != null)
1040 delete _pViewAsPopup;
1041 _pViewAsPopup = null;
1044 if (_pCustomListViewForPopup != null)
1046 delete _pCustomListViewForPopup;
1047 _pCustomListViewForPopup = null;
1050 if (pPanelBackground != null)
1052 delete pPanelBackground;
1053 pPanelBackground = null;
1056 if (pPopUpBackground != null)
1058 delete pPopUpBackground;
1059 pPopUpBackground = null;
1065 SubBaseFolderEntryForm::ShowMoreContextMenu(void)
1067 String extensionStatus;
1069 AppRegistry* pAppRegistry = null;
1070 result r = E_SUCCESS;
1071 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1073 //Show ContextMenu with More Options
1074 if (pAppRegistry != null)
1076 r = pAppRegistry->Get(_extensionKeyName, extensionStatus);
1079 if (_pMoreContextMenu != null)
1081 if (extensionStatus == _hideExtension)
1083 r = _pMoreContextMenu->SetItemAt(2, _showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1087 r = _pMoreContextMenu->SetItemAt(2, _hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1090 _pMoreContextMenu->SetShowState(true);
1091 _pMoreContextMenu->Show();
1093 AppLogDebug("Exit: %s", GetErrorMessage(r));
1097 SubBaseFolderEntryForm::OnListViewItemStateChangedNotify(ViewType listViewStyle)
1099 AppLogDebug("ENTER");
1101 int popupSource = POP_UP_VIEW_AS;
1102 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1104 AppRegistry* pAppRegistry = null;
1105 String sortByKeyName(L"SortBy");
1107 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1109 if (_pCustomListViewForPopup != null)
1111 popupSource = _pCustomListViewForPopup->GetSelectionPopup();
1114 pAppRegistry->Get(sortByKeyName, sortType);
1116 if (popupSource == POP_UP_VIEW_AS)
1118 _flagViewAsStatus = listViewStyle;
1128 if (_pFolderEntryPM != null)
1130 _pFolderEntryPM->SortFolderEntries();
1133 if (_pListView != null && _pListView->IsVisible())
1135 _pListView->UpdateList();
1139 if (_pIconListView != null && _pIconListView->IsVisible())
1141 _pIconListView->UpdateList();
1145 if (_pFolderEntryPM != null)
1147 _pFolderEntryPM->InitThumbnailManager();
1152 if (_pMoreContextMenu != null)
1154 delete _pMoreContextMenu;
1155 _pMoreContextMenu = null;
1159 SubBaseFolderEntryForm::OnIconListViewItemStateChangeNotify()
1161 if (_pIconListView != null && _pIconListView->IsVisible())
1163 _pIconListView->UpdateList();
1167 SubBaseFolderEntryForm::OnFooterStateChangeNotify(void)
1169 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1171 _pFooter = GetFooter();
1172 if (_pFooter != null)
1174 _pFooter->Invalidate(true);
1179 SubBaseFolderEntryForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1181 AppLogDebug("OnAppControlCompleteResponseReceived");
1182 result r = E_SUCCESS;
1183 CustomAppControl::GetInstance()->SetAppControlInUse(null);
1185 ContentType contentType = CONTENT_TYPE_UNKNOWN;
1186 contentType = ContentManagerUtil::CheckContentType(_pathOfSelectedFile);
1187 AppLogDebug("OnAppControlCompleteResponseReceived:%d", contentType);
1189 if (GetLastResult() == E_FILE_NOT_FOUND)
1191 _pFolderEntryPM->RefreshFolderEntries();
1192 if (_pListView != null && _pListView->IsVisible())
1194 r = _pListView->UpdateList();
1197 if (_pIconListView != null && _pIconListView->IsVisible())
1199 r = _pIconListView->UpdateList();
1201 _pFolderEntryPM->InitThumbnailManager();
1206 SubBaseFolderEntryForm::SetDefaultSelectionForSortByPopUp(void)
1208 result r = E_SUCCESS;
1210 int defaultSortPopUpSelect = 0;
1212 int sortType = SORT_BY_TYPE_NAME_ASCENDING;
1214 int uncheckItem1 = 0;
1215 int uncheckItem2 = 0;
1216 int uncheckItem3 = 0;
1217 int uncheckItem4 = 0;
1218 int uncheckItem5 = 0;
1220 String sortByKeyName(L"SortBy");
1222 AppRegistry* pAppRegistry = null;
1224 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1226 r = pAppRegistry->Get(sortByKeyName, sortType);
1227 TryCatch(r == E_SUCCESS, , "Failed To Get Value From AppRegistry");
1232 case SORT_BY_TYPE_NAME_ASCENDING:
1234 defaultSortPopUpSelect = 0;
1243 case SORT_BY_TYPE_NAME_DESCENDING:
1245 defaultSortPopUpSelect = 1;
1254 case SORT_BY_TYPE_DATE_RECENT:
1256 defaultSortPopUpSelect = 2;
1266 case SORT_BY_TYPE_DATE_OLDEST:
1268 defaultSortPopUpSelect = 3;
1277 case SORT_BY_TYPE_SIZE_ASCENDING:
1279 defaultSortPopUpSelect = 4;
1288 case SORT_BY_TYPE_SIZE_DESCENDING:
1290 defaultSortPopUpSelect = 4;
1299 case SORT_BY_TYPE_ASCENDING:
1301 defaultSortPopUpSelect = 5;
1311 case SORT_BY_TYPE_DESCENDING:
1313 defaultSortPopUpSelect = 5;
1325 defaultSortPopUpSelect = 0;
1326 AppLogDebug("UnSupported case reached");
1331 if (_pCustomListViewForPopup != null)
1333 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1336 if (_pSortByPopup != null && _pSortByListView != null)
1338 _pSortByListView->UpdateList();
1339 _pSortByListView->SetItemChecked(defaultSortPopUpSelect, true);
1340 _pSortByListView->SetItemChecked(uncheckItem1, false);
1341 _pSortByListView->SetItemChecked(uncheckItem2, false);
1342 _pSortByListView->SetItemChecked(uncheckItem3, false);
1343 _pSortByListView->SetItemChecked(uncheckItem4, false);
1344 _pSortByListView->SetItemChecked(uncheckItem5, false);
1346 _pSortByListView->Invalidate(true);
1355 SubBaseFolderEntryForm::SwitchViewType(void)
1357 String viewStyleKeyName(L"ListDisplayType");
1359 switch (_flagViewAsStatus)
1362 case VIEW_TYPE_AS_DETAILED_LIST:
1364 if (_pIconListView != null && _pIconListView->IsVisible())
1366 _pIconListView->SetShowState(false);
1368 if (_pListView != null)
1370 _pListView->UpdateList();
1371 _pListView->ScrollToItem(0);
1372 _pListView->SetShowState(true);
1378 case VIEW_TYPE_AS_NORMAL_LIST:
1380 if (_pIconListView != null && _pIconListView->IsVisible())
1382 _pIconListView->SetShowState(false);
1385 if (_pListView != null)
1387 _pListView->UpdateList();
1388 _pListView->ScrollToItem(0);
1389 _pListView->SetShowState(true);
1394 case VIEW_TYPE_AS_THUMBNAILS:
1396 if (_pListView != null && _pListView->IsVisible())
1398 _pListView->SetShowState(false);
1400 if (_pIconListView != null)
1402 _pIconListView->UpdateList();
1403 _pIconListView->ScrollToItem(0);
1404 _pIconListView->SetShowState(true);
1411 if (_pListView != null)
1413 _pListView->UpdateList();
1420 FolderEntryPresentationModel*
1421 SubBaseFolderEntryForm::GetFoldeEntryPresentationModel(void)
1423 return _pFolderEntryPM;
1427 SubBaseFolderEntryForm::DeleteFile(String& filePath)
1429 AppLogDebug("ENTER");
1430 result r = E_SUCCESS;
1432 //_pFolderEntryPM->SetFileEventListener(null);
1433 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
1435 _pFileManager->DeleteFolderEntries(&filePath);
1437 AppLogDebug("EXIT: r = %s", GetErrorMessage(GetLastResult()));
1442 SubBaseFolderEntryForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1444 DirectoryEntry* pDirStr = null;
1449 //If filenames is not empty then Load the edit form.
1450 if (_pFilenames->GetCount() != 0)
1452 //_pFolderEntryPM->SetFileEventListener(null);
1461 CreateMoreContextMenu();
1463 ShowMoreContextMenu();
1467 case IDA_BTN_SORT_BY:
1469 //Show the SortBy PopUp.
1470 if (_pCustomListViewForPopup != null)
1472 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_SORT_BY);
1480 case IDA_CONTEXT_MENU_CREATE_FOLDER:
1482 //Load the CreateFolder Form.
1483 //_pFolderEntryPM->SetFileEventListener(null);
1484 _renameOrCreate = SELECT_CREATE_FOLDER;
1486 if (_pMoreContextMenu != null)
1488 delete _pMoreContextMenu;
1489 _pMoreContextMenu = null;
1492 LoadCreateFolderForm();
1496 case IDA_CONTEXT_MENU_VIEW_AS:
1498 //Show the ViewAs Popup
1499 if (_pCustomListViewForPopup != null)
1501 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1508 case IDA_BTN_POPUP_CANCEL:
1510 //Hide the ViewAs PopUp and redraw the form.
1515 case IDA_BTN_SORT_POPUP_CANCEL:
1517 //Hide the SortBy PopUp and redraw the form.
1524 case IDA_BTN_SEARCH:
1526 //Load the SearchForm
1527 //LoadSearchForm(_tabSelected);
1532 case IDA_DELETE_FILE:
1534 HideDeleteConfirmationPopup();
1536 if (_pDeleteConfirmationPopUp != null)
1538 delete _pDeleteConfirmationPopUp;
1539 _pDeleteConfirmationPopUp = null;
1544 if (_pFilenames != null)
1546 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(_indexToDelete));
1549 if (pDirStr != null)
1551 _filePath = pDirStr->GetFullFilePath();
1554 _indexTracker = _indexToDelete;
1556 //Call the DeleteFile Function.
1557 DeleteFile(_filePath);
1561 case IDA_CANCEL_DELETION:
1563 HideDeleteConfirmationPopup();
1565 if (_pDeleteConfirmationPopUp != null)
1567 delete _pDeleteConfirmationPopUp;
1568 _pDeleteConfirmationPopUp = null;
1572 case IDA_BTN_ANIMATION_POPUP_CANCEL:
1574 AppLogDebug("IDA_BTN_ANIMATION_POPUP_CANCEL");
1575 HideFileProgressingPopup();
1576 _pFileManager->ForceStopWorkerThread();
1588 SubBaseFolderEntryForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1590 DirectoryEntry* pDirStr = null;
1592 if (_pFilenames != null)
1594 pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1596 if (pDirStr != null)
1600 case IDA_CONTEXT_DETAIL:
1603 // if (pDirStr != null)
1605 _filePath = pDirStr->GetFullFilePath();
1607 //Load the FileDetails View
1608 LoadDetailForm(_filePath);
1612 case IDA_CONTEXT_RENAME:
1614 // if (pDirStr != null)
1616 _currentFileName.Clear();
1617 _currentFileName = pDirStr->GetFileName();
1620 _renameIndex = index;
1621 _renameOrCreate = SELECT_RENAME;
1622 //Load the Rename View of the item selected.
1623 LoadRenameForm(index);
1627 case IDA_CONTEXT_DELETE:
1629 _indexToDelete = index;
1631 ShowDeleteConfirmationPopup();
1637 //Empty Implementation.
1646 SubBaseFolderEntryForm::OnThumbnailReceived(ThumbRequest* pThumbReq)
1648 result res = E_SUCCESS;
1649 AppLogDebug("Enter");
1651 if (_pFolderEntryPM)
1653 if (pThumbReq != null)
1655 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
1657 if (pThumbReq->pBitmap != null)
1659 delete pThumbReq->pBitmap;
1667 if (pThumbReq->iRquestId < _pFilenames->GetCount())
1669 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
1670 if (_pListView && _pListView->IsVisible())
1672 res = _pListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1674 else if (_pIconListView && _pIconListView->IsVisible())
1676 res = _pIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
1680 AppLogDebug("Thumbnail Request is not valid");
1684 _pFolderEntryPM->OnThumbnailResponseFailed();
1687 AppLogDebug("Exit %s", GetErrorMessage(res));
1692 SubBaseFolderEntryForm::CreateSortByPopup(void)
1694 result r = E_SUCCESS;
1696 if (_pSortByPopup != null)
1698 AppLogDebug("_pSortByPopup is not null");
1701 String cancelButton;
1702 String sortByPopupTitle;
1704 Label* pSortByPanelLabel = null;
1705 Label* pSortByPopupLabel = null;
1707 Bitmap* pPanelBackground = null;
1708 Bitmap* pPopUpBackground = null;
1710 pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1711 pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1713 _pSortByPopup = new (std::nothrow) Popup();
1714 _pSortByPopup->Construct(L"IDL_SORT_BY_POPUP");
1716 _pCancelSortBy = static_cast< Button* >(_pSortByPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1717 TryCatch(_pCancelSortBy != null, , "MfMyFilesApp::Button For Popup not created!");
1719 _pCancelSortBy->SetActionId(IDA_BTN_SORT_POPUP_CANCEL);
1720 _pCancelSortBy->AddActionEventListener(*this);
1721 _pCancelSortBy->SetShowState(true);
1723 pSortByPanelLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_PANEL_BACKGROUND", true));
1724 TryCatch(pSortByPanelLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1726 pSortByPopupLabel = static_cast< Label* >(_pSortByPopup->GetControl(L"IDC_LABEL_POPUP_BACKGROUND", true));
1727 TryCatch(pSortByPopupLabel != null, , "MfMyFilesApp::pLabel For Popup not created!");
1729 if (pPanelBackground != null)
1731 pSortByPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1734 if (pPopUpBackground != null)
1736 pSortByPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
1740 _pSortByListView = static_cast< ListView* >(_pSortByPopup->GetControl(L"IDC_LISTVIEW_SORT_BY", true));
1741 TryCatch(_pSortByListView != null, , "MfMyFilesApp::ListView Control For Popup not created!");
1743 _pSortByListView->SetShowState(true);
1744 _pSortByListView->AddListViewItemEventListener(*_pCustomListViewForPopup);
1745 _pSortByListView->SetItemProvider(*_pCustomListViewForPopup);
1746 _pSortByListView->SetName(L"SORT_BY_LISTVIEW");
1747 _pSortByListView->SetItemDividerColor(Color::GetColor(COLOR_ID_GREY));
1749 AppLogDebug("EXIT: r = %s", GetErrorMessage(r));
1751 _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPanelLabel, true);
1752 _pSortByPopup->SetControlAlwaysAtBottom(*pSortByPopupLabel, true);
1753 _pSortByPopup->SetControlAlwaysOnTop(*_pSortByListView, true);
1754 _pSortByPopup->SetControlAlwaysOnTop(*_pCancelSortBy, true);
1756 if (pPanelBackground != null)
1758 delete pPanelBackground;
1759 pPanelBackground = null;
1761 if (pPopUpBackground != null)
1763 delete pPopUpBackground;
1764 pPopUpBackground = null;
1769 if (_pCustomListViewForPopup != null)
1771 delete _pCustomListViewForPopup;
1772 _pCustomListViewForPopup = null;
1775 if (_pSortByPopup != null)
1777 delete _pSortByPopup;
1778 _pSortByPopup = null;
1781 if (pPanelBackground != null)
1783 delete pPanelBackground;
1784 pPanelBackground = null;
1787 if (pPopUpBackground != null)
1789 delete pPopUpBackground;
1790 pPopUpBackground = null;
1797 SubBaseFolderEntryForm::CreateMoreContextMenu(void)
1799 result r = E_SUCCESS;
1805 String extensionVisibility;
1807 String buttonCreateFolder;
1809 AppResource* pAppResource = null;
1810 AppRegistry* pAppRegistry = null;
1811 pAppResource = Application::GetInstance()->GetAppResource();
1813 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1815 if (pAppResource != null)
1817 pAppResource->GetString(L"IDS_MF_OPT_VIEW_AS", viewAs);
1818 pAppResource->GetString(L"IDS_MF_OPT_CREATE_FOLDER", buttonCreateFolder);
1819 pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", _hideExtension);
1820 pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", _showExtension);
1823 _pFooter = GetFooter();
1824 if (_pFooter != null)
1826 _pFooter->GetPosition(xPosition, yPosition);
1829 xPosition += 3 * (GetClientAreaBounds().width / 4);
1831 //Create the ContextMenu
1832 _pMoreContextMenu = new (std::nothrow) ContextMenu();
1834 _pMoreContextMenu->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
1835 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
1836 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
1838 _pMoreContextMenu->AddItem(buttonCreateFolder, IDA_CONTEXT_MENU_CREATE_FOLDER);
1840 _pMoreContextMenu->AddItem(viewAs, IDA_CONTEXT_MENU_VIEW_AS);
1842 pAppRegistry->Get(_extensionKeyName, extensionVisibility);
1844 if (extensionVisibility == _hideExtension)
1846 _pMoreContextMenu->AddItem(_showExtension, IDA_CONTEXT_MENU_SHOW_EXTENSION);
1850 _pMoreContextMenu->AddItem(_hideExtension, IDA_CONTEXT_MENU_HIDE_EXTENSION);
1853 //Set the ContextMenu's ActionEventListener
1854 _pMoreContextMenu->AddActionEventListener(*this);
1855 _pMoreContextMenu->SetAnchorPosition(Point(xPosition, yPosition));
1856 _pMoreContextMenu->SetShowState(true);
1862 SubBaseFolderEntryForm::SetDefaultSelectionForViewAsPopUp(void)
1864 result r = E_SUCCESS;
1866 int defaultViewAsPopUpSelect = 0;
1867 int uncheckItem1 = 0;
1868 int uncheckItem2 = 0;
1870 int viewType = VIEW_TYPE_AS_NONE;
1871 String viewStyleKeyName(L"ListDisplayType");
1873 AppRegistry* pAppRegistry = null;
1875 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
1877 r = pAppRegistry->Get(viewStyleKeyName, viewType);
1882 case VIEW_TYPE_AS_DETAILED_LIST:
1884 defaultViewAsPopUpSelect = 1;
1890 case VIEW_TYPE_AS_NORMAL_LIST:
1892 defaultViewAsPopUpSelect = 0;
1898 case VIEW_TYPE_AS_THUMBNAILS:
1900 defaultViewAsPopUpSelect = 2;
1908 //Empty Implementation.
1914 if (_pCustomListViewForPopup != null)
1916 _pCustomListViewForPopup->SetSelectionPopup(POP_UP_VIEW_AS);
1919 if (_pViewAsPopup != null && _pViewAsListView != null)
1921 _pViewAsListView->UpdateList();
1922 _pViewAsListView->SetItemChecked(defaultViewAsPopUpSelect, true);
1923 _pViewAsListView->SetItemChecked(uncheckItem1, false);
1924 _pViewAsListView->SetItemChecked(uncheckItem2, false);
1925 _pViewAsListView->Invalidate(true);
1931 SubBaseFolderEntryForm::OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult)
1933 AppLogDebug("TopMostFolderFileListForm::OnPackageInstallationComplete");
1934 HideInstallationProgressPopup();
1938 SubBaseFolderEntryForm::OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress)
1940 //Empty Implementation
1944 SubBaseFolderEntryForm::OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult)
1946 //Empty Implementation
1950 SubBaseFolderEntryForm::OnPackageInstallationResponseReceived(const PackageId& packageId, PackageInstallationResult installationResult)
1952 //Empty Implementation
1956 SubBaseFolderEntryForm::OnPackageInstallationInProgressResponseReceived(const PackageId& packageId, int progress)
1958 //Empty Implementation
1962 SubBaseFolderEntryForm::CreateInstallationConfirmationPopUp(void)
1964 AppLogDebug("Entry");
1965 result r = E_SUCCESS;
1967 Label* pPanelLabel = null;
1968 Label* pPopupLabel = null;
1970 Bitmap* pPanelBackground = null;
1971 Bitmap* pPopUpBackground = null;
1973 pPanelBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_BOTTOM, BITMAP_PIXEL_FORMAT_ARGB8888);
1974 pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
1976 //Create a new popup control
1977 _pInstallationConfirmationPopUp = new (std::nothrow) Popup();
1978 _pInstallationConfirmationPopUp->Construct(L"IDL_INSTALL_POPUP");
1979 AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1981 pPanelLabel = static_cast< Label* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_LABEL_BOTTOM", true));
1982 AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1983 TryCatch(pPanelLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
1986 if (pPanelBackground != null)
1988 pPanelLabel->SetBackgroundBitmap(*pPanelBackground);
1991 pPopupLabel = static_cast< Label* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_LABEL_TOP", true));
1992 AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
1993 TryCatch(pPopupLabel != null, , "MfMyFilesApp::pPanelLabel For Popup not created!");
1995 if (pPopUpBackground != null)
1997 pPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
2000 _pInstall = static_cast< Button* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_BUTTON_YES", true));
2001 AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
2002 TryCatch(_pInstall != null, , "MfMyFilesApp::Button For Popup not created!");
2004 _pInstall->SetActionId(IDA_INSTALL_APP);
2005 _pInstall->AddActionEventListener(*this);
2006 _pInstall->SetShowState(true);
2008 _pCancelInstallation = static_cast< Button* >(_pInstallationConfirmationPopUp->GetControl(L"IDC_BUTTON_NO", true));
2009 AppLogDebug("Install Popup:Error Message:%s", GetErrorMessage(GetLastResult()));
2010 TryCatch(_pCancelInstallation != null, , "MfMyFilesApp::Button For Popup not created!");
2012 _pCancelInstallation->SetActionId(IDA_CANCEL_INSTALLATION);
2013 _pCancelInstallation->AddActionEventListener(*this);
2014 _pCancelInstallation->SetShowState(true);
2016 AppLogDebug("Exit");
2017 if (pPopUpBackground != null)
2019 delete pPopUpBackground;
2020 pPopUpBackground = null;
2022 if (pPanelBackground != null)
2024 delete pPanelBackground;
2025 pPanelBackground = null;
2030 r = GetLastResult();
2031 if (pPopUpBackground != null)
2033 delete pPopUpBackground;
2034 pPopUpBackground = null;
2036 if (pPanelBackground != null)
2038 delete pPanelBackground;
2039 pPanelBackground = null;
2041 if (_pInstallationConfirmationPopUp != null)
2043 delete _pInstallationConfirmationPopUp;
2044 _pInstallationConfirmationPopUp = null;
2050 SubBaseFolderEntryForm::CreateInstallationProgressPopUp(void)
2052 result r = E_SUCCESS;
2054 Label* pinstProgPopupLabel = null;
2055 Bitmap* pPopUpBackground = null;
2058 _pInstallationProgressPopup = new (std::nothrow) Popup();
2059 _pInstallationProgressPopup->Construct(L"IDL_INSTALLATION_PROGRESS_POPUP");
2061 pinstProgPopupLabel = static_cast< Label* >(_pInstallationProgressPopup->GetControl(L"IDC_LABEL1", true));
2063 pPopUpBackground = UiApp::App::GetInstance()->GetAppResource()->GetBitmapN(IDB_BACKGROUND_POPUP_CENTER, BITMAP_PIXEL_FORMAT_ARGB8888);
2064 if (pinstProgPopupLabel && pPopUpBackground)
2066 pinstProgPopupLabel->SetBackgroundBitmap(*pPopUpBackground);
2068 _pInstallationProgressPopup->SetShowState(false);
2070 if (pPopUpBackground != null)
2072 delete pPopUpBackground;
2073 pPopUpBackground = null;
2079 SubBaseFolderEntryForm::ShowInstallationProgressPopup(void)
2081 CreateInstallationProgressPopUp();
2082 if (_pInstallationProgressPopup != null)
2084 _pInstallationProgressPopup->SetShowState(true);
2085 _pInstallationProgressPopup->Invalidate(true);
2089 SubBaseFolderEntryForm::HideInstallationProgressPopup(void)
2091 if (_pInstallationProgressPopup != null && _pInstallationProgressPopup->IsVisible())
2093 _pInstallationProgressPopup->SetShowState(false);
2095 delete _pInstallationProgressPopup;
2096 _pInstallationProgressPopup = null;
2100 SubBaseFolderEntryForm::ShowInstallationConfirmationPopup(void)
2102 CreateInstallationConfirmationPopUp();
2104 if (_pInstallationConfirmationPopUp != null)
2106 _pInstallationConfirmationPopUp->SetShowState(true);
2107 _pInstallationConfirmationPopUp->Show();
2111 SubBaseFolderEntryForm::HideInstallationConfirmationPopup(void)
2113 if (_pInstallationConfirmationPopUp != null && _pInstallationConfirmationPopUp->IsVisible())
2115 _pInstallationConfirmationPopUp->SetShowState(false);
2117 delete _pInstallationConfirmationPopUp;
2118 _pInstallationConfirmationPopUp = null;
2123 SubBaseFolderEntryForm::SetFooterVisibility(int mode)
2125 AppLogDebug("Entry");
2126 _pFooter = GetFooter();
2130 _pFooter->SetItemEnabled(0, false);
2131 _pFooter->SetItemEnabled(1, false);
2132 if (CheckSearchHistory() == false)
2134 _pFooter->SetItemEnabled(2, false);
2139 _pFooter->SetItemEnabled(0, true);
2140 _pFooter->SetItemEnabled(1, true);
2141 _pFooter->SetItemEnabled(2, true);
2144 _pFooter->Invalidate(true);
2148 SubBaseFolderEntryForm::CheckSearchHistory(void)
2150 bool searchHistoryStatus = false;
2153 SceneManager* pSceneManager = SceneManager::GetInstance();
2154 IListT< SceneId >* pSceneList = pSceneManager->GetSceneHistoryN();
2156 if (pSceneList != null)
2158 itemCount = pSceneList->GetCount() - 1;
2159 pSceneList->GetAt(itemCount, searchScene);
2160 while (searchScene != IDSCN_SEARCH_FORM && itemCount >= 0)
2163 pSceneList->GetAt(itemCount, searchScene);
2167 if (searchScene == IDSCN_SEARCH_FORM)
2169 AppLogDebug("Search scene present");
2170 searchHistoryStatus = true;
2174 AppLogDebug("Search scene not present");
2175 searchHistoryStatus = false;
2180 pSceneList->RemoveAll();
2184 return searchHistoryStatus;
2188 SubBaseFolderEntryForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)