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 "GlProgressAnimation.h"
26 #include "GlResourceManager.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Content;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Io;
35 using namespace Tizen::Media;
36 using namespace Tizen::System;
37 using namespace Tizen::Ui;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
41 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
42 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
43 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
44 static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera" + DIRECTORY_SEPARATOR;
45 static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera" + DIRECTORY_SEPARATOR;
46 static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
47 static const String RESERVED_EXTERNAL_MEDIA_PATH = Environment::GetExternalStoragePath();
49 static const int GAP_W_POPUP_ITEM = 5;
50 static const int W_DELETE_POPUP = 620;
51 static const int H_DELETE_POPUP = 300;
52 static const int H_DELETE_LABEL = 180;
53 static const int Y_DELETE_BUTTON = 180;
54 static const int H_DELETE_BUTTON = 80;
56 static const int FORMAT_BUFFER_SIZE = 256;
58 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
59 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
61 static const int IDA_ALBUM_EDIT = 503;
63 AlbumListEditorForm::AlbumListEditorForm(void)
65 , __pSelectCountLabel(null)
66 , __pEditorFolderIconList(null)
67 , __pShareContextMenu(null)
68 , __pDeletePopup(null)
69 , __pFileUpdateTimer(null)
70 , __pPresentationModel(null)
71 , __isScanProgress(false)
74 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
77 AlbumListEditorForm::~AlbumListEditorForm(void)
80 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
84 AlbumListEditorForm::Initialize(void)
87 result r = Form::Construct(IDL_FORM_ALBUM_LIST_EDITOR);
88 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
94 AlbumListEditorForm::OnInitializing(void)
99 SetOrientation(ORIENTATION_AUTOMATIC);
100 AddOrientationEventListener(*this);
102 __pPresentationModel = AlbumListPresentationModel::GetInstance();
103 __pPresentationModel->ClearThumbnailRequests();
104 r = __pPresentationModel->AddPresentationModelListener(this);
106 SetFormBackEventListener(this);
107 GetHeader()->AddActionEventListener(*this);
108 GetFooter()->AddActionEventListener(*this);
110 r = InitializeControl();
113 AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
116 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
122 AlbumListEditorForm::OnTerminating(void)
124 AppLogDebug("ENTER");
125 result r = E_SUCCESS;
126 r = __pPresentationModel->RemovePresentationModelListener(*this);
127 __pPresentationModel->RemoveContentEventListener(*this);
129 if (__pDeletePopup != null)
131 delete __pDeletePopup;
132 __pDeletePopup = null;
134 if (__pFileUpdateTimer != null)
136 delete __pFileUpdateTimer;
137 __pFileUpdateTimer = null;
139 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
145 AlbumListEditorForm::ShowAnimation(void)
147 Rectangle clientRect= GetClientAreaBounds();
148 Rectangle rect(0, 0, clientRect.width, clientRect.height);
149 _pProgressAnim = new (std::nothrow) ProgressAnimation;
150 _pProgressAnim->Construct(rect);
151 AddControl(_pProgressAnim);
152 _pProgressAnim->SetShowState(true);
153 GetFooter()->SetEnabled(false);
154 _pProgressAnim->AnimationStart();
155 _pProgressAnim->Draw();
158 AlbumListEditorForm::StopAnimation(void)
162 _pProgressAnim->AnimationStop();
163 _pProgressAnim->SetShowState(false);
164 RemoveControl(_pProgressAnim);
165 GetFooter()->SetEnabled(true);
166 _pProgressAnim = null;
171 AlbumListEditorForm::OnContentUpdated(void)
173 AppLogDebug("ENTER");
174 int maxCount = __pPresentationModel->GetFolderCount();
175 if (__pDeletePopup != null)
177 if (__pDeletePopup->IsVisible() == true)
179 __pDeletePopup->Destroy();
180 __pDeletePopup = null;
185 for (int i = 0; i < maxCount; ++i)
187 __pEditorFolderIconList->SetItemChecked(i, false);
189 SceneManager* pSceneManager = SceneManager::GetInstance();
190 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
191 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
195 AlbumListEditorForm::InitializeControl(void)
197 AppLogDebug("ENTER");
198 result r = E_SUCCESS;
201 __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
202 AppAssert(__pSelectCountLabel);
204 CreateIconListView();
205 __checkedCount = GetCheckedFolderCount();
208 r = InitializePopup();
209 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
215 AlbumListEditorForm::InitializePopup(void)
217 AppLogDebug("ENTER");
218 if (__pDeletePopup == null)
220 __pDeletePopup = new (std::nothrow) Popup();
221 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
222 __pDeletePopup->SetPropagatedKeyEventListener(this);
224 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
226 Label* pLabel = new (std::nothrow) Label();
227 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
228 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
229 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
230 pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
232 Button* pDeleteButton = new (std::nothrow) Button();
233 pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
234 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
235 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
236 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
237 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
238 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
239 pDeleteButton->AddActionEventListener(*this);
241 Button* pCancelButton = new (std::nothrow) Button();
242 pCancelButton->Construct(Rectangle(10, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM -10, H_DELETE_BUTTON),
243 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
244 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
245 pCancelButton->AddActionEventListener(*this);
247 __pDeletePopup->AddControl(pLabel);
248 __pDeletePopup->AddControl(pDeleteButton);
249 __pDeletePopup->AddControl(pCancelButton);
253 __pDeletePopup->SetShowState(true);
254 __pDeletePopup->Show();
256 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
262 AlbumListEditorForm::CreateIconListView(void)
264 AppLogDebug("ENTER");
267 __pEditorFolderIconList = new IconListView();
268 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
269 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
270 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
271 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
272 __pEditorFolderIconList->SetItemProvider(*this);
273 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
274 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
276 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
280 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
284 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
286 AddControl(__pEditorFolderIconList);
288 __pEditorFolderIconList->SetShowState(true);
290 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
294 AlbumListEditorForm::GetItemCount(void)
296 AppLogDebug("ENTER");
297 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
299 return __pPresentationModel->GetFolderCount();
303 AlbumListEditorForm::CreateItem(int index)
305 AppLogDebug("ENTER : index(%d)", index);
306 Bitmap* pBitmap = null;
307 Canvas* pEditAlbumCanvas = null;
308 Bitmap* pEditAlbumBitmap = null;
309 Bitmap* pBitmapRenameBg = null;
310 Bitmap* pBitmapRename = null;
312 int canvasWidth = 75;
313 int canvasHeight = 75;
315 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
317 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
318 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
320 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
321 if (pAlbumBitmap == null)
323 __pPresentationModel->RequestThumbnail(index, 0);
326 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
328 if (__pEditorFolderIconList->IsItemChecked(index) == true)
332 BufferInfo bufferInfo;
333 pBitmap->Lock(bufferInfo, INFINITE);
335 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
336 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
338 canvas.Construct(bufferInfo);
339 canvas.FillRectangle(dimColor, canvas.GetBounds());
340 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
341 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
342 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
343 delete pSelectedBitmap;
348 pIconListviewItem->Construct(*pBitmap);
356 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
357 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
359 if (pBitmapRenameBg != null && pBitmapRename != null)
362 pEditAlbumCanvas = new (std::nothrow) Canvas();
363 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
364 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg);
365 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename);
368 pEditAlbumBitmap = new (std::nothrow) Bitmap();
370 if (pEditAlbumBitmap != NULL)
372 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
375 delete pEditAlbumCanvas;
377 albumName = pAlbumInfo->GetAlbumName();
379 if (albumName == ALL_ALBUMS_REAL_NAME)
381 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS");
384 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
385 String albumPath = pAlbumInfo->GetDirectory(0);
386 albumPath.Append(DIRECTORY_SEPARATOR);
388 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
389 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
390 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
396 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
399 if (pEditAlbumBitmap != null)
401 delete pEditAlbumBitmap;
407 delete pBitmapRenameBg;
411 delete pBitmapRename;
414 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
416 return pIconListviewItem;
420 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
422 AppLogDebug("ENTER");
424 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
426 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
430 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
436 if (__checkedCount == 0)
438 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
440 else if (__checkedCount == 1)
442 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
446 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
449 __pSelectCountLabel->SetText(tempString);
450 __pSelectCountLabel->RequestRedraw();
451 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
455 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
459 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
462 AppLogDebug("ENTER");
463 SceneManager* pSceneManager = SceneManager::GetInstance();
465 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
466 pSelectedIndex->Construct();
467 //Adding the Action Type
468 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
469 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
470 pSelectedIndex->Add(new (std::nothrow) Integer(index));
472 if (__pEditorFolderIconList->IsItemChecked(index) == false)
474 __pEditorFolderIconList->SetItemChecked(index,true);
478 __pEditorFolderIconList->SetItemChecked(index,false);
480 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
481 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
485 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
487 AppLogDebug("ENTER");
489 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
495 AlbumListEditorForm::DeleteFolder(void)
498 AppLogDebug("ENTER");
499 IList* pIndexList = GetItemCheckedIndexListN();
500 if (pIndexList->GetCount() <= 0)
503 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
507 if (__pFileUpdateTimer != null)
509 delete __pFileUpdateTimer;
511 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
512 result r = __pFileUpdateTimer->StartTimer();
516 delete __pFileUpdateTimer;
517 __pFileUpdateTimer = null;
522 __pPresentationModel->SetUpdateProgressStatus(true);
528 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
530 AppLogDebug("ENTER");
531 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
532 Integer* pIndex = null;
534 if (__pEditorFolderIconList!=null)
536 int loopCount = __pPresentationModel->GetFolderCount();
537 for (int i = 0; i < loopCount; ++i)
539 if (__pEditorFolderIconList->IsItemChecked(i) == true)
541 pIndex = new (std::nothrow) Integer(i);
543 AppLogDebug("checked index(%d)", i);
547 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
553 AlbumListEditorForm::SetAllCheckState(const bool state)
555 AppLogDebug("ENTER");
557 int maxCount = __pPresentationModel->GetFolderCount();
564 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
568 tempString.Format(FORMAT_BUFFER_SIZE,
569 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
574 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
577 for (int i = 0; i < maxCount; ++i)
579 __pEditorFolderIconList->SetItemChecked(i, state);
580 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
583 __pEditorFolderIconList->Draw();
584 __pSelectCountLabel->SetText(tempString);
585 __pSelectCountLabel->RequestRedraw();
586 __checkedCount = GetCheckedFolderCount();
590 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
594 AlbumListEditorForm::GetCheckedFolderCount(void) const
596 AppLogDebug("ENTER");
597 int maxCount = __pPresentationModel->GetFolderCount();
600 for (int i = 0; i < maxCount; ++i)
602 if (__pEditorFolderIconList->IsItemChecked (i))
607 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
613 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
615 AppLogDebug("ENTER");
618 case IDA_ALBUM_LIST_SELECT_ALL:
620 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
622 SetAllCheckState(false);
626 SetAllCheckState(true);
631 case IDA_FOOTER_DELETE:
633 __pDeletePopup->SetShowState(true);
634 __pDeletePopup->Show();
638 case IDA_FOOTER_SHARE:
641 if (__pShareContextMenu != NULL)
643 delete __pShareContextMenu;
644 __pShareContextMenu = null;
648 Bitmap* pBitmapEmailContextItem = null;
649 Bitmap* pBitmapMessageContextItem = null;
650 pBitmapEmailContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_EMAIL_ICON);
651 pBitmapMessageContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_MESSAGE_ICON);
653 __pShareContextMenu = new (std::nothrow) ContextMenu();
654 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5),
655 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
657 if ( pBitmapMessageContextItem != null)
659 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
660 IDA_CONTEXT_MENU_MESSAGE , *pBitmapMessageContextItem, null, null);
662 delete pBitmapMessageContextItem;
665 if ( pBitmapEmailContextItem != null)
667 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL,
668 *pBitmapEmailContextItem, null, null);
670 delete pBitmapEmailContextItem;
673 __pShareContextMenu->SetFocusable(true);
674 __pShareContextMenu->AddActionEventListener(*this);
675 __pShareContextMenu->SetShowState(true);
676 __pShareContextMenu->Show();
680 case IDA_CONTEXT_MENU_MESSAGE:
686 case IDA_CONTEXT_MENU_EMAIL:
692 case IDA_DELETE_POPUP_DEL:
694 __pDeletePopup->SetShowState(false);
695 __pDeletePopup->Show();
700 case IDA_DELETE_POPUP_CANCEL:
702 __pDeletePopup->SetShowState(false);
703 __pDeletePopup->Show();
710 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
714 AlbumListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
723 AlbumListEditorForm::OnFormBackRequested(Form& source)
725 AppLogDebug("ENTER");
730 SceneManager* pSceneManager = SceneManager::GetInstance();
731 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
732 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
736 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
737 const SceneId& currentSceneId, IList* pArgs)
739 AppLogDebug("ENTER OnSceneActivatedN");
743 int count = __pPresentationModel->GetFolderCount();
745 __pPresentationModel->AddContentEventListener(this);
747 __checkedCount = GetCheckedFolderCount();
749 if (previousSceneId == IDSCN_ALBUM_NAME_EDITOR)
752 if (__checkedCount == 0)
754 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
758 tempString.Format(FORMAT_BUFFER_SIZE,
759 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
764 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
766 for (int index = 0; index < count; ++index)
768 __pEditorFolderIconList->SetItemChecked(index,false);
771 __pEditorFolderIconList->UpdateList();
774 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
777 __pSelectCountLabel->SetText(tempString);
778 __pSelectCountLabel->Invalidate(true);
781 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
785 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
787 AppLogDebug("ENTER");
788 __pPresentationModel->RemoveContentEventListener(*this);
790 if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR)
792 int loopCount = __pPresentationModel->GetFolderCount();
794 for (int count = 0; count < loopCount; ++count)
796 __pEditorFolderIconList->SetItemChecked(count,false);
798 __pEditorFolderIconList->UpdateList();
801 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
805 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
807 AppLogDebug("ENTER");
809 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
813 AlbumListEditorForm::OnThumbnailDecoded(const int index)
815 AppLogDebug("ENTER : index(%d)", index);
816 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
817 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
821 AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
827 AlbumListEditorForm::OnScanDirStart()
829 AppLogDebug("SANTHOSH ENTER");
830 GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
832 __isScanProgress = true;
833 AppLogDebug("SANTHOSH EXIT");
836 AlbumListEditorForm::OnScanDirComplete()
838 AppLogDebug("SANTHOSH ENTER");
839 GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, true);
841 __isScanProgress = false;
842 AppLogDebug("SANTHOSH EXIT");
846 AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
848 AppLogDebug("ENTER");
849 __pPresentationModel->SetUpdateProgressStatus(false);
850 SetAllCheckState(false);
851 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
852 __pEditorFolderIconList->UpdateList();
854 SceneManager* pSceneManager = SceneManager::GetInstance();
855 AppAssert(pSceneManager);
856 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
857 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
861 AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
863 AppLogDebug("ENTER");
865 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
867 __pDeletePopup->SetShowState(false);
868 __pDeletePopup->Show();
870 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
875 AlbumListEditorForm::Update(void)
877 AppLogDebug("ENTER");
878 result r = __pEditorFolderIconList->UpdateList();
879 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
885 AlbumListEditorForm::OnRequestMessage(void)
887 AppLogDebug("ENTER");
889 int checkCount = GetCheckedFolderCount();
893 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
898 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
900 int maxCount = __pPresentationModel->GetFolderCount();
901 ContentManager contentManager;
902 result r = contentManager.Construct();
907 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
911 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
912 pArrayList->Construct();
913 for (int i = 0; i < maxCount; ++i)
915 if (__pEditorFolderIconList->IsItemChecked (i))
917 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
918 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
919 int loopCount = pContentIdList->GetCount();
920 for (int k = 0; k < loopCount; ++k)
922 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
923 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
925 if (pContentInfo == null)
930 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
940 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
941 pDataList->Construct();
942 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
943 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
945 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
946 null, null, pDataList, null);
948 if (r == E_MAX_EXCEEDED)
950 MessageBox messageBox;
951 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
952 MSGBOX_STYLE_NONE, 3000);
954 messageBox.ShowAndWait(modalResult);
957 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
961 AlbumListEditorForm::OnRequestEmail(void)
963 AppLogDebug("ENTER");
965 int checkCount = GetCheckedFolderCount();
969 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
974 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
976 int maxCount = __pPresentationModel->GetFolderCount();
977 ContentManager contentManager;
978 result r = contentManager.Construct();
983 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
987 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
988 pArrayList->Construct();
989 for (int i = 0; i < maxCount; ++i)
991 if (__pEditorFolderIconList->IsItemChecked(i))
993 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
994 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
995 int loopCount = pContentIdList->GetCount();
996 for (int k = 0; k < loopCount; ++k)
998 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
999 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
1001 if (pContentInfo == null)
1006 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
1016 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1017 pDataList->Construct();
1018 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
1020 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
1021 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
1023 if (r == E_MAX_EXCEEDED)
1025 MessageBox messageBox;
1026 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
1027 MSGBOX_STYLE_NONE, 3000);
1029 messageBox.ShowAndWait(modalResult);
1032 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1036 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
1038 AppLogDebug("ENTER");
1039 Footer* pFooter = GetFooter();
1042 if (enableState == true)
1044 pFooter->SetItemEnabled(0, true);
1045 pFooter->SetItemEnabled(1, true);
1049 pFooter->SetItemEnabled(0, false);
1050 pFooter->SetItemEnabled(1, false);
1053 pFooter->RequestRedraw(true);
1054 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1058 AlbumListEditorForm::SetButtonState(void)
1060 AppLogDebug("ENTER");
1061 if (GetCheckedFolderCount() > 0)
1063 AppLogDebug("BUTTONSTATE : Request Enable");
1064 SetFooterButtonsState(true);
1068 AppLogDebug("BUTTONSTATE : Request disable");
1069 SetFooterButtonsState(false);
1071 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1076 AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1079 IList* pIndexList = GetItemCheckedIndexListN();
1081 if (__pEditorFolderIconList != null)
1083 RemoveControl(__pEditorFolderIconList);
1086 __pEditorFolderIconList = new IconListView();
1088 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
1090 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
1091 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1093 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1095 int horizontalSpacing = 8;
1096 int verticalSpacing = 60;
1100 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
1101 Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1103 __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing);
1104 __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40);
1107 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
1109 if (pBitmap != null)
1111 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
1115 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
1116 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
1117 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
1118 __pEditorFolderIconList->SetItemProvider(*this);
1119 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
1120 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
1122 AddControl(__pEditorFolderIconList);
1124 int loopCount = pIndexList->GetCount();
1126 for (int count = 0; count < loopCount; ++count)
1128 Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
1129 index = pRealIndex->ToInt();
1130 __pEditorFolderIconList->SetItemChecked(index, true);
1131 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);