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: MfSubBaseFileManageForm.cpp
19 * @brief: This file contains the implementation of SubBaseFileManageForm class,
20 * and is responsible for creating the Edit View form.
21 * Operations like copy, move, delete can be performed in this form.
26 #include "MfDirectoryEntry.h"
27 #include "MfSubBaseFileManageForm.h"
28 #include "MfSceneRegister.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Base::Runtime;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Io;
37 using namespace Tizen::Locales;
38 using namespace Tizen::System;
39 using namespace Tizen::Ui;
40 using namespace Tizen::Ui::Animations;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
44 FolderEntryPresentationModel* SubBaseFileManageForm::_pFolderEntryPM = null;
46 /*Constructor for the Edit Form.
47 * Variable are initialised to null or other default values
49 SubBaseFileManageForm::SubBaseFileManageForm(void)
50 : _pBaseItemProvider(null)
51 , _pCustomListViewForPopup(null)
53 , _pMediaMetaData(null)
54 , _pThumbnailItemProvider(null)
55 , _pThumbnailManager(null)
57 , _pStrItemSelectedCount(null)
59 , _pCancelDeletion(null)
61 , _pFileProgressingCancelButton(null)
62 , _pShareContextMenu(null)
63 , _pMoreContextMenu(null)
67 , _pEditIconListView(null)
68 , _pFileProgressingLabel(null)
69 , _pFileProgressingHeaderLabel(null)
70 , _pLabelNumberOfItems(null)
71 , _pEditListView(null)
73 , _pDeleteConfirmationPopUp(null)
74 , _pFileProgressingPopup(null)
75 , _pAnimationProgress(null)
76 ,_pFileEventManager(null)
79 _fileProcessedCount = 0;
82 _editOrShare = FILE_MANAGE_EDIT;
86 SubBaseFileManageForm::~SubBaseFileManageForm(void)
88 if (_pStrItemSelectedCount != null)
90 delete _pStrItemSelectedCount;
94 if (_pFileManager != null)
96 _pFileManager->ClearCheckedList();
99 if (_pMoreContextMenu != null)
101 delete _pMoreContextMenu;
104 if (_pFileProgressingPopup != null)
106 delete _pFileProgressingPopup;
109 if (_pDelete != null)
119 if (_pDeleteConfirmationPopUp != null)
121 delete _pDeleteConfirmationPopUp;
124 if (_pThumbnailItemProvider != null)
126 delete _pThumbnailItemProvider;
128 if (_pShareContextMenu != null)
130 delete _pShareContextMenu;
132 if (_pBaseItemProvider != null)
134 delete _pBaseItemProvider;
136 if(_pFileEventManager != null)
138 _pFileEventManager->RemovePath(FolderNavigationPresentationModel::GetCurrentPath());
139 delete _pFileEventManager;
140 _pFileEventManager = null;
142 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
146 SubBaseFileManageForm::SubBaseOnActionPerformed(const Tizen::Ui::Control& source, int actionId)
148 AppLogDebug("Entry");
149 int selectedItemsCount = 0;
156 DirectoryEntry* pCheckedEntry = null;
157 Bitmap* pBitmapCopyContextItem = null;
158 Bitmap* pBitmapMoveContextItem = null;
162 AppResource* pAppResource = null;
163 pAppResource = UiApp::GetInstance()->GetAppResource();
165 if (pAppResource != null)
167 pAppResource->GetString(L"IDS_MF_SK3_MOVE", btnMove);
168 pAppResource->GetString(L"IDS_MF_SK3_COPY", btnCopy);
169 pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selected);
170 pBitmapCopyContextItem = pAppResource->GetBitmapN(IDB_POPUP_COPY_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
171 pBitmapMoveContextItem = pAppResource->GetBitmapN(IDB_POPUP_MOVE_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
174 h_ListView = GetClientAreaBounds().height - H_CHECK_BUTTON - H_DISPLAY_PATH_LABEL;
176 Rectangle listViewBounds(X_DEFAULT, H_CHECK_BUTTON, GetClientAreaBounds().width, h_ListView);
182 CreateDeleteConfirmationPopUp();
184 if (_pDeleteConfirmationPopUp != null)
186 _pDeleteConfirmationPopUp->SetShowState(true);
187 _pDeleteConfirmationPopUp->Show();
192 case IDA_DELETE_FILE:
194 if (_pDeleteConfirmationPopUp != null)
196 _pDeleteConfirmationPopUp->SetShowState(false);
199 if (_pDeleteConfirmationPopUp != null)
201 delete _pDeleteConfirmationPopUp;
202 _pDeleteConfirmationPopUp = null;
205 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
207 if (_pFileManager->GetCheckedListCount() > 0)
209 if (_pFileEventManager != null)
211 _pFileEventManager->RemovePath(FolderNavigationPresentationModel::GetCurrentPath());
212 delete _pFileEventManager;
213 _pFileEventManager = null;
215 AppLogDebug("remove path result %s",GetErrorMessage(GetLastResult()));
216 SetFooterVisibility(DISABLE_FOOTER_ITEM);
217 ShowFileProgressingPopup();
219 SetFooterVisibility(ENABLE_FOOTER_ITEM);
223 SetFooterVisibility(DISABLE_FOOTER_ITEM);
229 case IDA_CANCEL_DELETION:
231 _isSelectAll = false;
233 if (_pDeleteConfirmationPopUp != null)
235 _pDeleteConfirmationPopUp->SetShowState(false);
240 case IDA_BTN_ANIMATION_POPUP_CANCEL:
242 HideFileProgressingPopup();
244 _isSelectAll = false;
246 if (_pFileManager != null)
247 _pFileManager->ForceStopWorkerThread();
249 if (_pEditListView != null && _pEditListView->IsVisible())
251 for (itemCount = 0;itemCount < _pEditListView->GetItemCount(); itemCount++)
253 _pEditListView->SetItemChecked(itemCount,false);
257 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
259 if (_pThumbnailItemProvider != null)
261 for (itemCount = 0; itemCount < _pThumbnailItemProvider->GetItemCount(); itemCount++)
263 _pEditIconListView->SetItemChecked(itemCount,false);
273 CreateShareContextMenu();
275 if (_pShareContextMenu != null)
277 _pShareContextMenu->SetShowState(true);
278 _pShareContextMenu->Show();
285 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
287 if (_pFileManager->GetCheckedListCount() > 0)
289 SetFooterVisibility(ENABLE_FOOTER_ITEM);
294 SetFooterVisibility(DISABLE_FOOTER_ITEM);
302 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
304 if (_pFileManager->GetCheckedListCount() > 0)
306 SetFooterVisibility(ENABLE_FOOTER_ITEM);
311 SetFooterVisibility(DISABLE_FOOTER_ITEM);
319 _pMoreContextMenu->RemoveAllItems();
320 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
321 _pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
322 _pMoreContextMenu->AddItem(btnMove, IDA_BTN_MOVE, *pBitmapMoveContextItem, null, null);
323 _pMoreContextMenu->AddItem(btnCopy, IDA_BTN_COPY, *pBitmapCopyContextItem, null, null);
324 _pMoreContextMenu->SetShowState(true);
325 _pMoreContextMenu->Show();
331 SceneManager* pSceneManager = null;
332 FolderNavigationPresentationModel::SetCurrentFilePath(_currentDirectoryPath);
333 pSceneManager = SceneManager::GetInstance();
335 if (pSceneManager != null)
337 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), null);
342 case IDA_BTN_CHECKED:
344 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
346 if (_isSelectAll == false)
349 //Clear the existing entries of CheckedList
350 if (_pFileManager != null)
352 _pFileManager->ClearCheckedList();
354 //Add all entries to CheckedList!
355 for (int itemcount = 0; itemcount < _pFilenames->GetCount(); itemcount++)
358 if (_editOrShare == FILE_MANAGE_EDIT)
360 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(itemcount));
362 if (_pFileManager != null /* && pCheckedEntry != null*/)
364 _pFileManager->AddCheckedListEntry(itemcount, pCheckedEntry);
366 if (_pEditListView != null && _pEditListView->IsVisible())
368 _pEditListView->SetItemChecked(itemcount, true);
371 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
373 _pEditIconListView->SetItemChecked(itemcount, true);
378 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(itemcount));
380 if (!pCheckedEntry->IsDirectory())
382 if (_pFileManager != null /* && pCheckedEntry != null*/)
384 _pFileManager->AddCheckedListEntry(itemcount, pCheckedEntry);
386 if (_pEditListView != null && _pEditListView->IsVisible())
388 _pEditListView->SetItemChecked(itemcount - folderCount, true);
391 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
393 _pEditIconListView->SetItemChecked(itemcount - folderCount, true);
397 AppLogDebug("Added to CheckedList! %ls", pCheckedEntry->GetFileName().GetPointer());
400 if (_pFileManager != null)
402 selectedItemsCount = _pFileManager->GetCheckedListCount();
405 _pStrItemSelectedCount->Clear();
406 _pStrItemSelectedCount->Append(selected);
407 _pStrItemSelectedCount->Append(L"\x200E");
408 _pStrItemSelectedCount->Append(L" (");
409 _pStrItemSelectedCount->Append(selectedItemsCount);
410 _pStrItemSelectedCount->Append(L")");
411 _pStrItemSelectedCount->Append(L"\x200E");
413 if (_pLabelNumberOfItems != null)
415 _pLabelNumberOfItems->SetShowState(true);
416 _pLabelNumberOfItems->SetText(*_pStrItemSelectedCount);
417 _pLabelNumberOfItems->Invalidate(true);
420 if (selectedItemsCount > 0)
422 SetFooterVisibility(ENABLE_FOOTER_ITEM);
426 SetFooterVisibility(DISABLE_FOOTER_ITEM);
431 _isSelectAll = false;
432 h_ListView = GetClientAreaBounds().height - H_CHECK_BUTTON;
434 for (int itemcount = 0; itemcount < _pFilenames->GetCount(); itemcount++)
436 if (_pEditListView != null && _pEditListView->IsVisible())
438 _pEditListView->SetItemChecked(itemcount, false);
441 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
443 _pEditIconListView->SetItemChecked(itemcount, false);
447 if (_pFileManager != null)
449 _pFileManager->ClearCheckedList();
452 if (_pLabelNumberOfItems != null)
454 _pLabelNumberOfItems->SetShowState(false);
457 SetFooterVisibility(DISABLE_FOOTER_ITEM);
460 if (_pLabelNumberOfItems != null && _pLabelNumberOfItems->GetShowState() == true)
462 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
464 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
466 _pEditIconListView->Invalidate(true);
469 if (_pEditListView != null && _pEditListView->IsVisible())
471 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
473 _pEditListView->Invalidate(true);
478 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
480 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
482 _pEditIconListView->Invalidate(true);
485 if (_pEditListView != null && _pEditListView->IsVisible())
487 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
489 _pEditListView->Invalidate(true);
495 case IDA_BTN_SHARE_MESSAGE:
497 ShareFile(SHARE_VIA_MESSAGE);
501 case IDA_BTN_SHARE_EMAIL:
503 ShareFile(SHARE_VIA_EMAIL);
507 case IDA_BTN_SHARE_BLUETOOTH:
510 ShareFile(SHARE_VIA_BLUETOOTH);
515 case IDA_BTN_SHARE_WIFI_DIRECT:
518 ShareFile(SHARE_VIA_WIFIDIRECT);
530 if (pBitmapCopyContextItem != null)
532 delete pBitmapCopyContextItem;
533 pBitmapCopyContextItem = null;
535 if (pBitmapMoveContextItem != null)
537 delete pBitmapMoveContextItem;
538 pBitmapMoveContextItem = null;
541 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
545 SubBaseFileManageForm::SubBaseOnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
547 AppLogDebug("Entry");
549 int selectedItemsCount = 0;
552 int itemIndex = INVALID_LIST_INDEX;
555 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), folderCount, fileCount);
557 DirectoryEntry* pCheckedEntry = null;
560 AppResource* pAppResource = null;
561 pAppResource = UiApp::GetInstance()->GetAppResource();
562 if (pAppResource != null)
564 pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selected);
567 if (_editOrShare == FILE_MANAGE_SHARE)
569 itemIndex = folderCount + index;
576 _renameItemIndex = index;
578 if (elementId == CONTENT_LIST_ITEM_TYPE_RENAME || elementId == DETAILED_LIST_ELEMENTS_RENAME)
580 if (listView.IsItemChecked(index) == false)
582 listView.SetItemChecked(index, true);
586 listView.SetItemChecked(index, false);
588 if (_pFileEventManager != null)
590 _pFileEventManager->RemovePath(FolderNavigationPresentationModel::GetCurrentPath());
591 delete _pFileEventManager;
592 _pFileEventManager = null;
594 LoadRenameForm(index);
600 _renameItemIndex = INVALID_LIST_INDEX;
603 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(itemIndex));
604 TryCatch(pCheckedEntry != null,, "Failed to retieve Directory Entry from ArrayList");
607 if (_pLabelNumberOfItems != null)
609 _pLabelNumberOfItems->SetShowState(true);
612 if (listView.IsItemChecked(index) == false)
614 _isSelectAll = false;
616 if (_pFileManager != null)
617 _pFileManager->RemoveCheckedListEntry(itemIndex);
621 if (_editOrShare == FILE_MANAGE_SHARE)
623 if (! pCheckedEntry->IsDirectory())
625 if (pCheckedEntry != null && _pFileManager != null)
627 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
633 if (pCheckedEntry != null && _pFileManager != null)
635 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
640 selectedItemsCount = 0;
642 if(_pFileManager != null)
644 selectedItemsCount = _pFileManager->GetCheckedListCount();
647 if (selectedItemsCount == 0)
649 _isSelectAll = false;
651 if (_pLabelNumberOfItems != null)
653 _pLabelNumberOfItems->SetShowState(false);
655 SetFooterVisibility(DISABLE_FOOTER_ITEM);
659 if (_editOrShare == FILE_MANAGE_EDIT)
661 if (selectedItemsCount == _pFilenames->GetCount())
668 if (selectedItemsCount == fileCount)
673 //Selected Item Count Not Equal to Zero, Display the Label.
674 if (_pLabelNumberOfItems != null)
676 _pLabelNumberOfItems->SetShowState(true);
677 _pStrItemSelectedCount->Clear();
678 _pStrItemSelectedCount->Append(selected);
679 _pStrItemSelectedCount->Append(L"\x200E");
680 _pStrItemSelectedCount->Append(L" (");
681 _pStrItemSelectedCount->Append(selectedItemsCount);
682 _pStrItemSelectedCount->Append(L")");
683 _pStrItemSelectedCount->Append(L"\x200E");
685 _pLabelNumberOfItems->SetText(*_pStrItemSelectedCount);
687 _pLabelNumberOfItems->Invalidate(true);
690 SetFooterVisibility(ENABLE_FOOTER_ITEM);
692 if (_pLabelNumberOfItems != null && _pLabelNumberOfItems->GetShowState() == true)
694 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
696 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
698 _pEditIconListView->Invalidate(true);
701 if (_pEditListView != null && _pEditListView->IsVisible())
703 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
705 _pEditListView->Invalidate(true);
710 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
712 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
714 _pEditIconListView->Invalidate(true);
717 if (_pEditListView != null && _pEditListView->IsVisible())
719 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
721 _pEditListView->Invalidate(true);
725 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
727 if (_pFileManager->GetCheckedListCount() > 0)
729 SetFooterVisibility(ENABLE_FOOTER_ITEM);
733 SetFooterVisibility(DISABLE_FOOTER_ITEM);
737 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
746 SubBaseFileManageForm::SubBaseOnThumbnailReceived(ThumbRequest* pThumbReq)
748 result res = E_SUCCESS;
749 AppLogDebug("Enter");
753 if (pThumbReq != null)
755 if (pThumbReq->GetCurrentSourceForm() != _pFolderEntryPM->GetSourceForm())
757 if (pThumbReq->pBitmap != null)
759 AppLogDebug("This Bitmap is not requested from same form");
760 delete pThumbReq->pBitmap;
767 if (pThumbReq->iRquestId < _pFilenames->GetCount())
769 _pFolderEntryPM->OnThumbnailResponseReceived(pThumbReq->pBitmap, pThumbReq->iRquestId);
770 if (_pEditListView && _pEditListView->IsVisible())
772 res = _pEditListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
774 else if (_pEditIconListView && _pEditIconListView->IsVisible())
776 res = _pEditIconListView->RefreshList(pThumbReq->iRquestId, LIST_REFRESH_TYPE_ITEM_MODIFY);
782 _pFolderEntryPM->OnThumbnailResponseFailed();
785 AppLogDebug("Exit %s", GetErrorMessage(res));
790 SubBaseFileManageForm::CreateFooterControls(void)
792 AppLogDebug("Entry");
796 Bitmap* pBitmap = null;
797 Bitmap* pBitmapDisabled = null;
798 Bitmap* pBitmapPress = null;
799 AppResource* pAppResource = null;
801 pAppResource = Application::GetInstance()->GetAppResource();
802 if (pAppResource != null)
804 pAppResource->GetString(L"IDS_COM_BUTTON_SHARE", btnShare);
805 pAppResource->GetString(L"IDS_COM_POP_CANCEL", btnCancel);
806 pAppResource->GetString(L"IDS_MF_SK3_DELETE", btnDelete);
807 pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);
808 pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888);
809 pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
812 _pButtonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);
814 _pDelete = new (std::nothrow) FooterItem();
815 _pDelete->Construct(IDA_BTN_DELETE);
816 _pDelete->SetText(btnDelete);
818 _pShare = new (std::nothrow) FooterItem();
819 _pShare->Construct(IDA_BTN_SHARE);
820 _pShare->SetText(btnShare);
822 TryCatch(pBitmap != null, , "MfMyFilesApp::Bitmap pBitmap null");
823 TryCatch(pBitmapDisabled != null, , "MfMyFilesApp::Bitmap pBitmapDisabled null");
824 TryCatch(pBitmapPress != null, , "MfMyFilesApp::Bitmap pBitmapPress null");
826 pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
827 _pButtonItemMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);
829 pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
830 _pButtonItemMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled);
832 pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));
833 _pButtonItemMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);
836 _pFooter = GetFooter();
837 if (_pFooter != null)
839 _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
841 SetFooterVisibility(DISABLE_FOOTER_ITEM);
843 //Set am ActionEventListener to the Footer
844 _pFooter->AddActionEventListener(*this);
856 if (pBitmapDisabled != null)
858 delete pBitmapDisabled;
864 SubBaseFileManageForm::RemoveFooter(void)
866 _pFooter = GetFooter();
867 if (_pFooter != null)
869 _pFooter->RemoveAllItems();
870 _pFooter->RemoveAllButtons();
875 SubBaseFileManageForm::DeleteFile(void)
877 //_pFolderEntryPM->SetFileEventListener(null);
878 ((MyFilesApp*) Application::GetInstance())->SetNotifyListener(this);
879 if (_pFileManager != null)
880 _pFileManager->DeleteFolderEntries();
885 SubBaseFileManageForm::CopyFile(void)
887 AppLogDebug("Entry");
888 Integer* pSourceForm = null;
889 SceneManager* pSceneManager = SceneManager::GetInstance();
890 ArrayList* pArgs = null;
892 pArgs = new (std::nothrow) ArrayList();
893 TryCatch(pArgs != null, , "pArgs is null.");
894 pSourceForm = new (std::nothrow) Integer(SELECT_COPY_BUTTON);
896 //_pFolderEntryPM->SetFileEventListener(null);
900 pArgs->Add(pSourceForm);
902 TryCatch(pSceneManager != null, , "SceneManager is null.");
904 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_COPY_MOVE_FORM),pArgs);
908 if (pSourceForm != null)
922 SubBaseFileManageForm::MoveFile(void)
924 AppLogDebug("Entry");
925 Integer* pSourceForm;
927 ArrayList* pArgs = null;
928 SceneManager* pSceneManager = null;
930 pSceneManager = SceneManager::GetInstance();
932 pSourceForm = new (std::nothrow) Integer(SELECT_MOVE_BUTTON);
934 pArgs = new (std::nothrow) ArrayList();
935 TryCatch(pArgs != null, , "pArgs is null.");
936 //_pFolderEntryPM->SetFileEventListener(null);
939 pArgs->Add(pSourceForm);
941 TryCatch(pSceneManager != null, , "SceneManager is null.");
943 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_COPY_MOVE_FORM),pArgs);
944 //_pCheckedList = null;
948 if (pSourceForm != null)
964 SubBaseFileManageForm::ShareFile(ShareVia shareType)
966 AppLogDebug("Entry");
967 DirectoryEntry* ptempDirEntry = null;
968 IMapEnumerator* pMapEnum = null;
969 AppControl* pAc = null;
970 const String* pAttachKey = null;
971 const String* pUriType = null;
972 result r = E_SUCCESS;
975 ArrayList* filePathList = null;
976 MessageBox messageBox;
979 //Disable the form to avoid any more clicks, if the share button is already clicked
982 dataList.Construct();
983 pAttachKey = new (std::nothrow) const String(L"http://tizen.org/appcontrol/data/path");
987 case SHARE_VIA_EMAIL:
989 pAc = AppManager::FindAppControlN(L"tizen.email", "http://tizen.org/appcontrol/operation/compose");
993 case SHARE_VIA_MESSAGE:
995 pUriType = new (std::nothrow) const String(L"mmsto");
996 pAc = AppManager::FindAppControlN(L"tizen.messages", "http://tizen.org/appcontrol/operation/compose");
1007 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
1009 pMapEnum = _pFileManager->GetCheckedList()->GetMapEnumeratorN();
1010 if (pMapEnum != null)
1012 if (filePathList == null)
1014 filePathList = new (std::nothrow) ArrayList();
1016 while (pMapEnum->MoveNext() == E_SUCCESS)
1018 ptempDirEntry = static_cast< DirectoryEntry* >(pMapEnum->GetValue());
1020 if (ptempDirEntry != null)
1022 filePathList->Add(new (std::nothrow) String (ptempDirEntry->GetFullFilePath()));
1028 dataList.Add(*pAttachKey,*filePathList);
1029 if (shareType == SHARE_VIA_MESSAGE)
1031 dataList.Add(new (std::nothrow) String (L"http://tizen.org/appcontrol/data/message/type"),new (std::nothrow) String (L"mms"));
1036 AppLogDebug("filePathList count is %d",filePathList->GetCount());
1038 if (shareType == SHARE_VIA_EMAIL)
1040 r = pAc->Start(null, null, &dataList, null);
1042 else if (shareType == SHARE_VIA_MESSAGE)
1044 r = pAc->Start(pUriType, null, &dataList, null);
1047 //Before going to Message/Email appcontrol, remove FIleEventListener
1048 //to avoid any file modification event
1049 if ( r == E_SUCCESS)
1051 ((MyFilesApp*) Application::GetInstance())->SetAppControlLaunched(true);
1052 if(_pFileEventManager != null)
1054 _pFileEventManager->RemovePath(FolderNavigationPresentationModel::GetCurrentPath());
1055 delete _pFileEventManager;
1056 _pFileEventManager = null;
1060 if (r == E_MAX_EXCEEDED)
1062 messageBox.Construct(L"", L"Email Size Exceeded", MSGBOX_STYLE_OK);
1063 messageBox.ShowAndWait(modalResult);
1068 if (dataList.GetCount() > 0)
1070 if (filePathList != null)
1072 filePathList->RemoveAll(true);
1074 dataList.RemoveAll(true);
1076 if (pUriType != null)
1083 SubBaseFileManageForm::CreateLabelControl(void)
1085 Color backgroundColor(68, 68, 68);
1087 _pLabelNumberOfItems = new (std::nothrow) Label();
1088 if (_pLabelNumberOfItems != null)
1090 _pLabelNumberOfItems->Construct(Rectangle(X_DEFAULT, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL), *_pStrItemSelectedCount);
1091 _pLabelNumberOfItems->SetBackgroundColor(backgroundColor);
1092 _pLabelNumberOfItems->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
1093 _pLabelNumberOfItems->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1094 _pLabelNumberOfItems->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1095 _pLabelNumberOfItems->SetTextConfig(ID_FONT_SIZE_32, LABEL_TEXT_STYLE_BOLD);
1096 _pLabelNumberOfItems->SetName(L"IDC_LABEL_COUNT");
1098 _pLabelNumberOfItems->SetShowState(false);
1100 AddControl(*_pLabelNumberOfItems);
1106 SubBaseFileManageForm::SetFooterVisibility(int mode)
1108 AppLogDebug("ENTRY mode = %d",mode);
1110 _pFooter = GetFooter();
1112 if (mode == DISABLE_FOOTER_ITEM)
1114 _pFooter->SetItemEnabled(0, false);
1115 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1119 _pFooter->SetItemEnabled(0, true);
1120 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1122 _pFooter->Invalidate(true);
1126 SubBaseFileManageForm::SubBaseOnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
1128 AppLogDebug("Entry");
1129 int itemIndex = INVALID_LIST_INDEX;
1130 int selectedItemsCount = 0;
1131 //int shareEnableFlag = 1;
1136 result r = E_SUCCESS;
1137 DirectoryEntry* pCheckedEntry = null;
1138 Integer indexToCheck(itemIndex);
1141 AppResource* pAppResource = null;
1142 pAppResource = UiApp::GetInstance()->GetAppResource();
1143 if (pAppResource != null)
1145 pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selected);
1148 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), dirCount, fileCount);
1150 if (_editOrShare == FILE_MANAGE_SHARE)
1152 itemIndex = dirCount + index;
1159 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(itemIndex));
1160 TryCatch(pCheckedEntry != null, , "Failed to retrieve the directory entry for this index.");
1164 //Set ShowState of the Label Displaying Selected Count as true
1165 if (_pLabelNumberOfItems != null)
1167 _pLabelNumberOfItems->SetShowState(true);
1170 //Check the item @ index if it is false.
1171 if (iconListView.IsItemChecked(index) == false)
1173 _isSelectAll = false;
1175 if (_pFileManager != null)
1176 _pFileManager->RemoveCheckedListEntry(itemIndex);
1180 if (_editOrShare == FILE_MANAGE_SHARE)
1182 if (!pCheckedEntry->IsDirectory())
1184 if (pCheckedEntry != null && _pFileManager != null)
1186 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
1192 if (pCheckedEntry != null && _pFileManager != null)
1194 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
1199 if (_pFileManager != null)
1201 selectedItemsCount = _pFileManager->GetCheckedListCount();
1204 if (selectedItemsCount == 0)
1206 //If each item is unselected, set the showstate of the label to false.
1207 if (_pFileManager != null)
1208 _pFileManager->ClearCheckedList();
1210 if (_pLabelNumberOfItems != null)
1212 _pLabelNumberOfItems->SetShowState(false);
1215 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1220 //Else at least one item is selected and show the number of items selected on the label.
1221 if (_pLabelNumberOfItems != null)
1223 _pLabelNumberOfItems->SetShowState(true);
1225 _pStrItemSelectedCount->Clear();
1226 _pStrItemSelectedCount->Append(selected);
1227 _pStrItemSelectedCount->Append(L"\x200E");
1228 _pStrItemSelectedCount->Append(L" (");
1229 _pStrItemSelectedCount->Append(selectedItemsCount);
1230 _pStrItemSelectedCount->Append(L")");
1231 _pStrItemSelectedCount->Append(L"\x200E");
1233 AppLogDebug("Text on Label = %ls", _pStrItemSelectedCount->GetPointer());
1235 _pLabelNumberOfItems->SetText(*_pStrItemSelectedCount);
1236 _pLabelNumberOfItems->Invalidate(true);
1239 SetFooterVisibility(ENABLE_FOOTER_ITEM);
1242 AppLogDebug("Exit %s", GetErrorMessage(r));
1252 SubBaseFileManageForm::ShowFileProgressingPopup(void)
1254 CreateFileProgressingPopup();
1256 if (_pFileProgressingPopup != null)
1258 _pFileProgressingPopup->SetShowState(true);
1259 _pFileProgressingPopup->Show();
1264 SubBaseFileManageForm::HideFileProgressingPopup(void)
1266 if (_pFileProgressingPopup != null && _pFileProgressingPopup->IsVisible())
1268 _pFileProgressingPopup->SetShowState(false);
1269 //_pFileProgressingPopup->Invalidate(true);
1271 //_pFileProgressingPopup->RemoveAllControls();
1272 delete _pFileProgressingPopup;
1273 _pFileProgressingPopup = null;
1278 SubBaseFileManageForm::CreateFileProgressingPopup(void)
1280 result r = E_SUCCESS;
1281 //String popUpTitle;
1283 String fileProgress;
1285 AppResource* pAppResource = null;
1287 if (_pFileProgressingPopup != null)
1289 //_pFileProgressingPopup->RemoveAllControls();
1290 delete _pFileProgressingPopup;
1291 _pFileProgressingPopup = null;
1294 pAppResource = UiApp::GetInstance()->GetAppResource();
1296 if (pAppResource != null)
1298 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
1300 _pFileProgressingPopup = new (std::nothrow) Popup();
1301 TryCatch(_pFileProgressingPopup != null, , "Failed to Allocate Memory to _pAnimationPopUp");
1303 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
1305 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1306 if (_pFileProgressingCancelButton != null)
1308 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
1309 _pFileProgressingCancelButton->AddActionEventListener(*this);
1310 _pFileProgressingCancelButton->SetShowState(true);
1312 _pAnimationProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
1313 if (_pAnimationProgress != null)
1315 _pAnimationProgress->SetName(L"AnimationProgress");
1316 _pAnimationProgress->SetValue(0);
1319 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
1320 if (_pFileProgressingHeaderLabel != null)
1322 _pFileProgressingHeaderLabel->SetText(deleting);
1323 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
1324 _pFileProgressingHeaderLabel->SetShowState(true);
1326 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
1327 if (_pFileProgressingLabel != null)
1329 _pFileProgressingLabel->SetName(L"FileCountLabel");
1330 _pFileProgressingLabel->SetText(L"");
1331 _pFileProgressingLabel->SetShowState(false);
1337 if (_pFileProgressingPopup != null)
1339 delete _pFileProgressingPopup;
1340 _pFileProgressingPopup = null;
1345 SubBaseFileManageForm::SubBaseOnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
1347 AppLogDebug("Entry");
1349 result r = E_SUCCESS;
1350 Integer* pCurrentStatus = null;
1351 Integer* pTotalCount = null;
1352 String fileProcessCountText;
1353 Integer* pFileProcessingResult = null;
1354 Integer* pFolderEntryDeleteIndex = null;
1356 Rectangle listViewBounds(X_DEFAULT, H_CHECK_BUTTON, GetClientAreaBounds().width, GetClientAreaBounds().height - H_CHECK_BUTTON);
1358 int badgeNumber = 0;
1360 Header* pHeader = null;
1361 pHeader = GetHeader();
1362 NotificationManager* pNotiManager = null;
1363 TryCatch(pArgs != null, , "Argument Lis Received is Invalid!");
1365 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
1366 TryCatch(pFileProcessingResult != null, , "File Processing Result is Invalid!");
1368 pNotiManager = new (std::nothrow) NotificationManager();
1369 TryCatch(pNotiManager != null, , "Failed to fetch AppNotificationManager");
1371 pNotiManager->Construct();
1372 badgeNumber = pNotiManager->GetBadgeNumber();
1375 switch (pFileProcessingResult->ToInt())
1377 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
1379 HideFileProgressingPopup();
1380 if(_pFileEventManager == null)
1382 _pFileEventManager = new (std::nothrow)FileEventManager();
1383 _pFileEventManager->Construct(*this);
1385 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(), FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVE_SELF);
1389 if (_pFileManager != null)
1390 _pFileManager->ClearCheckedList();
1392 if (_pLabelNumberOfItems != null)
1393 _pLabelNumberOfItems->SetShowState(false);
1395 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1397 if (_pFilenames->GetCount() == 0)
1400 if (pHeader != null)
1402 pHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
1403 //pHeader->SetItemEnabled(0, false);
1404 pHeader->Invalidate(true);
1406 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1411 case FILE_MANAGING_RESULT_DELETING_FAILED:
1413 HideFileProgressingPopup();
1414 if(_pFileEventManager == null)
1416 _pFileEventManager = new (std::nothrow)FileEventManager();
1417 _pFileEventManager->Construct(*this);
1419 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(), FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVE_SELF);
1422 String deleteFailed;
1423 AppResource* pAppResource = null;
1424 pAppResource = Application::GetInstance()->GetAppResource();
1425 pAppResource->GetString("IDS_MF_POP_DELETE_FAILED", deleteFailed);
1427 MessageBox messageBox;
1428 messageBox.Construct(L"", deleteFailed, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
1429 int modalResult = 0;
1430 messageBox.ShowAndWait(modalResult);
1434 case FILE_MANAGING_RESULT_CURRENT_STATUS:
1437 if (pArgs->GetCount() > 1)
1439 pCurrentStatus = (Integer*) pArgs->GetAt(1);
1440 pTotalCount = (Integer*) pArgs->GetAt(2);
1441 if (pCurrentStatus != null)
1443 _fileProcessedCount = pCurrentStatus->ToInt();
1445 fileProcessCountText.Append(_fileProcessedCount);
1446 fileProcessCountText.Append(L"/");
1447 if (pTotalCount != null)
1449 fileProcessCountText.Append(pTotalCount->ToInt());
1450 value = (_fileProcessedCount * 100) / pTotalCount->ToInt();
1455 if (_pFileProgressingPopup != null)
1457 if(_pAnimationProgress != null)
1459 _pAnimationProgress->SetValue(value);
1460 _pAnimationProgress->SetShowState(true);
1461 _pAnimationProgress->Invalidate(true);
1463 if (_pFileProgressingLabel != null)
1465 _pFileProgressingLabel->SetText(fileProcessCountText);
1466 _pFileProgressingLabel->SetShowState(true);
1467 _pFileProgressingLabel->Invalidate(true);
1472 case FILE_MANAGING_REFRESH_LIST:
1474 HashMap* pCacheList = null;
1475 DirectoryEntry* pCurrentEntry = null;
1476 bool cacheKeyStatus = false;
1479 if (pArgs->GetCount() > 1)
1481 pFolderEntryDeleteIndex = (Integer*) pArgs->GetAt(1);
1483 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
1485 if (pCacheList != null)
1487 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(pFolderEntryDeleteIndex->ToInt()));
1489 if (pCurrentEntry != null)
1491 cachePath = pCurrentEntry->GetFullFilePath();
1494 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1498 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1502 if (pFolderEntryDeleteIndex != null)
1504 r = _pFilenames->RemoveAt(pFolderEntryDeleteIndex->ToInt());
1505 TryCatch(r == E_SUCCESS, , "Remove from array list failed");
1508 if (_pEditListView != null && _pEditListView->IsVisible())
1510 _pEditListView->RefreshList(pFolderEntryDeleteIndex->ToInt(), LIST_REFRESH_TYPE_ITEM_REMOVE);
1513 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1515 _pEditIconListView->RefreshList(pFolderEntryDeleteIndex->ToInt(), LIST_REFRESH_TYPE_ITEM_REMOVE);
1528 if (_pLabelNumberOfItems != null && _pLabelNumberOfItems->GetShowState() == true)
1530 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1532 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
1534 _pEditIconListView->Invalidate(true);
1537 if (_pEditListView != null && _pEditListView->IsVisible())
1539 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
1541 _pEditListView->Invalidate(true);
1546 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1548 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
1550 _pEditIconListView->Invalidate(true);
1553 if (_pEditListView != null && _pEditListView->IsVisible())
1555 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
1557 _pEditListView->Invalidate(true);
1561 if (pNotiManager != null)
1563 delete pNotiManager;
1564 pNotiManager = null;
1569 pArgs->RemoveAll(true);
1579 pArgs->RemoveAll(true);
1583 if (pNotiManager != null)
1585 delete pNotiManager;
1586 pNotiManager = null;
1592 SubBaseFileManageForm::LoadRenameForm(int index)
1594 result r = E_SUCCESS;
1595 ArrayList* pArg = null;
1596 Integer* pSourceSelected = null;
1597 SceneManager* pSceneManager = null;
1598 DirectoryEntry* pDirectory = null;
1600 if (_pFilenames != null)
1602 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1605 pSceneManager = SceneManager::GetInstance();
1606 TryCatch(pSceneManager != null, , "Failed to Get SceneManager Instance");
1608 pArg = new (std::nothrow) ArrayList();
1611 pSourceSelected = new (std::nothrow) Integer(SELECT_RENAME);
1613 r = pArg->Add(pSourceSelected);
1614 TryCatch(r == E_SUCCESS, , "Failed to Add Entry to ArrayList");
1615 if (pDirectory != null)
1617 r = pArg->Add(pDirectory);
1618 TryCatch(r == E_SUCCESS, , "Failed to Add Entry to ArrayList");
1620 AppLogDebug("SubBaseFileManageForm: pArgs Count is %d", pArg->GetCount());
1622 if (pSceneManager != null)
1624 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
1626 AppLogDebug("Exit %s", GetErrorMessage(r));
1631 if (pSourceSelected != null)
1633 delete pSourceSelected;
1634 pSourceSelected = null;
1641 AppLogDebug("Exit %s", GetErrorMessage(r));
1647 SubBaseFileManageForm::CreateDeleteConfirmationPopUp(void)
1650 result r = E_SUCCESS;
1651 Rectangle popupBounds;
1653 //Create a new popup control
1654 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
1655 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
1657 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
1658 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
1660 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
1661 _pDeleteFile->AddActionEventListener(*this);
1662 _pDeleteFile->SetShowState(true);
1664 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
1665 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
1667 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
1668 _pCancelDeletion->AddActionEventListener(*this);
1669 _pCancelDeletion->SetShowState(true);
1674 delete _pDeleteConfirmationPopUp;
1675 _pDeleteConfirmationPopUp = null;
1681 SubBaseFileManageForm::CreateShareContextMenu(void)
1683 AppLogDebug("Enter");
1684 result r = E_SUCCESS;
1686 if (_pShareContextMenu != null)
1699 AppResource* pAppResource = null;
1700 Bitmap* pBitmapEmailContextItem = null;
1701 Bitmap* pBitmapMessageContextItem = null;
1702 // Bitmap* pBitmapBluetoothContextItem = null;
1703 // Bitmap* pBitmapWiFiDirectContextItem = null;
1705 _pFooter = GetFooter();
1706 if (_pFooter != null)
1708 _pFooter->GetPosition(x_Footer, y_Footer);
1711 Point startPosition(GetClientAreaBounds().width / 2, y_Footer - H_DISPLAY_PATH_LABEL);
1713 pAppResource = Application::GetInstance()->GetAppResource();
1714 if (pAppResource != null)
1716 pAppResource->GetString(L"IDS_COM_BODY_MESSAGE", message);
1717 pAppResource->GetString(L"IDS_COM_BODY_EMAIL", eMail);
1718 pAppResource->GetString(L"IDS_COM_BODY_BLUETOOTH", bluetooth);
1719 pAppResource->GetString(L"IDS_COM_OPT1_WI_FI_DIRECT", wifiDirect);
1720 pBitmapEmailContextItem = pAppResource->GetBitmapN(IDB_POPUP_EMAIL_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1721 pBitmapMessageContextItem = pAppResource->GetBitmapN(IDB_POPUP_MESSAGE_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1723 //pBitmapBluetoothContextItem = pAppResource->GetBitmapN(IDB_POPUP_BLUETOOTH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1724 //pBitmapWiFiDirectContextItem = pAppResource->GetBitmapN(IDB_POPUP_WIFIDIRECT_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1726 AppLogDebug("enter1");
1727 _pShareContextMenu = new (std::nothrow) ContextMenu();
1728 _pShareContextMenu->Construct(startPosition, CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
1729 _pShareContextMenu->AddItem(message, IDA_BTN_SHARE_MESSAGE, *pBitmapMessageContextItem, null, null);
1730 _pShareContextMenu->AddItem(eMail, IDA_BTN_SHARE_EMAIL, *pBitmapEmailContextItem, null, null);
1732 _pShareContextMenu->AddItem(bluetooth, IDA_BTN_SHARE_BLUETOOTH, *pBitmapBluetoothContextItem, null, null);
1733 _pShareContextMenu->AddItem(wifiDirect, IDA_BTN_SHARE_WIFI_DIRECT, *pBitmapWiFiDirectContextItem, null, null);
1736 _pShareContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_BLACK));
1737 _pShareContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
1739 _pShareContextMenu->SetShowState(false);
1741 _pShareContextMenu->AddActionEventListener(*this);
1743 AppLogDebug("EXIT");
1748 SubBaseFileManageForm::SortArrayList(Tizen::Base::Collection::ArrayList* pArrList)
1750 for (int i = 0; i < pArrList->GetCount(); i++)
1752 Integer* PValue1 = (Integer*) pArrList->GetAt(i);
1753 for (int j = i + 1; j < pArrList->GetCount(); j++)
1755 Integer* PValue2 = (Integer*) pArrList->GetAt(j);
1756 if (PValue1->ToInt() > PValue2->ToInt())
1759 temp = PValue1->ToInt();
1760 *PValue1 = *PValue2;
1765 for (int i = 0; i < pArrList->GetCount(); i++)
1767 Integer* PValue1 = (Integer*) pArrList->GetAt(i);
1768 AppLogDebug("%d", PValue1->ToInt());
1773 SubBaseFileManageForm::ToggleFooter(void)
1775 int xPos = 0, yPos = 0;
1777 _pFooter = GetFooter();
1778 TryReturn(_pFooter != null, , "Footer is Null");
1779 _pFooter->RemoveAllItems();
1780 _pFooter->RemoveAllButtons();
1781 _pFooter->SetBackButton();
1782 _pFooter->SetBackButtonEnabled(true);
1784 switch (_editOrShare)
1786 case FILE_MANAGE_EDIT:
1788 _pFooter->AddItem(*_pDelete);
1789 _pFooter->SetButton(BUTTON_POSITION_LEFT, _pButtonItemMore);
1790 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1792 _pMoreContextMenu = new (std::nothrow) ContextMenu();
1793 _pFooter->GetPosition(xPos, yPos);
1794 _pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST);
1795 _pMoreContextMenu->AddActionEventListener(*this);
1796 _pMoreContextMenu->SetShowState(false);
1799 case FILE_MANAGE_SHARE:
1801 _pFooter->AddItem(*_pShare);
1808 _pFooter->Invalidate(true);
1812 SubBaseFileManageForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
1814 AppLogDebug("SubBaseFileManageForm::OnFileEventOccured");
1815 if (events & FILE_EVENT_TYPE_MOVE_SELF)
1817 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), null);
1821 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1826 SubBaseFileManageForm::OnAppControlCompleted(void)
1828 AppLogDebug("SubBaseFileManageForm::OnAppControlCompleted");
1829 //On coming back from Email/Message appcontrol, Enable the Form and
1830 //register the FileEvent Listener back
1832 if(_pFileEventManager == null)
1834 _pFileEventManager = new (std::nothrow)FileEventManager();
1835 _pFileEventManager->Construct(*this);
1837 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(), FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVE_SELF);
1841 SubBaseFileManageForm::OnSettingValueChanged(void)
1843 //Empty Implementation.