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 clientAreaBounds.x = clientAreaBounds.y = 0;
97 SetBounds(clientAreaBounds);
99 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
101 __pContentIconListView = new (std::nothrow) IconListView();
103 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
105 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
106 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK,
107 ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
108 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
109 if (pBitmapEmpty != null)
111 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
115 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
116 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
117 __pContentIconListView->SetItemProvider(*this);
118 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
119 __pContentIconListView->AddIconListViewItemEventListener(*this);
120 __pContentIconListView->SetTouchAnimationEnabled(false);
121 AddControl(*__pContentIconListView);
122 __pContentIconListView->SetShowState(true);
125 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
126 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
127 __pLabelSelectCnt = new (std::nothrow) Label();
128 __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL,
129 clientAreaBounds.width, H_COUNT_LABEL), strTmp);
130 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
131 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
132 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
133 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
134 AddControl(*__pLabelSelectCnt);
138 __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
139 DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_NORMAL,
140 ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
141 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
142 if (pBitmapEmpty != null)
144 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
148 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
149 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
150 __pContentIconListView->SetItemProvider(*this);
151 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
152 __pContentIconListView->AddIconListViewItemEventListener(*this);
153 __pContentIconListView->SetTouchAnimationEnabled(false);
154 AddControl(*__pContentIconListView);
155 __pContentIconListView->SetShowState(true);
160 Panel* pCheckPanel = new (std::nothrow) Panel();
161 pCheckPanel->Construct(Rectangle(0, 0, clientAreaBounds.width, H_SELECTALL_REGION));
162 pCheckPanel->SetBackgroundColor(COLOR_SELECTALL_REGION);
163 __pCheckButton = new (std::nothrow) CheckButton();
164 __pCheckButton->Construct(pCheckPanel->GetBounds(), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT,
165 false, ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
166 __pCheckButton->SetActionId(ACTION_ID_SELECTALL_CHECKED, ACTION_ID_SELECTALL_UNCHECKED);
167 __pCheckButton->AddActionEventListener(*this);
168 pCheckPanel->AddControl(*__pCheckButton);
169 AddControl(*pCheckPanel);
171 __pContentIconListView = new (std::nothrow) IconListView();
172 __pContentIconListView->Construct(Rectangle(0, H_SELECTALL_REGION, clientAreaBounds.width,
173 clientAreaBounds.height - H_SELECTALL_REGION), DIMENSION_DEFAULT_THUMBNAIL,
174 ICON_LIST_VIEW_STYLE_MARK, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
175 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
176 if (pBitmapEmpty != null)
178 __pContentIconListView->SetBitmapOfEmptyList(pBitmapEmpty);
182 __pContentIconListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
183 __pContentIconListView->SetItemBorderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE);
184 __pContentIconListView->SetItemProvider(*this);
185 __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
186 __pContentIconListView->AddIconListViewItemEventListener(*this);
187 __pContentIconListView->SetTouchAnimationEnabled(false);
188 AddControl(*__pContentIconListView);
189 __pContentIconListView->SetShowState(true);
192 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
193 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
194 __pLabelSelectCnt = new (std::nothrow) Label();
195 __pLabelSelectCnt->Construct(
196 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
198 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
199 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
200 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
201 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
202 AddControl(*__pLabelSelectCnt);
204 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
210 ImageListEditorPanel::OnTerminating(void)
212 AppLogDebug("ENTER");
213 __pPresentationModel->RemovePresentationModelListener(*this);
214 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
220 ImageListEditorPanel::OnUpdateContentList()
222 AppLogDebug("ENTER");
223 SceneManager* pSceneManager = SceneManager::GetInstance();
224 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
225 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
229 ImageListEditorPanel::OnActionPerformed(const Control& source, int actionId)
231 AppLogDebug("ENTER");
232 SceneManager* pSceneManager = SceneManager::GetInstance();
233 AppAssert(pSceneManager);
237 case ACTION_ID_SELECTALL_CHECKED:
239 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
240 for (int i = 0; i < loopCount; ++i)
242 if (__pContentIconListView->IsItemChecked(i) == false)
244 __pContentIconListView->SetItemChecked(i,true);
245 __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
249 int checkedCount = GetItemCheckedCount();
251 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
252 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
253 __pLabelSelectCnt->SetText(strTmp);
254 __pLabelSelectCnt->RequestRedraw(true);
257 case ACTION_ID_SELECTALL_UNCHECKED:
259 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
260 for (int i = 0; i < loopCount; ++i)
262 if (__pContentIconListView->IsItemChecked(i) == true)
264 __pContentIconListView->SetItemChecked(i,false);
267 int checkedCount = GetItemCheckedCount();
269 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
270 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
271 __pLabelSelectCnt->SetText(strTmp);
272 __pLabelSelectCnt->RequestRedraw(true);
273 __pContentIconListView->UpdateList();
281 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
285 ImageListEditorPanel::GetItemCount(void)
287 AppLogDebug("ENTER");
288 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
294 ImageListEditorPanel::CreateItem(int index)
296 AppLogDebug("ENTER : index(%d)", index);
297 IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
298 Bitmap* pBitmap=null;
299 String* pItemText=null;
301 result r = __pPresentationModel->GetThumbnailInSyncCacheN(index, pItemText, pBitmap);
302 if (pBitmap == null || r == E_FAILURE)
304 __pPresentationModel->RequestThumbnail(index);
305 pBitmap = CommonUtil::GetEmptyThumbnailN();
308 if (pItemText == null)
310 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
312 else if ((*pItemText) != ResourceManager::GetString(L"EMPTY_SPACE"))
315 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
318 if (__pContentIconListView->IsItemChecked(index) == true)
322 BufferInfo bufferInfo;
323 pBitmap->Lock(bufferInfo, INFINITE);
325 Color dimColor(COLOR_THUMBNAIL_DIM);
326 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
329 canvas.Construct(bufferInfo);
330 canvas.FillRectangle(dimColor, canvas.GetBounds());
332 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
333 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
334 pIconListviewItem->Construct(*pBitmap, pItemText, pSelectedBitmap);
335 delete pSelectedBitmap;
336 pSelectedBitmap = null;
340 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
347 pIconListviewItem->Construct(*pBitmap, pItemText);
355 if (pItemText != null)
360 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
362 return pIconListviewItem;
366 ImageListEditorPanel::DeleteItem(int index, IconListViewItem* pItem)
368 AppLogDebug("ENTER");
370 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
376 ImageListEditorPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
378 AppLogDebug("ENTER");
380 if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
382 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
384 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
386 int checkedCount = GetItemCheckedCount();
388 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
389 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
390 __pLabelSelectCnt->SetText(strTmp);
391 __pLabelSelectCnt->RequestRedraw(true);
392 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
397 int checkedCount = GetItemCheckedCount();
399 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
400 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
401 __pLabelSelectCnt->SetText(strTmp);
402 __pLabelSelectCnt->RequestRedraw(true);
403 if (__pCheckButton->IsSelected())
405 __pCheckButton->SetSelected(false);
407 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
411 if ( __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
412 && __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE)
414 if (status == ICON_LIST_VIEW_ITEM_SELECTED)
416 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
417 result r = map->Construct();
420 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
421 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
422 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
423 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
425 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
428 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
444 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
448 ImageListEditorPanel::OnFileInfoChanged(const ContentType contentType)
450 AppLogDebug("ENTER");
451 if (contentType == CONTENT_TYPE_IMAGE)
453 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_IMAGE);
454 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
455 __pContentIconListView->UpdateList();
457 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
461 ImageListEditorPanel::OnThumbnailDecoded(const int index)
463 AppLogDebug("ENTER : index(%d)",index);
466 __pContentIconListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
468 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
472 ImageListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
473 const SceneId& currentSceneId, IList* pArgs)
475 AppLogDebug("ENTER");
476 __pPresentationModel = FileListPresentationModel::GetInstance();
478 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
480 if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR)
482 if (previousSceneId == IDSCN_ALBUM_LIST)
484 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
485 if (pAlbumInfo == null)
487 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
492 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
493 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
495 if (pDirectoryList != null)
497 delete pDirectoryList;
501 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
502 __pContentIconListView->UpdateList();
508 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
509 __pContentIconListView->RequestRedraw(true);
511 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
515 ImageListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
516 const SceneId& nextSceneId)
518 AppLogDebug("ENTER");
519 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
523 ImageListEditorPanel::GetItemCheckedCount(void) const
525 AppLogDebug("ENTER");
527 if (__pContentIconListView != null)
529 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
530 for (int i = 0; i < loopCount; ++i)
532 if (__pContentIconListView->IsItemChecked(i))
538 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
544 ImageListEditorPanel::GetItemCheckedIndexList(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))
557 pIndex = new (std::nothrow) Integer(i);
562 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
568 ImageListEditorPanel::OnRequestDelete(void)
570 AppLogDebug("ENTER");
571 IList* pIndexList = GetItemCheckedIndexList();
573 if (pIndexList == null || pIndexList->GetCount() <= 0 || __pPresentationModel == null)
576 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
580 //TODO To test this properly, seems like OnRequestDelete is unused
581 delete __pFileDelete;
582 __pFileDelete = new FileDeleteTimer(pIndexList,
583 __pPresentationModel,
585 result r = __pFileDelete->StartTimer();
589 delete __pFileDelete;
590 __pFileDelete = null;
594 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
596 void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
598 SceneManager* pSceneManager = SceneManager::GetInstance();
599 FileListEditorForm* pFileListEditorForm =
600 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
601 TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
602 GetErrorMessage(GetLastResult()));
603 pFileListEditorForm->Invalidate(true);
606 void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
608 if ( actionId == FILE_DELETE_ACTION )
612 else if ( actionId == FILE_MOVE_ACTION )
621 ImageListEditorPanel::OnRequestMessage(void)
623 AppLogDebug("ENTER");
624 IList* pIndexList = GetItemCheckedIndexList();
625 if (pIndexList->GetCount() <= 0)
627 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
634 int loopCount = pIndexList->GetCount();
635 for (int i = 0; i < loopCount; ++i)
637 path = __pPresentationModel->GetContentFilePath(i);
639 if (path.EndsWith(CONTENT_EXT_PNG)
640 || path.EndsWith(CONTENT_EXT_BMP)
641 || path.EndsWith(CONTENT_EXT_JPG)
642 || path.EndsWith(CONTENT_EXT_GIF)
643 || path.EndsWith(CONTENT_EXT_TIF)
644 || path.EndsWith(CONTENT_EXT_MP4)
645 || path.EndsWith(CONTENT_EXT_3GP)
646 || path.EndsWith(CONTENT_EXT_AVI)
647 || path.EndsWith(CONTENT_EXT_RM)
648 || path.EndsWith(CONTENT_EXT_WMV)
649 || path.EndsWith(CONTENT_EXT_ASF)
652 if (combineText.CompareTo(EMPTY_SPACE) != 0)
654 combineText.Append(L";");
656 combineText.Append(path);
660 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
661 pDataList->Construct();
662 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
663 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
665 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
667 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
671 ImageListEditorPanel::OnRequestEmail(void)
673 AppLogDebug("ENTER");
674 IList* pIndexList = GetItemCheckedIndexList();
675 if (pIndexList->GetCount() <= 0)
677 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
684 int loopCount = pIndexList->GetCount();
685 for (int i = 0; i < loopCount; ++i)
687 path = __pPresentationModel->GetContentFilePath(i);
689 if (path.EndsWith(CONTENT_EXT_PNG)
690 || path.EndsWith(CONTENT_EXT_BMP)
691 || path.EndsWith(CONTENT_EXT_JPG)
692 || path.EndsWith(CONTENT_EXT_GIF)
693 || path.EndsWith(CONTENT_EXT_TIF)
694 || path.EndsWith(CONTENT_EXT_MP4)
695 || path.EndsWith(CONTENT_EXT_3GP)
696 || path.EndsWith(CONTENT_EXT_AVI)
697 || path.EndsWith(CONTENT_EXT_RM)
698 || path.EndsWith(CONTENT_EXT_WMV)
699 || path.EndsWith(CONTENT_EXT_ASF)
702 if (combineText.CompareTo(EMPTY_SPACE) != 0)
704 combineText.Append(L";");
706 combineText.Append(path);
710 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
711 pDataList->Construct();
712 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
713 new (std::nothrow) String(combineText));
715 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
717 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
721 ImageListEditorPanel::OnRequestMoveTo(String& destDirectory)
723 AppLogDebug("ENTER");
724 if (&destDirectory == null || destDirectory.IsEmpty())
726 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
731 IList* pIndexList = GetItemCheckedIndexList();
732 if (pIndexList == null || pIndexList->GetCount() <= 0)
734 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
738 //TODO TO rework this, update to use the FileMoveTimer, When this func is used..
739 result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
742 TryReturn(r == E_SUCCESS, , "Failed on OnRequestDeleteAction");
744 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
745 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
746 __pContentIconListView->UpdateList();
747 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
751 ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
753 AppLogDebug("ENTER");
754 IList* pIndexList = GetItemCheckedIndexList();
756 if (pIndexList->GetCount() <= 0)
758 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
765 int loopCount = pIndexList->GetCount();
766 for (int i = 0; i < loopCount; ++i)
768 combineText.Append(__pPresentationModel->GetContentFilePath(i));
769 combineText.Append(L";");
772 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
774 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
775 new (std::nothrow) String(combineText));
776 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
777 new (std::nothrow) String(combineText));
779 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
782 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
785 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));