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 //const HashMap* pResultHash = null;
973 result r = E_SUCCESS;
976 ArrayList* filePathList = null;
977 MessageBox messageBox;
980 dataList.Construct();
981 pAttachKey = new (std::nothrow) const String(L"http://tizen.org/appcontrol/data/path");
985 case SHARE_VIA_EMAIL:
987 pAc = AppManager::FindAppControlN(L"tizen.email", "http://tizen.org/appcontrol/operation/compose");
991 case SHARE_VIA_MESSAGE:
993 pUriType = new (std::nothrow) const String(L"mmsto");
994 pAc = AppManager::FindAppControlN(L"tizen.messages", "http://tizen.org/appcontrol/operation/compose");
1004 //pResultHash = FolderEntryEditorPresentationModel::GetInstance()->GetCheckedList();
1006 if (_pFileManager != null && _pFileManager->IsCheckedListNull() == false)
1008 pMapEnum = _pFileManager->GetCheckedList()->GetMapEnumeratorN();
1009 if (pMapEnum != null)
1011 if (filePathList == null)
1013 filePathList = new (std::nothrow) ArrayList();
1015 while (pMapEnum->MoveNext() == E_SUCCESS)
1017 ptempDirEntry = static_cast< DirectoryEntry* >(pMapEnum->GetValue());
1019 if (ptempDirEntry != null)
1021 filePathList->Add(new (std::nothrow) String (ptempDirEntry->GetFullFilePath()));
1027 dataList.Add(*pAttachKey,*filePathList);
1028 if (shareType == SHARE_VIA_MESSAGE)
1030 dataList.Add(new (std::nothrow) String (L"http://tizen.org/appcontrol/data/message/type"),new (std::nothrow) String (L"mms"));
1035 AppLogDebug("filePathList count is %d",filePathList->GetCount());
1037 if (shareType == SHARE_VIA_EMAIL)
1039 r = pAc->Start(null, null, &dataList, null);
1041 else if (shareType == SHARE_VIA_MESSAGE)
1043 r = pAc->Start(pUriType, null, &dataList, null);
1046 //Before going to Message/Email appcontrol, remove FIleEventListener
1047 //to avoid any file modification event
1048 if ( r == E_SUCCESS)
1050 if(_pFileEventManager != null)
1052 _pFileEventManager->RemovePath(FolderNavigationPresentationModel::GetCurrentPath());
1053 delete _pFileEventManager;
1054 _pFileEventManager = null;
1058 if (r == E_MAX_EXCEEDED)
1060 messageBox.Construct(L"", L"Email Size Exceeded", MSGBOX_STYLE_OK);
1061 messageBox.ShowAndWait(modalResult);
1066 if (dataList.GetCount() > 0)
1068 if (filePathList != null)
1070 filePathList->RemoveAll(true);
1072 dataList.RemoveAll(true);
1074 if (pUriType != null)
1081 SubBaseFileManageForm::CreateLabelControl(void)
1083 Color backgroundColor(68, 68, 68);
1085 _pLabelNumberOfItems = new (std::nothrow) Label();
1086 if (_pLabelNumberOfItems != null)
1088 _pLabelNumberOfItems->Construct(Rectangle(X_DEFAULT, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL, GetClientAreaBounds().width, H_DISPLAY_PATH_LABEL), *_pStrItemSelectedCount);
1089 _pLabelNumberOfItems->SetBackgroundColor(backgroundColor);
1090 _pLabelNumberOfItems->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
1091 _pLabelNumberOfItems->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1092 _pLabelNumberOfItems->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1093 _pLabelNumberOfItems->SetTextConfig(ID_FONT_SIZE_32, LABEL_TEXT_STYLE_BOLD);
1094 _pLabelNumberOfItems->SetName(L"IDC_LABEL_COUNT");
1096 _pLabelNumberOfItems->SetShowState(false);
1098 AddControl(*_pLabelNumberOfItems);
1104 SubBaseFileManageForm::SetFooterVisibility(int mode)
1106 AppLogDebug("ENTRY mode = %d",mode);
1108 _pFooter = GetFooter();
1110 if (mode == DISABLE_FOOTER_ITEM)
1112 _pFooter->SetItemEnabled(0, false);
1113 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1117 _pFooter->SetItemEnabled(0, true);
1118 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
1120 _pFooter->Invalidate(true);
1124 SubBaseFileManageForm::SubBaseOnIconListViewItemStateChanged(Tizen::Ui::Controls::IconListView& iconListView, int index, Tizen::Ui::Controls::IconListViewItemStatus status)
1126 AppLogDebug("Entry");
1127 int itemIndex = INVALID_LIST_INDEX;
1128 int selectedItemsCount = 0;
1129 //int shareEnableFlag = 1;
1134 result r = E_SUCCESS;
1135 DirectoryEntry* pCheckedEntry = null;
1136 Integer indexToCheck(itemIndex);
1139 AppResource* pAppResource = null;
1140 pAppResource = UiApp::GetInstance()->GetAppResource();
1141 if (pAppResource != null)
1143 pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selected);
1146 _pFolderEntryPM->GetFolderEntryCount(FolderNavigationPresentationModel::GetCurrentPath(), dirCount, fileCount);
1148 if (_editOrShare == FILE_MANAGE_SHARE)
1150 itemIndex = dirCount + index;
1157 pCheckedEntry = static_cast< DirectoryEntry* >(_pFilenames->GetAt(itemIndex));
1158 TryCatch(pCheckedEntry != null, , "Failed to retrieve the directory entry for this index.");
1162 //Set ShowState of the Label Displaying Selected Count as true
1163 if (_pLabelNumberOfItems != null)
1165 _pLabelNumberOfItems->SetShowState(true);
1168 //Check the item @ index if it is false.
1169 if (iconListView.IsItemChecked(index) == false)
1171 _isSelectAll = false;
1173 if (_pFileManager != null)
1174 _pFileManager->RemoveCheckedListEntry(itemIndex);
1178 if (_editOrShare == FILE_MANAGE_SHARE)
1180 if (!pCheckedEntry->IsDirectory())
1182 if (pCheckedEntry != null && _pFileManager != null)
1184 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
1190 if (pCheckedEntry != null && _pFileManager != null)
1192 _pFileManager->AddCheckedListEntry(itemIndex, pCheckedEntry);
1197 if (_pFileManager != null)
1199 selectedItemsCount = _pFileManager->GetCheckedListCount();
1202 if (selectedItemsCount == 0)
1204 //If each item is unselected, set the showstate of the label to false.
1205 if (_pFileManager != null)
1206 _pFileManager->ClearCheckedList();
1208 if (_pLabelNumberOfItems != null)
1210 _pLabelNumberOfItems->SetShowState(false);
1213 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1218 //Else at least one item is selected and show the number of items selected on the label.
1219 if (_pLabelNumberOfItems != null)
1221 _pLabelNumberOfItems->SetShowState(true);
1223 _pStrItemSelectedCount->Clear();
1224 _pStrItemSelectedCount->Append(selected);
1225 _pStrItemSelectedCount->Append(L"\x200E");
1226 _pStrItemSelectedCount->Append(L" (");
1227 _pStrItemSelectedCount->Append(selectedItemsCount);
1228 _pStrItemSelectedCount->Append(L")");
1229 _pStrItemSelectedCount->Append(L"\x200E");
1231 AppLogDebug("Text on Label = %ls", _pStrItemSelectedCount->GetPointer());
1233 _pLabelNumberOfItems->SetText(*_pStrItemSelectedCount);
1234 _pLabelNumberOfItems->Invalidate(true);
1237 SetFooterVisibility(ENABLE_FOOTER_ITEM);
1240 AppLogDebug("Exit %s", GetErrorMessage(r));
1250 SubBaseFileManageForm::ShowFileProgressingPopup(void)
1252 CreateFileProgressingPopup();
1254 if (_pFileProgressingPopup != null)
1256 _pFileProgressingPopup->SetShowState(true);
1257 _pFileProgressingPopup->Show();
1262 SubBaseFileManageForm::HideFileProgressingPopup(void)
1264 if (_pFileProgressingPopup != null && _pFileProgressingPopup->IsVisible())
1266 _pFileProgressingPopup->SetShowState(false);
1267 //_pFileProgressingPopup->Invalidate(true);
1269 //_pFileProgressingPopup->RemoveAllControls();
1270 delete _pFileProgressingPopup;
1271 _pFileProgressingPopup = null;
1276 SubBaseFileManageForm::CreateFileProgressingPopup(void)
1278 result r = E_SUCCESS;
1279 //String popUpTitle;
1281 String fileProgress;
1283 AppResource* pAppResource = null;
1285 if (_pFileProgressingPopup != null)
1287 //_pFileProgressingPopup->RemoveAllControls();
1288 delete _pFileProgressingPopup;
1289 _pFileProgressingPopup = null;
1292 pAppResource = UiApp::GetInstance()->GetAppResource();
1294 if (pAppResource != null)
1296 pAppResource->GetString(L"IDS_COM_POP_DELETING", deleting);
1298 _pFileProgressingPopup = new (std::nothrow) Popup();
1299 TryCatch(_pFileProgressingPopup != null, , "Failed to Allocate Memory to _pAnimationPopUp");
1301 _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
1303 _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
1304 if (_pFileProgressingCancelButton != null)
1306 _pFileProgressingCancelButton->SetActionId(IDA_BTN_ANIMATION_POPUP_CANCEL);
1307 _pFileProgressingCancelButton->AddActionEventListener(*this);
1308 _pFileProgressingCancelButton->SetShowState(true);
1310 _pAnimationProgress = static_cast< Progress* >(_pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
1311 if (_pAnimationProgress != null)
1313 _pAnimationProgress->SetName(L"AnimationProgress");
1314 _pAnimationProgress->SetValue(0);
1317 _pFileProgressingHeaderLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
1318 if (_pFileProgressingHeaderLabel != null)
1320 _pFileProgressingHeaderLabel->SetText(deleting);
1321 _pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
1322 _pFileProgressingHeaderLabel->SetShowState(true);
1324 _pFileProgressingLabel = static_cast< Label* >(_pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
1325 if (_pFileProgressingLabel != null)
1327 _pFileProgressingLabel->SetName(L"FileCountLabel");
1328 _pFileProgressingLabel->SetText(L"");
1329 _pFileProgressingLabel->SetShowState(false);
1335 if (_pFileProgressingPopup != null)
1337 delete _pFileProgressingPopup;
1338 _pFileProgressingPopup = null;
1343 SubBaseFileManageForm::SubBaseOnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
1345 AppLogDebug("Entry");
1347 result r = E_SUCCESS;
1348 Integer* pCurrentStatus = null;
1349 Integer* pTotalCount = null;
1350 String fileProcessCountText;
1351 Integer* pFileProcessingResult = null;
1352 Integer* pFolderEntryDeleteIndex = null;
1354 Rectangle listViewBounds(X_DEFAULT, H_CHECK_BUTTON, GetClientAreaBounds().width, GetClientAreaBounds().height - H_CHECK_BUTTON);
1356 int badgeNumber = 0;
1358 Header* pHeader = null;
1359 pHeader = GetHeader();
1360 NotificationManager* pNotiManager = null;
1361 TryCatch(pArgs != null, , "Argument Lis Received is Invalid!");
1363 pFileProcessingResult = (Integer*) pArgs->GetAt(0);
1364 TryCatch(pFileProcessingResult != null, , "File Processing Result is Invalid!");
1366 pNotiManager = new (std::nothrow) NotificationManager();
1367 TryCatch(pNotiManager != null, , "Failed to fetch AppNotificationManager");
1369 pNotiManager->Construct();
1370 badgeNumber = pNotiManager->GetBadgeNumber();
1373 switch (pFileProcessingResult->ToInt())
1375 case FILE_MANAGING_RESULT_DELETING_SUCCESS:
1377 HideFileProgressingPopup();
1378 if(_pFileEventManager == null)
1380 _pFileEventManager = new (std::nothrow)FileEventManager();
1381 _pFileEventManager->Construct(*this);
1383 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(),FILE_EVENT_TYPE_DELETE);
1387 if (_pFileManager != null)
1388 _pFileManager->ClearCheckedList();
1390 if (_pLabelNumberOfItems != null)
1391 _pLabelNumberOfItems->SetShowState(false);
1393 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1395 if (_pFilenames->GetCount() == 0)
1398 if (pHeader != null)
1400 pHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
1401 //pHeader->SetItemEnabled(0, false);
1402 pHeader->Invalidate(true);
1404 SetFooterVisibility(DISABLE_FOOTER_ITEM);
1409 case FILE_MANAGING_RESULT_DELETING_FAILED:
1411 HideFileProgressingPopup();
1412 if(_pFileEventManager == null)
1414 _pFileEventManager = new (std::nothrow)FileEventManager();
1415 _pFileEventManager->Construct(*this);
1417 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(),FILE_EVENT_TYPE_DELETE);
1420 String deleteFailed;
1421 AppResource* pAppResource = null;
1422 pAppResource = Application::GetInstance()->GetAppResource();
1423 pAppResource->GetString("IDS_MF_POP_DELETE_FAILED", deleteFailed);
1425 MessageBox messageBox;
1426 messageBox.Construct(L"", deleteFailed, MSGBOX_STYLE_NONE, ID_MESSAGE_BOX_TIMEOUT_ONE_SECOND);
1427 int modalResult = 0;
1428 messageBox.ShowAndWait(modalResult);
1432 case FILE_MANAGING_RESULT_CURRENT_STATUS:
1435 if (pArgs->GetCount() > 1)
1437 pCurrentStatus = (Integer*) pArgs->GetAt(1);
1438 pTotalCount = (Integer*) pArgs->GetAt(2);
1439 if (pCurrentStatus != null)
1441 _fileProcessedCount = pCurrentStatus->ToInt();
1443 fileProcessCountText.Append(_fileProcessedCount);
1444 fileProcessCountText.Append(L"/");
1445 if (pTotalCount != null)
1447 fileProcessCountText.Append(pTotalCount->ToInt());
1448 value = (_fileProcessedCount * 100) / pTotalCount->ToInt();
1453 if (_pFileProgressingPopup != null)
1455 if(_pAnimationProgress != null)
1457 _pAnimationProgress->SetValue(value);
1458 _pAnimationProgress->SetShowState(true);
1459 _pAnimationProgress->Invalidate(true);
1461 if (_pFileProgressingLabel != null)
1463 _pFileProgressingLabel->SetText(fileProcessCountText);
1464 _pFileProgressingLabel->SetShowState(true);
1465 _pFileProgressingLabel->Invalidate(true);
1470 case FILE_MANAGING_REFRESH_LIST:
1472 HashMap* pCacheList = null;
1473 DirectoryEntry* pCurrentEntry = null;
1474 bool cacheKeyStatus = false;
1477 if (pArgs->GetCount() > 1)
1479 pFolderEntryDeleteIndex = (Integer*) pArgs->GetAt(1);
1481 pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
1483 if (pCacheList != null)
1485 pCurrentEntry = static_cast<DirectoryEntry*>(_pFilenames->GetAt(pFolderEntryDeleteIndex->ToInt()));
1487 if (pCurrentEntry != null)
1489 cachePath = pCurrentEntry->GetFullFilePath();
1492 cacheKeyStatus = pCacheList->ContainsKey(cachePath);
1496 CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
1500 if (pFolderEntryDeleteIndex != null)
1502 r = _pFilenames->RemoveAt(pFolderEntryDeleteIndex->ToInt());
1503 TryCatch(r == E_SUCCESS, , "Remove from array list failed");
1506 if (_pEditListView != null && _pEditListView->IsVisible())
1508 _pEditListView->RefreshList(pFolderEntryDeleteIndex->ToInt(), LIST_REFRESH_TYPE_ITEM_REMOVE);
1511 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1513 _pEditIconListView->RefreshList(pFolderEntryDeleteIndex->ToInt(), LIST_REFRESH_TYPE_ITEM_REMOVE);
1526 if (_pLabelNumberOfItems != null && _pLabelNumberOfItems->GetShowState() == true)
1528 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1530 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
1532 _pEditIconListView->Invalidate(true);
1535 if (_pEditListView != null && _pEditListView->IsVisible())
1537 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height - H_DISPLAY_PATH_LABEL));
1539 _pEditListView->Invalidate(true);
1544 if (_pEditIconListView != null && _pEditIconListView->IsVisible())
1546 _pEditIconListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
1548 _pEditIconListView->Invalidate(true);
1551 if (_pEditListView != null && _pEditListView->IsVisible())
1553 _pEditListView->SetBounds(Rectangle(X_DEFAULT, Y_DEFAULT, GetClientAreaBounds().width, GetClientAreaBounds().height));
1555 _pEditListView->Invalidate(true);
1559 if (pNotiManager != null)
1561 delete pNotiManager;
1562 pNotiManager = null;
1567 pArgs->RemoveAll(true);
1577 pArgs->RemoveAll(true);
1581 if (pNotiManager != null)
1583 delete pNotiManager;
1584 pNotiManager = null;
1590 SubBaseFileManageForm::LoadRenameForm(int index)
1592 result r = E_SUCCESS;
1593 ArrayList* pArg = null;
1594 Integer* pSourceSelected = null;
1595 SceneManager* pSceneManager = null;
1596 DirectoryEntry* pDirectory = null;
1598 if (_pFilenames != null)
1600 pDirectory = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));
1603 pSceneManager = SceneManager::GetInstance();
1604 TryCatch(pSceneManager != null, , "Failed to Get SceneManager Instance");
1606 pArg = new (std::nothrow) ArrayList();
1609 pSourceSelected = new (std::nothrow) Integer(SELECT_RENAME);
1611 r = pArg->Add(pSourceSelected);
1612 TryCatch(r == E_SUCCESS, , "Failed to Add Entry to ArrayList");
1613 if (pDirectory != null)
1615 r = pArg->Add(pDirectory);
1616 TryCatch(r == E_SUCCESS, , "Failed to Add Entry to ArrayList");
1618 AppLogDebug("SubBaseFileManageForm: pArgs Count is %d", pArg->GetCount());
1620 if (pSceneManager != null)
1622 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_FOLDER_FORM, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArg);
1624 AppLogDebug("Exit %s", GetErrorMessage(r));
1629 if (pSourceSelected != null)
1631 delete pSourceSelected;
1632 pSourceSelected = null;
1639 AppLogDebug("Exit %s", GetErrorMessage(r));
1645 SubBaseFileManageForm::CreateDeleteConfirmationPopUp(void)
1648 result r = E_SUCCESS;
1649 Rectangle popupBounds;
1651 //Create a new popup control
1652 _pDeleteConfirmationPopUp = new (std::nothrow) Popup();
1653 _pDeleteConfirmationPopUp->Construct(L"IDL_DELETE_POPUP");
1655 _pDeleteFile = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_DELETE", true));
1656 TryCatch(_pDeleteFile != null, , "MfMyFilesApp::Button For Popup not created!");
1658 _pDeleteFile->SetActionId(IDA_DELETE_FILE);
1659 _pDeleteFile->AddActionEventListener(*this);
1660 _pDeleteFile->SetShowState(true);
1662 _pCancelDeletion = static_cast< Button* >(_pDeleteConfirmationPopUp->GetControl(L"IDC_BUTTON_CANCEL", true));
1663 TryCatch(_pCancelDeletion != null, , "MfMyFilesApp::Button For Popup not created!");
1665 _pCancelDeletion->SetActionId(IDA_CANCEL_DELETION);
1666 _pCancelDeletion->AddActionEventListener(*this);
1667 _pCancelDeletion->SetShowState(true);
1672 delete _pDeleteConfirmationPopUp;
1673 _pDeleteConfirmationPopUp = null;
1679 SubBaseFileManageForm::CreateShareContextMenu(void)
1681 AppLogDebug("Enter");
1682 result r = E_SUCCESS;
1684 if (_pShareContextMenu != null)
1697 AppResource* pAppResource = null;
1698 Bitmap* pBitmapEmailContextItem = null;
1699 Bitmap* pBitmapMessageContextItem = null;
1700 // Bitmap* pBitmapBluetoothContextItem = null;
1701 // Bitmap* pBitmapWiFiDirectContextItem = null;
1703 _pFooter = GetFooter();
1704 if (_pFooter != null)
1706 _pFooter->GetPosition(x_Footer, y_Footer);
1709 Point startPosition(GetClientAreaBounds().width / 2, y_Footer - H_DISPLAY_PATH_LABEL);
1711 pAppResource = Application::GetInstance()->GetAppResource();
1712 if (pAppResource != null)
1714 pAppResource->GetString(L"IDS_COM_BODY_MESSAGE", message);
1715 pAppResource->GetString(L"IDS_COM_BODY_EMAIL", eMail);
1716 pAppResource->GetString(L"IDS_COM_BODY_BLUETOOTH", bluetooth);
1717 pAppResource->GetString(L"IDS_COM_OPT1_WI_FI_DIRECT", wifiDirect);
1718 pBitmapEmailContextItem = pAppResource->GetBitmapN(IDB_POPUP_EMAIL_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1719 pBitmapMessageContextItem = pAppResource->GetBitmapN(IDB_POPUP_MESSAGE_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1721 //pBitmapBluetoothContextItem = pAppResource->GetBitmapN(IDB_POPUP_BLUETOOTH_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1722 //pBitmapWiFiDirectContextItem = pAppResource->GetBitmapN(IDB_POPUP_WIFIDIRECT_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);
1724 AppLogDebug("enter1");
1725 _pShareContextMenu = new (std::nothrow) ContextMenu();
1726 _pShareContextMenu->Construct(startPosition, CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
1727 _pShareContextMenu->AddItem(message, IDA_BTN_SHARE_MESSAGE, *pBitmapMessageContextItem, null, null);
1728 _pShareContextMenu->AddItem(eMail, IDA_BTN_SHARE_EMAIL, *pBitmapEmailContextItem, null, null);
1730 _pShareContextMenu->AddItem(bluetooth, IDA_BTN_SHARE_BLUETOOTH, *pBitmapBluetoothContextItem, null, null);
1731 _pShareContextMenu->AddItem(wifiDirect, IDA_BTN_SHARE_WIFI_DIRECT, *pBitmapWiFiDirectContextItem, null, null);
1734 _pShareContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_BLACK));
1735 _pShareContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
1737 _pShareContextMenu->SetShowState(false);
1739 _pShareContextMenu->AddActionEventListener(*this);
1741 AppLogDebug("EXIT");
1746 SubBaseFileManageForm::SortArrayList(Tizen::Base::Collection::ArrayList* pArrList)
1748 for (int i = 0; i < pArrList->GetCount(); i++)
1750 Integer* PValue1 = (Integer*) pArrList->GetAt(i);
1751 for (int j = i + 1; j < pArrList->GetCount(); j++)
1753 Integer* PValue2 = (Integer*) pArrList->GetAt(j);
1754 if (PValue1->ToInt() > PValue2->ToInt())
1757 temp = PValue1->ToInt();
1758 *PValue1 = *PValue2;
1763 for (int i = 0; i < pArrList->GetCount(); i++)
1765 Integer* PValue1 = (Integer*) pArrList->GetAt(i);
1766 AppLogDebug("%d", PValue1->ToInt());
1771 SubBaseFileManageForm::ToggleFooter(void)
1773 int xPos = 0, yPos = 0;
1775 _pFooter = GetFooter();
1776 TryReturn(_pFooter != null, , "Footer is Null");
1777 _pFooter->RemoveAllItems();
1778 _pFooter->RemoveAllButtons();
1779 _pFooter->SetBackButton();
1780 _pFooter->SetBackButtonEnabled(true);
1782 switch (_editOrShare)
1784 case FILE_MANAGE_EDIT:
1786 _pFooter->AddItem(*_pDelete);
1787 _pFooter->SetButton(BUTTON_POSITION_LEFT, _pButtonItemMore);
1788 _pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
1790 _pMoreContextMenu = new (std::nothrow) ContextMenu();
1791 _pFooter->GetPosition(xPos, yPos);
1792 _pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST);
1793 _pMoreContextMenu->AddActionEventListener(*this);
1794 _pMoreContextMenu->SetShowState(false);
1797 case FILE_MANAGE_SHARE:
1799 _pFooter->AddItem(*_pShare);
1806 _pFooter->Invalidate(true);
1810 SubBaseFileManageForm::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)
1812 AppLogDebug("SubBaseFileManageForm::OnFileEventOccured");
1813 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1817 SubBaseFileManageForm::OnAppControlCompleted(void)
1819 AppLogDebug("SubBaseFileManageForm::OnAppControlCompleted");
1820 //On coming back from Email/Message appcontrol, register the FileEvent Listener back
1821 if(_pFileEventManager == null)
1823 _pFileEventManager = new (std::nothrow)FileEventManager();
1824 _pFileEventManager->Construct(*this);
1826 _pFileEventManager->AddPath(FolderNavigationPresentationModel::GetCurrentPath(),FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_MOVED_FROM);