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 GlAlbumListEditorForm.cpp
19 * @brief This is the implementation file for AlbumListEditorForm class.
22 #include "GlAlbumInfo.h"
23 #include "GlAlbumListEditorForm.h"
24 #include "GlAlbumListPresentationModel.h"
25 #include "GlResourceManager.h"
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Content;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Io;
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 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
41 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
42 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
43 static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera" + DIRECTORY_SEPARATOR;
44 static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera" + DIRECTORY_SEPARATOR;
45 static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
46 static const String RESERVED_EXTERNAL_MEDIA_PATH = Environment::GetExternalStoragePath();
48 static const int GAP_W_POPUP_ITEM = 5;
49 static const int W_DELETE_POPUP = 620;
50 static const int H_DELETE_POPUP = 300;
51 static const int H_DELETE_LABEL = 180;
52 static const int Y_DELETE_BUTTON = 180;
53 static const int H_DELETE_BUTTON = 80;
55 static const int FORMAT_BUFFER_SIZE = 256;
57 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
58 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
60 static const int IDA_ALBUM_EDIT = 503;
62 AlbumListEditorForm::AlbumListEditorForm(void)
64 , __pSelectCountLabel(null)
65 , __pEditorFolderIconList(null)
66 , __pShareContextMenu(null)
67 , __pDeletePopup(null)
68 , __pFileUpdateTimer(null)
69 , __pPresentationModel(null)
72 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
75 AlbumListEditorForm::~AlbumListEditorForm(void)
78 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
82 AlbumListEditorForm::Initialize(void)
85 result r = Form::Construct(IDL_FORM_ALBUM_LIST_EDITOR);
86 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
92 AlbumListEditorForm::OnInitializing(void)
97 SetOrientation(ORIENTATION_AUTOMATIC);
98 AddOrientationEventListener(*this);
100 __pPresentationModel = AlbumListPresentationModel::GetInstance();
101 __pPresentationModel->ClearThumbnailRequests();
102 r = __pPresentationModel->AddPresentationModelListener(this);
104 SetFormBackEventListener(this);
105 GetHeader()->AddActionEventListener(*this);
106 GetFooter()->AddActionEventListener(*this);
108 r = InitializeControl();
111 AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
114 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
120 AlbumListEditorForm::OnTerminating(void)
122 AppLogDebug("ENTER");
123 result r = E_SUCCESS;
124 r = __pPresentationModel->RemovePresentationModelListener(*this);
125 __pPresentationModel->RemoveContentEventListener(*this);
127 if (__pDeletePopup != null)
129 delete __pDeletePopup;
130 __pDeletePopup = null;
132 if (__pFileUpdateTimer != null)
134 delete __pFileUpdateTimer;
135 __pFileUpdateTimer = null;
137 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
143 AlbumListEditorForm::OnContentUpdated(void)
145 AppLogDebug("ENTER");
146 int maxCount = __pPresentationModel->GetFolderCount();
147 if (__pDeletePopup != null)
149 if (__pDeletePopup->IsVisible() == true)
151 __pDeletePopup->Destroy();
152 __pDeletePopup = null;
157 for (int i = 0; i < maxCount; ++i)
159 __pEditorFolderIconList->SetItemChecked(i, false);
161 SceneManager* pSceneManager = SceneManager::GetInstance();
162 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
163 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
167 AlbumListEditorForm::InitializeControl(void)
169 AppLogDebug("ENTER");
170 result r = E_SUCCESS;
173 __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
174 AppAssert(__pSelectCountLabel);
176 CreateIconListView();
177 __checkedCount = GetCheckedFolderCount();
180 r = InitializePopup();
181 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
187 AlbumListEditorForm::InitializePopup(void)
189 AppLogDebug("ENTER");
190 if (__pDeletePopup == null)
192 __pDeletePopup = new (std::nothrow) Popup();
193 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
194 __pDeletePopup->SetPropagatedKeyEventListener(this);
196 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
198 Label* pLabel = new (std::nothrow) Label();
199 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
200 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
201 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
202 pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
204 Button* pDeleteButton = new (std::nothrow) Button();
205 pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
206 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
207 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
208 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
209 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
210 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
211 pDeleteButton->AddActionEventListener(*this);
213 Button* pCancelButton = new (std::nothrow) Button();
214 pCancelButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
215 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
216 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
217 pCancelButton->AddActionEventListener(*this);
219 __pDeletePopup->AddControl(pLabel);
220 __pDeletePopup->AddControl(pDeleteButton);
221 __pDeletePopup->AddControl(pCancelButton);
225 __pDeletePopup->SetShowState(true);
226 __pDeletePopup->Show();
228 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
234 AlbumListEditorForm::CreateIconListView(void)
236 AppLogDebug("ENTER");
239 __pEditorFolderIconList = new IconListView();
240 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
241 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
242 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
243 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
244 __pEditorFolderIconList->SetItemProvider(*this);
245 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
246 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
248 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
252 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
256 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
258 AddControl(__pEditorFolderIconList);
260 __pEditorFolderIconList->SetShowState(true);
262 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
266 AlbumListEditorForm::GetItemCount(void)
268 AppLogDebug("ENTER");
269 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
271 return __pPresentationModel->GetFolderCount();
275 AlbumListEditorForm::CreateItem(int index)
277 AppLogDebug("ENTER : index(%d)", index);
278 Bitmap* pBitmap = null;
279 Canvas* pEditAlbumCanvas = null;
280 Bitmap* pEditAlbumBitmap = null;
281 Bitmap* pBitmapRenameBg = null;
282 Bitmap* pBitmapRename = null;
284 int canvasWidth = 75;
285 int canvasHeight = 75;
287 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
289 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
290 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
292 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
293 if (pAlbumBitmap == null)
295 __pPresentationModel->RequestThumbnail(index, 0);
298 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
300 if (__pEditorFolderIconList->IsItemChecked(index) == true)
304 BufferInfo bufferInfo;
305 pBitmap->Lock(bufferInfo, INFINITE);
307 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
308 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
310 canvas.Construct(bufferInfo);
311 canvas.FillRectangle(dimColor, canvas.GetBounds());
312 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
313 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
314 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
315 delete pSelectedBitmap;
320 pIconListviewItem->Construct(*pBitmap);
328 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
329 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
331 if (pBitmapRenameBg != null && pBitmapRename != null)
334 pEditAlbumCanvas = new (std::nothrow) Canvas();
335 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
336 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg);
337 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename);
340 pEditAlbumBitmap = new (std::nothrow) Bitmap();
342 if (pEditAlbumBitmap != NULL)
344 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
347 delete pEditAlbumCanvas;
349 albumName = pAlbumInfo->GetAlbumName();
350 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
351 String albumPath = pAlbumInfo->GetDirectory(0);
352 albumPath.Append(DIRECTORY_SEPARATOR);
354 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
355 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
356 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
362 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
365 if (pEditAlbumBitmap != null)
367 delete pEditAlbumBitmap;
373 delete pBitmapRenameBg;
377 delete pBitmapRename;
380 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
382 return pIconListviewItem;
386 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
388 AppLogDebug("ENTER");
390 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
392 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
396 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
402 if (__checkedCount == 0)
404 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
406 else if (__checkedCount == 1)
408 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
412 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
415 __pSelectCountLabel->SetText(tempString);
416 __pSelectCountLabel->RequestRedraw();
417 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
421 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
425 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
428 AppLogDebug("ENTER");
429 SceneManager* pSceneManager = SceneManager::GetInstance();
431 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
432 pSelectedIndex->Construct();
433 //Adding the Action Type
434 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
435 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
436 pSelectedIndex->Add(new (std::nothrow) Integer(index));
438 if (__pEditorFolderIconList->IsItemChecked(index) == false)
440 __pEditorFolderIconList->SetItemChecked(index,true);
444 __pEditorFolderIconList->SetItemChecked(index,false);
446 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
447 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
451 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
453 AppLogDebug("ENTER");
455 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
461 AlbumListEditorForm::DeleteFolder(void)
464 AppLogDebug("ENTER");
465 IList* pIndexList = GetItemCheckedIndexListN();
466 if (pIndexList->GetCount() <= 0)
469 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
473 if (__pFileUpdateTimer != null)
475 delete __pFileUpdateTimer;
477 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
478 result r = __pFileUpdateTimer->StartTimer();
482 delete __pFileUpdateTimer;
483 __pFileUpdateTimer = null;
488 __pPresentationModel->SetUpdateProgressStatus(true);
494 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
496 AppLogDebug("ENTER");
497 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
498 Integer* pIndex = null;
500 if (__pEditorFolderIconList!=null)
502 int loopCount = __pPresentationModel->GetFolderCount();
503 for (int i = 0; i < loopCount; ++i)
505 if (__pEditorFolderIconList->IsItemChecked(i) == true)
507 pIndex = new (std::nothrow) Integer(i);
509 AppLogDebug("checked index(%d)", i);
513 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
519 AlbumListEditorForm::SetAllCheckState(const bool state)
521 AppLogDebug("ENTER");
523 int maxCount = __pPresentationModel->GetFolderCount();
530 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
534 tempString.Format(FORMAT_BUFFER_SIZE,
535 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
540 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
543 for (int i = 0; i < maxCount; ++i)
545 __pEditorFolderIconList->SetItemChecked(i, state);
546 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
549 __pEditorFolderIconList->Draw();
550 __pSelectCountLabel->SetText(tempString);
551 __pSelectCountLabel->RequestRedraw();
552 __checkedCount = GetCheckedFolderCount();
556 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
560 AlbumListEditorForm::GetCheckedFolderCount(void) const
562 AppLogDebug("ENTER");
563 int maxCount = __pPresentationModel->GetFolderCount();
566 for (int i = 0; i < maxCount; ++i)
568 if (__pEditorFolderIconList->IsItemChecked (i))
573 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
579 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
581 AppLogDebug("ENTER");
584 case IDA_ALBUM_LIST_SELECT_ALL:
586 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
588 SetAllCheckState(false);
592 SetAllCheckState(true);
597 case IDA_FOOTER_DELETE:
599 __pDeletePopup->SetShowState(true);
600 __pDeletePopup->Show();
604 case IDA_FOOTER_SHARE:
607 if (__pShareContextMenu != NULL)
609 delete __pShareContextMenu;
610 __pShareContextMenu = null;
614 Bitmap* pBitmapEmailContextItem = null;
615 Bitmap* pBitmapMessageContextItem = null;
616 pBitmapEmailContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_EMAIL_ICON);
617 pBitmapMessageContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_MESSAGE_ICON);
619 __pShareContextMenu = new (std::nothrow) ContextMenu();
620 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5),
621 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
623 if ( pBitmapMessageContextItem != null)
625 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
626 IDA_CONTEXT_MENU_MESSAGE , *pBitmapMessageContextItem, null, null);
628 delete pBitmapMessageContextItem;
631 if ( pBitmapEmailContextItem != null)
633 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL,
634 *pBitmapEmailContextItem, null, null);
636 delete pBitmapEmailContextItem;
639 __pShareContextMenu->SetFocusable(true);
640 __pShareContextMenu->AddActionEventListener(*this);
641 __pShareContextMenu->SetShowState(true);
642 __pShareContextMenu->Show();
646 case IDA_CONTEXT_MENU_MESSAGE:
652 case IDA_CONTEXT_MENU_EMAIL:
658 case IDA_DELETE_POPUP_DEL:
660 __pDeletePopup->SetShowState(false);
661 __pDeletePopup->Show();
666 case IDA_DELETE_POPUP_CANCEL:
668 __pDeletePopup->SetShowState(false);
669 __pDeletePopup->Show();
676 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
680 AlbumListEditorForm::OnFormBackRequested(Form& source)
682 AppLogDebug("ENTER");
683 SceneManager* pSceneManager = SceneManager::GetInstance();
684 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
685 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
689 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
690 const SceneId& currentSceneId, IList* pArgs)
692 AppLogDebug("ENTER OnSceneActivatedN");
696 int count = __pPresentationModel->GetFolderCount();
698 __pPresentationModel->AddContentEventListener(this);
700 __checkedCount = GetCheckedFolderCount();
702 if (previousSceneId == IDSCN_ALBUM_NAME_EDITOR)
705 if (__checkedCount == 0)
707 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
711 tempString.Format(FORMAT_BUFFER_SIZE,
712 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
717 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
719 for (int index = 0; index < count; ++index)
721 __pEditorFolderIconList->SetItemChecked(index,false);
724 __pEditorFolderIconList->UpdateList();
726 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
729 __pSelectCountLabel->SetText(tempString);
730 __pSelectCountLabel->Invalidate(true);
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
737 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
739 AppLogDebug("ENTER");
740 __pPresentationModel->RemoveContentEventListener(*this);
742 if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR)
744 int loopCount = __pPresentationModel->GetFolderCount();
746 for (int count = 0; count < loopCount; ++count)
748 __pEditorFolderIconList->SetItemChecked(count,false);
750 __pEditorFolderIconList->UpdateList();
753 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
757 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
759 AppLogDebug("ENTER");
761 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
765 AlbumListEditorForm::OnThumbnailDecoded(const int index)
767 AppLogDebug("ENTER : index(%d)", index);
768 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
769 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
772 void AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
777 void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
779 AppLogDebug("ENTER");
780 __pPresentationModel->SetUpdateProgressStatus(false);
781 SetAllCheckState(false);
782 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
783 __pEditorFolderIconList->UpdateList();
785 SceneManager* pSceneManager = SceneManager::GetInstance();
786 AppAssert(pSceneManager);
787 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
788 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
791 bool AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
793 AppLogDebug("ENTER");
795 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
797 __pDeletePopup->SetShowState(false);
798 __pDeletePopup->Show();
800 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
805 AlbumListEditorForm::Update(void)
807 AppLogDebug("ENTER");
808 result r = __pEditorFolderIconList->UpdateList();
809 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
815 AlbumListEditorForm::OnRequestMessage(void)
817 AppLogDebug("ENTER");
819 int checkCount = GetCheckedFolderCount();
823 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
828 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
830 int maxCount = __pPresentationModel->GetFolderCount();
831 ContentManager contentManager;
832 result r = contentManager.Construct();
837 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
841 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
842 pArrayList->Construct();
843 for (int i = 0; i < maxCount; ++i)
845 if (__pEditorFolderIconList->IsItemChecked (i))
847 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
848 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
849 int loopCount = pContentIdList->GetCount();
850 for (int k = 0; k < loopCount; ++k)
852 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
853 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
855 if (pContentInfo == null)
860 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
870 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
871 pDataList->Construct();
872 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
873 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
875 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
876 null, null, pDataList, null);
878 if (r == E_MAX_EXCEEDED)
880 MessageBox messageBox;
881 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
882 MSGBOX_STYLE_NONE, 3000);
884 messageBox.ShowAndWait(modalResult);
887 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
891 AlbumListEditorForm::OnRequestEmail(void)
893 AppLogDebug("ENTER");
895 int checkCount = GetCheckedFolderCount();
899 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
904 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
906 int maxCount = __pPresentationModel->GetFolderCount();
907 ContentManager contentManager;
908 result r = contentManager.Construct();
913 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
917 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
918 pArrayList->Construct();
919 for (int i = 0; i < maxCount; ++i)
921 if (__pEditorFolderIconList->IsItemChecked(i))
923 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
924 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
925 int loopCount = pContentIdList->GetCount();
926 for (int k = 0; k < loopCount; ++k)
928 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
929 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
931 if (pContentInfo == null)
936 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
946 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
947 pDataList->Construct();
948 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
950 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
951 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
953 if (r == E_MAX_EXCEEDED)
955 MessageBox messageBox;
956 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
957 MSGBOX_STYLE_NONE, 3000);
959 messageBox.ShowAndWait(modalResult);
962 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
966 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
968 AppLogDebug("ENTER");
969 Footer* pFooter = GetFooter();
972 if (enableState == true)
974 pFooter->SetItemEnabled(0, true);
975 pFooter->SetItemEnabled(1, true);
979 pFooter->SetItemEnabled(0, false);
980 pFooter->SetItemEnabled(1, false);
983 pFooter->RequestRedraw(true);
984 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
988 AlbumListEditorForm::SetButtonState(void)
990 AppLogDebug("ENTER");
991 if (GetCheckedFolderCount() > 0)
993 AppLogDebug("BUTTONSTATE : Request Enable");
994 SetFooterButtonsState(true);
998 AppLogDebug("BUTTONSTATE : Request disable");
999 SetFooterButtonsState(false);
1001 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1006 AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1009 IList* pIndexList = GetItemCheckedIndexListN();
1011 if (__pEditorFolderIconList != null)
1013 RemoveControl(__pEditorFolderIconList);
1016 __pEditorFolderIconList = new IconListView();
1018 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
1020 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
1021 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1023 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1025 int horizontalSpacing = 8;
1026 int verticalSpacing = 60;
1030 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
1031 Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1033 __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing);
1034 __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40);
1037 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
1039 if (pBitmap != null)
1041 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
1045 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
1046 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
1047 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
1048 __pEditorFolderIconList->SetItemProvider(*this);
1049 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
1050 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
1052 AddControl(__pEditorFolderIconList);
1054 int loopCount = pIndexList->GetCount();
1056 for (int count = 0; count < loopCount; ++count)
1058 Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
1059 index = pRealIndex->ToInt();
1060 __pEditorFolderIconList->SetItemChecked(index, true);
1061 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);