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);
126 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
127 __pContentListView->SetItemProvider(*this);
128 __pContentListView->AddListViewItemEventListener(*this);
129 AddControl(*__pContentListView);
130 __pContentListView->SetShowState(true);
133 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
134 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
135 __pLabelSelectCnt = new (std::nothrow) Label();
136 __pLabelSelectCnt->Construct(
137 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
139 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
140 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
141 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
142 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
143 AddControl(*__pLabelSelectCnt);
147 __pContentListView->Construct(Rectangle(0, 0, W_CLIENT_REGION, clientAreaBounds.height),true, false);
148 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
149 if (pBitmapEmpty != null)
151 __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty);
155 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
156 __pContentListView->SetItemProvider(*this);
157 __pContentListView->AddListViewItemEventListener(*this);
158 AddControl(*__pContentListView);
159 __pContentListView->SetShowState(true);
164 Panel* pCheckPanel = new (std::nothrow) Panel();
165 pCheckPanel->Construct(Rectangle(0, 0, clientAreaBounds.width, H_SELECTALL_REGION));
166 pCheckPanel->SetBackgroundColor(COLOR_SELECTALL_REGION);
167 __pCheckButton = new (std::nothrow) CheckButton();
168 __pCheckButton->Construct(pCheckPanel->GetBounds(), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT,
169 false, ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
170 __pCheckButton->SetActionId(ACTION_ID_SELECTALL_CHECKED, ACTION_ID_SELECTALL_UNCHECKED);
171 __pCheckButton->AddActionEventListener(*this);
172 pCheckPanel->AddControl(*__pCheckButton);
173 AddControl(*pCheckPanel);
175 __pContentListView = new (std::nothrow) ListView();
176 __pContentListView->Construct(
177 Rectangle(0, H_SELECTALL_REGION, W_CLIENT_REGION, clientAreaBounds.height-H_SELECTALL_REGION),
179 Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
180 if (pBitmapEmpty != null)
182 __pContentListView->SetBitmapOfEmptyList(pBitmapEmpty);
186 __pContentListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_COM_BODY_NO_ITEMS"));
187 __pContentListView->SetItemProvider(*this);
188 __pContentListView->AddListViewItemEventListener(*this);
189 AddControl(*__pContentListView);
190 __pContentListView->SetShowState(true);
193 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
194 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), 0);
195 __pLabelSelectCnt = new (std::nothrow) Label();
196 __pLabelSelectCnt->Construct(
197 Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
199 __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
200 __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
201 __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
202 __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
203 AddControl(*__pLabelSelectCnt);
206 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
212 VideoListEditorPanel::OnTerminating(void)
214 AppLogDebug("ENTER");
215 __pPresentationModel->RemovePresentationModelListener(*this);
216 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
222 VideoListEditorPanel::OnUpdateContentList()
224 AppLogDebug("ENTER");
225 SceneManager* pSceneManager = SceneManager::GetInstance();
226 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_VIDEO_LIST));
227 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
231 VideoListEditorPanel::OnActionPerformed(const Control& source, int actionId)
233 AppLogDebug("ENTER");
234 SceneManager* pSceneManager = SceneManager::GetInstance();
235 TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
239 case ACTION_ID_SELECTALL_CHECKED:
241 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
242 for (int i = 0; i < loopCount; ++i)
244 if (__pContentListView->IsItemChecked(i) == false)
246 __pContentListView->SetItemChecked(i,true);
247 __pContentListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
251 int checkedCount = GetItemCheckedCount();
253 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
254 ResourceManager::GetString(L"IDS_COM_BODY_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 (__pContentListView->IsItemChecked(i) == true)
266 __pContentListView->SetItemChecked(i,false);
270 int checkedCount = GetItemCheckedCount();
272 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
273 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
274 __pLabelSelectCnt->SetText(strTmp);
275 __pLabelSelectCnt->RequestRedraw(true);
276 __pContentListView->UpdateList();
284 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
288 VideoListEditorPanel::GetItemCount(void)
290 AppLogDebug("ENTER");
291 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
297 VideoListEditorPanel::CreateItem(int index, int itemWidth)
299 AppLogDebug("ENTER : index(%d)", index);
300 CustomItem* pItem = new (std::nothrow) CustomItem();
302 Bitmap* pBitmap = null;
303 String* pItemText = null;
304 String* pTitle = null;
305 String* pDuration = null;
307 result r = __pPresentationModel->GetThumbnailVideoInSyncCacheN(index, pItemText, pBitmap, pDuration);
308 if (pBitmap == null || r == E_FAILURE)
310 __pPresentationModel->RequestThumbnail(index);
311 pBitmap = CommonUtil::GetEmptyThumbnailN();
314 if (pItemText == null)
316 pItemText = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
319 pTitle = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
321 if (pDuration == null)
323 pDuration = new (std::nothrow) String(ResourceManager::GetString(L"EMPTY_SPACE"));
326 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
328 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
330 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK);
332 if (__pContentListView->IsItemChecked(index) == true)
336 BufferInfo bufferInfo;
337 pBitmap->Lock(bufferInfo, INFINITE);
340 Color dimColor(COLOR_THUMBNAIL_DIM);
341 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
344 canvas.Construct(bufferInfo);
345 canvas.FillRectangle(dimColor, canvas.GetBounds());
347 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
348 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
349 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap,
351 delete pSelectedBitmap;
352 pSelectedBitmap = null;
356 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
363 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
368 pTitle = new (std::nothrow) String(SINGLE_SPACE);
370 else if (pTitle->IsEmpty() == true)
373 pTitle = new (std::nothrow) String(SINGLE_SPACE);
376 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
377 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
378 Color::GetColor(COLOR_ID_BLACK),null,null,false);
380 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION,
382 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
383 Color::GetColor(COLOR_ID_GREY),null,null,false);
387 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_NORMAL);
388 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
392 pTitle = new (std::nothrow) String(SINGLE_SPACE);
394 else if (pTitle->IsEmpty() == true)
397 pTitle = new (std::nothrow) String(SINGLE_SPACE);
400 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
401 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
402 Color::GetColor(COLOR_ID_BLACK),null,null,false);
404 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth-W_VIDEO_DURATION,
406 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
407 Color::GetColor(COLOR_ID_GREY),null,null,false);
412 pItem->Construct(Dimension(itemWidth, H_VIDEO_ITEM), LIST_ANNEX_STYLE_MARK);
413 if (__pContentListView->IsItemChecked(index) == true)
417 BufferInfo bufferInfo;
418 pBitmap->Lock(bufferInfo, INFINITE);
420 Color dimColor(COLOR_THUMBNAIL_DIM);
421 dimColor.SetAlpha(ALPHA_THUMBNAIL_DIM);
424 canvas.Construct(bufferInfo);
425 canvas.FillRectangle(dimColor, canvas.GetBounds());
427 Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
428 pSelectedBitmap->Construct(canvas, canvas.GetBounds());
429 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap, pSelectedBitmap);
430 delete pSelectedBitmap;
431 pSelectedBitmap = null;
435 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
440 pItem->AddElement(RECT_VIDEO_THUMBNAIL, ACTION_ID_FORMAT_THUMBNAIL, *pBitmap);
445 pTitle = new (std::nothrow) String(SINGLE_SPACE);
447 else if (pTitle->IsEmpty() == true)
450 pTitle = new (std::nothrow) String(SINGLE_SPACE);
453 Rectangle titleRect(GAP_W_VIDEO_TITLE, GAP_H_VIDEO_TITLE, itemWidth-W_VIDEO_TITLE, H_VIDEO_TITLE);
454 pItem->AddElement(titleRect, ACTION_ID_FORMAT_TITLE, *pTitle, FONT_SIZE_TITLE,
455 Color::GetColor(COLOR_ID_BLACK),null,null,false);
457 Rectangle durationRect(GAP_W_VIDEO_DURATION, GAP_H_VIDEO_DURATION, itemWidth - W_VIDEO_DURATION,
459 pItem->AddElement(durationRect, ACTION_ID_FORMAT_DURATION, *pDuration, FONT_SIZE_DURATION,
460 Color::GetColor(COLOR_ID_GREY),null,null,false);
467 if (pItemText != null)
475 if (pDuration != null)
479 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
485 VideoListEditorPanel::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
487 AppLogDebug("ENTER");
489 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
495 VideoListEditorPanel::OnListViewItemStateChanged(ListView& listView, int index, int elementId,
496 ListItemStatus status)
498 AppLogDebug("ENTER");
500 if (status == LIST_ITEM_STATUS_CHECKED || status == LIST_ITEM_STATUS_UNCHECKED)
502 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
504 if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
506 int checkedCount = GetItemCheckedCount();
508 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
509 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
510 __pLabelSelectCnt->SetText(strTmp);
511 __pLabelSelectCnt->RequestRedraw(true);
512 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
517 int checkedCount = GetItemCheckedCount();
519 strTmp.Format(LENGTH_COUNT_LABEL, L"%ls (%d)",
520 ResourceManager::GetString(L"IDS_COM_BODY_SELECTED").GetPointer(), checkedCount);
521 __pLabelSelectCnt->SetText(strTmp);
522 __pLabelSelectCnt->RequestRedraw(true);
523 if (__pCheckButton->IsSelected())
525 __pCheckButton->SetSelected(false);
527 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
531 if ( __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
532 && __pPresentationModel->GetAppControlSelectionMode() != APPCONTROL_SELECTION_MODE_MULTIPLE)
534 if (status == LIST_ITEM_STATUS_SELECTED)
536 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
537 result r = map->Construct();
540 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
541 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
542 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
543 new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
545 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
548 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
562 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
566 VideoListEditorPanel::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
568 AppLogDebug("ENTER");
569 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
573 VideoListEditorPanel::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId,
574 ListContextItemStatus status)
576 AppLogDebug("ENTER");
577 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
581 VideoListEditorPanel::OnFileInfoChanged(const ContentType contentType)
583 AppLogDebug("ENTER");
584 if (contentType == CONTENT_TYPE_VIDEO)
586 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_VIDEO);
587 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
588 __pContentListView->UpdateList();
590 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
594 VideoListEditorPanel::OnThumbnailDecoded(const int index)
596 AppLogDebug("ENTER : index(%d)", index);
599 __pContentListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
601 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
605 VideoListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
606 const SceneId& currentSceneId, IList* pArgs)
608 AppLogDebug("ENTER");
609 __pPresentationModel = FileListPresentationModel::GetInstance();
611 if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
613 if (currentSceneId == IDSCN_VIDEO_LIST_EDITOR)
615 if (previousSceneId == IDSCN_ALBUM_LIST)
617 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pArgs->GetAt(0));
618 if (pAlbumInfo == null)
620 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
625 IList* pDirectoryList = pAlbumInfo->GetDirectoryListN();
626 __pPresentationModel->SetCurrentAlbumInfo(pAlbumInfo->GetAlbumName(), *pDirectoryList);
628 if (pDirectoryList != null)
630 delete pDirectoryList;
634 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
635 __pContentListView->UpdateList();
641 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
642 __pContentListView->RequestRedraw(true);
645 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
649 VideoListEditorPanel::OnSceneDeactivated(const SceneId& currentSceneId,
650 const SceneId& nextSceneId)
652 AppLogDebug("ENTER");
653 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
657 VideoListEditorPanel::GetItemCheckedCount(void) const
659 AppLogDebug("ENTER");
661 if (__pContentListView != null)
663 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
664 for (int i = 0; i < loopCount; ++i)
666 if (__pContentListView->IsItemChecked(i))
672 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
678 VideoListEditorPanel::GetItemCheckedIndexList(void) const
680 AppLogDebug("ENTER");
681 IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
682 Integer* pIndex=null;
684 if (__pContentListView != null)
686 int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
687 for (int i = 0; i < loopCount; ++i)
689 if (__pContentListView->IsItemChecked(i))
691 pIndex = new (std::nothrow) Integer(i);
696 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
702 VideoListEditorPanel::OnRequestDelete(void)
704 AppLogDebug("ENTER");
705 IList* pIndexList = GetItemCheckedIndexList();
707 if (pIndexList == null || pIndexList->GetCount() <= 0 || __pPresentationModel == null)
710 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
714 delete __pFileDelete;
715 __pFileDelete = new FileDeleteTimer(pIndexList,
716 __pPresentationModel,
718 result r = __pFileDelete->StartTimer();
722 delete __pFileDelete;
723 __pFileDelete = null;
727 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
729 void VideoListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
731 SceneManager* pSceneManager = SceneManager::GetInstance();
732 FileListEditorForm* pFileListEditorForm =
733 dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
734 TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
735 GetErrorMessage(GetLastResult()));
736 pFileListEditorForm->Invalidate(true);
739 void VideoListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
741 if ( actionId == FILE_DELETE_ACTION )
745 else if ( actionId == FILE_MOVE_ACTION )
751 VideoListEditorPanel::OnRequestMessage(void)
753 AppLogDebug("ENTER");
754 IList* pIndexList = GetItemCheckedIndexList();
755 if (pIndexList->GetCount() <= 0)
757 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
765 int loopCount = pIndexList->GetCount();
766 for (int i = 0; i < loopCount; ++i)
768 path = __pPresentationModel->GetContentFilePath(i);
770 if ( path.EndsWith(CONTENT_EXT_PNG)
771 || path.EndsWith(CONTENT_EXT_BMP)
772 || path.EndsWith(CONTENT_EXT_JPG)
773 || path.EndsWith(CONTENT_EXT_GIF)
774 || path.EndsWith(CONTENT_EXT_TIF)
775 || path.EndsWith(CONTENT_EXT_MP4)
776 || path.EndsWith(CONTENT_EXT_3GP)
777 || path.EndsWith(CONTENT_EXT_AVI)
778 || path.EndsWith(CONTENT_EXT_RM)
779 || path.EndsWith(CONTENT_EXT_WMV)
780 || path.EndsWith(CONTENT_EXT_ASF)
783 if (combineText.CompareTo(EMPTY_SPACE) != 0)
785 combineText.Append(L";");
787 combineText.Append(path);
791 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
792 pDataList->Construct();
793 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
794 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
796 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
798 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
802 VideoListEditorPanel::OnRequestEmail(void)
804 AppLogDebug("ENTER");
805 IList* pIndexList = GetItemCheckedIndexList();
806 if (pIndexList->GetCount() <= 0)
808 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
816 int loopCount = pIndexList->GetCount();
817 for (int i = 0; i < loopCount; ++i)
819 path = __pPresentationModel->GetContentFilePath(i);
821 if ( path.EndsWith(CONTENT_EXT_PNG)
822 || path.EndsWith(CONTENT_EXT_BMP)
823 || path.EndsWith(CONTENT_EXT_JPG)
824 || path.EndsWith(CONTENT_EXT_GIF)
825 || path.EndsWith(CONTENT_EXT_TIF)
826 || path.EndsWith(CONTENT_EXT_MP4)
827 || path.EndsWith(CONTENT_EXT_3GP)
828 || path.EndsWith(CONTENT_EXT_AVI)
829 || path.EndsWith(CONTENT_EXT_RM)
830 || path.EndsWith(CONTENT_EXT_WMV)
831 || path.EndsWith(CONTENT_EXT_ASF)
834 if (combineText.CompareTo(EMPTY_SPACE) != 0)
836 combineText.Append(L";");
838 combineText.Append(path);
842 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
843 pDataList->Construct();
844 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
845 new (std::nothrow) String(combineText));
847 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
849 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
853 VideoListEditorPanel::OnRequestMoveTo(String& destDirectory)
855 AppLogDebug("ENTER");
856 if (&destDirectory == null || destDirectory.IsEmpty())
858 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
863 IList* pIndexList = GetItemCheckedIndexList();
864 if (pIndexList == null || pIndexList->GetCount() <= 0)
866 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
870 //TODO TO rework this, update to use the FileMoveTimer, When this func is used..
871 result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
874 TryReturn(r == E_SUCCESS, , "Failed on OnRequestDeleteAction");
876 __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
877 __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
878 __pContentListView->UpdateList();
879 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
883 VideoListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
885 AppLogDebug("ENTER");
886 IList* pIndexList = GetItemCheckedIndexList();
888 if (pIndexList->GetCount() <= 0)
890 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
897 int loopCount = pIndexList->GetCount();
898 for (int i = 0; i < loopCount; ++i)
900 combineText.Append(__pPresentationModel->GetContentFilePath(i));
901 combineText.Append(L";");
904 HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
906 map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
907 new (std::nothrow) String(combineText));
908 map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
909 new (std::nothrow) String(combineText));
911 GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
914 pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
917 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));