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 GlAllListEditorPanel.cpp
19 * @brief This is the implementation file for AllListEditorPanel class.
23 #include "GlAllListEditorPanel.h"
24 #include "GlCommonUtil.h"
25 #include "GlFileUpdateTimer.h"
26 #include "GlFileListEditorForm.h"
27 #include "GlFileListPresentationModel.h"
28 #include "GlResourceManager.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Base::Utility;
35 using namespace Tizen::Content;
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Media;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
41 static const float H_COUNT_LABEL = 48.0f;
42 static const float H_COUNT_LABEL_BUTTON = 42.0f;
43 static const float W_COUNT_LABEL_BUTTON = 42.0f;
44 static const int COUNT_LABEL_FONT_SIZE = 33;
45 static const int H_CONTENT_MARGIN = 9;
46 static const int W_CONTENT_MARGIN = 6;
47 static const int W_CONTENT_SPACE = 6;
48 static const int H_CONTENT_SPACE = 6;
49 static const int LENGTH_COUNT_LABEL = 256;
50 static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value;
51 static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
52 static const unsigned int COLOR_COUNT_LABEL_BUTTON = Color32<120, 120, 120>::Value;
53 static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
54 static const int ALPHA_THUMBNAIL_DIM = 70;
56 static const Rectangle RECT_INITIAL (0, 0, 10, 10);
58 AllListEditorPanel::AllListEditorPanel(void)
60 , __pContentIconListView(null)
61 , __pLabelSelectCnt(null)
62 , __pButtonSelectRegion(null)
63 , __pFileUpdateTimer(null)
64 , __pFileListEditorForm(null)
65 , __pPresentationModel(null)
68 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
71 AllListEditorPanel::~AllListEditorPanel(void)
74 delete __pFileUpdateTimer;
75 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
79 AllListEditorPanel::Initialize(void)
82 result r = Construct(RECT_INITIAL);
83 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
89 AllListEditorPanel::OnInitializing(void)
92 const Form* pForm = dynamic_cast<Form*>(GetParent());
93 TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
95 __pPresentationModel = FileListPresentationModel::GetInstance();
96 __pPresentationModel->ClearThumbnailRequests();
97 __pPresentationModel->AddPresentationModelListener(this);
99 FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
100 SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
103 __pContentIconListView = new (std::nothrow) IconListView();
104 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
105 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
106 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
107 if (pBitmapEmpty != null)
109 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
112 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
113 __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN);
114 __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN);
115 __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN);
116 __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE);
117 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
118 __pContentIconListView->SetItemProvider(*this);
119 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
120 __pContentIconListView->AddIconListViewItemEventListener(*this);
121 __pContentIconListView->SetTouchAnimationEnabled(false);
122 AddControl(__pContentIconListView);
123 __pContentIconListView->SetShowState(true);
125 __pLabelSelectCnt = new (std::nothrow) Label();
127 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED").GetPointer();
128 __pLabelSelectCnt->Construct(
129 FloatRectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), strTmp);
130 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
131 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
132 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
133 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
134 __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
135 AddControl(__pLabelSelectCnt);
136 __pLabelSelectCnt->Invalidate(true);
138 __pButtonSelectRegion = new (std::nothrow) Button();
139 __pButtonSelectRegion->Construct(FloatRectangle(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10,
140 clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON),
142 __pButtonSelectRegion->SetActionId(IDA_BUTTON_MOVE_TO_SELECTION);
143 __pButtonSelectRegion->SetColor(BUTTON_STATUS_NORMAL, COLOR_COUNT_LABEL_BUTTON);
144 Bitmap* pSelectionBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MOVE_SELECTION);
145 if (pSelectionBitmap != null)
147 Rectangle buttonRegionRect = __pButtonSelectRegion->GetBounds();
148 pSelectionBitmap->Scale(Dimension(buttonRegionRect.width, buttonRegionRect.height));
149 __pButtonSelectRegion->SetNormalBitmap(Point(buttonRegionRect.width, buttonRegionRect.height),
152 AddControl(__pButtonSelectRegion);
154 if (pSelectionBitmap != null)
156 delete pSelectionBitmap;
158 __pButtonSelectRegion->AddActionEventListener(*this);
161 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
167 AllListEditorPanel::OnTerminating(void)
169 AppLogDebug("ENTER");
170 __pPresentationModel->RemovePresentationModelListener(*this);
171 __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm);
172 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
178 AllListEditorPanel::OnActionPerformed(const Control& source, int actionId)
180 AppLogDebug("ENTER");
181 SceneManager* pSceneManager = SceneManager::GetInstance();
182 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
186 case IDA_BUTTON_CHECKED:
188 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
189 for (int i=0; i < loopCount; ++i)
191 if (__pContentIconListView->IsItemChecked(i) == false)
193 __pContentIconListView->SetItemChecked(i, true);
194 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
197 int checkedCount = GetItemCheckedCount();
200 if (checkedCount == 0)
202 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
204 else if (checkedCount == 1)
206 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
210 strTmp.Format(LENGTH_COUNT_LABEL,
211 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
214 __pLabelSelectCnt->SetText(strTmp);
215 __pLabelSelectCnt->RequestRedraw(true);
220 case IDA_BUTTON_UNCHECKED:
222 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
223 for (int i = 0; i < loopCount; ++i)
225 if (__pContentIconListView->IsItemChecked(i) == true)
227 __pContentIconListView->SetItemChecked(i,false);
230 int checkedCount = GetItemCheckedCount();
233 if (checkedCount == 0)
235 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
237 else if (checkedCount == 1)
239 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
243 strTmp.Format(LENGTH_COUNT_LABEL,
244 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
247 __pLabelSelectCnt->SetText(strTmp);
248 __pLabelSelectCnt->RequestRedraw(true);
249 __pContentIconListView->UpdateList();
254 case IDA_BUTTON_MOVE_TO_SELECTION:
256 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
258 IList* pList = GetItemCheckedIndexListN();
261 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
263 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION), pList);
267 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION));
275 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
279 AllListEditorPanel::GetItemCount(void)
281 AppLogDebug("ENTER");
282 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
288 AllListEditorPanel::CreateItem(int index)
290 AppLogDebug("ENTER : index(%d)", index);
291 IconListViewItem* pIconListviewItem;
292 Bitmap* pBitmap = null;
293 String* pItemText = null;
294 result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap);
295 if (pBitmap == null || r == E_FAILURE)
297 __pPresentationModel->RequestThumbnail(index);
298 pBitmap = CommonUtil::GetEmptyThumbnailN();
301 if (pItemText == null)
303 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
305 else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
308 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
311 if (__pContentIconListView->IsItemChecked(index) == true)
315 BufferInfo bufferInfo;
316 pBitmap->Lock(bufferInfo, INFINITE);
318 Color dimColor(COLOR_THUMBNAIL_DIM);
319 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
322 canvas.Construct(bufferInfo);
323 canvas.FillRectangle(dimColor, canvas.GetBounds());
325 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
326 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
327 pIconListviewItem = new (std::nothrow) IconListViewItem();
328 pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
329 delete pSelectedBitmap;
333 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
340 pIconListviewItem = new (std::nothrow) IconListViewItem();
341 pIconListviewItem->Construct(*pBitmap, pItemText);
348 if (pItemText != null)
352 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
354 return pIconListviewItem;
358 AllListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
360 AppLogDebug("ENTER");
362 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
368 AllListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
370 AppLogDebug("ENTER");
371 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
373 int checkedCount = GetItemCheckedCount();
376 if (checkedCount == 0)
378 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
380 else if (checkedCount == 1)
382 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
386 strTmp.Format(LENGTH_COUNT_LABEL,
387 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
390 __pLabelSelectCnt->SetText(strTmp);
391 __pLabelSelectCnt->RequestRedraw(true);
392 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
395 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
399 AllListEditorPanel::OnFileInfoChanged(const ContentType contentType)
401 AppLogDebug("ENTER");
402 if (contentType == CONTENT_TYPE_ALL
403 || contentType == CONTENT_TYPE_IMAGE
404 || contentType == CONTENT_TYPE_VIDEO)
406 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
407 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
408 __pContentIconListView->UpdateList();
410 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
414 AllListEditorPanel::OnThumbnailDecoded(const int index)
416 AppLogDebug("ENTER : index(%d)", index);
419 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
421 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
425 AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
426 const SceneId& currentSceneId, IList* pArgs)
428 AppLogDebug("ENTER");
432 __pPresentationModel = FileListPresentationModel::GetInstance();
434 SceneManager* pSceneManager = SceneManager::GetInstance();
435 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
436 __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
437 TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
438 __pPresentationModel->AddContentEventListener(__pFileListEditorForm);
440 if (previousSceneId == IDSCN_ALL_LIST_SELECTION)
444 if (__pContentIconListView != null)
446 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
447 for (int i = 0; i < loopCount; ++i)
449 __pContentIconListView->SetItemChecked(i, false);
451 __pContentIconListView->UpdateList();
454 if (pArgs->GetCount() > 0) //SomeItems are Still Selected.
456 IList* pSeletedIndexList = pArgs;
457 int loopCount = pSeletedIndexList->GetCount();
458 if (__pContentIconListView != null)
460 for (int i = 0; i < loopCount; ++i)
462 int index = static_cast<Integer*>(pSeletedIndexList->GetAt(i))->ToInt();
463 __pContentIconListView->SetItemChecked(index, true);
465 __pContentIconListView->UpdateList();
470 int checkedCount = GetItemCheckedCount();
473 if (checkedCount == 0)
475 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
477 else if (checkedCount == 1)
479 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
483 strTmp.Format(LENGTH_COUNT_LABEL,
484 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
487 __pLabelSelectCnt->SetText(strTmp);
488 __pLabelSelectCnt->RequestRedraw(true);
490 else if (previousSceneId == IDSCN_ALL_LIST)
497 __pFileListEditorForm->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
499 if (pArgs != null && pArgs->GetCount() > 0 && previousSceneId != IDSCN_ALL_LIST_SELECTION)
501 String* pDirectory = static_cast<String*>(pArgs->GetAt(0));
502 if (pDirectory != null && pDirectory->GetLength() > 0)
504 __pFileListEditorForm->MoveToAlbum(*pDirectory);
508 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
512 AllListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
514 AppLogDebug("ENTER");
515 __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm);
516 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
520 AllListEditorPanel::GetItemCheckedCount(void) const
522 AppLogDebug("ENTER");
524 if (__pContentIconListView != null)
526 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
527 for (int i = 0; i < loopCount; ++i)
529 if (__pContentIconListView->IsItemChecked(i))
535 AppLog("Index i = %d is Not Checked", i);
539 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
545 AllListEditorPanel::GetItemCheckedIndexListN(void) const
547 AppLogDebug("ENTER");
548 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
549 Integer* pIndex = null;
551 if (__pContentIconListView!=null)
553 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
554 for (int i = 0; i < loopCount; ++i)
556 if (__pContentIconListView->IsItemChecked(i) == true)
558 pIndex = new (std::nothrow) Integer(i);
560 AppLogDebug("checked index(%d)", i);
564 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
570 AllListEditorPanel::OnRequestDelete(void)
572 AppLogDebug("ENTER");
573 IList* pIndexList = GetItemCheckedIndexListN();
574 if (pIndexList->GetCount() <= 0)
577 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
582 delete __pFileUpdateTimer;
583 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
584 result r = __pFileUpdateTimer->StartTimer();
588 delete __pFileUpdateTimer;
589 __pFileUpdateTimer = null;
594 __pPresentationModel->SetUpdateProgressStatus(true);
599 void AllListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
601 __pFileListEditorForm->Invalidate(true);
604 void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
606 __pPresentationModel->SetUpdateProgressStatus(false);
608 __pLabelSelectCnt->SetText(ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
609 __pLabelSelectCnt->RequestRedraw(true);
611 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
612 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
613 __pContentIconListView->UpdateList();
615 SceneManager* pSceneManager = SceneManager::GetInstance();
616 if (GetItemCount() > 0)
618 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
619 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
623 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
624 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
626 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
630 AllListEditorPanel::ChangeOrientation(void)
632 SceneManager* pSceneManager = SceneManager::GetInstance();
633 const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
634 TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
636 FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
637 SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
638 __pContentIconListView->SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL);
639 __pLabelSelectCnt->SetBounds(0.0f, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL);
640 __pButtonSelectRegion->SetBounds(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10.0f,
641 clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4.0f, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON);
645 AllListEditorPanel::OnRequestMessage(void)
647 AppLogDebug("ENTER");
648 result r = E_SUCCESS;
649 IList* pIndexList = GetItemCheckedIndexListN();
650 if (pIndexList == null || pIndexList->GetCount() <= 0)
652 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
657 Integer* pIndex = null;
659 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
660 pArrayList->Construct();
661 int loopCount = pIndexList->GetCount();
663 for (int i = 0; i < loopCount; ++i)
665 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
668 checkedIndex = pIndex->ToInt();
669 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex)));
673 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
674 pDataList->Construct();
675 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
676 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
678 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null,
679 null, pDataList, null);
681 if (r == E_MAX_EXCEEDED)
683 MessageBox messageBox;
684 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
685 MSGBOX_STYLE_NONE, 3000);
687 messageBox.ShowAndWait(modalResult);
689 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
695 AllListEditorPanel::OnRequestEmail(void)
697 AppLogDebug("ENTER");
698 result r = E_SUCCESS;
700 IList* pIndexList = GetItemCheckedIndexListN();
701 if (pIndexList == null || pIndexList->GetCount() <= 0)
703 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
708 Integer* pIndex = null;
710 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
711 pArrayList->Construct();
712 int loopCount = pIndexList->GetCount();
714 for (int i = 0; i < loopCount; ++i)
716 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
719 checkedIndex = pIndex->ToInt();
720 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex)));
724 const String uriData = APPCONTROL_URI_MAIL_TO;
725 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
726 pDataList->Construct();
727 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
729 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
730 &uriData, null, pDataList, null);
732 if (r == E_MAX_EXCEEDED)
734 MessageBox messageBox;
735 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
736 MSGBOX_STYLE_NONE, 3000);
738 messageBox.ShowAndWait(modalResult);
741 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
747 AllListEditorPanel::OnRequestSlideShow(void)
749 AppLogDebug("ENTER");
750 result r = E_SUCCESS;
751 IList* pIndexList = GetItemCheckedIndexListN();
752 if (pIndexList == null)
754 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
758 Integer* pRealIndex = null;
760 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
761 pArrayList->Construct();
762 int loopCount = pIndexList->GetCount();
764 for (int i = 0; i < loopCount; ++i)
766 pRealIndex = static_cast<Integer*>(pIndexList->GetAt(i));
767 if (pRealIndex != null)
769 realIndex = pRealIndex->ToInt();
770 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex)));
774 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
775 pDataList->Construct();
776 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW));
777 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
778 const String mimeType = APPCONTROL_MIME_IMAGE_ALL;
780 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null,
781 &mimeType, pDataList, null);
783 if (r == E_MAX_EXCEEDED)
785 MessageBox messageBox;
786 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
787 MSGBOX_STYLE_NONE, 3000);
789 messageBox.ShowAndWait(modalResult);
793 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
799 AllListEditorPanel::ResetSelection(void)
801 AppLogDebug("ENTER");
802 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
803 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
804 __pContentIconListView->UpdateList();
806 for (int index = 0; index < __itemCount; ++index)
808 __pContentIconListView->SetItemChecked(index, false);
809 __pContentIconListView->RefreshList(index,LIST_REFRESH_TYPE_ITEM_MODIFY);
813 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
815 __pLabelSelectCnt->SetText(strTmp);
816 __pLabelSelectCnt->RequestRedraw(true);
818 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
822 AllListEditorPanel::SetButtonState(void)
824 AppLogDebug("ENTER");
825 SceneManager* pSceneManager = SceneManager::GetInstance();
826 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
828 if (GetItemCheckedCount() > 0)
830 AppLogDebug("BUTTONSTATE : Request Enable");
831 __pFileListEditorForm->SetFooterButtonsState(true);
832 __pButtonSelectRegion->SetShowState(true);
836 AppLogDebug("BUTTONSTATE : Request disable");
837 __pFileListEditorForm->SetFooterButtonsState(false);
838 __pButtonSelectRegion->SetShowState(false);
840 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
844 AllListEditorPanel::OnSelectAllPressed(void)
846 bool needToSelectAll = true;
847 int checkedCount = GetItemCheckedCount();
848 int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
849 if (checkedCount == totalFileCount)
851 needToSelectAll = false;
854 if (needToSelectAll == true)
856 for (int i = 0; i < totalFileCount; ++i)
858 if (__pContentIconListView->IsItemChecked(i) == false)
860 __pContentIconListView->SetItemChecked(i,true);
861 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
867 for (int i = 0; i < totalFileCount; ++i)
869 if (__pContentIconListView->IsItemChecked(i) == true)
871 __pContentIconListView->SetItemChecked(i, false);
872 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
878 if (needToSelectAll == true)
880 tempString.Format(LENGTH_COUNT_LABEL,
881 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount);
885 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
888 __pLabelSelectCnt->SetText(tempString);
889 __pLabelSelectCnt->RequestRedraw(true);
894 AllListEditorPanel::OnRequestRotate(RotateMode rotateMode)
896 AppLogDebug("ENTER");
897 IList* pIndexList = GetItemCheckedIndexListN();
898 if (pIndexList == null)
900 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
903 else if (pIndexList->GetCount() <= 0)
906 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
911 delete __pFileUpdateTimer;
912 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_ROTATE, rotateMode);
913 result r = __pFileUpdateTimer->StartTimer();
917 delete __pFileUpdateTimer;
918 __pFileUpdateTimer = null;
923 __pPresentationModel->SetUpdateProgressStatus(true);
928 void AllListEditorPanel::CancelUpdateProgress(void)
930 if (__pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted())
932 __pFileUpdateTimer->Cancel();
933 delete __pFileUpdateTimer;
934 __pFileUpdateTimer = null;
939 AllListEditorPanel::OnScanDirStart()
941 AppLogDebug("ENTER");
942 __pFileListEditorForm->SetProgressState(true);
946 AllListEditorPanel::OnScanDirComplete()
948 AppLogDebug("ENTER");
949 __pFileListEditorForm->SetProgressState(false);