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 = 600;
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 int X_POSITION_SHARE_CONTEXTMENU = 280;
58 static const int Y_POSITION_SHARE_CONTEXTMENU = 1140;
60 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
61 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
63 static const int IDA_ALBUM_EDIT = 503 ;
65 AlbumListEditorForm::AlbumListEditorForm(void)
67 , __pSelectCountLabel(null)
68 , __pEditorFolderIconList(null)
69 , __pShareContextMenu(null)
70 , __pDeletePopup(null)
71 , __pFileUpdateTimer(null)
72 , __pPresentationModel(null)
75 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
78 AlbumListEditorForm::~AlbumListEditorForm(void)
81 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
85 AlbumListEditorForm::Initialize(void)
88 result r = Form::Construct(IDL_FORM_ALBUM_LIST_EDITOR);
89 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
95 AlbumListEditorForm::OnInitializing(void)
99 __pPresentationModel = AlbumListPresentationModel::GetInstance();
100 __pPresentationModel->ClearThumbnailRequests();
101 r = __pPresentationModel->AddPresentationModelListener(this);
103 SetFormBackEventListener(this);
104 GetHeader()->AddActionEventListener(*this);
105 GetFooter()->AddActionEventListener(*this);
107 r = InitializeControl();
110 AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
113 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
119 AlbumListEditorForm::OnTerminating(void)
121 AppLogDebug("ENTER");
122 result r = E_SUCCESS;
123 r = __pPresentationModel->RemovePresentationModelListener(*this);
124 __pPresentationModel->RemoveContentEventListener(*this);
126 if (__pDeletePopup != null)
128 delete __pDeletePopup;
129 __pDeletePopup = null;
131 if (__pFileUpdateTimer != null)
133 delete __pFileUpdateTimer;
134 __pFileUpdateTimer = null;
136 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
142 AlbumListEditorForm::OnContentUpdated(void)
144 AppLogDebug("ENTER");
145 int maxCount = __pPresentationModel->GetFolderCount();
146 if(__pDeletePopup != null)
148 if(__pDeletePopup->IsVisible() == true)
150 __pDeletePopup->Destroy();
151 __pDeletePopup = null;
156 for (int i = 0; i < maxCount; ++i)
158 __pEditorFolderIconList->SetItemChecked(i, false);
160 SceneManager* pSceneManager = SceneManager::GetInstance();
161 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
162 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
166 AlbumListEditorForm::InitializeControl(void)
168 AppLogDebug("ENTER");
169 result r = E_SUCCESS;
172 CreateIconListView();
173 __checkedCount = GetCheckedFolderCount();
175 __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
176 AppAssert(__pSelectCountLabel);
178 __pShareContextMenu = new (std::nothrow) ContextMenu();
179 r = __pShareContextMenu->Construct(Point(X_POSITION_SHARE_CONTEXTMENU, Y_POSITION_SHARE_CONTEXTMENU),
180 CONTEXT_MENU_STYLE_LIST);
181 r = __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
182 IDA_CONTEXT_MENU_MESSAGE);
183 r = __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL);
184 __pShareContextMenu->AddActionEventListener(*this);
186 r = InitializePopup();
187 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
193 AlbumListEditorForm::InitializePopup(void)
195 AppLogDebug("ENTER");
196 if (__pDeletePopup == null)
198 __pDeletePopup = new (std::nothrow) Popup();
199 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
201 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
203 Label* pLabel = new (std::nothrow) Label();
204 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
205 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
206 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
207 pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
209 Button* pDeleteButton = new (std::nothrow) Button();
210 pDeleteButton->Construct(
211 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
212 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
213 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
214 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
215 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
216 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
217 pDeleteButton->AddActionEventListener(*this);
219 Button* pCancelButton = new (std::nothrow) Button();
220 pCancelButton->Construct(
221 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
222 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
223 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
224 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
225 pCancelButton->AddActionEventListener(*this);
227 __pDeletePopup->AddControl(pLabel);
228 __pDeletePopup->AddControl(pDeleteButton);
229 __pDeletePopup->AddControl(pCancelButton);
233 __pDeletePopup->SetShowState(true);
234 __pDeletePopup->Show();
236 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
242 AlbumListEditorForm::CreateIconListView(void)
244 AppLogDebug("ENTER");
245 __pEditorFolderIconList = static_cast<IconListView*>(GetControl(L"IDC_ICONLISTVIEW_ALBUM_LIST_EDITOR"));
246 AppAssert(__pEditorFolderIconList);
248 __pEditorFolderIconList->SetItemProvider(*this);
249 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
250 __pEditorFolderIconList->SetShowState(true);
251 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
255 AlbumListEditorForm::GetItemCount(void)
257 AppLogDebug("ENTER");
258 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
260 return __pPresentationModel->GetFolderCount();
264 AlbumListEditorForm::CreateItem(int index)
266 AppLogDebug("ENTER : index(%d)", index);
267 Bitmap* pBitmap = null;
268 Canvas* pEditAlbumCanvas = null;
269 Bitmap* pEditAlbumBitmap = null;
270 Bitmap* pBitmapRenameBg = null;
271 Bitmap* pBitmapRename = null;
273 int canvasWidth = 64;
274 int canvasHeight = 64;
276 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
278 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
279 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
281 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
282 if (pAlbumBitmap == null)
284 __pPresentationModel->RequestThumbnail(index, 0);
287 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
289 if (__pEditorFolderIconList->IsItemChecked(index) == true)
293 BufferInfo bufferInfo;
294 pBitmap->Lock(bufferInfo, INFINITE);
296 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
297 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
299 canvas.Construct(bufferInfo);
300 canvas.FillRectangle(dimColor, canvas.GetBounds());
301 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
302 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
303 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
304 delete pSelectedBitmap;
309 pIconListviewItem->Construct(*pBitmap);
317 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
318 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
320 if (pBitmapRenameBg != null && pBitmapRename != null)
323 pEditAlbumCanvas = new (std::nothrow) Canvas();
324 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
325 pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRenameBg);
326 pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRename);
329 pEditAlbumBitmap = new (std::nothrow) Bitmap();
331 if (pEditAlbumBitmap != NULL)
333 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
334 delete pEditAlbumCanvas;
337 albumName = pAlbumInfo->GetAlbumName();
338 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
339 String albumPath = pAlbumInfo->GetDirectory(0);
340 albumPath.Append(DIRECTORY_SEPARATOR);
342 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
343 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
344 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
350 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
353 if (pEditAlbumBitmap != null)
355 delete pEditAlbumBitmap;
359 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
361 return pIconListviewItem;
365 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
367 AppLogDebug("ENTER");
369 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
371 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
375 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
381 if (__checkedCount == 0)
383 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
385 else if (__checkedCount == 1)
387 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
391 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
394 __pSelectCountLabel->SetText(tempString);
395 __pSelectCountLabel->RequestRedraw();
396 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
400 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
404 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
407 AppLogDebug("ENTER");
408 SceneManager* pSceneManager = SceneManager::GetInstance();
410 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
411 pSelectedIndex->Construct();
412 //Adding the Action Type
413 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
414 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
415 pSelectedIndex->Add(new (std::nothrow) Integer(index));
417 if( __pEditorFolderIconList->IsItemChecked(index) == false )
419 __pEditorFolderIconList->SetItemChecked(index,true);
423 __pEditorFolderIconList->SetItemChecked(index,false);
425 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
426 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
430 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
432 AppLogDebug("ENTER");
434 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
440 AlbumListEditorForm::DeleteFolder(void)
443 AppLogDebug("ENTER");
444 IList* pIndexList = GetItemCheckedIndexListN();
445 if (pIndexList->GetCount() <= 0)
448 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
452 if (__pFileUpdateTimer != null)
454 delete __pFileUpdateTimer;
456 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
457 result r = __pFileUpdateTimer->StartTimer();
461 delete __pFileUpdateTimer;
462 __pFileUpdateTimer = null;
467 __pPresentationModel->SetUpdateProgressStatus(true);
473 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
475 AppLogDebug("ENTER");
476 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
477 Integer* pIndex = null;
479 if (__pEditorFolderIconList!=null)
481 int loopCount = __pPresentationModel->GetFolderCount();
482 for (int i = 0; i < loopCount; ++i)
484 if (__pEditorFolderIconList->IsItemChecked(i) == true)
486 pIndex = new (std::nothrow) Integer(i);
488 AppLogDebug("checked index(%d)", i);
492 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
498 AlbumListEditorForm::SetAllCheckState(const bool state)
500 AppLogDebug("ENTER");
502 int maxCount = __pPresentationModel->GetFolderCount();
509 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
513 tempString.Format(FORMAT_BUFFER_SIZE,
514 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
519 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
522 for (int i = 0; i < maxCount; ++i)
524 __pEditorFolderIconList->SetItemChecked(i, state);
525 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
528 __pEditorFolderIconList->Draw();
529 __pSelectCountLabel->SetText(tempString);
530 __pSelectCountLabel->RequestRedraw();
531 __checkedCount = GetCheckedFolderCount();
535 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
539 AlbumListEditorForm::GetCheckedFolderCount(void) const
541 AppLogDebug("ENTER");
542 int maxCount = __pPresentationModel->GetFolderCount();
545 for (int i = 0 ; i < maxCount; ++i)
547 if (__pEditorFolderIconList->IsItemChecked (i))
552 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
558 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
560 AppLogDebug("ENTER");
563 case IDA_ALBUM_LIST_SELECT_ALL:
565 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
567 SetAllCheckState(false);
571 SetAllCheckState(true);
576 case IDA_FOOTER_DELETE:
578 __pDeletePopup->SetShowState(true);
579 __pDeletePopup->Show();
583 case IDA_FOOTER_SHARE:
585 __pShareContextMenu->SetShowState(true);
586 __pShareContextMenu->Show();
590 case IDA_CONTEXT_MENU_MESSAGE:
596 case IDA_CONTEXT_MENU_EMAIL:
602 case IDA_DELETE_POPUP_DEL:
604 __pDeletePopup->SetShowState(false);
605 __pDeletePopup->Show();
610 case IDA_DELETE_POPUP_CANCEL:
612 __pDeletePopup->SetShowState(false);
613 __pDeletePopup->Show();
620 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
624 AlbumListEditorForm::OnFormBackRequested(Form& source)
626 AppLogDebug("ENTER");
627 SceneManager* pSceneManager = SceneManager::GetInstance();
628 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
629 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
633 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
634 const SceneId& currentSceneId, IList* pArgs)
636 AppLogDebug("ENTER OnSceneActivatedN");
638 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
640 int count = __pPresentationModel->GetFolderCount();
642 __pPresentationModel->AddContentEventListener(this);
644 __checkedCount = GetCheckedFolderCount();
646 if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
648 tempString.Format(FORMAT_BUFFER_SIZE,
649 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
653 for ( int index = 0 ; index < count ; index++ )
655 __pEditorFolderIconList->SetItemChecked(index,false);
658 __pEditorFolderIconList->UpdateList();
660 if (__checkedCount == 0)
662 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
664 else if (__checkedCount == 1)
666 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
670 tempString.Format(FORMAT_BUFFER_SIZE,
671 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
675 __pSelectCountLabel->SetText(tempString);
676 __pSelectCountLabel->Invalidate(true);
679 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
683 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
685 AppLogDebug("ENTER");
686 __pPresentationModel->RemoveContentEventListener(*this);
687 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
691 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
693 AppLogDebug("ENTER");
695 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
699 AlbumListEditorForm::OnThumbnailDecoded(const int index)
701 AppLogDebug("ENTER : index(%d)", index);
702 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
703 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
706 void AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
711 void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
713 AppLogDebug("ENTER");
714 __pPresentationModel->SetUpdateProgressStatus(false);
715 SetAllCheckState(false);
716 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
717 __pEditorFolderIconList->UpdateList();
719 SceneManager* pSceneManager = SceneManager::GetInstance();
720 AppAssert(pSceneManager);
721 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
725 AlbumListEditorForm::Update(void)
727 AppLogDebug("ENTER");
728 result r = __pEditorFolderIconList->UpdateList();
729 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
735 AlbumListEditorForm::OnRequestMessage(void)
737 AppLogDebug("ENTER");
739 int checkCount = GetCheckedFolderCount();
743 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
748 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
750 int maxCount = __pPresentationModel->GetFolderCount();
751 ContentManager contentManager;
752 result r = contentManager.Construct();
757 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
761 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
762 pArrayList->Construct();
763 for (int i = 0; i < maxCount; ++i)
765 if (__pEditorFolderIconList->IsItemChecked (i))
767 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
768 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
769 int loopCount = pContentIdList->GetCount();
770 for (int k = 0; k < loopCount; ++k)
772 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
773 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
775 if (pContentInfo == null)
780 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
790 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
791 pDataList->Construct();
792 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
793 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
795 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
796 null, null, pDataList, null);
798 if (r == E_MAX_EXCEEDED)
800 MessageBox messageBox;
801 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
802 MSGBOX_STYLE_NONE, 3000);
804 messageBox.ShowAndWait(modalResult);
807 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
811 AlbumListEditorForm::OnRequestEmail(void)
813 AppLogDebug("ENTER");
815 int checkCount = GetCheckedFolderCount();
819 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
824 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
826 int maxCount = __pPresentationModel->GetFolderCount();
827 ContentManager contentManager;
828 result r = contentManager.Construct();
833 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
837 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
838 pArrayList->Construct();
839 for (int i = 0; i < maxCount; ++i)
841 if (__pEditorFolderIconList->IsItemChecked(i))
843 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
844 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
845 int loopCount = pContentIdList->GetCount();
846 for (int k = 0; k < loopCount; ++k)
848 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
849 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
851 if (pContentInfo == null)
856 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
866 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
867 pDataList->Construct();
868 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
870 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
871 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
873 if (r == E_MAX_EXCEEDED)
875 MessageBox messageBox;
876 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
877 MSGBOX_STYLE_NONE, 3000);
879 messageBox.ShowAndWait(modalResult);
882 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
886 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
888 AppLogDebug("ENTER");
889 Footer* pFooter = GetFooter();
892 if (enableState == true)
894 pFooter->SetItemEnabled(0, true);
895 pFooter->SetItemEnabled(1, true);
899 pFooter->SetItemEnabled(0, false);
900 pFooter->SetItemEnabled(1, false);
903 pFooter->RequestRedraw(true);
904 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
908 AlbumListEditorForm::SetButtonState(void)
910 AppLogDebug("ENTER");
911 if (GetCheckedFolderCount() > 0)
913 AppLogDebug("BUTTONSTATE : Request Enable");
914 SetFooterButtonsState(true);
918 AppLogDebug("BUTTONSTATE : Request disable");
919 SetFooterButtonsState(false);
921 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));