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 GlImageListEditorPanel.cpp
19 * @brief This is the implementation file for ImageListEditorPanel class.
24 #include "GlAlbumInfo.h"
25 #include "GlCommonUtil.h"
26 #include "GlFileListPresentationModel.h"
27 #include "GlGalleryApp.h"
28 #include "GlImageListEditorPanel.h"
29 #include "GlResourceManager.h"
31 #include "GlFileDeleteTimer.h"
32 #include "GlFileListEditorForm.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Content;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Media;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
44 static const int H_SELECTALL_REGION = 112;
45 static const unsigned int COLOR_SELECTALL_REGION = Color32<0x2A, 0x36, 0x4A>::Value;
46 static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value;
47 static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
48 static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
49 static const int H_COUNT_LABEL = 48;
50 static const int LENGTH_COUNT_LABEL = 256;
51 static const int ALPHA_THUMBNAIL_DIM = 70;
52 static const Rectangle RECT_INITIAL (0, 0, 10, 10);
54 ImageListEditorPanel::ImageListEditorPanel(void)
55 : __pContentIconListView(null)
56 , __pCheckButton(null)
57 , __pLabelSelectCnt(null)
59 , __pPresentationModel(null)
63 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
66 ImageListEditorPanel::~ImageListEditorPanel(void)
70 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
74 ImageListEditorPanel::Initialize(void)
77 result r = Construct(RECT_INITIAL);
78 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
84 ImageListEditorPanel::OnInitializing(void)
87 const Form* pForm = dynamic_cast<Form*>(GetParent());
88 TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
90 __pPresentationModel = FileListPresentationModel::GetInstance();
91 __pPresentationModel->ClearThumbnailRequests();
92 __pPresentationModel->AddPresentationModelListener(this);
95 Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
96 SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
98 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
100 __pContentIconListView = new (std::nothrow) IconListView();
102 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
104 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
105 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK,
106 ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
107 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
108 if (pBitmapEmpty != null)
110 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
113 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
114 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
115 __pContentIconListView->SetItemProvider(*this);
116 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
117 __pContentIconListView->AddIconListViewItemEventListener(*this);
118 __pContentIconListView->SetTouchAnimationEnabled(false);
119 AddControl(*__pContentIconListView);
120 __pContentIconListView->SetShowState(true);
122 __pLabelSelectCnt = new (std::nothrow) Label();
123 __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL,
124 clientAreaBounds.width, H_COUNT_LABEL), ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
125 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
126 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
127 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
128 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
129 AddControl(*__pLabelSelectCnt);
133 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
134 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL,
135 ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
136 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
137 if (pBitmapEmpty != null)
139 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
142 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
143 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
144 __pContentIconListView->SetItemProvider(*this);
145 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
146 __pContentIconListView->AddIconListViewItemEventListener(*this);
147 __pContentIconListView->SetTouchAnimationEnabled(false);
148 AddControl(*__pContentIconListView);
149 __pContentIconListView->SetShowState(true);
154 Panel* pCheckPanel = new (std::nothrow) Panel();
155 pCheckPanel->Construct(Rectangle(0, 0, clientAreaBounds.width, H_SELECTALL_REGION));
156 pCheckPanel->SetBackgroundColor(COLOR_SELECTALL_REGION);
157 __pCheckButton = new (std::nothrow) CheckButton();
158 __pCheckButton->Construct(pCheckPanel->GetBounds(), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT,
159 false, ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
160 __pCheckButton->SetActionId(ACTION_ID_SELECTALL_CHECKED, ACTION_ID_SELECTALL_UNCHECKED);
161 __pCheckButton->AddActionEventListener(*this);
162 pCheckPanel->AddControl(*__pCheckButton);
163 AddControl(*pCheckPanel);
165 __pContentIconListView = new (std::nothrow) IconListView();
166 __pContentIconListView->Construct(Rectangle(0, H_SELECTALL_REGION, clientAreaBounds.width,
167 clientAreaBounds.height - H_SELECTALL_REGION), DIMENSION_DEFAULT_THUMBNAIL,
168 ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
169 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
170 if (pBitmapEmpty != null)
172 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
175 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
176 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
177 __pContentIconListView->SetItemProvider(*this);
178 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
179 __pContentIconListView->AddIconListViewItemEventListener(*this);
180 __pContentIconListView->SetTouchAnimationEnabled(false);
181 AddControl(*__pContentIconListView);
182 __pContentIconListView->SetShowState(true);
184 __pLabelSelectCnt = new (std::nothrow) Label();
185 __pLabelSelectCnt->Construct(
186 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
187 ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
188 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
189 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
190 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
191 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
192 AddControl(*__pLabelSelectCnt);
194 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
200 ImageListEditorPanel::OnTerminating(void)
202 AppLogDebug("ENTER");
203 __pPresentationModel->RemovePresentationModelListener(*this);
204 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
210 ImageListEditorPanel::UpdatePanelContent()
212 AppLogDebug("ENTER");
213 SceneManager* pSceneManager = SceneManager::GetInstance();
214 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
215 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
219 ImageListEditorPanel::OnActionPerformed(const Control& source, int actionId)
221 AppLogDebug("ENTER");
222 SceneManager* pSceneManager = SceneManager::GetInstance();
223 AppAssert(pSceneManager);
227 case ACTION_ID_SELECTALL_CHECKED:
229 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
230 for (int i = 0; i < loopCount; ++i)
232 if (__pContentIconListView->IsItemChecked(i) == false)
234 __pContentIconListView->SetItemChecked(i,true);
235 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
239 int checkedCount = GetItemCheckedCount();
241 if (checkedCount == 0)
243 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
245 else if (checkedCount == 1)
247 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
251 strTmp.Format(LENGTH_COUNT_LABEL,
252 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
255 __pLabelSelectCnt->SetText(strTmp);
256 __pLabelSelectCnt->RequestRedraw(true);
259 case ACTION_ID_SELECTALL_UNCHECKED:
261 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
262 for (int i = 0; i < loopCount; ++i)
264 if (__pContentIconListView->IsItemChecked(i) == true)
266 __pContentIconListView->SetItemChecked(i,false);
269 int checkedCount = GetItemCheckedCount();
271 if (checkedCount == 0)
273 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
275 else if (checkedCount == 1)
277 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
281 strTmp.Format(LENGTH_COUNT_LABEL,
282 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
285 __pLabelSelectCnt->SetText(strTmp);
286 __pLabelSelectCnt->RequestRedraw(true);
287 __pContentIconListView->UpdateList();
295 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
299 ImageListEditorPanel::GetItemCount(void)
301 AppLogDebug("ENTER");
302 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
308 ImageListEditorPanel::CreateItem(int index)
310 AppLogDebug("ENTER : index(%d)", index);
311 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
312 Bitmap* pBitmap = null;
313 String* pItemText = null;
315 result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap);
316 if (pBitmap == null || r == E_FAILURE)
318 __pPresentationModel->RequestThumbnail(index);
319 pBitmap = CommonUtil::GetEmptyThumbnailN();
322 if (pItemText == null)
324 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
326 else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
329 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
332 if (__pContentIconListView->IsItemChecked(index) == true)
336 BufferInfo bufferInfo;
337 pBitmap->Lock(bufferInfo, INFINITE);
339 Color dimColor(COLOR_THUMBNAIL_DIM);
340 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
343 canvas.Construct(bufferInfo);
344 canvas.FillRectangle(dimColor, canvas.GetBounds());
346 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
347 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
348 pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
349 delete pSelectedBitmap;
353 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
360 pIconListviewItem->Construct(*pBitmap, pItemText);
367 if (pItemText != null)
371 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
373 return pIconListviewItem;
377 ImageListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
379 AppLogDebug("ENTER");
381 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
387 ImageListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
389 AppLogDebug("ENTER");
391 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
393 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
395 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
397 int checkedCount = GetItemCheckedCount();
399 if (checkedCount == 0)
401 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
403 else if (checkedCount == 1)
405 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
409 strTmp.Format(LENGTH_COUNT_LABEL,
410 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
413 __pLabelSelectCnt->SetText(strTmp);
414 __pLabelSelectCnt->RequestRedraw(true);
415 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
420 int checkedCount = GetItemCheckedCount();
422 if (checkedCount == 0)
424 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
426 else if (checkedCount == 1)
428 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
432 strTmp.Format(LENGTH_COUNT_LABEL,
433 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
436 __pLabelSelectCnt->SetText(strTmp);
437 __pLabelSelectCnt->RequestRedraw(true);
438 if (__pCheckButton->IsSelected())
440 __pCheckButton->SetSelected(false);
442 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
446 if ( __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
447 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE)
449 if (status == ICON_LIST_VIEW_ITEM_SELECTED)
451 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
452 result r = map->Construct();
455 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
456 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
458 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
461 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
475 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
479 ImageListEditorPanel::OnFileInfoChanged(const ContentType contentType)
481 AppLogDebug("ENTER");
482 if (contentType == CONTENT_TYPE_IMAGE)
484 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE);
485 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
486 __pContentIconListView->UpdateList();
488 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
492 ImageListEditorPanel::OnThumbnailDecoded(const int index)
494 AppLogDebug("ENTER : index(%d)",index);
497 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
499 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
503 ImageListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
504 const SceneId& currentSceneId, IList* pArgs)
506 AppLogDebug("ENTER");
507 __pPresentationModel = FileListPresentationModel::GetInstance();
509 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
511 if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR)
513 if (previousSceneId == IDSCN_ALBUM_LIST)
515 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
516 if (pAlbumInfo == null)
518 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
523 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
524 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
526 if (pDirectoryList != null)
528 delete pDirectoryList;
532 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
533 __pContentIconListView->UpdateList();
539 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
540 __pContentIconListView->RequestRedraw(true);
542 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
546 ImageListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
547 const SceneId& nextSceneId)
549 AppLogDebug("ENTER");
550 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
554 ImageListEditorPanel::GetItemCheckedCount(void) const
556 AppLogDebug("ENTER");
558 if (__pContentIconListView != null)
560 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
561 for (int i = 0; i < loopCount; ++i)
563 if (__pContentIconListView->IsItemChecked(i))
569 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
575 ImageListEditorPanel::GetItemCheckedIndexList(void) const
577 AppLogDebug("ENTER");
578 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
579 Integer* pIndex = null;
581 if (__pContentIconListView != null)
583 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
584 for (int i = 0; i < loopCount; ++i)
586 if (__pContentIconListView->IsItemChecked(i))
588 pIndex = new (std::nothrow) Integer(i);
593 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
599 ImageListEditorPanel::OnRequestDelete(void)
601 AppLogDebug("ENTER");
602 IList* pIndexList = GetItemCheckedIndexList();
604 if (pIndexList == null || pIndexList->GetCount() <= 0 || __pPresentationModel == null)
607 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
611 //TODO To test this properly, seems like OnRequestDelete is unused
612 delete __pFileDelete;
613 __pFileDelete = new FileDeleteTimer(pIndexList, __pPresentationModel, this);
614 result r = __pFileDelete->StartTimer();
618 delete __pFileDelete;
619 __pFileDelete = null;
623 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
626 void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
628 SceneManager* pSceneManager = SceneManager::GetInstance();
629 FileListEditorForm* pFileListEditorForm =
630 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
631 TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
632 GetErrorMessage(GetLastResult()));
633 pFileListEditorForm->Invalidate(true);
636 void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
638 if (actionId == FILE_DELETE_ACTION)
642 else if (actionId == FILE_MOVE_ACTION)
648 ImageListEditorPanel::OnRequestMessage(void)
650 AppLogDebug("ENTER");
651 IList* pIndexList = GetItemCheckedIndexList();
652 if (pIndexList->GetCount() <= 0)
654 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
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 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
667 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
668 pDataList->Construct();
669 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
670 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
672 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null,
674 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
678 ImageListEditorPanel::OnRequestEmail(void)
680 AppLogDebug("ENTER");
681 IList* pIndexList = GetItemCheckedIndexList();
682 if (pIndexList->GetCount() <= 0)
684 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
689 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
690 pArrayList->Construct();
691 int loopCount = pIndexList->GetCount();
693 for (int i = 0; i < loopCount; ++i)
695 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
698 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
699 pDataList->Construct();
700 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
702 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE, null,
704 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
708 ImageListEditorPanel::OnRequestMoveTo(String& destDirectory)
710 AppLogDebug("ENTER");
711 if (&destDirectory == null || destDirectory.IsEmpty())
713 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
718 IList* pIndexList = GetItemCheckedIndexList();
719 if (pIndexList == null || pIndexList->GetCount() <= 0)
721 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
726 result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
728 TryReturn(r == E_SUCCESS, , "Failed on OnRequestDeleteAction");
730 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
731 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
732 __pContentIconListView->UpdateList();
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
737 ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
739 AppLogDebug("ENTER");
740 IList* pIndexList = GetItemCheckedIndexList();
742 if (pIndexList->GetCount() <= 0)
744 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
748 ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
749 pArrayList->Construct();
750 int loopCount = pIndexList->GetCount();
752 for (int i = 0; i < loopCount; ++i)
754 pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
757 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
759 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList);
761 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
764 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
767 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
771 ImageListEditorPanel::SelectAllPressed(void)
773 bool needToSelectAll = true;
774 int checkedCount = GetItemCheckedCount();
775 int totalFileCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
776 if (checkedCount == totalFileCount)
778 needToSelectAll = false;
781 if (needToSelectAll == true)
783 for (int i = 0 ; i < totalFileCount; ++i)
785 if (__pContentIconListView->IsItemChecked(i) == false)
787 __pContentIconListView->SetItemChecked(i,true);
788 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
794 for (int i = 0 ; i < totalFileCount; ++i)
796 if (__pContentIconListView->IsItemChecked(i) == true)
798 __pContentIconListView->SetItemChecked(i, false);
799 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
805 if (needToSelectAll == true)
807 tempString.Format(LENGTH_COUNT_LABEL,
808 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), totalFileCount);
812 tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
815 __pLabelSelectCnt->SetText(tempString);
816 __pLabelSelectCnt->RequestRedraw(true);