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(
206 Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
207 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
208 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
209 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
210 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
211 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
212 pDeleteButton->AddActionEventListener(*this);
214 Button* pCancelButton = new (std::nothrow) Button();
215 pCancelButton->Construct(
216 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
217 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
218 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
219 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
220 pCancelButton->AddActionEventListener(*this);
222 __pDeletePopup->AddControl(pLabel);
223 __pDeletePopup->AddControl(pDeleteButton);
224 __pDeletePopup->AddControl(pCancelButton);
228 __pDeletePopup->SetShowState(true);
229 __pDeletePopup->Show();
231 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
237 AlbumListEditorForm::CreateIconListView(void)
239 AppLogDebug("ENTER");
242 __pEditorFolderIconList = new IconListView();
243 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
244 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
245 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
246 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
247 __pEditorFolderIconList->SetItemProvider(*this);
248 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
249 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
251 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
255 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
259 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
261 AddControl(__pEditorFolderIconList);
263 __pEditorFolderIconList->SetShowState(true);
265 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
269 AlbumListEditorForm::GetItemCount(void)
271 AppLogDebug("ENTER");
272 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
274 return __pPresentationModel->GetFolderCount();
278 AlbumListEditorForm::CreateItem(int index)
280 AppLogDebug("ENTER : index(%d)", index);
281 Bitmap* pBitmap = null;
282 Canvas* pEditAlbumCanvas = null;
283 Bitmap* pEditAlbumBitmap = null;
284 Bitmap* pBitmapRenameBg = null;
285 Bitmap* pBitmapRename = null;
287 int canvasWidth = 75;
288 int canvasHeight = 75;
290 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
292 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
293 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
295 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
296 if (pAlbumBitmap == null)
298 __pPresentationModel->RequestThumbnail(index, 0);
301 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
303 if (__pEditorFolderIconList->IsItemChecked(index) == true)
307 BufferInfo bufferInfo;
308 pBitmap->Lock(bufferInfo, INFINITE);
310 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
311 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
313 canvas.Construct(bufferInfo);
314 canvas.FillRectangle(dimColor, canvas.GetBounds());
315 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
316 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
317 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
318 delete pSelectedBitmap;
323 pIconListviewItem->Construct(*pBitmap);
331 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
332 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
334 if (pBitmapRenameBg != null && pBitmapRename != null)
337 pEditAlbumCanvas = new (std::nothrow) Canvas();
338 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
339 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg);
340 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename);
343 pEditAlbumBitmap = new (std::nothrow) Bitmap();
345 if (pEditAlbumBitmap != NULL)
347 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
350 delete pEditAlbumCanvas;
352 albumName = pAlbumInfo->GetAlbumName();
353 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
354 String albumPath = pAlbumInfo->GetDirectory(0);
355 albumPath.Append(DIRECTORY_SEPARATOR);
357 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
358 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
359 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
365 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
368 if (pEditAlbumBitmap != null)
370 delete pEditAlbumBitmap;
376 delete pBitmapRenameBg;
380 delete pBitmapRename;
383 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
385 return pIconListviewItem;
389 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
391 AppLogDebug("ENTER");
393 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
395 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
399 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
405 if (__checkedCount == 0)
407 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
409 else if (__checkedCount == 1)
411 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
415 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
418 __pSelectCountLabel->SetText(tempString);
419 __pSelectCountLabel->RequestRedraw();
420 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
424 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
428 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
431 AppLogDebug("ENTER");
432 SceneManager* pSceneManager = SceneManager::GetInstance();
434 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
435 pSelectedIndex->Construct();
436 //Adding the Action Type
437 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
438 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
439 pSelectedIndex->Add(new (std::nothrow) Integer(index));
441 if( __pEditorFolderIconList->IsItemChecked(index) == false )
443 __pEditorFolderIconList->SetItemChecked(index,true);
447 __pEditorFolderIconList->SetItemChecked(index,false);
449 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
450 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
454 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
456 AppLogDebug("ENTER");
458 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
464 AlbumListEditorForm::DeleteFolder(void)
467 AppLogDebug("ENTER");
468 IList* pIndexList = GetItemCheckedIndexListN();
469 if (pIndexList->GetCount() <= 0)
472 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
476 if (__pFileUpdateTimer != null)
478 delete __pFileUpdateTimer;
480 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
481 result r = __pFileUpdateTimer->StartTimer();
485 delete __pFileUpdateTimer;
486 __pFileUpdateTimer = null;
491 __pPresentationModel->SetUpdateProgressStatus(true);
497 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
499 AppLogDebug("ENTER");
500 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
501 Integer* pIndex = null;
503 if (__pEditorFolderIconList!=null)
505 int loopCount = __pPresentationModel->GetFolderCount();
506 for (int i = 0; i < loopCount; ++i)
508 if (__pEditorFolderIconList->IsItemChecked(i) == true)
510 pIndex = new (std::nothrow) Integer(i);
512 AppLogDebug("checked index(%d)", i);
516 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
522 AlbumListEditorForm::SetAllCheckState(const bool state)
524 AppLogDebug("ENTER");
526 int maxCount = __pPresentationModel->GetFolderCount();
533 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
537 tempString.Format(FORMAT_BUFFER_SIZE,
538 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
543 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
546 for (int i = 0; i < maxCount; ++i)
548 __pEditorFolderIconList->SetItemChecked(i, state);
549 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
552 __pEditorFolderIconList->Draw();
553 __pSelectCountLabel->SetText(tempString);
554 __pSelectCountLabel->RequestRedraw();
555 __checkedCount = GetCheckedFolderCount();
559 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
563 AlbumListEditorForm::GetCheckedFolderCount(void) const
565 AppLogDebug("ENTER");
566 int maxCount = __pPresentationModel->GetFolderCount();
569 for (int i = 0 ; i < maxCount; ++i)
571 if (__pEditorFolderIconList->IsItemChecked (i))
576 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
582 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
584 AppLogDebug("ENTER");
587 case IDA_ALBUM_LIST_SELECT_ALL:
589 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
591 SetAllCheckState(false);
595 SetAllCheckState(true);
600 case IDA_FOOTER_DELETE:
602 __pDeletePopup->SetShowState(true);
603 __pDeletePopup->Show();
607 case IDA_FOOTER_SHARE:
610 if( __pShareContextMenu != NULL)
612 delete __pShareContextMenu;
613 __pShareContextMenu = null;
616 __pShareContextMenu = new (std::nothrow) ContextMenu();
617 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5),
618 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
619 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
620 IDA_CONTEXT_MENU_MESSAGE);
621 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL);
622 __pShareContextMenu->SetFocusable(true);
623 __pShareContextMenu->AddActionEventListener(*this);
624 __pShareContextMenu->SetShowState(true);
625 __pShareContextMenu->Show();
629 case IDA_CONTEXT_MENU_MESSAGE:
635 case IDA_CONTEXT_MENU_EMAIL:
641 case IDA_DELETE_POPUP_DEL:
643 __pDeletePopup->SetShowState(false);
644 __pDeletePopup->Show();
649 case IDA_DELETE_POPUP_CANCEL:
651 __pDeletePopup->SetShowState(false);
652 __pDeletePopup->Show();
659 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
663 AlbumListEditorForm::OnFormBackRequested(Form& source)
665 AppLogDebug("ENTER");
666 SceneManager* pSceneManager = SceneManager::GetInstance();
667 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
668 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
672 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
673 const SceneId& currentSceneId, IList* pArgs)
675 AppLogDebug("ENTER OnSceneActivatedN");
679 int count = __pPresentationModel->GetFolderCount();
681 __pPresentationModel->AddContentEventListener(this);
683 __checkedCount = GetCheckedFolderCount();
685 if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
688 if (__checkedCount == 0)
690 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
694 tempString.Format(FORMAT_BUFFER_SIZE,
695 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
700 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
702 for ( int index = 0 ; index < count ; index++ )
704 __pEditorFolderIconList->SetItemChecked(index,false);
707 __pEditorFolderIconList->UpdateList();
709 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
712 __pSelectCountLabel->SetText(tempString);
713 __pSelectCountLabel->Invalidate(true);
716 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
720 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
722 AppLogDebug("ENTER");
723 __pPresentationModel->RemoveContentEventListener(*this);
725 if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR )
727 int loopCount = __pPresentationModel->GetFolderCount();
729 for( int count = 0 ; count < loopCount ; count++ )
731 __pEditorFolderIconList->SetItemChecked(count,false);
733 __pEditorFolderIconList->UpdateList();
736 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
740 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
742 AppLogDebug("ENTER");
744 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
748 AlbumListEditorForm::OnThumbnailDecoded(const int index)
750 AppLogDebug("ENTER : index(%d)", index);
751 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
752 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
755 void AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
760 void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
762 AppLogDebug("ENTER");
763 __pPresentationModel->SetUpdateProgressStatus(false);
764 SetAllCheckState(false);
765 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
766 __pEditorFolderIconList->UpdateList();
768 SceneManager* pSceneManager = SceneManager::GetInstance();
769 AppAssert(pSceneManager);
770 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
771 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
774 bool AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
776 AppLogDebug("ENTER");
778 if(keyEventInfo.GetKeyCode() == KEY_BACK)
780 __pDeletePopup->SetShowState(false);
781 __pDeletePopup->Show();
783 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
788 AlbumListEditorForm::Update(void)
790 AppLogDebug("ENTER");
791 result r = __pEditorFolderIconList->UpdateList();
792 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
798 AlbumListEditorForm::OnRequestMessage(void)
800 AppLogDebug("ENTER");
802 int checkCount = GetCheckedFolderCount();
806 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
811 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
813 int maxCount = __pPresentationModel->GetFolderCount();
814 ContentManager contentManager;
815 result r = contentManager.Construct();
820 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
824 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
825 pArrayList->Construct();
826 for (int i = 0; i < maxCount; ++i)
828 if (__pEditorFolderIconList->IsItemChecked (i))
830 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
831 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
832 int loopCount = pContentIdList->GetCount();
833 for (int k = 0; k < loopCount; ++k)
835 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
836 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
838 if (pContentInfo == null)
843 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
853 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
854 pDataList->Construct();
855 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
856 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
858 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
859 null, null, pDataList, null);
861 if (r == E_MAX_EXCEEDED)
863 MessageBox messageBox;
864 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
865 MSGBOX_STYLE_NONE, 3000);
867 messageBox.ShowAndWait(modalResult);
870 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
874 AlbumListEditorForm::OnRequestEmail(void)
876 AppLogDebug("ENTER");
878 int checkCount = GetCheckedFolderCount();
882 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
887 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
889 int maxCount = __pPresentationModel->GetFolderCount();
890 ContentManager contentManager;
891 result r = contentManager.Construct();
896 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
900 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
901 pArrayList->Construct();
902 for (int i = 0; i < maxCount; ++i)
904 if (__pEditorFolderIconList->IsItemChecked(i))
906 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
907 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
908 int loopCount = pContentIdList->GetCount();
909 for (int k = 0; k < loopCount; ++k)
911 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
912 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
914 if (pContentInfo == null)
919 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
929 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
930 pDataList->Construct();
931 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
933 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
934 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
936 if (r == E_MAX_EXCEEDED)
938 MessageBox messageBox;
939 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
940 MSGBOX_STYLE_NONE, 3000);
942 messageBox.ShowAndWait(modalResult);
945 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
949 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
951 AppLogDebug("ENTER");
952 Footer* pFooter = GetFooter();
955 if (enableState == true)
957 pFooter->SetItemEnabled(0, true);
958 pFooter->SetItemEnabled(1, true);
962 pFooter->SetItemEnabled(0, false);
963 pFooter->SetItemEnabled(1, false);
966 pFooter->RequestRedraw(true);
967 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
971 AlbumListEditorForm::SetButtonState(void)
973 AppLogDebug("ENTER");
974 if (GetCheckedFolderCount() > 0)
976 AppLogDebug("BUTTONSTATE : Request Enable");
977 SetFooterButtonsState(true);
981 AppLogDebug("BUTTONSTATE : Request disable");
982 SetFooterButtonsState(false);
984 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
989 AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
992 IList* pIndexList = GetItemCheckedIndexListN();
994 if( __pEditorFolderIconList != null )
996 RemoveControl(__pEditorFolderIconList);
999 __pEditorFolderIconList = new IconListView();
1001 if( orientationStatus == ORIENTATION_STATUS_PORTRAIT )
1003 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
1004 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1006 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1008 int horizontalSpacing = 8;
1009 int verticalSpacing = 60;
1013 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
1014 Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1016 __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing);
1017 __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40);
1020 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
1022 if (pBitmap != null)
1024 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
1028 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
1029 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
1030 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
1031 __pEditorFolderIconList->SetItemProvider(*this);
1032 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
1033 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
1035 AddControl(__pEditorFolderIconList);
1037 int loopCount = pIndexList->GetCount();
1039 for(int count = 0 ; count < loopCount; count ++)
1041 Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
1042 index = pRealIndex->ToInt();
1043 __pEditorFolderIconList->SetItemChecked(index, true);
1044 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);