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 GlFileListPresentationModel.cpp
19 * @brief This is the implementation file for FileListPresentationModel class.
25 #include "GlCommonUtil.h"
26 #include "GlFileListPresentationModel.h"
27 #include "GlContentUpdateEventListener.h"
28 #include "GlGalleryApp.h"
29 #include "GlThumbnailEvent.h"
30 #include "GlThumbnailEventArg.h"
31 #include "GlThumbnailProvider.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Runtime;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::Content;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Io;
42 using namespace Tizen::Media;
43 using namespace Tizen::System;
45 static const String CONTENT_INFO_ORDER = L"ContentFileName";
47 static const int SIZE_PAGE_NO = 1;
48 static const int SIZE_CONUNT_PER_PAGE = 3000;
49 static const int SIZE_ICON_LIST_CACHE = 50;
50 static const int W_DURATION_TEXT = 44;
51 static const int H_DURATION_TEXT = 4;
52 static const int W_DURATION = 171;
53 static const int H_DURATION = 32;
54 static const int W_DEFAULT_THUMBNAIL = 171;
55 static const int H_DEFAULT_THUMBNAIL = 127;
56 static const int W_WIDE_THUMBNAIL = 171;
57 static const int H_WIDE_THUMBNAIL = 127;
58 static const int W_PLAY_FG = 64;
59 static const int H_PLAY_FG = 64;
60 static const int GAP_W_PLAY_FG = (W_DEFAULT_THUMBNAIL -W_PLAY_FG)/2 ;
61 static const int GAP_H_PLAY_FG = (H_DEFAULT_THUMBNAIL - H_PLAY_FG)/2;
62 static const int GAP_H_DURATION = H_DEFAULT_THUMBNAIL - H_DURATION;
63 static const int ALPHA_DURATION = 70;
64 static const int FONT_SIZE_DURATION = 24;
65 static const Dimension DIMENSION_REAL_ICON (171,127);
66 static const Rectangle RECTANGLE_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127);
67 static const Rectangle RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127);
68 static const Color COLOR_DURATION_BG (Color::GetColor(COLOR_ID_BLACK));
69 static const Color COLOR_TEXT_OUTLINE (Color::GetColor(COLOR_ID_WHITE));
71 static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera";
72 static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera";
73 static const String RESERVED_DOWNLOAD_PATH = Environment::GetMediaPath() + L"Downloads";
75 FileListPresentationModel* FileListPresentationModel::__pPresentationModelInstance = null;
76 ThumbnailProvider* FileListPresentationModel::__pThumbnailProvider = null;
77 ThumbnailEvent* FileListPresentationModel::__pThumbnailEvent = null;
78 ArrayList* FileListPresentationModel::__pPresentationModelListener = null;
79 ArrayList* FileListPresentationModel::__pContentEventListener = null;
80 ArrayList* FileListPresentationModel::__pIconListViewCache = null;
81 IList* FileListPresentationModel::__pDirectoryList = null;
82 IList* FileListPresentationModel::__pContentInfoList = null;
84 FileListPresentationModel::FileListPresentationModel(void)
85 : __pContentManager(null)
86 , __albumContentType(CONTENT_TYPE_ALL)
87 , __appControlMode(APPCONTROL_MODE_MAIN)
88 , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE)
89 , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE)
90 , __pContentIdList(null)
91 , __updateProgressStatus(false)
94 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
97 FileListPresentationModel::~FileListPresentationModel(void)
100 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
103 FileListPresentationModel*
104 FileListPresentationModel::GetInstance(void)
106 AppLogDebug("ENTER");
107 if (__pPresentationModelInstance == null)
111 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
113 return __pPresentationModelInstance;
117 FileListPresentationModel::Construct(void)
119 AppLogDebug("ENTER");
121 IThumbnailEventListener* pThumbnailEventListener = static_cast<IThumbnailEventListener*>(this);
122 __pThumbnailEvent = new (std::nothrow) ThumbnailEvent();
123 __pThumbnailEvent->AddListener(*pThumbnailEventListener, true);
125 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
127 ContentUpdateEventListener::GetInstance();
128 __pContentManager = new (std::nothrow) ContentManager();
129 __pContentManager->Construct();
131 if (__pIconListViewCache != null)
133 delete __pIconListViewCache;
135 __pIconListViewCache = new (std::nothrow) ArrayList(SingleObjectDeleter);
136 __pIconListViewCache->Construct(SIZE_ICON_LIST_CACHE);
138 if (__pDirectoryList != null)
140 delete __pDirectoryList;
142 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
144 if (__pContentInfoList != null)
146 delete __pContentInfoList;
148 __pContentInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter);
150 __pPresentationModelListener = new (std::nothrow) ArrayList();
151 __pPresentationModelListener->Construct();
153 __pContentEventListener = new (std::nothrow) ArrayList();
154 __pContentEventListener->Construct();
156 __pThumbnailProvider = ThumbnailProvider::GetInstance();
158 GalleryApp* pApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
159 const IMap* pArguments = pApp->GetAppControlArguments();
160 String operationId = pApp->GetAppControlOperationId();
162 if (operationId.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0)
164 __appControlMode = APPCONTROL_MODE_MAIN;
166 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0)
168 __appControlMode = APPCONTROL_MODE_PICK;
170 if (pArguments != null)
172 const String* selectionMode = static_cast<const String*>(pArguments->GetValue(String(APPCONTROL_KEY_SELECTION_MODE)));
174 if (pApp->GetMimeType().StartsWith(APPCONTROL_DATA_VIDEO, 0) == true)
176 __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO;
179 if (selectionMode != null && selectionMode->CompareTo(APPCONTROL_DATA_MULTIPLE) == 0)
181 __appControlSelectionMode = APPCONTROL_SELECTION_MODE_MULTIPLE;
185 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0)
187 __appControlMode = APPCONTROL_MODE_SETTING;
190 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
196 FileListPresentationModel::CreateInstance(void)
198 AppLogDebug("ENTER");
199 __pPresentationModelInstance = new (std::nothrow) FileListPresentationModel();
200 result r = __pPresentationModelInstance->Construct();
201 if (IsFailed(r) == true)
203 delete __pPresentationModelInstance;
204 __pPresentationModelInstance = null;
205 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
210 std::atexit(DestroyInstance);
211 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
215 FileListPresentationModel::DestroyInstance(void)
217 AppLogDebug("ENTER");
219 delete __pThumbnailEvent;
220 __pIconListViewCache = null;
222 if (__pIconListViewCache != null)
224 delete __pIconListViewCache;
225 __pIconListViewCache = null;
228 if (__pDirectoryList != null)
230 delete __pDirectoryList;
231 __pDirectoryList = null;
234 if (__pContentInfoList != null)
236 delete __pContentInfoList;
237 __pContentInfoList = null;
240 if (__pPresentationModelListener != null)
242 delete __pPresentationModelListener;
243 __pPresentationModelListener = null;
246 if (__pContentEventListener != null)
248 delete __pContentEventListener;
249 __pContentEventListener = null;
252 delete __pPresentationModelInstance;
253 __pPresentationModelInstance = null;
255 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
259 FileListPresentationModel::GetFileNameFromFullPath(const String& fullPath, const bool withExt) const
261 AppLogDebug("ENTER");
262 if (fullPath.CompareTo(EMPTY_SPACE) == 0)
264 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
269 String delim(DIRECTORY_SEPARATOR);
270 StringTokenizer st(fullPath,delim);
272 while (st.HasMoreTokens())
274 st.GetNextToken(token);
279 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
285 String subDelim(FILE_EXT_SEPARATOR);
286 StringTokenizer subSt(token, subDelim);
288 subSt.GetNextToken(subToken);
289 AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
296 FileListPresentationModel::GetDirecotyNameFromFullPath(const String& fullPath)const
298 AppLogDebug("ENTER");
299 if (fullPath == null)
301 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
305 String delim(DIRECTORY_SEPARATOR);
306 StringTokenizer st(fullPath,delim);
308 while (st.HasMoreTokens())
310 st.GetNextToken(token);
312 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
318 FileListPresentationModel::IsContainContentInDirectory(const String& directoryPath, ContentType contentType) const
320 AppLogDebug("ENTER");
321 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
322 if (&directoryPath == null || pContentTypeList == null)
324 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
329 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
331 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
333 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
335 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
338 ContentDirectory contentDirectory;
339 result r = contentDirectory.Construct(*pContentTypeList);
340 if (pContentTypeList != null)
342 delete pContentTypeList;
344 TryReturn(r == E_SUCCESS, false, "[%s] Unable to construct ContentDirectory", GetErrorMessage(r));
346 bool returnValue = false;
347 int pageNo = SIZE_PAGE_NO;
348 int countPerPage = SIZE_CONUNT_PER_PAGE;
350 IList* pContentList = contentDirectory.GetContentDirectoryItemListN(directoryPath, pageNo, countPerPage,
351 CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING);
353 if (pContentList == null || pContentList->GetCount() <= 0)
362 if (pContentList != null)
366 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
372 FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pName, Bitmap*& pThumbnail)
374 AppLogDebug("ENTER : index(%d)", index);
375 Bitmap* pOriginalBitmap = null;
376 Bitmap* pDestinationBitmap = null;
377 ContentInfo* pContentInfo = null;
379 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
381 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
382 if (pContentInfo == null)
384 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
391 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
395 ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId());
396 if (pThumbnailInfo != null)
398 pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
399 pOriginalBitmap = pThumbnailInfo->GetBitmapN();
402 if ((pThumbnailInfo != null)&&(pThumbnailInfo->GetContentType() == CONTENT_TYPE_VIDEO))
404 if (pOriginalBitmap != null)
406 pDestinationBitmap = CoverVideoOverlayedImageOnThumbnailN(*pOriginalBitmap, *pThumbnailInfo);
407 delete pOriginalBitmap;
412 pDestinationBitmap = pOriginalBitmap;
415 if (pDestinationBitmap != null)
417 Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
418 Rectangle thumbnailRect(RECTANGLE_THUMBNAIL_OFFSET_POSION);
419 pDestinationBitmap->Scale(Dimension(RECTANGLE_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_THUMBNAIL_OFFSET_POSION.x
420 , RECTANGLE_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_THUMBNAIL_OFFSET_POSION.y));
421 if (pThumbnailBgBitmap != null)
423 pThumbnailBgBitmap->Scale(DIMENSION_REAL_ICON);
424 pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pDestinationBitmap, thumbnailRect);
425 delete pThumbnailBgBitmap;
426 delete pDestinationBitmap;
430 pThumbnail = pDestinationBitmap;
438 if (pThumbnailInfo != null)
440 delete pThumbnailInfo;
442 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
448 FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index,
449 String*& pName, Bitmap*& pThumbnail, String*& pDuration) const
451 AppLogDebug("ENTER : index(%d)", index);
452 ContentInfo* pContentInfo = null;
453 Bitmap* pOriginalBitmap = null;
455 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
457 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
458 if (pContentInfo == null)
460 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
466 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
470 ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId());
471 if (pThumbnailInfo != null)
473 pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
474 pOriginalBitmap = pThumbnailInfo->GetBitmapN();
475 pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(pThumbnailInfo->GetDuration()));
479 pName = new (std::nothrow) String(EMPTY_SPACE);
480 pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(0));
483 if (pOriginalBitmap != null)
485 Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
486 Rectangle thumbnailRect(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION);
487 pOriginalBitmap->Scale(Dimension(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.x
488 , RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.y));
489 if (pThumbnailBgBitmap != null)
491 pThumbnailBgBitmap->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL));
492 pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pOriginalBitmap, thumbnailRect);
493 delete pThumbnailBgBitmap;
495 delete pOriginalBitmap;
502 if (pThumbnail != null)
504 pThumbnail->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL));
507 if (pThumbnailInfo != null)
509 delete pThumbnailInfo;
511 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
517 FileListPresentationModel::RequestThumbnail(const int index)
519 AppLogDebug("ENTER : index(%d)", index);
520 ContentInfo* pContentInfo = null;
522 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
524 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
525 if (pContentInfo == null)
527 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
533 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
538 __pThumbnailProvider->RequestThumbnail(pContentInfo->GetContentId(), __pThumbnailEvent);
543 FileListPresentationModel::ClearThumbnailRequests(const bool appTerminating)
545 AppLogDebug("ENTER");
547 if (__pThumbnailProvider != null)
549 __pThumbnailProvider->ClearThumbnailRequests(appTerminating);
556 FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
558 AppLogDebug("ENTER");
560 if (&eventArg != null)
562 ThumbnailEventArg* pThumbnailEventArg = static_cast<ThumbnailEventArg*>(&eventArg);
563 if (pThumbnailEventArg == null)
565 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
569 ThumbnailInfo* pThumbnailInfo = pThumbnailEventArg->GetThumbnailInfoN();
570 if (pThumbnailInfo == null)
572 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
577 bool isMatch = false;
578 ContentId contentId = pThumbnailInfo->GetContentId();
580 if (__pIconListViewCache != null)
582 IEnumerator* pEnum = __pIconListViewCache->GetEnumeratorN();
583 Bitmap* pBitmap = null;
584 while (pEnum->MoveNext() == E_SUCCESS)
586 ThumbnailInfo* pTempThumbnailInfo = static_cast<ThumbnailInfo*>(pEnum->GetCurrent());
588 if (contentId == pTempThumbnailInfo->GetContentId())
590 AppLogDebug("[CHASEFIRE] PM receive (%ls)", pThumbnailInfo->GetFilePath().GetPointer());
591 pBitmap = pThumbnailInfo->GetBitmapN();
592 pTempThumbnailInfo->SetBitmap(*pBitmap);
595 pTempThumbnailInfo->SetContentType(pThumbnailInfo->GetContentType());
596 pTempThumbnailInfo->SetDuration(pThumbnailInfo->GetDuration());
597 delete pThumbnailInfo;
603 if (isMatch == false)
605 if (SIZE_ICON_LIST_CACHE <= __pIconListViewCache->GetCount())
607 __pIconListViewCache->RemoveAt(0, true);
609 AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)", __pIconListViewCache->GetCount(),
610 pThumbnailInfo->GetFilePath().GetPointer());
611 __pIconListViewCache->Add(pThumbnailInfo);
616 int loopCount = __pContentInfoList->GetCount();
617 for (int i = 0; i < loopCount; ++i)
619 if (contentId == (static_cast<ContentInfo*>(__pContentInfoList->GetAt(i)))->GetContentId())
626 IAlbumEventListener* pInterface = null;
627 IEnumerator* pEventEnum = __pPresentationModelListener->GetEnumeratorN();
628 while (pEventEnum->MoveNext() == E_SUCCESS)
630 pInterface = static_cast<IAlbumEventListener*>(pEventEnum->GetCurrent());
631 pInterface->OnThumbnailDecoded(index);
635 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
639 FileListPresentationModel::OnContentCreated(void)
641 AppLogDebug("ENTER");
642 if (__updateProgressStatus == true)
644 AppLogDebug("EXIT update in application");
647 IFormContentUpdateEventListener* pInterface = null;
648 if (__pContentEventListener == null)
653 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
654 while (pEventEnum->MoveNext() == E_SUCCESS)
656 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
657 if (pInterface != null)
659 pInterface->OnContentUpdated();
667 FileListPresentationModel::OnContentUpdated(void)
669 AppLogDebug("ENTER");
670 if (__updateProgressStatus == true)
672 AppLogDebug("EXIT update in application");
675 IFormContentUpdateEventListener* pInterface = null;
676 if (__pContentEventListener == null)
681 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
682 while (pEventEnum->MoveNext() == E_SUCCESS)
684 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
685 pInterface->OnContentUpdated();
692 FileListPresentationModel::OnContentDeleted(void)
694 AppLogDebug("ENTER");
695 if (__updateProgressStatus == true)
697 AppLogDebug("EXIT update in application");
700 IFormContentUpdateEventListener* pInterface = null;
701 if (__pContentEventListener == null)
706 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
707 while (pEventEnum->MoveNext() == E_SUCCESS)
709 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
710 pInterface->OnContentUpdated();
717 FileListPresentationModel::AddPresentationModelListener(const IAlbumEventListener* listener)
719 AppLogDebug("ENTER");
720 __pPresentationModelListener->Add((Object*)listener);
721 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
725 FileListPresentationModel::RemovePresentationModelListener(const IAlbumEventListener& listener)
727 AppLogDebug("ENTER");
728 __pPresentationModelListener->Remove(listener);
729 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
733 FileListPresentationModel::AddContentEventListener(const IFormContentUpdateEventListener* listener)
735 AppLogDebug("ENTER");
736 if (__pContentEventListener != null)
738 __pContentEventListener->RemoveAll();
739 __pContentEventListener->Add((Object*)listener);
740 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
745 FileListPresentationModel::RemoveContentEventListener(const IFormContentUpdateEventListener* listener)
747 AppLogDebug("ENTER");
748 __pContentEventListener->Remove(*listener);
749 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
753 FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId& contentId) const
755 AppLogDebug("ENTER");
756 ThumbnailInfo* pThumbnailInfo = null;
757 ThumbnailInfo* pTempThumbnailInfo = null;
758 if (__pIconListViewCache != null)
760 int loopCount = __pIconListViewCache->GetCount();
761 for (int i = 0; i < loopCount; ++i)
763 pTempThumbnailInfo = static_cast<ThumbnailInfo*>(__pIconListViewCache->GetAt(i));
764 if (contentId == pTempThumbnailInfo->GetContentId())
767 pThumbnailInfo = new (std::nothrow) ThumbnailInfo();
768 Bitmap* pBitmap = pTempThumbnailInfo->GetBitmapN();
769 pThumbnailInfo->Construct(pTempThumbnailInfo->GetContentId(), pTempThumbnailInfo->GetFilePath(),
770 *pBitmap, pTempThumbnailInfo->GetContentType(), pTempThumbnailInfo->GetDuration());
776 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
778 return pThumbnailInfo;
782 FileListPresentationModel::DeleteContentFileList(const IList& contentIndexList)
784 AppLogDebug("ENTER");
785 if (&contentIndexList == null || contentIndexList.GetCount() <= 0)
787 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
792 IList * pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
793 int loopCount = contentIndexList.GetCount();
794 for (int i = 0; i < loopCount; ++i)
796 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
798 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
800 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>
801 (__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
805 loopCount = pContentIdList->GetCount();
806 for (int i = 0; i < loopCount; ++i)
808 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(i));
809 if (pContentId != null)
811 DeleteContentFile(*pContentId);
814 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
820 FileListPresentationModel::GetCollisionIndexListN(const IList& contentIndexList, const String& destDirectory)
822 AppLogDebug("ENTER");
823 if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null
824 || destDirectory.IsEmpty() == true)
826 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
831 if (File::IsFileExist(destDirectory) == false)
833 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
838 IList * pCollisionInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter);
839 ContentInfo* pContentInfo = null;
840 int loopCount = contentIndexList.GetCount();
841 for (int i = 0; i < loopCount; ++i)
843 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
845 if ((pIndex != null) && (pIndex->ToInt()) >= 0 && __pContentInfoList->GetCount() > pIndex->ToInt())
847 pContentInfo = const_cast<ContentInfo*>(static_cast<const ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())));
848 String filePath = pContentInfo->GetContentPath();
849 String fileName = GetFileNameFromFullPath(filePath, true);
852 if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
854 destPath.Append(destDirectory);
855 destPath.Append(fileName);
859 destPath.Append(destDirectory);
860 destPath.Append(DIRECTORY_SEPARATOR);
861 destPath.Append(fileName);
864 if (File::IsFileExist(destPath) == true)
866 pCollisionInfoList->Add(*(new (std::nothrow) String(pIndex->ToString() + MULTI_ITEM_SEPARATOR + fileName)));
870 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
872 return pCollisionInfoList;
876 FileListPresentationModel::MoveToContentFileList(const IList& contentIndexList, const String& destDirectory)
878 AppLogDebug("ENTER");
879 result r = E_SUCCESS;
880 if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null || destDirectory.IsEmpty() == true)
882 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
887 if (File::IsFileExist(destDirectory) == false)
889 Directory::Create(destDirectory, true);
892 delete __pContentIdList;
893 __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
894 int loopCount = contentIndexList.GetCount();
895 for (int i = 0; i < loopCount; ++i)
897 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
899 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
901 __pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
906 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
912 FileListPresentationModel::DeleteContentFile(const ContentId& contentId)
914 AppLogDebug("ENTER");
915 if (&contentId == null)
917 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
921 result r = __pContentManager->DeleteContent(contentId);
923 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
929 FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const String& destDirectory, const bool isCopyOperation)
931 AppLogDebug("ENTER");
932 if (contentId.ToString().IsEmpty() == true || destDirectory.IsEmpty() == true)
934 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
937 result r = E_SUCCESS;
938 ContentInfo* pContentInfo = __pContentManager->GetContentInfoN(contentId);
939 if (pContentInfo == null)
941 AppLogDebug("Santhosh %s", destDirectory.GetPointer());
942 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
946 String filePath = pContentInfo->GetContentPath();
947 if (filePath.GetLength() < 4)
949 AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
954 if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
956 destPath.Append(destDirectory);
957 destPath.Append(GetFileNameFromFullPath(filePath, true));
961 destPath.Append(destDirectory);
962 destPath.Append(DIRECTORY_SEPARATOR);
963 destPath.Append(GetFileNameFromFullPath(filePath, true));
966 if (destPath.CompareTo(filePath) == 0)
968 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
972 if (File::IsFileExist(destPath) == true)
974 File::Remove(destPath);
977 if (pContentInfo->GetContentType() == CONTENT_TYPE_IMAGE)
979 r = File::Copy(filePath, destPath, false);
984 ImageContentInfo contentInfo;
985 r = contentInfo.Construct(&destPath);
988 __pContentManager->CreateContent(contentInfo);
990 TryCatch(!IsFailed(r),,"CreateContent::the value is %s", GetErrorMessage(r));
991 if (!isCopyOperation)
993 r = __pContentManager->DeleteContent(contentId);
994 TryCatch(!IsFailed(r),,"DeleteContent::the value is %s", GetErrorMessage(r));
1000 else if (pContentInfo->GetContentType() == CONTENT_TYPE_VIDEO)
1002 r = File::Copy(filePath, destPath, false);
1005 VideoContentInfo contentInfo;
1006 r = contentInfo.Construct(&destPath);
1008 __pContentManager->CreateContent(contentInfo);
1009 r = GetLastResult();
1010 TryCatch(!IsFailed(r),,"CreateContent::the value is %s", GetErrorMessage(r));
1011 if (!isCopyOperation)
1013 r = __pContentManager->DeleteContent(contentId);
1014 TryCatch(!IsFailed(r),,"DeleteContent::the value is %s", GetErrorMessage(r));
1020 delete pContentInfo;
1022 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1028 FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId,
1029 const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList,
1030 IAppControlResponseListener* pListener)
1032 AppLogDebug("ENTER");
1033 AppControl* pAc = AppManager::FindAppControlN(providerId, operationId);
1036 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1039 result r = pAc->Start(pUriData, pMimeType, pDataList, pListener);
1043 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
1044 pGalleryApp->SetFrameEnabled(false);
1049 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1055 FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IList& directoryList)
1057 AppLogDebug("ENTER");
1059 if (&directoryList != null)
1061 if (__pDirectoryList != null && __pDirectoryList->GetCount() > 0)
1063 bool isMatched = false;
1064 int outterLoopCount = __pDirectoryList->GetCount();
1065 int innerLoopCount = 0;
1066 for (int i = 0; i < outterLoopCount ; ++i)
1069 innerLoopCount = directoryList.GetCount();
1070 for (int j = 0; j < innerLoopCount; ++j)
1072 if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(
1073 *(const_cast<String*>(static_cast<const String*>(directoryList.GetAt(j))))) == 0)
1081 outterLoopCount = directoryList.GetCount();
1082 for (int i = 0; i < outterLoopCount; ++i)
1085 innerLoopCount = __pDirectoryList->GetCount();
1086 for (int j = 0; j < innerLoopCount; ++j)
1088 if (const_cast<String*>(static_cast<const String*>(directoryList.GetAt(i)))->CompareTo(
1089 *(static_cast<String*>(__pDirectoryList->GetAt(j)))) == 0)
1099 __albumName = albumName;
1101 if (__pDirectoryList != null)
1103 delete __pDirectoryList;
1105 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1107 int loopCount = directoryList.GetCount();
1108 for (int i = 0; i < loopCount; ++i)
1110 __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>
1111 (static_cast<const String*>(directoryList.GetAt(i))))));
1114 if (__pContentInfoList != null)
1116 delete __pContentInfoList;
1117 __pContentInfoList = null;
1120 if (GetAppControlMode() == APPCONTROL_MODE_PICK)
1122 AppControlMediaType appControlMediaType = GetAppControlMediaType();
1123 if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE)
1125 __albumContentType = CONTENT_TYPE_IMAGE;
1127 else if (appControlMediaType == APPCONTROL_MEDIA_TYPE_VIDEO)
1129 __albumContentType = CONTENT_TYPE_VIDEO;
1132 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1133 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1139 FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
1141 AppLogDebug("ENTER");
1142 result r = RefreshContentInfoList(contentType);
1143 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1149 FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
1151 AppLogDebug("ENTER");
1152 if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO))
1154 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1159 if ((__pDirectoryList == null) || (__pDirectoryList->GetCount() <= 0))
1161 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1166 __albumContentType = contentType;
1168 if (__pContentInfoList != null)
1170 delete __pContentInfoList;
1171 __pContentInfoList = null;
1173 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1174 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1180 FileListPresentationModel::GetCurrentAlbumName(void) const
1182 AppLogDebug("ENTER");
1183 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1189 FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
1191 AppLogDebug("ENTER");
1192 if (&albumName == null)
1194 __albumName = EMPTY_SPACE;
1198 __albumName = albumName;
1200 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1204 FileListPresentationModel::GetCurrentAlbumContentType(void) const
1206 AppLogDebug("ENTER");
1207 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1209 return __albumContentType;
1213 FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
1215 AppLogDebug("ENTER");
1216 __albumContentType = contentType;
1217 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1221 FileListPresentationModel::GetAlbumDirectoryListN(void) const
1223 AppLogDebug("ENTER");
1224 IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1225 if (__pDirectoryList == null)
1227 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1229 return pAlbumDirectoryList;
1232 String* pDirectory = null;
1233 int loopCount = __pDirectoryList->GetCount();
1234 for (int i = 0; i < loopCount; ++i)
1236 pDirectory = static_cast<String*>(__pDirectoryList->GetAt(i));
1237 pAlbumDirectoryList->Add(new (std::nothrow) String(*pDirectory));
1239 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1241 return pAlbumDirectoryList;
1245 FileListPresentationModel::GetAlbumContentInfoList(void) const
1247 AppLogDebug("ENTER");
1248 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1249 if (__pContentInfoList == null)
1251 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1253 return pContentList;
1256 ContentInfo* pContentInfo = null;
1257 int loopCount = __pContentInfoList->GetCount();
1258 for (int i = 0; i < loopCount; ++i)
1260 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(i));
1261 pContentList->Add(pContentInfo);
1263 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1265 return pContentList;
1269 FileListPresentationModel::GetContentInfo(const int index) const
1271 AppLogDebug("ENTER");
1272 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1274 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1279 if (index < 0 || index >= __pContentInfoList->GetCount())
1281 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1285 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1286 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1288 return pContentInfo;
1291 IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
1293 IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1294 int loopCount = indexList.GetCount();
1295 for (int i = 0; i < loopCount; ++i)
1297 const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
1299 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
1301 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
1305 return pContentIdList;
1309 FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
1311 AppLogDebug("ENTER");
1312 if (__pContentInfoList == null)
1314 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1318 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1320 return __pContentInfoList->GetCount();
1324 FileListPresentationModel::GetContentInfoIndex(const int index) const
1326 AppLogDebug("ENTER");
1327 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1329 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1334 if (index < 0 || index >= __pContentInfoList->GetCount())
1336 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1340 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1341 ContentId contentId = pContentInfo->GetContentId();
1342 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1348 FileListPresentationModel::GetContentFilePath(const int index) const
1350 AppLogDebug("ENTER index(%d)", index);
1351 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1353 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1358 if (index < 0 || index >= __pContentInfoList->GetCount())
1360 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1365 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1366 String contentPath = pContentInfo->GetContentPath();
1367 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1373 FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail,
1374 const ThumbnailInfo& thumbmailInfo)
1376 AppLogDebug("ENTER");
1377 Bitmap* pOverlayedImage = null;
1379 if (&thumbmailInfo != null)
1381 long duration = thumbmailInfo.GetDuration();
1384 if (&thumbnail != null)
1386 BufferInfo bufferInfo;
1387 thumbnail.Lock(bufferInfo, INFINITE);
1389 mainCanvas.Construct(bufferInfo);
1393 Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL);
1394 mainCanvas.Construct(mainRect);
1395 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), mainRect);
1398 Rectangle playRect(GAP_W_PLAY_FG, GAP_H_PLAY_FG, W_PLAY_FG, H_PLAY_FG);
1399 Bitmap* playBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_PLAY);
1400 if (playBitmap != null)
1402 mainCanvas.DrawBitmap(playRect, *playBitmap);
1407 Rectangle durSize(0, 0, W_DURATION, H_DURATION);
1408 Rectangle durRect(0, GAP_H_DURATION, W_DURATION, H_DURATION);
1409 Color durColor(COLOR_DURATION_BG);
1410 durColor.SetAlpha(ALPHA_DURATION);
1411 durCanvas.Construct(durSize);
1412 durCanvas.FillRectangle(durColor, durSize);
1414 durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION);
1415 durCanvas.SetFont(durFont);
1416 durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT),
1417 CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
1419 durBitmap.Construct(durCanvas, durCanvas.GetBounds());
1420 mainCanvas.DrawBitmap(durRect, durBitmap);
1422 pOverlayedImage = new (std::nothrow) Bitmap();
1423 pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds());
1425 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1427 return pOverlayedImage;
1431 FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
1432 const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const
1434 AppLogDebug("ENTER");
1435 if (&originalBitmap == null || &originalBitmap == null)
1437 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1442 BufferInfo bufferInfo;
1443 bgBitmap.Lock(bufferInfo, INFINITE);
1446 mainCanvas.Construct(bufferInfo);
1448 mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap);
1450 Bitmap* pMainImage = new (std::nothrow) Bitmap();
1451 pMainImage->Construct(mainCanvas,mainCanvas.GetBounds());
1452 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1458 FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList,
1459 ContentType contentType)const
1461 AppLogDebug("ENTER");
1462 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1464 if ((&contentDirectoryList == null) || (contentDirectoryList.GetCount() == 0)
1465 || ((contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO) && (contentType != CONTENT_TYPE_ALL)))
1467 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1468 return pContentList;
1471 ContentDirectory contentDirectory;
1472 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
1473 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
1475 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
1477 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
1479 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
1481 result r = contentDirectory.Construct(*pContentTypeList);
1482 delete pContentTypeList;
1486 int pageNo = SIZE_PAGE_NO;
1487 int countPerPage = SIZE_CONUNT_PER_PAGE;
1488 String* pContentDirectory = null;
1490 int loopCount = contentDirectoryList.GetCount();
1491 for (int i = 0; i < loopCount; ++i)
1493 IList* pIList = null;
1494 pContentDirectory = const_cast<String*>(static_cast<const String*>(contentDirectoryList.GetAt(i)));
1495 if (pContentDirectory != null)
1497 pIList = contentDirectory.GetContentDirectoryItemListN(*pContentDirectory, pageNo, countPerPage,
1498 CONTENT_INFO_ORDER, SORT_ORDER_NONE);
1502 pContentList->AddItems(*pIList);
1507 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1509 return pContentList;
1513 FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
1515 AppLogDebug("ENTER");
1517 if (&targetPath == null || targetPath.GetLength() == 0)
1522 if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT)
1524 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
1526 else if (targetPath == RESERVED_DOWNLOAD_PATH)
1528 albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS");
1532 String directoryName = GetDirecotyNameFromFullPath(targetPath);
1533 albumName = directoryName;
1540 FileListPresentationModel::GetAppControlMode(void) const
1542 AppLogDebug("Enter");
1543 AppLogDebug("Exit");
1545 return __appControlMode;
1549 FileListPresentationModel::GetAppControlMediaType(void) const
1551 AppLogDebug("Enter");
1552 AppLogDebug("Exit");
1554 return __appControlMediaType;
1557 AppControlSelectionMode
1558 FileListPresentationModel::GetAppControlSelectionMode(void) const
1560 AppLogDebug("Enter");
1561 AppLogDebug("Exit");
1563 return __appControlSelectionMode;
1567 FileListPresentationModel::SetUpdateProgressStatus(const bool status)
1569 AppLogDebug("ENTER status = %d",status);
1570 __updateProgressStatus = status;
1571 AppLogDebug("EXIT");
1575 FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
1577 result r = E_SUCCESS;
1578 ImageBuffer rotateBuffer;
1579 ImageBuffer* pRotatedBuffer = null;
1580 ImageFormat imageFormat;
1582 String filePath = GetContentFilePath(index);
1583 r = img.Construct();
1588 imageFormat = img.GetImageFormat(filePath);
1591 r = rotateBuffer.Construct(filePath);
1594 if (rotateMode == ROTATE_MODE_RIGHT)
1596 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
1600 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
1604 if (pRotatedBuffer != null)
1606 r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
1607 delete pRotatedBuffer;
1610 ContentManager::ScanFile(filePath);
1615 FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
1617 AppLogDebug("ENTER");
1618 if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
1620 IFormContentUpdateEventListener* pInterface = null;
1621 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
1622 while (pEventEnum->MoveNext() == E_SUCCESS)
1624 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
1625 pInterface->OnContentUpdated();
1629 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));