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);
1034 __providerId.Clear();
\r
1035 __providerId.Append(providerId);
\r
1039 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1042 result r = pAc->Start(pUriData, pMimeType, pDataList, pListener);
1046 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
1047 pGalleryApp->SetFrameEnabled(false);
1052 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1058 FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IList& directoryList)
1060 AppLogDebug("ENTER");
1062 if (&directoryList != null)
1064 if (__pDirectoryList != null && __pDirectoryList->GetCount() > 0)
1066 bool isMatched = false;
1067 int outterLoopCount = __pDirectoryList->GetCount();
1068 int innerLoopCount = 0;
1069 for (int i = 0; i < outterLoopCount ; ++i)
1072 innerLoopCount = directoryList.GetCount();
1073 for (int j = 0; j < innerLoopCount; ++j)
1075 if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(
1076 *(const_cast<String*>(static_cast<const String*>(directoryList.GetAt(j))))) == 0)
1084 outterLoopCount = directoryList.GetCount();
1085 for (int i = 0; i < outterLoopCount; ++i)
1088 innerLoopCount = __pDirectoryList->GetCount();
1089 for (int j = 0; j < innerLoopCount; ++j)
1091 if (const_cast<String*>(static_cast<const String*>(directoryList.GetAt(i)))->CompareTo(
1092 *(static_cast<String*>(__pDirectoryList->GetAt(j)))) == 0)
1102 __albumName = albumName;
1103 __providerId.Clear();
\r
1105 if (__pDirectoryList != null)
1107 delete __pDirectoryList;
1109 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1111 int loopCount = directoryList.GetCount();
1112 for (int i = 0; i < loopCount; ++i)
1114 __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>
1115 (static_cast<const String*>(directoryList.GetAt(i))))));
1118 if (__pContentInfoList != null)
1120 delete __pContentInfoList;
1121 __pContentInfoList = null;
1124 if (GetAppControlMode() == APPCONTROL_MODE_PICK)
1126 AppControlMediaType appControlMediaType = GetAppControlMediaType();
1127 if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE)
1129 __albumContentType = CONTENT_TYPE_IMAGE;
1131 else if (appControlMediaType == APPCONTROL_MEDIA_TYPE_VIDEO)
1133 __albumContentType = CONTENT_TYPE_VIDEO;
1136 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1137 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1143 FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
1145 AppLogDebug("ENTER");
1146 result r = RefreshContentInfoList(contentType);
1147 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1153 FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
1155 AppLogDebug("ENTER");
1156 if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO))
1158 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1163 if ((__pDirectoryList == null) || (__pDirectoryList->GetCount() <= 0))
1165 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1170 __albumContentType = contentType;
1172 if (__pContentInfoList != null)
1174 delete __pContentInfoList;
1175 __pContentInfoList = null;
1177 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1178 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1184 FileListPresentationModel::GetCurrentAlbumName(void) const
1186 AppLogDebug("ENTER");
1187 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1193 FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
1195 AppLogDebug("ENTER");
1196 if (&albumName == null)
1198 __albumName = EMPTY_SPACE;
1202 __albumName = albumName;
1204 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1208 FileListPresentationModel::GetCurrentAlbumContentType(void) const
1210 AppLogDebug("ENTER");
1211 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1213 return __albumContentType;
1217 FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
1219 AppLogDebug("ENTER");
1220 __albumContentType = contentType;
1221 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1225 FileListPresentationModel::GetAlbumDirectoryListN(void) const
1227 AppLogDebug("ENTER");
1228 IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1229 if (__pDirectoryList == null)
1231 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1233 return pAlbumDirectoryList;
1236 String* pDirectory = null;
1237 int loopCount = __pDirectoryList->GetCount();
1238 for (int i = 0; i < loopCount; ++i)
1240 pDirectory = static_cast<String*>(__pDirectoryList->GetAt(i));
1241 pAlbumDirectoryList->Add(new (std::nothrow) String(*pDirectory));
1243 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1245 return pAlbumDirectoryList;
1249 FileListPresentationModel::GetAlbumContentInfoList(void) const
1251 AppLogDebug("ENTER");
1252 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1253 if (__pContentInfoList == null)
1255 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1257 return pContentList;
1260 ContentInfo* pContentInfo = null;
1261 int loopCount = __pContentInfoList->GetCount();
1262 for (int i = 0; i < loopCount; ++i)
1264 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(i));
1265 pContentList->Add(pContentInfo);
1267 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1269 return pContentList;
1273 FileListPresentationModel::GetContentInfo(const int index) const
1275 AppLogDebug("ENTER");
1276 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1278 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1283 if (index < 0 || index >= __pContentInfoList->GetCount())
1285 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1289 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1290 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1292 return pContentInfo;
1295 IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
1297 IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1298 int loopCount = indexList.GetCount();
1299 for (int i = 0; i < loopCount; ++i)
1301 const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
1303 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
1305 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
1309 return pContentIdList;
1313 FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
1315 AppLogDebug("ENTER");
1316 if (__pContentInfoList == null)
1318 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1322 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1324 return __pContentInfoList->GetCount();
1328 FileListPresentationModel::GetContentInfoIndex(const int index) const
1330 AppLogDebug("ENTER");
1331 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1333 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1338 if (index < 0 || index >= __pContentInfoList->GetCount())
1340 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1344 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1345 ContentId contentId = pContentInfo->GetContentId();
1346 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1352 FileListPresentationModel::GetContentFilePath(const int index) const
1354 AppLogDebug("ENTER index(%d)", index);
1355 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1357 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1362 if (index < 0 || index >= __pContentInfoList->GetCount())
1364 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1369 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1370 String contentPath = pContentInfo->GetContentPath();
1371 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1377 FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail,
1378 const ThumbnailInfo& thumbmailInfo)
1380 AppLogDebug("ENTER");
1381 Bitmap* pOverlayedImage = null;
1383 if (&thumbmailInfo != null)
1385 long duration = thumbmailInfo.GetDuration();
1388 if (&thumbnail != null)
1390 BufferInfo bufferInfo;
1391 thumbnail.Lock(bufferInfo, INFINITE);
1393 mainCanvas.Construct(bufferInfo);
1397 Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL);
1398 mainCanvas.Construct(mainRect);
1399 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), mainRect);
1402 Rectangle playRect(GAP_W_PLAY_FG, GAP_H_PLAY_FG, W_PLAY_FG, H_PLAY_FG);
1403 Bitmap* playBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_PLAY);
1404 if (playBitmap != null)
1406 mainCanvas.DrawBitmap(playRect, *playBitmap);
1411 Rectangle durSize(0, 0, W_DURATION, H_DURATION);
1412 Rectangle durRect(0, GAP_H_DURATION, W_DURATION, H_DURATION);
1413 Color durColor(COLOR_DURATION_BG);
1414 durColor.SetAlpha(ALPHA_DURATION);
1415 durCanvas.Construct(durSize);
1416 durCanvas.FillRectangle(durColor, durSize);
1418 durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION);
1419 durCanvas.SetFont(durFont);
1420 durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT),
1421 CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
1423 durBitmap.Construct(durCanvas, durCanvas.GetBounds());
1424 mainCanvas.DrawBitmap(durRect, durBitmap);
1426 pOverlayedImage = new (std::nothrow) Bitmap();
1427 pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds());
1429 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1431 return pOverlayedImage;
1435 FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
1436 const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const
1438 AppLogDebug("ENTER");
1439 if (&originalBitmap == null || &originalBitmap == null)
1441 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1446 BufferInfo bufferInfo;
1447 bgBitmap.Lock(bufferInfo, INFINITE);
1450 mainCanvas.Construct(bufferInfo);
1452 mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap);
1454 Bitmap* pMainImage = new (std::nothrow) Bitmap();
1455 pMainImage->Construct(mainCanvas,mainCanvas.GetBounds());
1456 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1462 FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList,
1463 ContentType contentType)const
1465 AppLogDebug("ENTER");
1466 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1468 if ((&contentDirectoryList == null) || (contentDirectoryList.GetCount() == 0)
1469 || ((contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO) && (contentType != CONTENT_TYPE_ALL)))
1471 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1472 return pContentList;
1475 ContentDirectory contentDirectory;
1476 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
1477 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
1479 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
1481 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
1483 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
1485 result r = contentDirectory.Construct(*pContentTypeList);
1486 delete pContentTypeList;
1490 int pageNo = SIZE_PAGE_NO;
1491 int countPerPage = SIZE_CONUNT_PER_PAGE;
1492 String* pContentDirectory = null;
1494 int loopCount = contentDirectoryList.GetCount();
1495 for (int i = 0; i < loopCount; ++i)
1497 IList* pIList = null;
1498 pContentDirectory = const_cast<String*>(static_cast<const String*>(contentDirectoryList.GetAt(i)));
1499 if (pContentDirectory != null)
1501 pIList = contentDirectory.GetContentDirectoryItemListN(*pContentDirectory, pageNo, countPerPage,
1502 CONTENT_INFO_ORDER, SORT_ORDER_NONE);
1506 pContentList->AddItems(*pIList);
1511 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1513 return pContentList;
1517 FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
1519 AppLogDebug("ENTER");
1521 if (&targetPath == null || targetPath.GetLength() == 0)
1526 if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT)
1528 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
1530 else if (targetPath == RESERVED_DOWNLOAD_PATH)
1532 albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS");
1536 String directoryName = GetDirecotyNameFromFullPath(targetPath);
1537 albumName = directoryName;
1544 FileListPresentationModel::GetAppControlMode(void) const
1546 AppLogDebug("Enter");
1547 AppLogDebug("Exit");
1549 return __appControlMode;
1553 FileListPresentationModel::GetAppControlMediaType(void) const
1555 AppLogDebug("Enter");
1556 AppLogDebug("Exit");
1558 return __appControlMediaType;
1561 AppControlSelectionMode
1562 FileListPresentationModel::GetAppControlSelectionMode(void) const
1564 AppLogDebug("Enter");
1565 AppLogDebug("Exit");
1567 return __appControlSelectionMode;
1571 FileListPresentationModel::SetUpdateProgressStatus(const bool status)
1573 AppLogDebug("ENTER status = %d",status);
1574 __updateProgressStatus = status;
1575 AppLogDebug("EXIT");
1579 FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
1581 result r = E_SUCCESS;
1582 ImageBuffer rotateBuffer;
1583 ImageBuffer* pRotatedBuffer = null;
1584 ImageFormat imageFormat;
1586 String filePath = GetContentFilePath(index);
1587 r = img.Construct();
1592 imageFormat = img.GetImageFormat(filePath);
1595 r = rotateBuffer.Construct(filePath);
1598 if (rotateMode == ROTATE_MODE_RIGHT)
1600 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
1604 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
1608 if (pRotatedBuffer != null)
1610 r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
1611 delete pRotatedBuffer;
1614 ContentManager::ScanFile(filePath);
1619 FileListPresentationModel::ClearImageCache(void)
\r
1621 AppLogDebug("FileListPresentationModel::ClearImageCache ++");
\r
1623 if(__pIconListViewCache != null && __providerId.Equals(APPCONTROL_PROVIDER_ID_IMAGE, false) == true)
\r
1625 bool clearThumbnailReq = true;
\r
1626 while(__pIconListViewCache->GetCount() != 0)
\r
1628 //This is to Clear the Thumbnail Reuqests only Once
\r
1629 if(clearThumbnailReq == true)
\r
1631 ClearThumbnailRequests();
\r
1632 clearThumbnailReq = false;
\r
1634 __pIconListViewCache->RemoveAt(0, true);
\r
1637 AppLogDebug("FileListPresentationModel::ClearImageCache --");
\r
1641 FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
1643 AppLogDebug("ENTER");
1644 if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
1646 IFormContentUpdateEventListener* pInterface = null;
1647 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
1648 while (pEventEnum->MoveNext() == E_SUCCESS)
1650 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
1651 pInterface->OnContentUpdated();
1655 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));