2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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 DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
101 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
104 FileListPresentationModel*
105 FileListPresentationModel::GetInstance(void)
107 AppLogDebug("ENTER");
108 if (__pPresentationModelInstance == null)
112 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
114 return __pPresentationModelInstance;
118 FileListPresentationModel::Construct(void)
120 AppLogDebug("ENTER");
122 IThumbnailEventListener* pThumbnailEventListener = static_cast<IThumbnailEventListener*>(this);
123 __pThumbnailEvent = new (std::nothrow) ThumbnailEvent();
124 __pThumbnailEvent->AddListener(*pThumbnailEventListener, true);
126 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
128 ContentUpdateEventListener::GetInstance();
129 __pContentManager = new (std::nothrow) ContentManager();
130 __pContentManager->Construct();
132 if (__pIconListViewCache != null)
134 delete __pIconListViewCache;
136 __pIconListViewCache = new (std::nothrow) ArrayList(SingleObjectDeleter);
137 __pIconListViewCache->Construct(SIZE_ICON_LIST_CACHE);
139 if (__pDirectoryList != null)
141 delete __pDirectoryList;
143 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
145 if (__pContentInfoList != null)
147 delete __pContentInfoList;
149 __pContentInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter);
151 __pPresentationModelListener = new (std::nothrow) ArrayList();
152 __pPresentationModelListener->Construct();
154 __pContentEventListener = new (std::nothrow) ArrayList();
155 __pContentEventListener->Construct();
157 __pThumbnailProvider = ThumbnailProvider::GetInstance();
159 GalleryApp* pApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
160 const IMap* pArguments = pApp->GetAppControlArguments();
161 String operationId = pApp->GetAppControlOperationId();
163 if (operationId.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0)
165 __appControlMode = APPCONTROL_MODE_MAIN;
167 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0)
169 __appControlMode = APPCONTROL_MODE_PICK;
171 String mimeType = pApp->GetMimeType();
172 if (mimeType.IsEmpty() != true)
174 if (mimeType.StartsWith(APPCONTROL_DATA_VIDEO, 0) == true)
176 __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO;
179 if (pArguments != null)
181 const String* selectionMode = static_cast<const String*>(pArguments->GetValue(String(APPCONTROL_KEY_SELECTION_MODE)));
183 if (pApp->GetMimeType().StartsWith(APPCONTROL_DATA_VIDEO, 0) == true)
185 __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO;
188 if (selectionMode != null && selectionMode->CompareTo(APPCONTROL_DATA_MULTIPLE) == 0)
190 __appControlSelectionMode = APPCONTROL_SELECTION_MODE_MULTIPLE;
194 else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0)
196 __appControlMode = APPCONTROL_MODE_SETTING;
199 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
205 FileListPresentationModel::CreateInstance(void)
207 AppLogDebug("ENTER");
208 __pPresentationModelInstance = new (std::nothrow) FileListPresentationModel();
209 result r = __pPresentationModelInstance->Construct();
210 if (IsFailed(r) == true)
212 delete __pPresentationModelInstance;
213 __pPresentationModelInstance = null;
214 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
219 std::atexit(DestroyInstance);
220 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
224 FileListPresentationModel::DestroyInstance(void)
226 AppLogDebug("ENTER");
228 delete __pThumbnailEvent;
229 __pIconListViewCache = null;
231 if (__pIconListViewCache != null)
233 delete __pIconListViewCache;
234 __pIconListViewCache = null;
237 if (__pDirectoryList != null)
239 delete __pDirectoryList;
240 __pDirectoryList = null;
243 if (__pContentInfoList != null)
245 delete __pContentInfoList;
246 __pContentInfoList = null;
249 if (__pPresentationModelListener != null)
251 delete __pPresentationModelListener;
252 __pPresentationModelListener = null;
255 if (__pContentEventListener != null)
257 delete __pContentEventListener;
258 __pContentEventListener = null;
261 delete __pPresentationModelInstance;
262 __pPresentationModelInstance = null;
264 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
268 FileListPresentationModel::GetFileNameFromFullPath(const String& fullPath, const bool withExt) const
270 AppLogDebug("ENTER");
271 if (fullPath.CompareTo(EMPTY_SPACE) == 0)
273 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
278 String delim(DIRECTORY_SEPARATOR);
279 StringTokenizer st(fullPath,delim);
281 while (st.HasMoreTokens())
283 st.GetNextToken(token);
288 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
294 String subDelim(FILE_EXT_SEPARATOR);
295 StringTokenizer subSt(token, subDelim);
297 subSt.GetNextToken(subToken);
298 AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
305 FileListPresentationModel::GetDirecotyNameFromFullPath(const String& fullPath)const
307 AppLogDebug("ENTER");
308 if (fullPath == null)
310 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
314 String delim(DIRECTORY_SEPARATOR);
315 StringTokenizer st(fullPath,delim);
317 while (st.HasMoreTokens())
319 st.GetNextToken(token);
321 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
327 FileListPresentationModel::IsContainContentInDirectory(const String& directoryPath, ContentType contentType) const
329 AppLogDebug("ENTER");
330 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
331 if (&directoryPath == null || pContentTypeList == null)
333 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
338 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
340 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
342 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
344 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
347 ContentDirectory contentDirectory;
348 result r = contentDirectory.Construct(*pContentTypeList);
349 if (pContentTypeList != null)
351 delete pContentTypeList;
353 TryReturn(r == E_SUCCESS, false, "[%s] Unable to construct ContentDirectory", GetErrorMessage(r));
355 bool returnValue = false;
356 int pageNo = SIZE_PAGE_NO;
357 int countPerPage = SIZE_CONUNT_PER_PAGE;
359 IList* pContentList = contentDirectory.GetContentDirectoryItemListN(directoryPath, pageNo, countPerPage,
360 CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING);
362 if (pContentList == null || pContentList->GetCount() <= 0)
371 if (pContentList != null)
375 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
381 FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pName, Bitmap*& pThumbnail)
383 AppLogDebug("ENTER : index(%d)", index);
384 Bitmap* pOriginalBitmap = null;
385 Bitmap* pDestinationBitmap = null;
386 ContentInfo* pContentInfo = null;
388 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
390 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
391 if (pContentInfo == null)
393 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
400 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
404 ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId());
405 if (pThumbnailInfo != null)
407 pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
408 pOriginalBitmap = pThumbnailInfo->GetBitmapN();
411 if ((pThumbnailInfo != null)&&(pThumbnailInfo->GetContentType() == CONTENT_TYPE_VIDEO))
413 if (pOriginalBitmap != null)
415 pDestinationBitmap = CoverVideoOverlayedImageOnThumbnailN(*pOriginalBitmap, *pThumbnailInfo);
416 delete pOriginalBitmap;
421 pDestinationBitmap = pOriginalBitmap;
424 if (pDestinationBitmap != null)
426 Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
427 Rectangle thumbnailRect(RECTANGLE_THUMBNAIL_OFFSET_POSION);
428 pDestinationBitmap->Scale(Dimension(RECTANGLE_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_THUMBNAIL_OFFSET_POSION.x
429 , RECTANGLE_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_THUMBNAIL_OFFSET_POSION.y));
430 if (pThumbnailBgBitmap != null)
432 pThumbnailBgBitmap->Scale(DIMENSION_REAL_ICON);
433 pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pDestinationBitmap, thumbnailRect);
434 delete pThumbnailBgBitmap;
435 delete pDestinationBitmap;
439 pThumbnail = pDestinationBitmap;
447 if (pThumbnailInfo != null)
449 delete pThumbnailInfo;
451 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
457 FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index,
458 String*& pName, Bitmap*& pThumbnail, String*& pDuration) const
460 AppLogDebug("ENTER : index(%d)", index);
461 ContentInfo* pContentInfo = null;
462 Bitmap* pOriginalBitmap = null;
464 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
466 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
467 if (pContentInfo == null)
469 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
475 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
479 ThumbnailInfo* pThumbnailInfo = GetThumbnailInfoFromInternalBufferN(pContentInfo->GetContentId());
480 if (pThumbnailInfo != null)
482 pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
483 pOriginalBitmap = pThumbnailInfo->GetBitmapN();
484 pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(pThumbnailInfo->GetDuration()));
488 pName = new (std::nothrow) String(EMPTY_SPACE);
489 pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(0));
492 if (pOriginalBitmap != null)
494 Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
495 Rectangle thumbnailRect(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION);
496 pOriginalBitmap->Scale(Dimension(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.x
497 , RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.y));
498 if (pThumbnailBgBitmap != null)
500 pThumbnailBgBitmap->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL));
501 pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pOriginalBitmap, thumbnailRect);
502 delete pThumbnailBgBitmap;
504 delete pOriginalBitmap;
511 if (pThumbnail != null)
513 pThumbnail->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL));
516 if (pThumbnailInfo != null)
518 delete pThumbnailInfo;
520 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
526 FileListPresentationModel::RequestThumbnail(const int index)
528 AppLogDebug("ENTER : index(%d)", index);
529 ContentInfo* pContentInfo = null;
531 if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
533 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
534 if (pContentInfo == null)
536 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
542 AppLogDebug("EXIT 2 __pContentInfoList(%x) index(%d)", __pContentInfoList, index);
547 __pThumbnailProvider->RequestThumbnail(pContentInfo->GetContentId(), __pThumbnailEvent);
552 FileListPresentationModel::ClearThumbnailRequests(const bool appTerminating)
554 AppLogDebug("ENTER");
556 if (__pThumbnailProvider != null)
558 __pThumbnailProvider->ClearThumbnailRequests(appTerminating);
565 FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
567 AppLogDebug("ENTER");
569 if (&eventArg != null)
571 ThumbnailEventArg* pThumbnailEventArg = static_cast<ThumbnailEventArg*>(&eventArg);
572 if (pThumbnailEventArg == null)
574 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
578 ThumbnailInfo* pThumbnailInfo = pThumbnailEventArg->GetThumbnailInfoN();
579 if (pThumbnailInfo == null)
581 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
586 bool isMatch = false;
587 ContentId contentId = pThumbnailInfo->GetContentId();
589 if (__pIconListViewCache != null)
591 IEnumerator* pEnum = __pIconListViewCache->GetEnumeratorN();
592 Bitmap* pBitmap = null;
593 while (pEnum->MoveNext() == E_SUCCESS)
595 ThumbnailInfo* pTempThumbnailInfo = static_cast<ThumbnailInfo*>(pEnum->GetCurrent());
597 if (contentId == pTempThumbnailInfo->GetContentId())
599 AppLogDebug("[CHASEFIRE] PM receive (%ls)", pThumbnailInfo->GetFilePath().GetPointer());
600 pBitmap = pThumbnailInfo->GetBitmapN();
601 pTempThumbnailInfo->SetBitmap(*pBitmap);
604 pTempThumbnailInfo->SetContentType(pThumbnailInfo->GetContentType());
605 pTempThumbnailInfo->SetDuration(pThumbnailInfo->GetDuration());
606 delete pThumbnailInfo;
612 if (isMatch == false)
614 if (SIZE_ICON_LIST_CACHE <= __pIconListViewCache->GetCount())
616 __pIconListViewCache->RemoveAt(0, true);
618 AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)", __pIconListViewCache->GetCount(),
619 pThumbnailInfo->GetFilePath().GetPointer());
620 __pIconListViewCache->Add(pThumbnailInfo);
625 int loopCount = __pContentInfoList->GetCount();
626 for (int i = 0; i < loopCount; ++i)
628 if (contentId == (static_cast<ContentInfo*>(__pContentInfoList->GetAt(i)))->GetContentId())
635 IAlbumEventListener* pInterface = null;
636 IEnumerator* pEventEnum = __pPresentationModelListener->GetEnumeratorN();
637 while (pEventEnum->MoveNext() == E_SUCCESS)
639 pInterface = static_cast<IAlbumEventListener*>(pEventEnum->GetCurrent());
640 pInterface->OnThumbnailDecoded(index);
644 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
648 FileListPresentationModel::OnContentCreated(void)
650 AppLogDebug("ENTER");
651 if (__updateProgressStatus == true)
653 AppLogDebug("EXIT update in application");
656 IFormContentUpdateEventListener* pInterface = null;
657 if (__pContentEventListener == null)
662 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
663 while (pEventEnum->MoveNext() == E_SUCCESS)
665 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
666 if (pInterface != null)
668 pInterface->OnContentUpdated();
676 FileListPresentationModel::OnContentUpdated(void)
678 AppLogDebug("ENTER");
679 if (__updateProgressStatus == true)
681 AppLogDebug("EXIT update in application");
684 //Clear the ImageCaches when content is updated like rotate.
687 IFormContentUpdateEventListener* pInterface = null;
688 if (__pContentEventListener == null)
693 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
694 while (pEventEnum->MoveNext() == E_SUCCESS)
696 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
697 pInterface->OnContentUpdated();
704 FileListPresentationModel::OnContentDeleted(void)
706 AppLogDebug("ENTER");
707 if (__updateProgressStatus == true)
709 AppLogDebug("EXIT update in application");
712 IFormContentUpdateEventListener* pInterface = null;
713 if (__pContentEventListener == null)
718 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
719 while (pEventEnum->MoveNext() == E_SUCCESS)
721 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
722 pInterface->OnContentUpdated();
729 FileListPresentationModel::AddPresentationModelListener(const IAlbumEventListener* listener)
731 AppLogDebug("ENTER");
732 __pPresentationModelListener->Add((Object*)listener);
733 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
737 FileListPresentationModel::RemovePresentationModelListener(const IAlbumEventListener& listener)
739 AppLogDebug("ENTER");
740 __pPresentationModelListener->Remove(listener);
741 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
745 FileListPresentationModel::AddContentEventListener(const IFormContentUpdateEventListener* listener)
747 AppLogDebug("ENTER");
748 if (__pContentEventListener != null)
750 __pContentEventListener->RemoveAll();
751 __pContentEventListener->Add((Object*)listener);
752 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
757 FileListPresentationModel::RemoveContentEventListener(const IFormContentUpdateEventListener* listener)
759 AppLogDebug("ENTER");
760 __pContentEventListener->Remove(*listener);
761 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
765 FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId& contentId) const
767 AppLogDebug("ENTER");
768 ThumbnailInfo* pThumbnailInfo = null;
769 ThumbnailInfo* pTempThumbnailInfo = null;
770 if (__pIconListViewCache != null)
772 int loopCount = __pIconListViewCache->GetCount();
773 for (int i = 0; i < loopCount; ++i)
775 pTempThumbnailInfo = static_cast<ThumbnailInfo*>(__pIconListViewCache->GetAt(i));
776 if (contentId == pTempThumbnailInfo->GetContentId())
779 pThumbnailInfo = new (std::nothrow) ThumbnailInfo();
780 Bitmap* pBitmap = pTempThumbnailInfo->GetBitmapN();
781 pThumbnailInfo->Construct(pTempThumbnailInfo->GetContentId(), pTempThumbnailInfo->GetFilePath(),
782 *pBitmap, pTempThumbnailInfo->GetContentType(), pTempThumbnailInfo->GetDuration());
788 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
790 return pThumbnailInfo;
794 FileListPresentationModel::DeleteContentFileList(const IList& contentIndexList)
796 AppLogDebug("ENTER");
797 if (&contentIndexList == null || contentIndexList.GetCount() <= 0)
799 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
804 IList * pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
805 int loopCount = contentIndexList.GetCount();
806 for (int i = 0; i < loopCount; ++i)
808 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
810 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
812 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>
813 (__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
817 loopCount = pContentIdList->GetCount();
818 for (int i = 0; i < loopCount; ++i)
820 ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(i));
821 if (pContentId != null)
823 DeleteContentFile(*pContentId);
826 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
832 FileListPresentationModel::GetCollisionIndexListN(const IList& contentIndexList, const String& destDirectory)
834 AppLogDebug("ENTER");
835 if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null
836 || destDirectory.IsEmpty() == true)
838 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
843 if (File::IsFileExist(destDirectory) == false)
845 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
850 IList * pCollisionInfoList = new (std::nothrow) ArrayList(SingleObjectDeleter);
851 ContentInfo* pContentInfo = null;
852 int loopCount = contentIndexList.GetCount();
853 for (int i = 0; i < loopCount; ++i)
855 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
857 if ((pIndex != null) && (pIndex->ToInt()) >= 0 && __pContentInfoList->GetCount() > pIndex->ToInt())
859 pContentInfo = const_cast<ContentInfo*>(static_cast<const ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())));
860 String filePath = pContentInfo->GetContentPath();
861 String fileName = GetFileNameFromFullPath(filePath, true);
864 if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
866 destPath.Append(destDirectory);
867 destPath.Append(fileName);
871 destPath.Append(destDirectory);
872 destPath.Append(DIRECTORY_SEPARATOR);
873 destPath.Append(fileName);
876 if (File::IsFileExist(destPath) == true)
878 pCollisionInfoList->Add(*(new (std::nothrow) String(pIndex->ToString() + MULTI_ITEM_SEPARATOR + fileName)));
882 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
884 return pCollisionInfoList;
888 FileListPresentationModel::MoveToContentFileList(const IList& contentIndexList, const String& destDirectory)
890 AppLogDebug("ENTER");
891 result r = E_SUCCESS;
892 if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null || destDirectory.IsEmpty() == true)
894 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
899 if (File::IsFileExist(destDirectory) == false)
901 Directory::Create(destDirectory, true);
904 delete __pContentIdList;
905 __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
906 int loopCount = contentIndexList.GetCount();
907 for (int i = 0; i < loopCount; ++i)
909 const Integer* pIndex = static_cast<const Integer*>(contentIndexList.GetAt(i));
911 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
913 __pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
918 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
924 FileListPresentationModel::DeleteContentFile(const ContentId& contentId)
926 AppLogDebug("ENTER");
927 if (&contentId == null)
929 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
933 result r = __pContentManager->DeleteContent(contentId);
935 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
941 FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const String& destDirectory, const bool isCopyOperation)
943 AppLogDebug("ENTER");
944 if (contentId.ToString().IsEmpty() == true || destDirectory.IsEmpty() == true)
946 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
949 result r = E_SUCCESS;
950 ContentInfo* pContentInfo = __pContentManager->GetContentInfoN(contentId);
951 if (pContentInfo == null)
953 AppLogDebug("Santhosh %s", destDirectory.GetPointer());
954 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
958 String filePath = pContentInfo->GetContentPath();
959 if (filePath.GetLength() < 4)
961 AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
966 if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
968 destPath.Append(destDirectory);
969 destPath.Append(GetFileNameFromFullPath(filePath, true));
973 destPath.Append(destDirectory);
974 destPath.Append(DIRECTORY_SEPARATOR);
975 destPath.Append(GetFileNameFromFullPath(filePath, true));
978 if (destPath.CompareTo(filePath) == 0)
980 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
984 if (File::IsFileExist(destPath) == true)
986 File::Remove(destPath);
989 if (pContentInfo->GetContentType() == CONTENT_TYPE_IMAGE)
991 r = File::Copy(filePath, destPath, false);
996 ImageContentInfo contentInfo;
997 r = contentInfo.Construct(&destPath);
1000 __pContentManager->CreateContent(contentInfo);
1001 r = GetLastResult();
1002 TryCatch(!IsFailed(r),,"CreateContent::the value is %s", GetErrorMessage(r));
1003 if (!isCopyOperation)
1005 r = __pContentManager->DeleteContent(contentId);
1006 TryCatch(!IsFailed(r),,"DeleteContent::the value is %s", GetErrorMessage(r));
1012 else if (pContentInfo->GetContentType() == CONTENT_TYPE_VIDEO)
1014 r = File::Copy(filePath, destPath, false);
1017 VideoContentInfo contentInfo;
1018 r = contentInfo.Construct(&destPath);
1020 __pContentManager->CreateContent(contentInfo);
1021 r = GetLastResult();
1022 TryCatch(!IsFailed(r),,"CreateContent::the value is %s", GetErrorMessage(r));
1023 if (!isCopyOperation)
1025 r = __pContentManager->DeleteContent(contentId);
1026 TryCatch(!IsFailed(r),,"DeleteContent::the value is %s", GetErrorMessage(r));
1032 delete pContentInfo;
1034 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1040 FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId,
1041 const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList,
1042 IAppControlResponseListener* pListener)
1044 AppLogDebug("ENTER");
1045 AppControl* pAc = AppManager::FindAppControlN(providerId, operationId);
1046 __providerId.Clear();
1047 __providerId.Append(providerId);
1051 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1054 result r = pAc->Start(pUriData, pMimeType, pDataList, pListener);
1058 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
1059 pGalleryApp->SetFrameEnabled(false);
1064 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1070 FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IList& directoryList)
1072 AppLogDebug("ENTER");
1074 if (&directoryList != null)
1076 if (__pDirectoryList != null && __pDirectoryList->GetCount() > 0)
1078 bool isMatched = false;
1079 int outterLoopCount = __pDirectoryList->GetCount();
1080 int innerLoopCount = 0;
1081 for (int i = 0; i < outterLoopCount ; ++i)
1084 innerLoopCount = directoryList.GetCount();
1085 for (int j = 0; j < innerLoopCount; ++j)
1087 if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(
1088 *(const_cast<String*>(static_cast<const String*>(directoryList.GetAt(j))))) == 0)
1096 outterLoopCount = directoryList.GetCount();
1097 for (int i = 0; i < outterLoopCount; ++i)
1100 innerLoopCount = __pDirectoryList->GetCount();
1101 for (int j = 0; j < innerLoopCount; ++j)
1103 if (const_cast<String*>(static_cast<const String*>(directoryList.GetAt(i)))->CompareTo(
1104 *(static_cast<String*>(__pDirectoryList->GetAt(j)))) == 0)
1114 __albumName = albumName;
1115 __providerId.Clear();
1117 if (__pDirectoryList != null)
1119 delete __pDirectoryList;
1121 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1123 int loopCount = directoryList.GetCount();
1124 for (int i = 0; i < loopCount; ++i)
1126 __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>
1127 (static_cast<const String*>(directoryList.GetAt(i))))));
1130 if (__pContentInfoList != null)
1132 delete __pContentInfoList;
1133 __pContentInfoList = null;
1136 if (GetAppControlMode() == APPCONTROL_MODE_PICK)
1138 AppControlMediaType appControlMediaType = GetAppControlMediaType();
1139 if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE)
1141 __albumContentType = CONTENT_TYPE_IMAGE;
1143 else if (appControlMediaType == APPCONTROL_MEDIA_TYPE_VIDEO)
1145 __albumContentType = CONTENT_TYPE_VIDEO;
1148 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1149 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1155 FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
1157 AppLogDebug("ENTER");
1158 result r = RefreshContentInfoList(contentType);
1159 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1165 FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
1167 AppLogDebug("ENTER");
1168 if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO))
1170 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1175 if ((__pDirectoryList == null) || (__pDirectoryList->GetCount() <= 0))
1177 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1182 __albumContentType = contentType;
1184 if (__pContentInfoList != null)
1186 delete __pContentInfoList;
1187 __pContentInfoList = null;
1189 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1190 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1196 FileListPresentationModel::GetCurrentAlbumName(void) const
1198 AppLogDebug("ENTER");
1199 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1205 FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
1207 AppLogDebug("ENTER");
1208 if (&albumName == null)
1210 __albumName = EMPTY_SPACE;
1214 __albumName = albumName;
1216 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1220 FileListPresentationModel::GetCurrentAlbumContentType(void) const
1222 AppLogDebug("ENTER");
1223 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1225 return __albumContentType;
1229 FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
1231 AppLogDebug("ENTER");
1232 __albumContentType = contentType;
1233 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1237 FileListPresentationModel::GetAlbumDirectoryListN(void) const
1239 AppLogDebug("ENTER");
1240 IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1241 if (__pDirectoryList == null)
1243 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1245 return pAlbumDirectoryList;
1248 String* pDirectory = null;
1249 int loopCount = __pDirectoryList->GetCount();
1250 for (int i = 0; i < loopCount; ++i)
1252 pDirectory = static_cast<String*>(__pDirectoryList->GetAt(i));
1253 pAlbumDirectoryList->Add(new (std::nothrow) String(*pDirectory));
1255 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1257 return pAlbumDirectoryList;
1261 FileListPresentationModel::GetAlbumContentInfoList(void) const
1263 AppLogDebug("ENTER");
1264 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1265 if (__pContentInfoList == null)
1267 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1269 return pContentList;
1272 ContentInfo* pContentInfo = null;
1273 int loopCount = __pContentInfoList->GetCount();
1274 for (int i = 0; i < loopCount; ++i)
1276 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(i));
1277 pContentList->Add(pContentInfo);
1279 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1281 return pContentList;
1285 FileListPresentationModel::GetContentInfo(const int index) const
1287 AppLogDebug("ENTER");
1288 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1290 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1295 if (index < 0 || index >= __pContentInfoList->GetCount())
1297 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1301 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1302 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1304 return pContentInfo;
1307 IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
1309 IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1310 int loopCount = indexList.GetCount();
1311 for (int i = 0; i < loopCount; ++i)
1313 const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
1315 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
1317 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
1321 return pContentIdList;
1325 FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
1327 AppLogDebug("ENTER");
1328 if (__pContentInfoList == null)
1330 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1334 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1336 return __pContentInfoList->GetCount();
1340 FileListPresentationModel::GetContentInfoIndex(const int index) const
1342 AppLogDebug("ENTER");
1343 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1345 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1350 if (index < 0 || index >= __pContentInfoList->GetCount())
1352 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1356 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1357 ContentId contentId = pContentInfo->GetContentId();
1358 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1364 FileListPresentationModel::GetContentFilePath(const int index) const
1366 AppLogDebug("ENTER index(%d)", index);
1367 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1369 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1374 if (index < 0 || index >= __pContentInfoList->GetCount())
1376 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1381 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1382 String contentPath = pContentInfo->GetContentPath();
1383 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1389 FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail,
1390 const ThumbnailInfo& thumbmailInfo)
1392 AppLogDebug("ENTER");
1393 Bitmap* pOverlayedImage = null;
1395 if (&thumbmailInfo != null)
1397 long duration = thumbmailInfo.GetDuration();
1400 if (&thumbnail != null)
1402 BufferInfo bufferInfo;
1403 thumbnail.Lock(bufferInfo, INFINITE);
1405 mainCanvas.Construct(bufferInfo);
1409 Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL);
1410 mainCanvas.Construct(mainRect);
1411 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), mainRect);
1414 Rectangle playRect(GAP_W_PLAY_FG, GAP_H_PLAY_FG, W_PLAY_FG, H_PLAY_FG);
1415 Bitmap* playBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_PLAY);
1416 if (playBitmap != null)
1418 mainCanvas.DrawBitmap(playRect, *playBitmap);
1423 Rectangle durSize(0, 0, W_DURATION, H_DURATION);
1424 Rectangle durRect(0, GAP_H_DURATION, W_DURATION, H_DURATION);
1425 Color durColor(COLOR_DURATION_BG);
1426 durColor.SetAlpha(ALPHA_DURATION);
1427 durCanvas.Construct(durSize);
1428 durCanvas.FillRectangle(durColor, durSize);
1430 durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION);
1431 durCanvas.SetFont(durFont);
1432 durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT),
1433 CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
1435 durBitmap.Construct(durCanvas, durCanvas.GetBounds());
1436 mainCanvas.DrawBitmap(durRect, durBitmap);
1438 pOverlayedImage = new (std::nothrow) Bitmap();
1439 pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds());
1441 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1443 return pOverlayedImage;
1447 FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
1448 const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const
1450 AppLogDebug("ENTER");
1451 if (&originalBitmap == null || &originalBitmap == null)
1453 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1458 BufferInfo bufferInfo;
1459 bgBitmap.Lock(bufferInfo, INFINITE);
1462 mainCanvas.Construct(bufferInfo);
1464 mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap);
1466 Bitmap* pMainImage = new (std::nothrow) Bitmap();
1467 pMainImage->Construct(mainCanvas,mainCanvas.GetBounds());
1468 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1474 FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList,
1475 ContentType contentType)const
1477 AppLogDebug("ENTER");
1478 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1480 if ((&contentDirectoryList == null) || (contentDirectoryList.GetCount() == 0)
1481 || ((contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO) && (contentType != CONTENT_TYPE_ALL)))
1483 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1484 return pContentList;
1487 ContentDirectory contentDirectory;
1488 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
1489 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
1491 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
1493 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
1495 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
1497 result r = contentDirectory.Construct(*pContentTypeList);
1498 delete pContentTypeList;
1502 int pageNo = SIZE_PAGE_NO;
1503 int countPerPage = SIZE_CONUNT_PER_PAGE;
1504 String* pContentDirectory = null;
1506 int loopCount = contentDirectoryList.GetCount();
1507 for (int i = 0; i < loopCount; ++i)
1509 IList* pIList = null;
1510 pContentDirectory = const_cast<String*>(static_cast<const String*>(contentDirectoryList.GetAt(i)));
1511 if (pContentDirectory != null)
1513 pIList = contentDirectory.GetContentDirectoryItemListN(*pContentDirectory, pageNo, countPerPage,
1514 CONTENT_INFO_ORDER, SORT_ORDER_NONE);
1518 pContentList->AddItems(*pIList);
1523 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1525 return pContentList;
1529 FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
1531 AppLogDebug("ENTER");
1533 if (&targetPath == null || targetPath.GetLength() == 0)
1538 if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT)
1540 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
1542 else if (targetPath == RESERVED_DOWNLOAD_PATH)
1544 albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS");
1548 String directoryName = GetDirecotyNameFromFullPath(targetPath);
1549 albumName = directoryName;
1556 FileListPresentationModel::GetAppControlMode(void) const
1558 AppLogDebug("Enter");
1559 AppLogDebug("Exit");
1561 return __appControlMode;
1565 FileListPresentationModel::GetAppControlMediaType(void) const
1567 AppLogDebug("Enter");
1568 AppLogDebug("Exit");
1570 return __appControlMediaType;
1573 AppControlSelectionMode
1574 FileListPresentationModel::GetAppControlSelectionMode(void) const
1576 AppLogDebug("Enter");
1577 AppLogDebug("Exit");
1579 return __appControlSelectionMode;
1583 FileListPresentationModel::SetUpdateProgressStatus(const bool status)
1585 AppLogDebug("ENTER status = %d",status);
1586 __updateProgressStatus = status;
1587 AppLogDebug("EXIT");
1591 FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
1593 result r = E_SUCCESS;
1594 ImageBuffer rotateBuffer;
1595 ImageBuffer* pRotatedBuffer = null;
1596 ImageFormat imageFormat;
1598 String filePath = GetContentFilePath(index);
1599 r = img.Construct();
1604 imageFormat = img.GetImageFormat(filePath);
1607 r = rotateBuffer.Construct(filePath);
1610 if (rotateMode == ROTATE_MODE_RIGHT)
1612 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
1616 pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
1620 if (pRotatedBuffer != null)
1622 r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
1623 delete pRotatedBuffer;
1626 ContentManager::ScanFile(filePath);
1631 FileListPresentationModel::ClearImageCache(void)
1633 AppLogDebug("FileListPresentationModel::ClearImageCache ++");
1635 if(__pIconListViewCache != null && __providerId.Equals(APPCONTROL_PROVIDER_ID_IMAGE, false) == true)
1637 bool clearThumbnailReq = true;
1638 while(__pIconListViewCache->GetCount() != 0)
1640 //This is to Clear the Thumbnail Reuqests only Once
1641 if(clearThumbnailReq == true)
1643 ClearThumbnailRequests();
1644 clearThumbnailReq = false;
1646 __pIconListViewCache->RemoveAt(0, true);
1649 AppLogDebug("FileListPresentationModel::ClearImageCache --");
1653 FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
1655 AppLogDebug("ENTER");
1656 if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
1658 IFormContentUpdateEventListener* pInterface = null;
1659 IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
1660 while (pEventEnum->MoveNext() == E_SUCCESS)
1662 pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
1663 pInterface->OnContentUpdated();
1667 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));