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 int H_COUNT_LABEL = 48;
42 static const int H_COUNT_LABEL_BUTTON = 42;
43 static const int W_COUNT_LABEL_BUTTON = 42;
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 Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
100 SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
102 __pContentIconListView = new (std::nothrow) IconListView();
103 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
104 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
105 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
106 if (pBitmapEmpty != null)
108 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
111 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
112 __pContentIconListView->SetMargin(MARGIN_TYPE_LEFT, W_CONTENT_MARGIN);
113 __pContentIconListView->SetMargin(MARGIN_TYPE_RIGHT, W_CONTENT_MARGIN);
114 __pContentIconListView->SetMargin(MARGIN_TYPE_TOP, H_CONTENT_MARGIN);
115 __pContentIconListView->SetItemSpacing(W_CONTENT_SPACE, H_CONTENT_SPACE);
116 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
117 __pContentIconListView->SetItemProvider(*this);
118 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
119 __pContentIconListView->AddIconListViewItemEventListener(*this);
120 __pContentIconListView->SetTouchAnimationEnabled(false);
121 AddControl(__pContentIconListView);
122 __pContentIconListView->SetShowState(true);
124 __pLabelSelectCnt = new (std::nothrow) Label();
126 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED").GetPointer();
127 __pLabelSelectCnt->Construct(
128 Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), strTmp);
129 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
130 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
131 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
132 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
133 __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
134 AddControl(__pLabelSelectCnt);
135 __pLabelSelectCnt->Invalidate(true);
137 __pButtonSelectRegion = new (std::nothrow) Button();
138 __pButtonSelectRegion->Construct(Rectangle(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10,
139 clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON),
141 __pButtonSelectRegion->SetActionId(IDA_BUTTON_MOVE_TO_SELECTION);
142 __pButtonSelectRegion->SetColor(BUTTON_STATUS_NORMAL, COLOR_COUNT_LABEL_BUTTON);
143 Bitmap* pSelectionBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MOVE_SELECTION);
144 if (pSelectionBitmap != null)
146 Rectangle buttonRegionRect = __pButtonSelectRegion->GetBounds();
147 pSelectionBitmap->Scale(Dimension(buttonRegionRect.width, buttonRegionRect.height));
148 __pButtonSelectRegion->SetNormalBitmap(Point(buttonRegionRect.width, buttonRegionRect.height),
151 AddControl(__pButtonSelectRegion);
153 if (pSelectionBitmap != null)
155 delete pSelectionBitmap;
157 __pButtonSelectRegion->AddActionEventListener(*this);
160 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
166 AllListEditorPanel::OnTerminating(void)
168 AppLogDebug("ENTER");
169 __pPresentationModel->RemovePresentationModelListener(*this);
170 __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm);
171 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
177 AllListEditorPanel::OnActionPerformed(const Control& source, int actionId)
179 AppLogDebug("ENTER");
180 SceneManager* pSceneManager = SceneManager::GetInstance();
181 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
185 case IDA_BUTTON_CHECKED:
187 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
188 for (int i=0; i < loopCount; ++i)
190 if (__pContentIconListView->IsItemChecked(i) == false)
192 __pContentIconListView->SetItemChecked(i, true);
193 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
196 int checkedCount = GetItemCheckedCount();
199 if (checkedCount == 0)
201 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
203 else if (checkedCount == 1)
205 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
209 strTmp.Format(LENGTH_COUNT_LABEL,
210 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
213 __pLabelSelectCnt->SetText(strTmp);
214 __pLabelSelectCnt->RequestRedraw(true);
219 case IDA_BUTTON_UNCHECKED:
221 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
222 for (int i = 0; i < loopCount; ++i)
224 if (__pContentIconListView->IsItemChecked(i) == true)
226 __pContentIconListView->SetItemChecked(i,false);
229 int checkedCount = GetItemCheckedCount();
232 if (checkedCount == 0)
234 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
236 else if (checkedCount == 1)
238 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
242 strTmp.Format(LENGTH_COUNT_LABEL,
243 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
246 __pLabelSelectCnt->SetText(strTmp);
247 __pLabelSelectCnt->RequestRedraw(true);
248 __pContentIconListView->UpdateList();
253 case IDA_BUTTON_MOVE_TO_SELECTION:
255 if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
257 IList* pList = GetItemCheckedIndexListN();
260 pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
262 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION), pList);
266 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_SELECTION));
274 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
278 AllListEditorPanel::GetItemCount(void)
280 AppLogDebug("ENTER");
281 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
287 AllListEditorPanel::CreateItem(int index)
289 AppLogDebug("ENTER : index(%d)", index);
290 IconListViewItem* pIconListviewItem;
291 Bitmap* pBitmap = null;
292 String* pItemText = null;
293 result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap);
294 if (pBitmap == null || r == E_FAILURE)
296 __pPresentationModel->RequestThumbnail(index);
297 pBitmap = CommonUtil::GetEmptyThumbnailN();
300 if (pItemText == null)
302 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
304 else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
307 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
310 if (__pContentIconListView->IsItemChecked(index) == true)
314 BufferInfo bufferInfo;
315 pBitmap->Lock(bufferInfo, INFINITE);
317 Color dimColor(COLOR_THUMBNAIL_DIM);
318 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
321 canvas.Construct(bufferInfo);
322 canvas.FillRectangle(dimColor, canvas.GetBounds());
324 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
325 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
326 pIconListviewItem = new (std::nothrow) IconListViewItem();
327 pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
328 delete pSelectedBitmap;
332 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
339 pIconListviewItem = new (std::nothrow) IconListViewItem();
340 pIconListviewItem->Construct(*pBitmap, pItemText);
347 if (pItemText != null)
351 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
353 return pIconListviewItem;
357 AllListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
359 AppLogDebug("ENTER");
361 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
367 AllListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
369 AppLogDebug("ENTER");
370 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
372 int checkedCount = GetItemCheckedCount();
375 if (checkedCount == 0)
377 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
379 else if (checkedCount == 1)
381 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
385 strTmp.Format(LENGTH_COUNT_LABEL,
386 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
389 __pLabelSelectCnt->SetText(strTmp);
390 __pLabelSelectCnt->RequestRedraw(true);
391 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
394 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
398 AllListEditorPanel::OnFileInfoChanged(const ContentType contentType)
400 AppLogDebug("ENTER");
401 if (contentType == CONTENT_TYPE_ALL
402 || contentType == CONTENT_TYPE_IMAGE
403 || contentType == CONTENT_TYPE_VIDEO)
405 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
406 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
407 __pContentIconListView->UpdateList();
409 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
413 AllListEditorPanel::OnThumbnailDecoded(const int index)
415 AppLogDebug("ENTER : index(%d)", index);
418 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
420 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
424 AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
425 const SceneId& currentSceneId, IList* pArgs)
427 AppLogDebug("ENTER");
431 __pPresentationModel = FileListPresentationModel::GetInstance();
433 SceneManager* pSceneManager = SceneManager::GetInstance();
434 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
435 __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
436 TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
437 __pPresentationModel->AddContentEventListener(__pFileListEditorForm);
439 if (previousSceneId == IDSCN_ALL_LIST_SELECTION)
443 if (__pContentIconListView != null)
445 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
446 for (int i = 0; i < loopCount; ++i)
448 __pContentIconListView->SetItemChecked(i, false);
450 __pContentIconListView->UpdateList();
453 if (pArgs->GetCount() > 0) //SomeItems are Still Selected.
455 IList* pSeletedIndexList = pArgs;
456 int loopCount = pSeletedIndexList->GetCount();
457 if (__pContentIconListView != null)
459 for (int i = 0; i < loopCount; ++i)
461 int index = static_cast<Integer*>(pSeletedIndexList->GetAt(i))->ToInt();
462 __pContentIconListView->SetItemChecked(index, true);
464 __pContentIconListView->UpdateList();
469 int checkedCount = GetItemCheckedCount();
472 if (checkedCount == 0)
474 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
476 else if (checkedCount == 1)
478 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
482 strTmp.Format(LENGTH_COUNT_LABEL,
483 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
486 __pLabelSelectCnt->SetText(strTmp);
487 __pLabelSelectCnt->RequestRedraw(true);
489 else if (previousSceneId == IDSCN_ALL_LIST)
496 __pFileListEditorForm->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
498 if (pArgs != null && pArgs->GetCount() > 0 && previousSceneId != IDSCN_ALL_LIST_SELECTION)
500 String* pDirectory = static_cast<String*>(pArgs->GetAt(0));
501 if (pDirectory != null && pDirectory->GetLength() > 0)
503 __pFileListEditorForm->MoveToAlbum(*pDirectory);
507 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
511 AllListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
513 AppLogDebug("ENTER");
514 __pPresentationModel->RemoveContentEventListener(__pFileListEditorForm);
515 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
519 AllListEditorPanel::GetItemCheckedCount(void) const
521 AppLogDebug("ENTER");
523 if (__pContentIconListView != null)
525 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
526 for (int i = 0; i < loopCount; ++i)
528 if (__pContentIconListView->IsItemChecked(i))
534 AppLog("Index i = %d is Not Checked", i);
538 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
544 AllListEditorPanel::GetItemCheckedIndexListN(void) const
546 AppLogDebug("ENTER");
547 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
548 Integer* pIndex = null;
550 if (__pContentIconListView!=null)
552 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
553 for (int i = 0; i < loopCount; ++i)
555 if (__pContentIconListView->IsItemChecked(i) == true)
557 pIndex = new (std::nothrow) Integer(i);
559 AppLogDebug("checked index(%d)", i);
563 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
569 AllListEditorPanel::OnRequestDelete(void)
571 AppLogDebug("ENTER");
572 IList* pIndexList = GetItemCheckedIndexListN();
573 if (pIndexList->GetCount() <= 0)
576 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
581 delete __pFileUpdateTimer;
582 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
583 result r = __pFileUpdateTimer->StartTimer();
587 delete __pFileUpdateTimer;
588 __pFileUpdateTimer = null;
593 __pPresentationModel->SetUpdateProgressStatus(true);
598 void AllListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
600 __pFileListEditorForm->Invalidate(true);
603 void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
605 __pPresentationModel->SetUpdateProgressStatus(false);
607 __pLabelSelectCnt->SetText(ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
608 __pLabelSelectCnt->RequestRedraw(true);
610 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
611 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
612 __pContentIconListView->UpdateList();
614 SceneManager* pSceneManager = SceneManager::GetInstance();
615 if (GetItemCount() > 0)
617 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
618 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
622 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
623 SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
625 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
629 AllListEditorPanel::ChangeOrientation(void)
631 SceneManager* pSceneManager = SceneManager::GetInstance();
632 const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
633 TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
635 Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
636 SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
637 __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL);
638 __pLabelSelectCnt->SetBounds(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL);
639 __pButtonSelectRegion->SetBounds(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10,
640 clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON);
644 AllListEditorPanel::OnRequestMessage(void)
646 AppLogDebug("ENTER");
647 result r = E_SUCCESS;
648 IList* pIndexList = GetItemCheckedIndexListN();
649 if (pIndexList == null || pIndexList->GetCount() <= 0)
651 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
656 Integer* pIndex = null;
658 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
659 pArrayList->Construct();
660 int loopCount = pIndexList->GetCount();
662 for (int i = 0; i < loopCount; ++i)
664 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
667 checkedIndex = pIndex->ToInt();
668 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex)));
672 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
673 pDataList->Construct();
674 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
675 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
677 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null,
678 null, pDataList, null);
680 if (r == E_MAX_EXCEEDED)
682 MessageBox messageBox;
683 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
684 MSGBOX_STYLE_NONE, 3000);
686 messageBox.ShowAndWait(modalResult);
688 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
694 AllListEditorPanel::OnRequestEmail(void)
696 AppLogDebug("ENTER");
697 result r = E_SUCCESS;
699 IList* pIndexList = GetItemCheckedIndexListN();
700 if (pIndexList == null || pIndexList->GetCount() <= 0)
702 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
707 Integer* pIndex = null;
709 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
710 pArrayList->Construct();
711 int loopCount = pIndexList->GetCount();
713 for (int i = 0; i < loopCount; ++i)
715 pIndex = static_cast<Integer*>(pIndexList->GetAt(i));
718 checkedIndex = pIndex->ToInt();
719 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(checkedIndex)));
723 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
724 pDataList->Construct();
725 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
727 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
728 new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
730 if (r == E_MAX_EXCEEDED)
732 MessageBox messageBox;
733 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
734 MSGBOX_STYLE_NONE, 3000);
736 messageBox.ShowAndWait(modalResult);
739 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
745 AllListEditorPanel::OnRequestSlideShow(void)
747 AppLogDebug("ENTER");
748 result r = E_SUCCESS;
749 IList* pIndexList = GetItemCheckedIndexListN();
750 if (pIndexList == null)
752 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
756 Integer* pRealIndex = null;
758 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
759 pArrayList->Construct();
760 int loopCount = pIndexList->GetCount();
762 for (int i = 0; i < loopCount; ++i)
764 pRealIndex = static_cast<Integer*>(pIndexList->GetAt(i));
765 if (pRealIndex != null)
767 realIndex = pRealIndex->ToInt();
768 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(realIndex)));
772 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
773 pDataList->Construct();
774 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW));
775 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
777 r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null,
778 new (std::nothrow) String(APPCONTROL_MIME_IMAGE_ALL), pDataList, null);
780 if (r == E_MAX_EXCEEDED)
782 MessageBox messageBox;
783 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
784 MSGBOX_STYLE_NONE, 3000);
786 messageBox.ShowAndWait(modalResult);
790 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
796 AllListEditorPanel::ResetSelection(void)
798 AppLogDebug("ENTER");
799 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
800 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
801 __pContentIconListView->UpdateList();
803 for (int index = 0; index < __itemCount; ++index)
805 __pContentIconListView->SetItemChecked(index, false);
806 __pContentIconListView->RefreshList(index,LIST_REFRESH_TYPE_ITEM_MODIFY);
810 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
812 __pLabelSelectCnt->SetText(strTmp);
813 __pLabelSelectCnt->RequestRedraw(true);
815 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
819 AllListEditorPanel::SetButtonState(void)
821 AppLogDebug("ENTER");
822 SceneManager* pSceneManager = SceneManager::GetInstance();
823 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
825 if (GetItemCheckedCount() > 0)
827 AppLogDebug("BUTTONSTATE : Request Enable");
828 __pFileListEditorForm->SetFooterButtonsState(true);
829 __pButtonSelectRegion->SetShowState(true);
833 AppLogDebug("BUTTONSTATE : Request disable");
834 __pFileListEditorForm->SetFooterButtonsState(false);
835 __pButtonSelectRegion->SetShowState(false);
837 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
841 AllListEditorPanel::OnSelectAllPressed(void)
843 bool needToSelectAll = true;
844 int checkedCount = GetItemCheckedCount();
845 int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
846 if (checkedCount == totalFileCount)
848 needToSelectAll = false;
851 if (needToSelectAll == true)
853 for (int i = 0; i < totalFileCount; ++i)
855 if (__pContentIconListView->IsItemChecked(i) == false)
857 __pContentIconListView->SetItemChecked(i,true);
858 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
864 for (int i = 0; i < totalFileCount; ++i)
866 if (__pContentIconListView->IsItemChecked(i) == true)
868 __pContentIconListView->SetItemChecked(i, false);
869 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
875 if (needToSelectAll == true)
877 tempString.Format(LENGTH_COUNT_LABEL,
878 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount);
882 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
885 __pLabelSelectCnt->SetText(tempString);
886 __pLabelSelectCnt->RequestRedraw(true);
891 AllListEditorPanel::OnRequestRotate(RotateMode rotateMode)
893 AppLogDebug("ENTER");
894 IList* pIndexList = GetItemCheckedIndexListN();
895 if (pIndexList == null)
897 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
900 else if (pIndexList->GetCount() <= 0)
903 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
908 delete __pFileUpdateTimer;
909 __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_ROTATE, rotateMode);
910 result r = __pFileUpdateTimer->StartTimer();
914 delete __pFileUpdateTimer;
915 __pFileUpdateTimer = null;
920 __pPresentationModel->SetUpdateProgressStatus(true);
925 void AllListEditorPanel::CancelUpdateProgress(void)
927 if (__pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted())
929 __pFileUpdateTimer->Cancel();
930 delete __pFileUpdateTimer;
931 __pFileUpdateTimer = null;