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;
458 pIconListview->Construct(*pBitmap);
465 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
467 return pIconListview;
471 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
473 AppLogDebug("ENTER");
476 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
478 __checkedCount = GetCheckedFolder();
479 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
480 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __checkedCount);
481 __pSelectCountLabel->SetText(tempString);
482 __pSelectCountLabel->RequestRedraw();
483 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
484 int maxCount = __pPresentationModel->GetFolderCount();
486 if (__pAllCheckButton->IsSelected() == true)
488 __pAllCheckButton->SetSelected(false);
492 if (__checkedCount == maxCount)
494 AppLogDebug("SELECTIONTEST(%d)(%d)",__checkedCount, maxCount);
495 __pAllCheckButton->SetSelected(true);
500 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
504 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
507 AppLogDebug("ENTER");
508 SceneManager* pSceneManager = SceneManager::GetInstance();
510 if (overlayBitmapId == ACTION_ID_EDITE_FOLDER)
512 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
513 pSelectedIndex->Construct();
514 pSelectedIndex->Add(new (std::nothrow) Integer(index));
516 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
518 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
522 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
524 AppLogDebug("ENTER");
526 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
532 AlbumListEditorForm::DeleteFolder()
534 AppLogDebug("ENTER");
535 int maxCount = __pPresentationModel->GetFolderCount();
536 result r = E_FAILURE;
538 int checkedCount = 0;
540 for (int i = 0 ; i < maxCount; ++i)
542 if (__pEditorFolderIconList->IsItemChecked(i) == true)
545 __pPresentationModel->DeleteContentInfoInDirectory(i, CONTENT_TYPE_ALL);
553 if (checkedCount == 0)
560 __pAllCheckButton->SetSelected(true);
561 __pAllCheckButton->RequestRedraw(true);
564 SetAllCheckState(false);
565 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
566 __pEditorFolderIconList->UpdateList();
567 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
573 AlbumListEditorForm::SetAllCheckState(bool state)
575 AppLogDebug("ENTER");
576 int maxCount = __pPresentationModel->GetFolderCount();
581 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
582 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), maxCount);
586 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
587 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
590 for (int i = 0 ; i < maxCount; ++i)
592 __pEditorFolderIconList->SetItemChecked(i, state);
593 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
596 __pEditorFolderIconList->Draw();
597 __pSelectCountLabel->SetText(tempString);
598 __pSelectCountLabel->RequestRedraw();
599 __checkedCount = GetCheckedFolder();
602 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
606 AlbumListEditorForm::GetCheckedFolder()
608 AppLogDebug("ENTER");
609 int maxCount = __pPresentationModel->GetFolderCount();
612 for (int i = 0 ; i < maxCount; ++i)
614 if (__pEditorFolderIconList->IsItemChecked (i))
619 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
625 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
627 AppLogDebug("ENTER");
630 case ACTION_ID_CHECK_SELECT_ON:
631 SetAllCheckState(true);
633 case ACTION_ID_CHECK_SELECT_OFF:
634 SetAllCheckState(false);
636 case ACTION_ID_FOOTER_DELETE:
637 if (__checkedCount > 0)
639 __pDeletePopup->SetShowState(true);
640 __pDeletePopup->Show();
643 case ACTION_ID_FOOTER_SHARE:
644 __pShareContextMenu->SetShowState(true);
645 __pShareContextMenu->Show();
647 case ACTION_ID_CONTEXT_MENU_MESSAGE:
652 case ACTION_ID_CONTEXT_MENU_EMAIL:
657 case ACTION_ID_DELETE_POPUP_DEL:
659 __pDeletePopup->SetShowState(false);
660 __pDeletePopup->Show();
661 result r = DeleteFolder();
662 AppLogDebug("CHECKBUTTONSTATE : R1");
665 AppLogDebug("CHECKBUTTONSTATE : R2");
666 SceneManager* pSceneManager = SceneManager::GetInstance();
667 AppAssert(pSceneManager);
668 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
670 AppLogDebug("CHECKBUTTONSTATE : R3");
673 case ACTION_ID_DELETE_POPUP_CANCEL:
675 __pDeletePopup->SetShowState(false);
676 __pDeletePopup->Show();
682 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
686 AlbumListEditorForm::OnFormBackRequested(Form& source)
688 AppLogDebug("ENTER");
689 SceneManager* pSceneManager = SceneManager::GetInstance();
690 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
691 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
695 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
696 const SceneId& currentSceneId, IList* pArgs)
698 AppLogDebug("ENTER OnSceneActivatedN");
699 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
700 __pEditorFolderIconList->UpdateList();
702 __checkedCount = GetCheckedFolder();
705 tempString.Format(FORMAT_BUFFER_SIZE, L"%ls (%d)",
706 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), __checkedCount);
707 __pSelectCountLabel->SetText(tempString);
708 __pSelectCountLabel->RequestRedraw();
710 int maxCount = __pPresentationModel->GetFolderCount();
711 if (__checkedCount != 0 && __checkedCount == maxCount)
713 __pAllCheckButton->SetSelected(true);
717 __pAllCheckButton->SetSelected(false);
721 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
725 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
726 const SceneId& nextSceneId)
728 AppLogDebug("ENTER");
729 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
733 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
735 AppLogDebug("ENTER");
737 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
741 AlbumListEditorForm::OnThumbnailDecoded(const int index)
743 AppLogDebug("ENTER : index(%d)", index);
744 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
745 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
749 AlbumListEditorForm::Update(void)
751 AppLogDebug("ENTER");
752 result r = __pEditorFolderIconList->UpdateList();
753 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
759 AlbumListEditorForm::OnRequestMessage(void)
761 AppLogDebug("ENTER");
763 int checkCount = GetCheckedFolder();
767 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
774 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
776 int maxCount = __pPresentationModel->GetFolderCount();
777 ContentManager contentManager;
778 result r = contentManager.Construct();
783 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
787 for (int i = 0 ; i < maxCount; ++i)
789 if (__pEditorFolderIconList->IsItemChecked (i))
791 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
792 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
793 int loopCount = pContentIdList->GetCount();
794 for (int k = 0; k < loopCount; ++k)
796 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
797 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
799 if (pContentInfo == null)
803 String path = pContentInfo->GetContentPath();
804 if (combineText.CompareTo(EMPTY_SPACE) != 0)
806 combineText.Append(L";");
808 combineText.Append(path);
818 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
819 pDataList->Construct();
820 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
821 new (std::nothrow) String(APPCONTROL_DATA_MMS));
822 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
823 new (std::nothrow) String(combineText));
825 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
828 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
832 AlbumListEditorForm::OnRequestEmail(void)
834 AppLogDebug("ENTER");
836 int checkCount = GetCheckedFolder();
840 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
847 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
849 int maxCount = __pPresentationModel->GetFolderCount();
850 ContentManager contentManager;
851 result r = contentManager.Construct();
856 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
860 for (int i = 0 ; i < maxCount; ++i)
862 if (__pEditorFolderIconList->IsItemChecked (i))
864 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
865 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
866 int loopCount = pContentIdList->GetCount();
867 for (int k = 0; k < loopCount; ++k)
869 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
870 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
872 if (pContentInfo == null)
876 String path = pContentInfo->GetContentPath();
877 if (combineText.CompareTo(EMPTY_SPACE) != 0)
879 combineText.Append(L";");
881 combineText.Append(path);
891 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
892 pDataList->Construct();
893 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
894 new (std::nothrow) String(combineText));
896 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
897 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, null);
899 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
903 AlbumListEditorForm::SetFooterButtonsState(bool enableState)
905 AppLogDebug("ENTER");
906 Footer* pFooter = GetFooter();
909 if (enableState == true)
911 pFooter->SetItemEnabled(0, true);
912 pFooter->SetItemEnabled(1, true);
916 pFooter->SetItemEnabled(0, false);
917 pFooter->SetItemEnabled(1, false);
920 pFooter->RequestRedraw(true);
921 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
925 AlbumListEditorForm::SetButtonState(void)
927 AppLogDebug("ENTER");
928 if (GetCheckedFolder() > 0)
930 AppLogDebug("BUTTONSTATE : Request Enable");
931 SetFooterButtonsState(true);
935 AppLogDebug("BUTTONSTATE : Request disable");
936 SetFooterButtonsState(false);
938 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));