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 = 10;
50 static const int W_DELETE_POPUP = 688;
51 static const int H_DELETE_POPUP = 230;
52 static const int H_DELETE_LABEL = 80;
53 static const int Y_DELETE_BUTTON = 132;
54 static const int H_DELETE_BUTTON = 74;
55 static const int W_DELETE_BUTTON = 318;
56 static const int Y_DELETE_LABEL = 32;
58 static const int FORMAT_BUFFER_SIZE = 256;
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)
73 , __isScanProgress(false)
76 _pProgressAnim = null;
77 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
80 AlbumListEditorForm::~AlbumListEditorForm(void)
83 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
87 AlbumListEditorForm::Initialize(void)
90 result r = Form::Construct(IDL_FORM_ALBUM_LIST_EDITOR);
91 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
97 AlbumListEditorForm::OnInitializing(void)
100 result r = E_SUCCESS;
102 SetOrientation(ORIENTATION_AUTOMATIC);
103 AddOrientationEventListener(*this);
105 __pPresentationModel = AlbumListPresentationModel::GetInstance();
106 __pPresentationModel->ClearThumbnailRequests();
107 r = __pPresentationModel->AddPresentationModelListener(this);
109 SetFormBackEventListener(this);
110 GetHeader()->AddActionEventListener(*this);
111 GetFooter()->AddActionEventListener(*this);
113 r = InitializeControl();
116 AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
119 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
125 AlbumListEditorForm::OnTerminating(void)
127 AppLogDebug("ENTER");
128 result r = E_SUCCESS;
129 r = __pPresentationModel->RemovePresentationModelListener(*this);
130 __pPresentationModel->RemoveContentEventListener(*this);
132 if (__pDeletePopup != null)
134 delete __pDeletePopup;
135 __pDeletePopup = null;
137 if (__pFileUpdateTimer != null)
139 delete __pFileUpdateTimer;
140 __pFileUpdateTimer = null;
142 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
148 AlbumListEditorForm::ShowAnimation(void)
150 Rectangle clientRect= GetClientAreaBounds();
151 Rectangle rect(0, 0, clientRect.width, clientRect.height);
152 _pProgressAnim = new (std::nothrow) ProgressAnimation;
153 _pProgressAnim->Construct(rect);
154 AddControl(_pProgressAnim);
155 SetControlAlwaysOnTop(*_pProgressAnim,true);
156 _pProgressAnim->SetShowState(true);
157 GetFooter()->SetEnabled(false);
158 _pProgressAnim->AnimationStart();
159 _pProgressAnim->Draw();
162 AlbumListEditorForm::StopAnimation(void)
166 _pProgressAnim->AnimationStop();
167 _pProgressAnim->SetShowState(false);
168 RemoveControl(_pProgressAnim);
169 GetFooter()->SetEnabled(true);
170 _pProgressAnim = null;
175 AlbumListEditorForm::OnContentUpdated(void)
177 AppLogDebug("ENTER");
178 int maxCount = __pPresentationModel->GetFolderCount();
179 if (__pDeletePopup != null)
181 if (__pDeletePopup->IsVisible() == true)
183 __pDeletePopup->Destroy();
184 __pDeletePopup = null;
189 for (int i = 0; i < maxCount; ++i)
191 __pEditorFolderIconList->SetItemChecked(i, false);
193 SceneManager* pSceneManager = SceneManager::GetInstance();
194 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
195 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
199 AlbumListEditorForm::InitializeControl(void)
201 AppLogDebug("ENTER");
202 result r = E_SUCCESS;
205 __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
206 AppAssert(__pSelectCountLabel);
208 CreateIconListView();
209 __checkedCount = GetCheckedFolderCount();
212 r = InitializePopup();
213 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
219 AlbumListEditorForm::InitializePopup(void)
221 AppLogDebug("ENTER");
222 if (__pDeletePopup == null)
224 __pDeletePopup = new (std::nothrow) Popup();
225 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
226 __pDeletePopup->SetPropagatedKeyEventListener(this);
228 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
230 Label* pLabel = new (std::nothrow) Label();
231 pLabel->Construct(Rectangle(0, Y_DELETE_LABEL, popupClientBounds.width, H_DELETE_LABEL),
232 ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
233 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
234 pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
236 Button* pDeleteButton = new (std::nothrow) Button();
237 pDeleteButton->Construct(Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON),
238 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
239 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
240 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
241 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
242 pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
243 pDeleteButton->AddActionEventListener(*this);
245 Button* pCancelButton = new (std::nothrow) Button();
246 pCancelButton->Construct(Rectangle(16, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON),
247 ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
248 pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
249 pCancelButton->AddActionEventListener(*this);
251 __pDeletePopup->AddControl(pLabel);
252 __pDeletePopup->AddControl(pDeleteButton);
253 __pDeletePopup->AddControl(pCancelButton);
257 __pDeletePopup->SetShowState(true);
258 __pDeletePopup->Show();
260 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
266 AlbumListEditorForm::CreateIconListView(void)
268 AppLogDebug("ENTER");
271 __pEditorFolderIconList = new IconListView();
272 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
273 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
274 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
275 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
276 __pEditorFolderIconList->SetItemProvider(*this);
277 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
278 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
280 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
284 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
288 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
290 AddControl(__pEditorFolderIconList);
292 __pEditorFolderIconList->SetShowState(true);
294 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
298 AlbumListEditorForm::GetItemCount(void)
300 AppLogDebug("ENTER");
301 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
303 return __pPresentationModel->GetFolderCount();
307 AlbumListEditorForm::CreateItem(int index)
309 AppLogDebug("ENTER : index(%d)", index);
310 Bitmap* pBitmap = null;
311 Canvas* pEditAlbumCanvas = null;
312 Bitmap* pEditAlbumBitmap = null;
313 Bitmap* pBitmapRenameBg = null;
314 Bitmap* pBitmapRename = null;
316 int canvasWidth = 75;
317 int canvasHeight = 75;
319 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
321 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
322 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
324 Bitmap* pAlbumBitmap = pAlbumInfo->GetFolderThumnailBitmap();
325 if (pAlbumBitmap == null)
327 __pPresentationModel->RequestThumbnail(index, 0);
330 pBitmap = __pPresentationModel->CreateMergeBitmapN(index);
332 if (__pEditorFolderIconList->IsItemChecked(index) == true)
336 BufferInfo bufferInfo;
337 pBitmap->Lock(bufferInfo, INFINITE);
339 Color dimColor(COLOR_FOLDER_BITMAP_DIM);
340 dimColor.SetAlpha(ALPHA_FOLDER_BITMAP_DIM);
342 canvas.Construct(bufferInfo);
343 canvas.FillRectangle(dimColor, canvas.GetBounds());
344 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
345 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
346 pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
347 delete pSelectedBitmap;
352 pIconListviewItem->Construct(*pBitmap);
360 pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
361 pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
363 if (pBitmapRenameBg != null && pBitmapRename != null)
366 pEditAlbumCanvas = new (std::nothrow) Canvas();
367 pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
368 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRenameBg);
369 pEditAlbumCanvas->DrawBitmap(Point(0, 6), *pBitmapRename);
372 pEditAlbumBitmap = new (std::nothrow) Bitmap();
374 if (pEditAlbumBitmap != NULL)
376 pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
379 delete pEditAlbumCanvas;
381 albumName = pAlbumInfo->GetAlbumName();
383 if (albumName == ALL_ALBUMS_REAL_NAME)
385 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS");
388 String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
389 String albumPath = pAlbumInfo->GetDirectory(0);
390 albumPath.Append(DIRECTORY_SEPARATOR);
392 if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
393 (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
394 || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
400 pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
403 if (pEditAlbumBitmap != null)
405 delete pEditAlbumBitmap;
411 delete pBitmapRenameBg;
415 delete pBitmapRename;
418 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
420 return pIconListviewItem;
424 AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
426 AppLogDebug("ENTER");
428 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
430 if (status == ICON_LIST_VIEW_ITEM_CHECKED)
434 else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
440 if (__checkedCount == 0)
442 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
444 else if (__checkedCount == 1)
446 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
450 tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
453 __pSelectCountLabel->SetText(tempString);
454 __pSelectCountLabel->RequestRedraw();
455 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
459 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
463 AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconListView, int index,
466 AppLogDebug("ENTER");
467 SceneManager* pSceneManager = SceneManager::GetInstance();
469 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
470 pSelectedIndex->Construct();
471 //Adding the Action Type
472 pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
473 pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
474 pSelectedIndex->Add(new (std::nothrow) Integer(index));
476 if (__pEditorFolderIconList->IsItemChecked(index) == false)
478 __pEditorFolderIconList->SetItemChecked(index,true);
482 __pEditorFolderIconList->SetItemChecked(index,false);
484 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
485 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
489 AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
491 AppLogDebug("ENTER");
493 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
499 AlbumListEditorForm::DeleteFolder(void)
502 AppLogDebug("ENTER");
503 IList* pIndexList = GetItemCheckedIndexListN();
504 if (pIndexList->GetCount() <= 0)
507 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
511 if (__pFileUpdateTimer != null)
513 delete __pFileUpdateTimer;
515 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
516 result r = __pFileUpdateTimer->StartTimer();
520 delete __pFileUpdateTimer;
521 __pFileUpdateTimer = null;
526 __pPresentationModel->SetUpdateProgressStatus(true);
532 AlbumListEditorForm::GetItemCheckedIndexListN(void) const
534 AppLogDebug("ENTER");
535 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
536 Integer* pIndex = null;
538 if (__pEditorFolderIconList!=null)
540 int loopCount = __pPresentationModel->GetFolderCount();
541 for (int i = 0; i < loopCount; ++i)
543 if (__pEditorFolderIconList->IsItemChecked(i) == true)
545 pIndex = new (std::nothrow) Integer(i);
547 AppLogDebug("checked index(%d)", i);
551 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
557 AlbumListEditorForm::SetAllCheckState(const bool state)
559 AppLogDebug("ENTER");
561 int maxCount = __pPresentationModel->GetFolderCount();
568 tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED;");
572 tempString.Format(FORMAT_BUFFER_SIZE,
573 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), maxCount);
578 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
581 for (int i = 0; i < maxCount; ++i)
583 __pEditorFolderIconList->SetItemChecked(i, state);
584 __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
587 __pEditorFolderIconList->Draw();
588 __pSelectCountLabel->SetText(tempString);
589 __pSelectCountLabel->RequestRedraw();
590 __checkedCount = GetCheckedFolderCount();
594 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
598 AlbumListEditorForm::GetCheckedFolderCount(void) const
600 AppLogDebug("ENTER");
601 int maxCount = __pPresentationModel->GetFolderCount();
604 for (int i = 0; i < maxCount; ++i)
606 if (__pEditorFolderIconList->IsItemChecked (i))
611 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
617 AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
619 AppLogDebug("ENTER");
622 case IDA_ALBUM_LIST_SELECT_ALL:
624 if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
626 SetAllCheckState(false);
630 SetAllCheckState(true);
635 case IDA_FOOTER_DELETE:
637 __pDeletePopup->SetShowState(true);
638 __pDeletePopup->Show();
642 case IDA_FOOTER_SHARE:
645 if (__pShareContextMenu != NULL)
647 delete __pShareContextMenu;
648 __pShareContextMenu = null;
652 Bitmap* pBitmapEmailContextItem = null;
653 Bitmap* pBitmapMessageContextItem = null;
654 pBitmapEmailContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_EMAIL_ICON);
655 pBitmapMessageContextItem = ResourceManager::GetBitmapN(IDB_IMAGE_CONTEXT_MESSAGE_ICON);
657 __pShareContextMenu = new (std::nothrow) ContextMenu();
658 __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height + __pSelectCountLabel->GetHeight() + 5),
659 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
661 if ( pBitmapMessageContextItem != null)
663 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
664 IDA_CONTEXT_MENU_MESSAGE , *pBitmapMessageContextItem, null, null);
666 delete pBitmapMessageContextItem;
669 if ( pBitmapEmailContextItem != null)
671 __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL,
672 *pBitmapEmailContextItem, null, null);
674 delete pBitmapEmailContextItem;
677 __pShareContextMenu->SetFocusable(true);
678 __pShareContextMenu->AddActionEventListener(*this);
679 __pShareContextMenu->SetShowState(true);
680 __pShareContextMenu->Show();
684 case IDA_CONTEXT_MENU_MESSAGE:
690 case IDA_CONTEXT_MENU_EMAIL:
696 case IDA_DELETE_POPUP_DEL:
698 __pDeletePopup->SetShowState(false);
699 __pDeletePopup->Show();
704 case IDA_DELETE_POPUP_CANCEL:
706 __pDeletePopup->SetShowState(false);
707 __pDeletePopup->Show();
714 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
718 AlbumListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
727 AlbumListEditorForm::OnFormBackRequested(Form& source)
729 AppLogDebug("ENTER");
734 SceneManager* pSceneManager = SceneManager::GetInstance();
735 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
736 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
740 AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
741 const SceneId& currentSceneId, IList* pArgs)
743 AppLogDebug("ENTER OnSceneActivatedN");
747 int count = __pPresentationModel->GetFolderCount();
749 __pPresentationModel->AddContentEventListener(this);
751 __checkedCount = GetCheckedFolderCount();
753 if (previousSceneId == IDSCN_ALBUM_NAME_EDITOR)
756 if (__checkedCount == 0)
758 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
762 tempString.Format(FORMAT_BUFFER_SIZE,
763 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
768 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
770 for (int index = 0; index < count; ++index)
772 __pEditorFolderIconList->SetItemChecked(index,false);
775 __pEditorFolderIconList->UpdateList();
778 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
781 __pSelectCountLabel->SetText(tempString);
782 __pSelectCountLabel->Invalidate(true);
785 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
789 AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
791 AppLogDebug("ENTER");
792 __pPresentationModel->RemoveContentEventListener(*this);
794 if (nextSceneId != IDSCN_ALBUM_NAME_EDITOR)
796 int loopCount = __pPresentationModel->GetFolderCount();
798 for (int count = 0; count < loopCount; ++count)
800 __pEditorFolderIconList->SetItemChecked(count,false);
802 __pEditorFolderIconList->UpdateList();
805 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
809 AlbumListEditorForm::OnFileInfoChanged(const ContentType contentType)
811 AppLogDebug("ENTER");
813 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
817 AlbumListEditorForm::OnThumbnailDecoded(const int index)
819 AppLogDebug("ENTER : index(%d)", index);
820 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
821 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
825 AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
831 AlbumListEditorForm::OnScanDirStart()
833 AppLogDebug("SANTHOSH ENTER");
834 GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
836 __isScanProgress = true;
837 AppLogDebug("SANTHOSH EXIT");
840 AlbumListEditorForm::OnScanDirComplete()
842 AppLogDebug("SANTHOSH ENTER");
843 GetHeader()->SetButtonEnabled(BUTTON_POSITION_RIGHT, true);
845 __isScanProgress = false;
846 AppLogDebug("SANTHOSH EXIT");
850 AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
852 AppLogDebug("ENTER");
853 __pPresentationModel->SetUpdateProgressStatus(false);
854 SetAllCheckState(false);
855 __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
856 __pEditorFolderIconList->UpdateList();
858 SceneManager* pSceneManager = SceneManager::GetInstance();
859 AppAssert(pSceneManager);
860 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
861 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
865 AlbumListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
867 AppLogDebug("ENTER");
869 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
871 __pDeletePopup->SetShowState(false);
872 __pDeletePopup->Show();
874 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
879 AlbumListEditorForm::Update(void)
881 AppLogDebug("ENTER");
882 result r = __pEditorFolderIconList->UpdateList();
883 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
889 AlbumListEditorForm::OnRequestMessage(void)
891 AppLogDebug("ENTER");
893 int checkCount = GetCheckedFolderCount();
897 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
902 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
904 int maxCount = __pPresentationModel->GetFolderCount();
905 ContentManager contentManager;
906 result r = contentManager.Construct();
911 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
915 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
916 pArrayList->Construct();
917 for (int i = 0; i < maxCount; ++i)
919 if (__pEditorFolderIconList->IsItemChecked (i))
921 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
922 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
923 int loopCount = pContentIdList->GetCount();
924 for (int k = 0; k < loopCount; ++k)
926 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
927 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
929 if (pContentInfo == null)
934 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
944 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
945 pDataList->Construct();
946 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
947 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
949 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
950 null, null, pDataList, null);
952 if (r == E_MAX_EXCEEDED)
954 MessageBox messageBox;
955 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
956 MSGBOX_STYLE_NONE, 3000);
958 messageBox.ShowAndWait(modalResult);
961 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
965 AlbumListEditorForm::OnRequestEmail(void)
967 AppLogDebug("ENTER");
969 int checkCount = GetCheckedFolderCount();
973 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
978 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
980 int maxCount = __pPresentationModel->GetFolderCount();
981 ContentManager contentManager;
982 result r = contentManager.Construct();
987 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
991 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
992 pArrayList->Construct();
993 for (int i = 0; i < maxCount; ++i)
995 if (__pEditorFolderIconList->IsItemChecked(i))
997 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
998 IList* pContentIdList = pAlbumInfo->GetContentIdListN();
999 int loopCount = pContentIdList->GetCount();
1000 for (int k = 0; k < loopCount; ++k)
1002 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(k));
1003 ContentInfo* pContentInfo = contentManager.GetContentInfoN(*pContentId);
1005 if (pContentInfo == null)
1010 pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
1020 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1021 pDataList->Construct();
1022 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
1024 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
1025 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
1027 if (r == E_MAX_EXCEEDED)
1029 MessageBox messageBox;
1030 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
1031 MSGBOX_STYLE_NONE, 3000);
1033 messageBox.ShowAndWait(modalResult);
1036 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1040 AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
1042 AppLogDebug("ENTER");
1043 Footer* pFooter = GetFooter();
1046 if (enableState == true)
1048 pFooter->SetItemEnabled(0, true);
1049 pFooter->SetItemEnabled(1, true);
1053 pFooter->SetItemEnabled(0, false);
1054 pFooter->SetItemEnabled(1, false);
1057 pFooter->RequestRedraw(true);
1058 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1062 AlbumListEditorForm::SetButtonState(void)
1064 AppLogDebug("ENTER");
1065 if (GetCheckedFolderCount() > 0)
1067 AppLogDebug("BUTTONSTATE : Request Enable");
1068 SetFooterButtonsState(true);
1072 AppLogDebug("BUTTONSTATE : Request disable");
1073 SetFooterButtonsState(false);
1075 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1080 AlbumListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1083 IList* pIndexList = GetItemCheckedIndexListN();
1085 if (__pEditorFolderIconList != null)
1087 RemoveControl(__pEditorFolderIconList);
1090 __pEditorFolderIconList = new IconListView();
1092 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
1094 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height- __pSelectCountLabel->GetHeight()),
1095 Dimension(348, 348), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1097 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1099 int horizontalSpacing = 8;
1100 int verticalSpacing = 60;
1104 __pEditorFolderIconList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height - __pSelectCountLabel->GetHeight()),
1105 Dimension(width, height), ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
1107 __pEditorFolderIconList->SetItemSpacing(horizontalSpacing, verticalSpacing);
1108 __pEditorFolderIconList->SetMargin(MARGIN_TYPE_TOP,40);
1111 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
1113 if (pBitmap != null)
1115 __pEditorFolderIconList->SetBitmapOfEmptyList(pBitmap);
1119 __pEditorFolderIconList->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
1120 __pEditorFolderIconList->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
1121 __pEditorFolderIconList->SetTouchAnimationEnabled(false);
1122 __pEditorFolderIconList->SetItemProvider(*this);
1123 __pEditorFolderIconList->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
1124 __pEditorFolderIconList->AddIconListViewItemEventListener(*this);
1126 AddControl(__pEditorFolderIconList);
1128 int loopCount = pIndexList->GetCount();
1130 for (int count = 0; count < loopCount; ++count)
1132 Integer* pRealIndex = static_cast<Integer*>(pIndexList->GetAt(count));
1133 index = pRealIndex->ToInt();
1134 __pEditorFolderIconList->SetItemChecked(index, true);
1135 __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
1138 if (_pProgressAnim != null)
1140 _pProgressAnim->ChangeOrientation(Form::GetBounds());
1141 _pProgressAnim->Invalidate(true);