2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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.
23 #include "GlAlbumInfo.h"
24 #include "GlAlbumListEditorForm.h"
25 #include "GlAlbumListPresentationModel.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::Media;
35 using namespace Tizen::Io;
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_SELECT_COUNT_LABEL = Color32<68, 68, 68>::Value;
42 static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
43 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
44 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
45 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
47 static const int W_FOLDER_SIZE = 334;
48 static const int H_FOLDER_SIZE = 334;
50 static const int W_BUTTON_RENAME_SIZE = 64;
51 static const int H_BUTTON_RENAME_SIZE = 64;
53 static const int GAP_W_POPUP_ITEM = 5;
54 static const int W_DELETE_POPUP = 600;
55 static const int H_DELETE_POPUP = 300;
56 static const int H_DELETE_LABEL = 180;
57 static const int Y_DELETE_BUTTON = 180;
58 static const int H_DELETE_BUTTON = 80;
60 static const int X_POSITION_ICON_LIST_VIEW = 0;
61 static const int Y_POSITION_ICON_LIST_VIEW = 80;
63 static const int H_CHECKBOX = 80;
64 static const int GAP_H_ICON_LIST_VIEW = 40;
66 static const int H_SELECT_COUNT_LABEL = 48;
68 static const int FORMAT_BUFFER_SIZE = 256;
70 static const int X_POSITION_SHARE_CONTEXTMENU = 300;
71 static const int Y_POSITION_SHARE_CONTEXTMENU = 1180;
73 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
74 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
76 AlbumListEditorForm::AlbumListEditorForm()
78 , __pAllCheckButton(null)
79 , __pSelectCountLabel(null)
80 , __pEditorFolderIconList(null)
81 , __pShareContextMenu(null)
82 , __pDeletePopup(null)
83 , __pEditFolderBitmap(null)
84 , __pPresentationModel(null)
88 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
91 AlbumListEditorForm::~AlbumListEditorForm()
94 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
98 AlbumListEditorForm::Initialize(void)
100 AppLogDebug("ENTER");
101 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
102 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
108 AlbumListEditorForm::OnInitializing(void)
110 AppLogDebug("ENTER");
111 result r = E_SUCCESS;
113 SetRenameButtonImage();
115 __pPresentationModel = AlbumListPresentationModel::GetInstance();
116 __pPresentationModel->ClearThumbnailRequests();
117 __pPresentationModel->AddPresentationModelListener(this);
119 r = InitializeHeader();
122 AppLogDebug("[%s] Unable to InitializeHeader.", GetErrorMessage(r));
125 r = InitializeFooter();
128 AppLogDebug("[%s] Unable to set InitializeFooter.", GetErrorMessage(r));
131 r = InitializeControl();
134 AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
137 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
143 AlbumListEditorForm::OnTerminating(void)
145 AppLogDebug("ENTER");
146 __pPresentationModel->RemovePresentationModelListener(*this);
148 if (__pDeletePopup != null)
150 delete __pDeletePopup;
151 __pDeletePopup = null;
154 if (__pEditFolderBitmap != null)
156 delete __pEditFolderBitmap;
157 __pEditFolderBitmap = null;
159 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
165 AlbumListEditorForm::OnUpdateContentList()
167 AppLogDebug("ENTER");
168 SceneManager* pSceneManager = SceneManager::GetInstance();
169 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
170 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
174 AlbumListEditorForm::SetRenameButtonImage(void)
176 AppLogDebug("ENTER");
177 Bitmap* pSrcBitmap1 = ResourceManager::GetBitmapN(IDB_BUTTON_CIRCLE_BACKGROUND);
178 Bitmap* pSrcBitmap2 = ResourceManager::GetBitmapN(IDB_BUTTON_RENAME);
180 Bitmap* pBitmap = new (std::nothrow) Bitmap();
181 BufferInfo bufferinfo;
183 Dimension size(W_BUTTON_RENAME_SIZE, H_BUTTON_RENAME_SIZE);
184 result r = pBitmap->Construct(size, BITMAP_PIXEL_FORMAT_ARGB8888);
185 r = pBitmap->Lock(bufferinfo);
186 r = canvas.Construct(bufferinfo);
188 if (pSrcBitmap1 != null)
190 canvas.DrawBitmap(Point(0, 0), *pSrcBitmap1);
194 if (pSrcBitmap2 != null)
196 canvas.DrawBitmap(Point(0, 0), *pSrcBitmap2);
203 __pEditFolderBitmap = pBitmap;
204 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
210 AlbumListEditorForm::InitializeHeader(void)
212 AppLogDebug("ENTER");
213 Header* pHeader = GetHeader();
216 AppLogDebug("EXIT 1");
221 result r = pHeader->SetStyle(HEADER_STYLE_TITLE);
224 AppLogDebug("EXIT 2");
229 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_GALLERY"));
230 pHeader->AddActionEventListener(*this);
231 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
237 AlbumListEditorForm::InitializeFooter(void)
239 AppLogDebug("ENTER");
240 Footer* pFooter = GetFooter();
243 AppLogDebug("EXIT 1");
248 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
249 pFooter->RemoveAllItems();
250 pFooter->SetBackButtonEnabled(true);
251 pFooter->SetBackButton();
252 SetFormBackEventListener(this);
254 FooterItem itemShare;
255 itemShare.Construct(ACTION_ID_FOOTER_SHARE);
256 itemShare.SetText(ResourceManager::GetString(L"EMPTY_SPACE"));
257 Bitmap* pShareBitmap = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
258 Bitmap* pShareBitmapDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
259 if (pShareBitmap != null && pShareBitmapDim !=null )
261 itemShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pShareBitmap);
262 itemShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pShareBitmapDim);
265 pFooter->AddItem(itemShare);
267 delete pShareBitmapDim;
269 FooterItem itemDelete;
270 itemDelete.Construct(ACTION_ID_FOOTER_DELETE);
271 itemDelete.SetText(ResourceManager::GetString(L"EMPTY_SPACE"));
272 Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
273 Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
275 if (pBitmapDelete != null)
277 itemDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
280 if( pBitmapDeleteDim != null)
282 itemDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
285 pFooter->AddItem(itemDelete);
286 delete pBitmapDelete;
287 delete pBitmapDeleteDim;
289 pFooter->AddActionEventListener(*this);
290 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
296 AlbumListEditorForm::InitializeControl()
298 AppLogDebug("ENTER");
301 CreateIconListView();
302 __checkedCount = GetCheckedFolder();
303 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
304 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __checkedCount);
306 __pAllCheckButton = new (std::nothrow) CheckButton();
307 __pAllCheckButton->Construct(Rectangle(0, 0, GetClientAreaBounds().width, H_CHECKBOX),
308 CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT, false);
309 __pAllCheckButton->SetText(ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
310 __pAllCheckButton->SetActionId(ACTION_ID_CHECK_SELECT_ON, ACTION_ID_CHECK_SELECT_OFF);
311 __pAllCheckButton->SetChromaKeyColor(Color(COLOR_SELECT_COUNT_LABEL));
312 __pAllCheckButton->AddActionEventListener(*this);
313 AddControl(*__pAllCheckButton);
315 __pSelectCountLabel = new (std::nothrow) Label();
316 __pSelectCountLabel->Construct(Rectangle(0, GetClientAreaBounds().height - H_SELECT_COUNT_LABEL,
317 GetClientAreaBounds().width, H_SELECT_COUNT_LABEL), tempString);
319 __pSelectCountLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
320 __pSelectCountLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
321 __pSelectCountLabel->SetBackgroundColor(Color(COLOR_SELECT_COUNT_LABEL));
322 __pSelectCountLabel->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
323 AddControl(*__pSelectCountLabel);
325 __pShareContextMenu = new ContextMenu();
326 __pShareContextMenu->Construct(Point(X_POSITION_SHARE_CONTEXTMENU, Y_POSITION_SHARE_CONTEXTMENU),
327 CONTEXT_MENU_STYLE_LIST);
328 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
329 ACTION_ID_CONTEXT_MENU_MESSAGE);
330 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXT_MENU_EMAIL);
331 __pShareContextMenu->AddActionEventListener(*this);
334 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
340 AlbumListEditorForm::InitializePopup(void)
342 AppLogDebug("ENTER");
343 if (__pDeletePopup == null)
345 __pDeletePopup = new (std::nothrow) Popup();
346 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
348 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
350 Label* pLabel = new (std::nothrow) Label();
351 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
352 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
354 Button* pDeleteButton = new (std::nothrow) Button();
355 pDeleteButton->Construct(
356 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
357 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
358 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
359 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
360 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
361 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
362 pDeleteButton->AddActionEventListener(*this);
364 Button* pCancelButton = new (std::nothrow) Button();
365 pCancelButton->Construct(
366 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
367 popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
368 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
369 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
370 pCancelButton->AddActionEventListener(*this);
372 __pDeletePopup->AddControl(*pLabel);
373 __pDeletePopup->AddControl(*pDeleteButton);
374 __pDeletePopup->AddControl(*pCancelButton);
378 __pDeletePopup->SetShowState(true);
379 __pDeletePopup->Show();
381 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
387 AlbumListEditorForm::CreateIconListView(void)
389 AppLogDebug("ENTER");
390 Dimension itemSize(W_FOLDER_SIZE, H_FOLDER_SIZE);
391 __pEditorFolderIconList = new (std::nothrow) IconListView();
392 __pEditorFolderIconList->Construct(Rectangle(X_POSITION_ICON_LIST_VIEW, Y_POSITION_ICON_LIST_VIEW,
393 GetClientAreaBounds().width, GetClientAreaBounds().height - H_CHECKBOX - GAP_H_ICON_LIST_VIEW),
394 itemSize, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
395 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
398 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
401 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
402 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
403 __pEditorFolderIconList->SetItemProvider(*this);
404 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
405 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
406 AddControl(*__pEditorFolderIconList);
407 __pEditorFolderIconList->SetShowState(true);
408 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
412 AlbumListEditorForm::GetItemCount(void)
414 AppLogDebug("ENTER");
415 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
417 return __pPresentationModel->GetFolderCount();
421 AlbumListEditorForm::CreateItem(int index)
423 AppLogDebug("ENTER : index(%d)", index);
424 Bitmap* pBitmap = null;
425 IconListViewItem* pIconListview = new IconListViewItem();
427 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
428 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
430 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
431 if (pAlbumBitmap == null)
433 __pPresentationModel->RequestThumbnail(index, 0);
436 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
438 if (__pEditorFolderIconList->IsItemChecked(index) == true)
442 BufferInfo bufferInfo;
443 pBitmap->Lock(bufferInfo, INFINITE);
445 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
446 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
448 canvas.Construct(bufferInfo);
449 canvas.FillRectangle(dimColor, canvas.GetBounds());
450 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
451 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
452 pIconListview->Construct(*pBitmap, null, pSelectedBitmap);
453 delete pSelectedBitmap;
454 pSelectedBitmap = null;
459 pIconListview->Construct(*pBitmap);
466 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
468 return pIconListview;
472 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
474 AppLogDebug("ENTER");
477 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
479 __checkedCount = GetCheckedFolder();
480 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
481 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __checkedCount);
482 __pSelectCountLabel->SetText(tempString);
483 __pSelectCountLabel->RequestRedraw();
484 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
485 int maxCount = __pPresentationModel->GetFolderCount();
487 if (__pAllCheckButton->IsSelected() == true)
489 __pAllCheckButton->SetSelected(false);
493 if (__checkedCount == maxCount)
495 AppLogDebug("SELECTIONTEST(%d)(%d)",__checkedCount, maxCount);
496 __pAllCheckButton->SetSelected(true);
501 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
505 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
508 AppLogDebug("ENTER");
509 SceneManager* pSceneManager = SceneManager::GetInstance();
511 if (overlayBitmapId == ACTION_ID_EDITE_FOLDER)
513 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
514 pSelectedIndex->Construct();
515 pSelectedIndex->Add(new (std::nothrow) Integer(index));
517 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
519 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
523 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
525 AppLogDebug("ENTER");
527 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
533 AlbumListEditorForm::DeleteFolder()
535 AppLogDebug("ENTER");
536 int maxCount = __pPresentationModel->GetFolderCount();
537 result r = E_FAILURE;
539 int checkedCount = 0;
541 for (int i = 0 ; i < maxCount; ++i)
543 if (__pEditorFolderIconList->IsItemChecked(i) == true)
546 __pPresentationModel->DeleteContentInfoInDirectory(i, CONTENT_TYPE_ALL);
554 if (checkedCount == 0)
561 __pAllCheckButton->SetSelected(true);
562 __pAllCheckButton->RequestRedraw(true);
565 SetAllCheckState(false);
566 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
567 __pEditorFolderIconList->UpdateList();
568 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
574 AlbumListEditorForm::SetAllCheckState(bool state)
576 AppLogDebug("ENTER");
577 int maxCount = __pPresentationModel->GetFolderCount();
582 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
583 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), maxCount);
587 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
588 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
591 for (int i = 0 ; i < maxCount; ++i)
593 __pEditorFolderIconList->SetItemChecked(i, state);
594 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
597 __pEditorFolderIconList->Draw();
598 __pSelectCountLabel->SetText(tempString);
599 __pSelectCountLabel->RequestRedraw();
600 __checkedCount = GetCheckedFolder();
603 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
607 AlbumListEditorForm::GetCheckedFolder()
609 AppLogDebug("ENTER");
610 int maxCount = __pPresentationModel->GetFolderCount();
613 for (int i = 0 ; i < maxCount; ++i)
615 if (__pEditorFolderIconList->IsItemChecked (i))
620 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
626 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
628 AppLogDebug("ENTER");
631 case ACTION_ID_CHECK_SELECT_ON:
632 SetAllCheckState(true);
634 case ACTION_ID_CHECK_SELECT_OFF:
635 SetAllCheckState(false);
637 case ACTION_ID_FOOTER_DELETE:
638 if (__checkedCount > 0)
640 __pDeletePopup->SetShowState(true);
641 __pDeletePopup->Show();
644 case ACTION_ID_FOOTER_SHARE:
645 __pShareContextMenu->SetShowState(true);
646 __pShareContextMenu->Show();
648 case ACTION_ID_CONTEXT_MENU_MESSAGE:
653 case ACTION_ID_CONTEXT_MENU_EMAIL:
658 case ACTION_ID_DELETE_POPUP_DEL:
660 __pDeletePopup->SetShowState(false);
661 __pDeletePopup->Show();
662 result r = DeleteFolder();
663 AppLogDebug("CHECKBUTTONSTATE : R1");
666 AppLogDebug("CHECKBUTTONSTATE : R2");
667 SceneManager* pSceneManager = SceneManager::GetInstance();
668 AppAssert(pSceneManager);
669 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
671 AppLogDebug("CHECKBUTTONSTATE : R3");
674 case ACTION_ID_DELETE_POPUP_CANCEL:
676 __pDeletePopup->SetShowState(false);
677 __pDeletePopup->Show();
683 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
687 AlbumListEditorForm::OnFormBackRequested(Form& source)
689 AppLogDebug("ENTER");
690 SceneManager* pSceneManager = SceneManager::GetInstance();
691 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
692 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
696 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
697 const SceneId& currentSceneId, IList* pArgs)
699 AppLogDebug("ENTER OnSceneActivatedN");
700 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
701 __pEditorFolderIconList->UpdateList();
703 __checkedCount = GetCheckedFolder();
706 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
707 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __checkedCount);
708 __pSelectCountLabel->SetText(tempString);
709 __pSelectCountLabel->RequestRedraw();
711 int maxCount = __pPresentationModel->GetFolderCount();
712 if (__checkedCount != 0 && __checkedCount == maxCount)
714 __pAllCheckButton->SetSelected(true);
718 __pAllCheckButton->SetSelected(false);
722 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
726 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
727 const SceneId& nextSceneId)
729 AppLogDebug("ENTER");
730 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
734 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
736 AppLogDebug("ENTER");
738 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
742 AlbumListEditorForm::OnThumbnailDecoded(const int index)
744 AppLogDebug("ENTER : index(%d)", index);
745 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
746 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
750 AlbumListEditorForm::Update(void)
752 AppLogDebug("ENTER");
753 result r = __pEditorFolderIconList->UpdateList();
754 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
760 AlbumListEditorForm::OnRequestMessage(void)
762 AppLogDebug("ENTER");
764 int checkCount = GetCheckedFolder();
768 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
775 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
777 int maxCount = __pPresentationModel->GetFolderCount();
778 ContentManager contentManager;
779 result r = contentManager.Construct();
784 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
788 for (int i = 0 ; i < maxCount; ++i)
790 if (__pEditorFolderIconList->IsItemChecked (i))
792 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
793 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
794 int loopCount = pContentIdList->GetCount();
795 for (int k = 0; k < loopCount; ++k)
797 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
798 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
800 if (pContentInfo == null)
804 String path = pContentInfo->GetContentPath();
805 if (combineText.CompareTo(EMPTY_SPACE) != 0)
807 combineText.Append(L";");
809 combineText.Append(path);
819 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
820 pDataList->Construct();
821 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
822 new (std::nothrow) String(APPCONTROL_DATA_MMS));
823 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
824 new (std::nothrow) String(combineText));
826 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
829 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
833 AlbumListEditorForm::OnRequestEmail(void)
835 AppLogDebug("ENTER");
837 int checkCount = GetCheckedFolder();
841 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
848 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
850 int maxCount = __pPresentationModel->GetFolderCount();
851 ContentManager contentManager;
852 result r = contentManager.Construct();
857 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
861 for (int i = 0 ; i < maxCount; ++i)
863 if (__pEditorFolderIconList->IsItemChecked (i))
865 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
866 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
867 int loopCount = pContentIdList->GetCount();
868 for (int k = 0; k < loopCount; ++k)
870 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
871 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
873 if (pContentInfo == null)
877 String path = pContentInfo->GetContentPath();
878 if (combineText.CompareTo(EMPTY_SPACE) != 0)
880 combineText.Append(L";");
882 combineText.Append(path);
892 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
893 pDataList->Construct();
894 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
895 new (std::nothrow) String(combineText));
897 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
898 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, null);
900 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
904 AlbumListEditorForm::SetFooterButtonsState(bool enableState)
906 AppLogDebug("ENTER");
907 Footer* pFooter = GetFooter();
910 if (enableState == true)
912 pFooter->SetItemEnabled(0, true);
913 pFooter->SetItemEnabled(1, true);
917 pFooter->SetItemEnabled(0, false);
918 pFooter->SetItemEnabled(1, false);
921 pFooter->RequestRedraw(true);
922 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
926 AlbumListEditorForm::SetButtonState(void)
928 AppLogDebug("ENTER");
929 if (GetCheckedFolder() > 0)
931 AppLogDebug("BUTTONSTATE : Request Enable");
932 SetFooterButtonsState(true);
936 AppLogDebug("BUTTONSTATE : Request disable");
937 SetFooterButtonsState(false);
939 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));