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));
195 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
197 Label* pLabel = new (std::nothrow) Label();
198 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
199 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
200 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
201 pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
203 Button* pDeleteButton = new (std::nothrow) Button();
204 pDeleteButton->Construct(
205 Rectangle(10, 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(
215 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
216 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
217 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
218 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
219 pCancelButton->AddActionEventListener(*this);
221 __pDeletePopup->AddControl(pLabel);
222 __pDeletePopup->AddControl(pDeleteButton);
223 __pDeletePopup->AddControl(pCancelButton);
227 __pDeletePopup->SetShowState(true);
228 __pDeletePopup->Show();
230 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
236 AlbumListEditorForm::CreateIconListView(void)
238 AppLogDebug("ENTER");
241 __pEditorFolderIconList = new IconListView();
242 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
243 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
244 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
245 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
246 __pEditorFolderIconList->SetItemProvider(*this);
247 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
248 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
250 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
254 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
258 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
260 AddControl(*__pEditorFolderIconList);
262 __pEditorFolderIconList->SetShowState(true);
264 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
268 AlbumListEditorForm::GetItemCount(void)
270 AppLogDebug("ENTER");
271 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
273 return __pPresentationModel->GetFolderCount();
277 AlbumListEditorForm::CreateItem(int index)
279 AppLogDebug("ENTER : index(%d)", index);
280 Bitmap* pBitmap = null;
281 Canvas* pEditAlbumCanvas = null;
282 Bitmap* pEditAlbumBitmap = null;
283 Bitmap* pBitmapRenameBg = null;
284 Bitmap* pBitmapRename = null;
286 int canvasWidth = 64;
287 int canvasHeight = 64;
289 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
291 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
292 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
294 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
295 if (pAlbumBitmap == null)
297 __pPresentationModel->RequestThumbnail(index, 0);
300 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
302 if (__pEditorFolderIconList->IsItemChecked(index) == true)
306 BufferInfo bufferInfo;
307 pBitmap->Lock(bufferInfo, INFINITE);
309 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
310 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
312 canvas.Construct(bufferInfo);
313 canvas.FillRectangle(dimColor, canvas.GetBounds());
314 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
315 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
316 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
317 delete pSelectedBitmap;
322 pIconListviewItem->Construct(*pBitmap);
330 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
331 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
333 if (pBitmapRenameBg != null && pBitmapRename != null)
336 pEditAlbumCanvas = new (std::nothrow) Canvas();
337 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
338 pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRenameBg);
339 pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRename);
342 pEditAlbumBitmap = new (std::nothrow) Bitmap();
344 if (pEditAlbumBitmap != NULL)
346 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
347 delete pEditAlbumCanvas;
350 albumName = pAlbumInfo->GetAlbumName();
351 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
352 String albumPath = pAlbumInfo->GetDirectory(0);
353 albumPath.Append(DIRECTORY_SEPARATOR);
355 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
356 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
357 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
363 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
366 if (pEditAlbumBitmap != null)
368 delete pEditAlbumBitmap;
372 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
374 return pIconListviewItem;
378 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
380 AppLogDebug("ENTER");
382 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
384 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
388 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
394 if (__checkedCount == 0)
396 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
398 else if (__checkedCount == 1)
400 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
404 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
407 __pSelectCountLabel->SetText(tempString);
408 __pSelectCountLabel->RequestRedraw();
409 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
413 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
417 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
420 AppLogDebug("ENTER");
421 SceneManager* pSceneManager = SceneManager::GetInstance();
423 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
424 pSelectedIndex->Construct();
425 //Adding the Action Type
426 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
427 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
428 pSelectedIndex->Add(new (std::nothrow) Integer(index));
430 if( __pEditorFolderIconList->IsItemChecked(index) == false )
432 __pEditorFolderIconList->SetItemChecked(index,true);
436 __pEditorFolderIconList->SetItemChecked(index,false);
438 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
439 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
443 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
445 AppLogDebug("ENTER");
447 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
453 AlbumListEditorForm::DeleteFolder(void)
456 AppLogDebug("ENTER");
457 IList* pIndexList = GetItemCheckedIndexListN();
458 if (pIndexList->GetCount() <= 0)
461 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
465 if (__pFileUpdateTimer != null)
467 delete __pFileUpdateTimer;
469 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
470 result r = __pFileUpdateTimer->StartTimer();
474 delete __pFileUpdateTimer;
475 __pFileUpdateTimer = null;
480 __pPresentationModel->SetUpdateProgressStatus(true);
486 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
488 AppLogDebug("ENTER");
489 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
490 Integer* pIndex = null;
492 if (__pEditorFolderIconList!=null)
494 int loopCount = __pPresentationModel->GetFolderCount();
495 for (int i = 0; i < loopCount; ++i)
497 if (__pEditorFolderIconList->IsItemChecked(i) == true)
499 pIndex = new (std::nothrow) Integer(i);
501 AppLogDebug("checked index(%d)", i);
505 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
511 AlbumListEditorForm::SetAllCheckState(const bool state)
513 AppLogDebug("ENTER");
515 int maxCount = __pPresentationModel->GetFolderCount();
522 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
526 tempString.Format(FORMAT_BUFFER_SIZE,
527 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
532 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
535 for (int i = 0; i < maxCount; ++i)
537 __pEditorFolderIconList->SetItemChecked(i, state);
538 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
541 __pEditorFolderIconList->Draw();
542 __pSelectCountLabel->SetText(tempString);
543 __pSelectCountLabel->RequestRedraw();
544 __checkedCount = GetCheckedFolderCount();
548 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
552 AlbumListEditorForm::GetCheckedFolderCount(void) const
554 AppLogDebug("ENTER");
555 int maxCount = __pPresentationModel->GetFolderCount();
558 for (int i = 0 ; i < maxCount; ++i)
560 if (__pEditorFolderIconList->IsItemChecked (i))
565 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
571 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
573 AppLogDebug("ENTER");
576 case IDA_ALBUM_LIST_SELECT_ALL:
578 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
580 SetAllCheckState(false);
584 SetAllCheckState(true);
589 case IDA_FOOTER_DELETE:
591 __pDeletePopup->SetShowState(true);
592 __pDeletePopup->Show();
596 case IDA_FOOTER_SHARE:
599 if( __pShareContextMenu != NULL)
601 delete __pShareContextMenu;
602 __pShareContextMenu = null;
605 __pShareContextMenu = new (std::nothrow) ContextMenu();
606 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5),
607 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
608 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
609 IDA_CONTEXT_MENU_MESSAGE);
610 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL);
611 __pShareContextMenu->SetFocusable(true);
612 __pShareContextMenu->AddActionEventListener(*this);
613 __pShareContextMenu->SetShowState(true);
614 __pShareContextMenu->Show();
618 case IDA_CONTEXT_MENU_MESSAGE:
624 case IDA_CONTEXT_MENU_EMAIL:
630 case IDA_DELETE_POPUP_DEL:
632 __pDeletePopup->SetShowState(false);
633 __pDeletePopup->Show();
638 case IDA_DELETE_POPUP_CANCEL:
640 __pDeletePopup->SetShowState(false);
641 __pDeletePopup->Show();
648 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
652 AlbumListEditorForm::OnFormBackRequested(Form& source)
654 AppLogDebug("ENTER");
655 SceneManager* pSceneManager = SceneManager::GetInstance();
656 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
657 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
661 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
662 const SceneId& currentSceneId, IList* pArgs)
664 AppLogDebug("ENTER OnSceneActivatedN");
668 int count = __pPresentationModel->GetFolderCount();
670 __pPresentationModel->AddContentEventListener(this);
672 __checkedCount = GetCheckedFolderCount();
674 if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
677 if (__checkedCount == 0)
679 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
683 tempString.Format(FORMAT_BUFFER_SIZE,
684 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
689 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
691 for ( int index = 0 ; index < count ; index++ )
693 __pEditorFolderIconList->SetItemChecked(index,false);
696 __pEditorFolderIconList->UpdateList();
698 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
701 __pSelectCountLabel->SetText(tempString);
702 __pSelectCountLabel->Invalidate(true);
705 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
709 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
711 AppLogDebug("ENTER");
712 __pPresentationModel->RemoveContentEventListener(*this);
714 if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR )
716 int loopCount = __pPresentationModel->GetFolderCount();
718 for( int count = 0 ; count < loopCount ; count++ )
720 __pEditorFolderIconList->SetItemChecked(count,false);
722 __pEditorFolderIconList->UpdateList();
725 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
729 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
731 AppLogDebug("ENTER");
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
737 AlbumListEditorForm::OnThumbnailDecoded(const int index)
739 AppLogDebug("ENTER : index(%d)", index);
740 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
741 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
744 void AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
749 void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
751 AppLogDebug("ENTER");
752 __pPresentationModel->SetUpdateProgressStatus(false);
753 SetAllCheckState(false);
754 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
755 __pEditorFolderIconList->UpdateList();
757 SceneManager* pSceneManager = SceneManager::GetInstance();
758 AppAssert(pSceneManager);
759 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
763 AlbumListEditorForm::Update(void)
765 AppLogDebug("ENTER");
766 result r = __pEditorFolderIconList->UpdateList();
767 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
773 AlbumListEditorForm::OnRequestMessage(void)
775 AppLogDebug("ENTER");
777 int checkCount = GetCheckedFolderCount();
781 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
786 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
788 int maxCount = __pPresentationModel->GetFolderCount();
789 ContentManager contentManager;
790 result r = contentManager.Construct();
795 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
799 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
800 pArrayList->Construct();
801 for (int i = 0; i < maxCount; ++i)
803 if (__pEditorFolderIconList->IsItemChecked (i))
805 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
806 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
807 int loopCount = pContentIdList->GetCount();
808 for (int k = 0; k < loopCount; ++k)
810 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
811 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
813 if (pContentInfo == null)
818 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
828 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
829 pDataList->Construct();
830 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
831 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
833 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
834 null, null, pDataList, null);
836 if (r == E_MAX_EXCEEDED)
838 MessageBox messageBox;
839 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
840 MSGBOX_STYLE_NONE, 3000);
842 messageBox.ShowAndWait(modalResult);
845 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
849 AlbumListEditorForm::OnRequestEmail(void)
851 AppLogDebug("ENTER");
853 int checkCount = GetCheckedFolderCount();
857 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
862 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
864 int maxCount = __pPresentationModel->GetFolderCount();
865 ContentManager contentManager;
866 result r = contentManager.Construct();
871 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
875 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
876 pArrayList->Construct();
877 for (int i = 0; i < maxCount; ++i)
879 if (__pEditorFolderIconList->IsItemChecked(i))
881 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
882 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
883 int loopCount = pContentIdList->GetCount();
884 for (int k = 0; k < loopCount; ++k)
886 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
887 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
889 if (pContentInfo == null)
894 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
904 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
905 pDataList->Construct();
906 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
908 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
909 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
911 if (r == E_MAX_EXCEEDED)
913 MessageBox messageBox;
914 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
915 MSGBOX_STYLE_NONE, 3000);
917 messageBox.ShowAndWait(modalResult);
920 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
924 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
926 AppLogDebug("ENTER");
927 Footer* pFooter = GetFooter();
930 if (enableState == true)
932 pFooter->SetItemEnabled(0, true);
933 pFooter->SetItemEnabled(1, true);
937 pFooter->SetItemEnabled(0, false);
938 pFooter->SetItemEnabled(1, false);
941 pFooter->RequestRedraw(true);
942 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
946 AlbumListEditorForm::SetButtonState(void)
948 AppLogDebug("ENTER");
949 if (GetCheckedFolderCount() > 0)
951 AppLogDebug("BUTTONSTATE : Request Enable");
952 SetFooterButtonsState(true);
956 AppLogDebug("BUTTONSTATE : Request disable");
957 SetFooterButtonsState(false);
959 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
964 AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
967 IList* pIndexList = GetItemCheckedIndexListN();
969 if( __pEditorFolderIconList != null )
971 RemoveControl(__pEditorFolderIconList);
974 __pEditorFolderIconList = new IconListView();
976 if( orientationStatus == ORIENTATION_STATUS_PORTRAIT )
978 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
979 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
981 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
983 int horizontalSpacing = 8;
984 int verticalSpacing = 60;
988 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
989 Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
991 __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing);
992 __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40);
995 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
999 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
1003 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
1004 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
1005 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
1006 __pEditorFolderIconList->SetItemProvider(*this);
1007 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
1008 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
1010 AddControl(*__pEditorFolderIconList);
1012 int loopCount = pIndexList->GetCount();
1014 for(int count = 0 ; count < loopCount; count ++)
1016 Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
1017 index = pRealIndex->ToInt();
1018 __pEditorFolderIconList->SetItemChecked(index, true);
1019 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);