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 GlVideoListEditorPanel.cpp
19 * @brief This is the implementation file for VideoListEditorPanel class.
24 #include "GlAlbumInfo.h"
25 #include "GlCommonUtil.h"
26 #include "GlFileListPresentationModel.h"
27 #include "GlGalleryApp.h"
28 #include "GlResourceManager.h"
30 #include "GlVideoListEditorPanel.h"
31 #include "GlFileListEditorForm.h"
32 #include "GlFileDeleteTimer.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::Controls;
41 using namespace Tizen::Ui::Scenes;
43 static const unsigned int COLOR_SELECTALL_REGION = Color32<0x2A, 0x36, 0x4A>::Value;
44 static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value;
45 static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
46 static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
47 static const Rectangle RECT_VIDEO_THUMBNAIL(16, 16, 172, 128);
48 static const Rectangle RECT_INITIAL(0, 0, 10, 10);
50 static const int H_SELECTALL_REGION = 112;
51 static const int ALPHA_THUMBNAIL_DIM = 70;
52 static const int H_COUNT_LABEL = 48;
53 static const int LENGTH_COUNT_LABEL = 256;
54 static const int W_CLIENT_REGION = 720;
55 static const int H_VIDEO_ITEM = 160;
56 static const int GAP_W_VIDEO_TITLE = 16+172+16;
57 static const int GAP_H_VIDEO_TITLE = 22;
58 static const int W_VIDEO_TITLE = (16+172+16)+(16+64+16);
59 static const int H_VIDEO_TITLE = 64;
60 static const int FONT_SIZE_TITLE = 36;
61 static const int GAP_W_VIDEO_DURATION = 16+172+16;
62 static const int GAP_H_VIDEO_DURATION = 22+64;
63 static const int W_VIDEO_DURATION = (16+172+16)+(16+64+16);
64 static const int H_VIDEO_DURATION = 48;
65 static const int FONT_SIZE_DURATION = 32;
67 VideoListEditorPanel::VideoListEditorPanel()
68 : __pContentListView(null)
69 , __pCheckButton(null)
70 , __pLabelSelectCnt(null)
72 , __pPresentationModel(null)
76 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
79 VideoListEditorPanel::~VideoListEditorPanel()
83 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
87 VideoListEditorPanel::Initialize(void)
90 result r = Construct(RECT_INITIAL);
91 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
97 VideoListEditorPanel::OnInitializing(void)
100 const Form* pForm = dynamic_cast<Form*>(GetParent());
101 TryReturn(pForm != null, E_FAILURE, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
103 __pPresentationModel = FileListPresentationModel::GetInstance();
104 __pPresentationModel->ClearThumbnailRequests();
105 __pPresentationModel->AddPresentationModelListener(this);
108 Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
109 clientAreaBounds.x = clientAreaBounds.y = 0;
110 SetBounds(clientAreaBounds);
112 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
114 __pContentListView = new (std::nothrow) ListView();
116 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
118 __pContentListView->Construct(Rectangle(0, 0, W_CLIENT_REGION, clientAreaBounds.height), true, false);
119 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
120 if (pBitmapEmpty != null)
122 __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty);
125 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
126 __pContentListView->SetItemProvider(*this);
127 __pContentListView->AddListViewItemEventListener(*this);
128 AddControl(*__pContentListView);
129 __pContentListView->SetShowState(true);
131 __pLabelSelectCnt = new (std::nothrow) Label();
132 __pLabelSelectCnt->Construct(
133 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
134 ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
135 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
136 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
137 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
138 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
139 AddControl(*__pLabelSelectCnt);
143 __pContentListView->Construct(Rectangle(0, 0, W_CLIENT_REGION, clientAreaBounds.height),true, false);
144 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
145 if (pBitmapEmpty != null)
147 __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty);
150 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
151 __pContentListView->SetItemProvider(*this);
152 __pContentListView->AddListViewItemEventListener(*this);
153 AddControl(*__pContentListView);
154 __pContentListView->SetShowState(true);
159 Panel* pCheckPanel = new (std::nothrow) Panel();
160 pCheckPanel->Construct(Rectangle(0, 0, clientAreaBounds.width, H_SELECTALL_REGION));
161 pCheckPanel->SetBackgroundColor(COLOR_SELECTALL_REGION);
162 __pCheckButton = new (std::nothrow) CheckButton();
163 __pCheckButton->Construct(pCheckPanel->GetBounds(), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT,
164 false, ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
165 __pCheckButton->SetActionId(ACTION_ID_SELECTALL_CHECKED, ACTION_ID_SELECTALL_UNCHECKED);
166 __pCheckButton->AddActionEventListener(*this);
167 pCheckPanel->AddControl(*__pCheckButton);
168 AddControl(*pCheckPanel);
170 __pContentListView = new (std::nothrow) ListView();
171 __pContentListView->Construct(
172 Rectangle(0, H_SELECTALL_REGION, W_CLIENT_REGION, clientAreaBounds.height-H_SELECTALL_REGION),
174 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
175 if (pBitmapEmpty != null)
177 __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty);
180 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
181 __pContentListView->SetItemProvider(*this);
182 __pContentListView->AddListViewItemEventListener(*this);
183 AddControl(*__pContentListView);
184 __pContentListView->SetShowState(true);
186 __pLabelSelectCnt = new (std::nothrow) Label();
187 __pLabelSelectCnt->Construct(
188 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
189 ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
190 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
191 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
192 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
193 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
194 AddControl(*__pLabelSelectCnt);
197 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
203 VideoListEditorPanel::OnTerminating(void)
205 AppLogDebug("ENTER");
206 __pPresentationModel->RemovePresentationModelListener(*this);
207 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
213 VideoListEditorPanel::UpdatePanelContent()
215 AppLogDebug("ENTER");
216 SceneManager* pSceneManager = SceneManager::GetInstance();
217 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
218 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
222 VideoListEditorPanel::OnActionPerformed(const Control& source, int actionId)
224 AppLogDebug("ENTER");
225 SceneManager* pSceneManager = SceneManager::GetInstance();
226 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
230 case ACTION_ID_SELECTALL_CHECKED:
232 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
233 for (int i = 0; i < loopCount; ++i)
235 if (__pContentListView->IsItemChecked(i) == false)
237 __pContentListView->SetItemChecked(i,true);
238 __pContentListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
242 int checkedCount = GetItemCheckedCount();
244 if (checkedCount == 0)
246 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
248 else if (checkedCount == 1)
250 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
254 strTmp.Format(LENGTH_COUNT_LABEL,
255 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
258 __pLabelSelectCnt->SetText(strTmp);
259 __pLabelSelectCnt->RequestRedraw(true);
262 case ACTION_ID_SELECTALL_UNCHECKED:
264 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
265 for (int i = 0; i < loopCount; ++i)
267 if (__pContentListView->IsItemChecked(i) == true)
269 __pContentListView->SetItemChecked(i,false);
273 int checkedCount = GetItemCheckedCount();
275 if (checkedCount == 0)
277 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
279 else if (checkedCount == 1)
281 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
285 strTmp.Format(LENGTH_COUNT_LABEL,
286 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
289 __pLabelSelectCnt->SetText(strTmp);
290 __pLabelSelectCnt->RequestRedraw(true);
291 __pContentListView->UpdateList();
299 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
303 VideoListEditorPanel::GetItemCount(void)
305 AppLogDebug("ENTER");
306 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
312 VideoListEditorPanel::CreateItem(int index, int itemWidth)
314 AppLogDebug("ENTER : index(%d)", index);
315 CustomItem* pItem = new (std::nothrow) CustomItem();
317 Bitmap* pBitmap = null;
318 String* pItemText = null;
319 String* pTitle = null;
320 String* pDuration = null;
322 result r = __pPresentationModel->GetThumbnailVideoInSyncCacheN(index, pItemText, pBitmap, pDuration);
323 if (pBitmap == null || r == E_FAILURE)
325 __pPresentationModel->RequestThumbnail(index);
326 pBitmap = CommonUtil::GetEmptyThumbnailN();
329 if (pItemText == null)
331 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
334 pTitle = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
336 if (pDuration == null)
338 pDuration = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
341 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
343 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
345 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK);
347 if (__pContentListView->IsItemChecked(index) == true)
351 BufferInfo bufferInfo;
352 pBitmap->Lock(bufferInfo, INFINITE);
355 Color dimColor(COLOR_THUMBNAIL_DIM);
356 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
359 canvas.Construct(bufferInfo);
360 canvas.FillRectangle(dimColor, canvas.GetBounds());
362 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
363 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
364 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap,
366 delete pSelectedBitmap;
370 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
377 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
382 pTitle = new (std::nothrow) String(SINGLE_SPACE);
384 else if (pTitle->IsEmpty() == true)
387 pTitle = new (std::nothrow) String(SINGLE_SPACE);
390 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
391 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
392 Color::GetColor(COLOR_ID_BLACK),null,null,false);
394 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION,
396 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
397 Color::GetColor(COLOR_ID_GREY),null,null,false);
401 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_NORMAL);
402 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
406 pTitle = new (std::nothrow) String(SINGLE_SPACE);
408 else if (pTitle->IsEmpty() == true)
411 pTitle = new (std::nothrow) String(SINGLE_SPACE);
414 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
415 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
416 Color::GetColor(COLOR_ID_BLACK),null,null,false);
418 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION,
420 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
421 Color::GetColor(COLOR_ID_GREY),null,null,false);
426 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK);
427 if (__pContentListView->IsItemChecked(index) == true)
431 BufferInfo bufferInfo;
432 pBitmap->Lock(bufferInfo, INFINITE);
434 Color dimColor(COLOR_THUMBNAIL_DIM);
435 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
438 canvas.Construct(bufferInfo);
439 canvas.FillRectangle(dimColor, canvas.GetBounds());
441 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
442 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
443 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap, pSelectedBitmap);
444 delete pSelectedBitmap;
448 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
453 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
458 pTitle = new (std::nothrow) String(SINGLE_SPACE);
460 else if (pTitle->IsEmpty() == true)
463 pTitle = new (std::nothrow) String(SINGLE_SPACE);
466 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
467 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
468 Color::GetColor(COLOR_ID_BLACK),null,null,false);
470 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth - W_VIDEO_DURATION,
472 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
473 Color::GetColor(COLOR_ID_GREY),null,null,false);
480 if (pItemText != null)
488 if (pDuration != null)
492 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
498 VideoListEditorPanel::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
500 AppLogDebug("ENTER");
502 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
508 VideoListEditorPanel::OnListViewItemStateChanged(ListView& listView, int index, int elementId,
509 ListItemStatus status)
511 AppLogDebug("ENTER");
513 if (status == LIST_ITEM_STATUS_CHECKED || status == LIST_ITEM_STATUS_UNCHECKED)
515 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
517 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
519 int checkedCount = GetItemCheckedCount();
521 if (checkedCount == 0)
523 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
525 else if (checkedCount == 1)
527 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
531 strTmp.Format(LENGTH_COUNT_LABEL,
532 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
535 __pLabelSelectCnt->SetText(strTmp);
536 __pLabelSelectCnt->RequestRedraw(true);
537 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
542 int checkedCount = GetItemCheckedCount();
544 if (checkedCount == 0)
546 strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
548 else if (checkedCount == 1)
550 strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
554 strTmp.Format(LENGTH_COUNT_LABEL,
555 ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
558 __pLabelSelectCnt->SetText(strTmp);
559 __pLabelSelectCnt->RequestRedraw(true);
560 if (__pCheckButton->IsSelected())
562 __pCheckButton->SetSelected(false);
564 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
568 if ( __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
569 && __pPresentationModel->GetAppControlSelectionMode() != APPCONTROL_SELECTION_MODE_MULTIPLE)
571 if (status == LIST_ITEM_STATUS_SELECTED)
573 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
574 result r = map->Construct();
577 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
578 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
579 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
580 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
582 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
585 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
599 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
603 VideoListEditorPanel::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
605 AppLogDebug("ENTER");
606 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
610 VideoListEditorPanel::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId,
611 ListContextItemStatus status)
613 AppLogDebug("ENTER");
614 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
618 VideoListEditorPanel::OnFileInfoChanged(const ContentType contentType)
620 AppLogDebug("ENTER");
621 if (contentType == CONTENT_TYPE_VIDEO)
623 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO);
624 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
625 __pContentListView->UpdateList();
627 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
631 VideoListEditorPanel::OnThumbnailDecoded(const int index)
633 AppLogDebug("ENTER : index(%d)", index);
636 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
638 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
642 VideoListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
643 const SceneId& currentSceneId, IList* pArgs)
645 AppLogDebug("ENTER");
646 __pPresentationModel = FileListPresentationModel::GetInstance();
648 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
650 if (currentSceneId == IDSCN_VIDEO_LIST_EDITOR)
652 if (previousSceneId == IDSCN_ALBUM_LIST)
654 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
655 if (pAlbumInfo == null)
657 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
662 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
663 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
665 if (pDirectoryList != null)
667 delete pDirectoryList;
671 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
672 __pContentListView->UpdateList();
678 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
679 __pContentListView->RequestRedraw(true);
682 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
686 VideoListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
687 const SceneId& nextSceneId)
689 AppLogDebug("ENTER");
690 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
694 VideoListEditorPanel::GetItemCheckedCount(void) const
696 AppLogDebug("ENTER");
698 if (__pContentListView != null)
700 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
701 for (int i = 0; i < loopCount; ++i)
703 if (__pContentListView->IsItemChecked(i))
709 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
715 VideoListEditorPanel::GetItemCheckedIndexList(void) const
717 AppLogDebug("ENTER");
718 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
719 Integer* pIndex = null;
721 if (__pContentListView != null)
723 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
724 for (int i = 0; i < loopCount; ++i)
726 if (__pContentListView->IsItemChecked(i))
728 pIndex = new (std::nothrow) Integer(i);
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
739 VideoListEditorPanel::OnRequestDelete(void)
741 AppLogDebug("ENTER");
742 IList* pIndexList = GetItemCheckedIndexList();
744 if (pIndexList == null || pIndexList->GetCount() <= 0 || __pPresentationModel == null)
747 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
751 delete __pFileDelete;
752 __pFileDelete = new FileDeleteTimer(pIndexList, __pPresentationModel, this);
753 result r = __pFileDelete->StartTimer();
757 delete __pFileDelete;
758 __pFileDelete = null;
762 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
765 void VideoListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
767 SceneManager* pSceneManager = SceneManager::GetInstance();
768 FileListEditorForm* pFileListEditorForm =
769 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
770 TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
771 GetErrorMessage(GetLastResult()));
772 pFileListEditorForm->Invalidate(true);
775 void VideoListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
777 if ( actionId == FILE_DELETE_ACTION )
781 else if ( actionId == FILE_MOVE_ACTION )
787 VideoListEditorPanel::OnRequestMessage(void)
789 AppLogDebug("ENTER");
790 IList* pIndexList = GetItemCheckedIndexList();
791 if (pIndexList->GetCount() <= 0)
793 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
801 int loopCount = pIndexList->GetCount();
802 for (int i = 0; i < loopCount; ++i)
804 path = __pPresentationModel->GetContentFilePath(i);
806 if ( path.EndsWith(CONTENT_EXT_PNG)
807 || path.EndsWith(CONTENT_EXT_BMP)
808 || path.EndsWith(CONTENT_EXT_JPG)
809 || path.EndsWith(CONTENT_EXT_GIF)
810 || path.EndsWith(CONTENT_EXT_TIF)
811 || path.EndsWith(CONTENT_EXT_MP4)
812 || path.EndsWith(CONTENT_EXT_3GP)
813 || path.EndsWith(CONTENT_EXT_AVI)
814 || path.EndsWith(CONTENT_EXT_RM)
815 || path.EndsWith(CONTENT_EXT_WMV)
816 || path.EndsWith(CONTENT_EXT_ASF)
819 if (combineText.CompareTo(EMPTY_SPACE) != 0)
821 combineText.Append(L";");
823 combineText.Append(path);
827 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
828 pDataList->Construct();
829 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
830 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
832 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
834 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
838 VideoListEditorPanel::OnRequestEmail(void)
840 AppLogDebug("ENTER");
841 IList* pIndexList = GetItemCheckedIndexList();
842 if (pIndexList->GetCount() <= 0)
844 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
852 int loopCount = pIndexList->GetCount();
853 for (int i = 0; i < loopCount; ++i)
855 path = __pPresentationModel->GetContentFilePath(i);
857 if ( path.EndsWith(CONTENT_EXT_PNG)
858 || path.EndsWith(CONTENT_EXT_BMP)
859 || path.EndsWith(CONTENT_EXT_JPG)
860 || path.EndsWith(CONTENT_EXT_GIF)
861 || path.EndsWith(CONTENT_EXT_TIF)
862 || path.EndsWith(CONTENT_EXT_MP4)
863 || path.EndsWith(CONTENT_EXT_3GP)
864 || path.EndsWith(CONTENT_EXT_AVI)
865 || path.EndsWith(CONTENT_EXT_RM)
866 || path.EndsWith(CONTENT_EXT_WMV)
867 || path.EndsWith(CONTENT_EXT_ASF)
870 if (combineText.CompareTo(EMPTY_SPACE) != 0)
872 combineText.Append(L";");
874 combineText.Append(path);
878 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
879 pDataList->Construct();
880 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
882 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
884 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
888 VideoListEditorPanel::OnRequestMoveTo(String& destDirectory)
890 AppLogDebug("ENTER");
891 if (&destDirectory == null || destDirectory.IsEmpty())
893 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
898 IList* pIndexList = GetItemCheckedIndexList();
899 if (pIndexList == null || pIndexList->GetCount() <= 0)
901 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
906 result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
908 TryReturn(r == E_SUCCESS, , "Failed on OnRequestDeleteAction");
910 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
911 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
912 __pContentListView->UpdateList();
913 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
917 VideoListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
919 AppLogDebug("ENTER");
920 IList* pIndexList = GetItemCheckedIndexList();
922 if (pIndexList->GetCount() <= 0)
924 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
931 int loopCount = pIndexList->GetCount();
932 for (int i = 0; i < loopCount; ++i)
934 combineText.Append(__pPresentationModel->GetContentFilePath(i));
935 combineText.Append(L";");
938 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
940 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(combineText));
941 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), new (std::nothrow) String(combineText));
943 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
946 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
949 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));