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 r = File::Copy(filePath, destPath, false);
991 if ( r == E_STORAGE_FULL)
993 File::Remove(destPath);
995 ContentManager::ScanFile(destPath);
997 if ( r == E_SUCCESS )
999 if ( isCopyOperation == false)
1001 File::Remove(filePath); // if Move Op remove original file
1002 ContentManager::ScanFile(filePath);
1006 delete pContentInfo;
1008 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1014 FileListPresentationModel::ClearProviderId(void)
1016 __providerId.Clear();
1020 FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId,
1021 const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList,
1022 IAppControlResponseListener* pListener)
1024 AppLogDebug("ENTER");
1025 AppControl* pAc = AppManager::FindAppControlN(providerId, operationId);
1027 AppLogDebug("rashmi b4(%ls)", __providerId.GetPointer());
1029 __providerId.Append(providerId);
1030 AppLogDebug("rashmi after(%ls)", __providerId.GetPointer());
1034 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1037 result r = pAc->Start(pUriData, pMimeType, pDataList, pListener);
1041 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
1042 pGalleryApp->SetFrameEnabled(false);
1047 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1053 FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IList& directoryList)
1055 AppLogDebug("ENTER");
1057 if (&directoryList != null)
1059 if (__pDirectoryList != null && __pDirectoryList->GetCount() > 0)
1061 bool isMatched = false;
1062 int outterLoopCount = __pDirectoryList->GetCount();
1063 int innerLoopCount = 0;
1064 for (int i = 0; i < outterLoopCount ; ++i)
1067 innerLoopCount = directoryList.GetCount();
1068 for (int j = 0; j < innerLoopCount; ++j)
1070 if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(
1071 *(const_cast<String*>(static_cast<const String*>(directoryList.GetAt(j))))) == 0)
1079 outterLoopCount = directoryList.GetCount();
1080 for (int i = 0; i < outterLoopCount; ++i)
1083 innerLoopCount = __pDirectoryList->GetCount();
1084 for (int j = 0; j < innerLoopCount; ++j)
1086 if (const_cast<String*>(static_cast<const String*>(directoryList.GetAt(i)))->CompareTo(
1087 *(static_cast<String*>(__pDirectoryList->GetAt(j)))) == 0)
1097 __albumName = albumName;
1098 __providerId.Clear();
1100 if (__pDirectoryList != null)
1102 delete __pDirectoryList;
1104 __pDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1106 int loopCount = directoryList.GetCount();
1107 for (int i = 0; i < loopCount; ++i)
1109 __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>
1110 (static_cast<const String*>(directoryList.GetAt(i))))));
1113 if (__pContentInfoList != null)
1115 delete __pContentInfoList;
1116 __pContentInfoList = null;
1119 if (GetAppControlMode() == APPCONTROL_MODE_PICK)
1121 AppControlMediaType appControlMediaType = GetAppControlMediaType();
1122 if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE)
1124 __albumContentType = CONTENT_TYPE_IMAGE;
1126 else if (appControlMediaType == APPCONTROL_MEDIA_TYPE_VIDEO)
1128 __albumContentType = CONTENT_TYPE_VIDEO;
1131 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1132 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1138 FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
1140 AppLogDebug("ENTER");
1141 result r = RefreshContentInfoList(contentType);
1142 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1148 FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
1150 AppLogDebug("ENTER");
1151 if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO))
1153 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1158 if ((__pDirectoryList == null) || (__pDirectoryList->GetCount() <= 0))
1160 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1165 __albumContentType = contentType;
1167 if (__pContentInfoList != null)
1169 delete __pContentInfoList;
1170 __pContentInfoList = null;
1172 __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
1173 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1179 FileListPresentationModel::GetCurrentAlbumName(void) const
1181 AppLogDebug("ENTER");
1182 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1188 FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
1190 AppLogDebug("ENTER");
1191 if (&albumName == null)
1193 __albumName = EMPTY_SPACE;
1197 __albumName = albumName;
1199 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1203 FileListPresentationModel::GetCurrentAlbumContentType(void) const
1205 AppLogDebug("ENTER");
1206 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1208 return __albumContentType;
1212 FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
1214 AppLogDebug("ENTER");
1215 __albumContentType = contentType;
1216 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1220 FileListPresentationModel::GetAlbumDirectoryListN(void) const
1222 AppLogDebug("ENTER");
1223 IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1224 if (__pDirectoryList == null)
1226 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1228 return pAlbumDirectoryList;
1231 String* pDirectory = null;
1232 int loopCount = __pDirectoryList->GetCount();
1233 for (int i = 0; i < loopCount; ++i)
1235 pDirectory = static_cast<String*>(__pDirectoryList->GetAt(i));
1236 pAlbumDirectoryList->Add(new (std::nothrow) String(*pDirectory));
1238 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1240 return pAlbumDirectoryList;
1244 FileListPresentationModel::GetAlbumContentInfoList(void) const
1246 AppLogDebug("ENTER");
1247 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1248 if (__pContentInfoList == null)
1250 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1252 return pContentList;
1255 ContentInfo* pContentInfo = null;
1256 int loopCount = __pContentInfoList->GetCount();
1257 for (int i = 0; i < loopCount; ++i)
1259 pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(i));
1260 pContentList->Add(pContentInfo);
1262 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1264 return pContentList;
1268 FileListPresentationModel::GetContentInfo(const int index) const
1270 AppLogDebug("ENTER");
1271 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1273 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1278 if (index < 0 || index >= __pContentInfoList->GetCount())
1280 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1284 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1285 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1287 return pContentInfo;
1290 IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
1292 IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1293 int loopCount = indexList.GetCount();
1294 for (int i = 0; i < loopCount; ++i)
1296 const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
1298 if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
1300 pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
1304 return pContentIdList;
1308 FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
1310 AppLogDebug("ENTER");
1311 if (__pContentInfoList == null)
1313 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1317 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1319 return __pContentInfoList->GetCount();
1323 FileListPresentationModel::GetContentInfoIndex(const int index) const
1325 AppLogDebug("ENTER");
1326 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1328 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1333 if (index < 0 || index >= __pContentInfoList->GetCount())
1335 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1339 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1340 ContentId contentId = pContentInfo->GetContentId();
1341 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1347 FileListPresentationModel::GetContentFilePath(const int index) const
1349 AppLogDebug("ENTER index(%d)", index);
1350 if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
1352 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1357 if (index < 0 || index >= __pContentInfoList->GetCount())
1359 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
1364 ContentInfo* pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
1365 String contentPath = pContentInfo->GetContentPath();
1366 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1372 FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail,
1373 const ThumbnailInfo& thumbmailInfo)
1375 AppLogDebug("ENTER");
1376 Bitmap* pOverlayedImage = null;
1378 if (&thumbmailInfo != null)
1380 long duration = thumbmailInfo.GetDuration();
1383 if (&thumbnail != null)
1385 BufferInfo bufferInfo;
1386 thumbnail.Lock(bufferInfo, INFINITE);
1388 mainCanvas.Construct(bufferInfo);
1392 Rectangle mainRect(0, 0, W_DEFAULT_THUMBNAIL, H_DEFAULT_THUMBNAIL);
1393 mainCanvas.Construct(mainRect);
1394 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_BLACK), mainRect);
1397 Rectangle playRect(GAP_W_PLAY_FG, GAP_H_PLAY_FG, W_PLAY_FG, H_PLAY_FG);
1398 Bitmap* playBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_PLAY);
1399 if (playBitmap != null)
1401 mainCanvas.DrawBitmap(playRect, *playBitmap);
1406 Rectangle durSize(0, 0, W_DURATION, H_DURATION);
1407 Rectangle durRect(0, GAP_H_DURATION, W_DURATION, H_DURATION);
1408 Color durColor(COLOR_DURATION_BG);
1409 durColor.SetAlpha(ALPHA_DURATION);
1410 durCanvas.Construct(durSize);
1411 durCanvas.FillRectangle(durColor, durSize);
1413 durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION);
1414 durCanvas.SetFont(durFont);
1415 durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT),
1416 CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
1418 durBitmap.Construct(durCanvas, durCanvas.GetBounds());
1419 mainCanvas.DrawBitmap(durRect, durBitmap);
1421 pOverlayedImage = new (std::nothrow) Bitmap();
1422 pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds());
1424 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1426 return pOverlayedImage;
1430 FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
1431 const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const
1433 AppLogDebug("ENTER");
1434 if (&originalBitmap == null || &originalBitmap == null)
1436 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1441 BufferInfo bufferInfo;
1442 bgBitmap.Lock(bufferInfo, INFINITE);
1445 mainCanvas.Construct(bufferInfo);
1447 mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap);
1449 Bitmap* pMainImage = new (std::nothrow) Bitmap();
1450 pMainImage->Construct(mainCanvas,mainCanvas.GetBounds());
1451 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1457 FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList,
1458 ContentType contentType)const
1460 AppLogDebug("ENTER");
1461 IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1463 if ((&contentDirectoryList == null) || (contentDirectoryList.GetCount() == 0)
1464 || ((contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO) && (contentType != CONTENT_TYPE_ALL)))
1466 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1467 return pContentList;
1470 ContentDirectory contentDirectory;
1471 IListT<ContentType>* pContentTypeList = new (std::nothrow) ArrayListT<ContentType>();
1472 if (contentType == CONTENT_TYPE_IMAGE || contentType == CONTENT_TYPE_ALL)
1474 pContentTypeList->Add(CONTENT_TYPE_IMAGE);
1476 if (contentType == CONTENT_TYPE_VIDEO || contentType == CONTENT_TYPE_ALL)
1478 pContentTypeList->Add(CONTENT_TYPE_VIDEO);
1480 result r = contentDirectory.Construct(*pContentTypeList);
1481 delete pContentTypeList;
1485 int pageNo = SIZE_PAGE_NO;
1486 int countPerPage = SIZE_CONUNT_PER_PAGE;
1487 String* pContentDirectory = null;
1489 int loopCount = contentDirectoryList.GetCount();
1490 for (int i = 0; i < loopCount; ++i)
1492 IList* pIList = null;
1493 pContentDirectory = const_cast<String*>(static_cast<const String*>(contentDirectoryList.GetAt(i)));
1494 if (pContentDirectory != null)
1496 pIList = contentDirectory.GetContentDirectoryItemListN(*pContentDirectory, pageNo, countPerPage,
1497 CONTENT_INFO_ORDER, SORT_ORDER_NONE);
1501 pContentList->AddItems(*pIList);
1506 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1508 return pContentList;
1512 FileListPresentationModel::ConvertToAlbumName(const String& targetPath)const
1514 AppLogDebug("ENTER");
1516 if (&targetPath == null || targetPath.GetLength() == 0)
1521 if (targetPath == RESERVED_CAMERA_PATH || targetPath == RESERVED_CAMERA_PATH_EXT)
1523 albumName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
1525 else if (targetPath == RESERVED_DOWNLOAD_PATH)
1527 albumName = ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS");
1531 String directoryName = GetDirecotyNameFromFullPath(targetPath);
1532 albumName = directoryName;
1539 FileListPresentationModel::GetAppControlMode(void) const
1541 AppLogDebug("Enter");
1542 AppLogDebug("Exit");
1544 return __appControlMode;
1548 FileListPresentationModel::GetAppControlMediaType(void) const
1550 AppLogDebug("Enter");
1551 AppLogDebug("Exit");
1553 return __appControlMediaType;
1556 AppControlSelectionMode
1557 FileListPresentationModel::GetAppControlSelectionMode(void) const
1559 AppLogDebug("Enter");
1560 AppLogDebug("Exit");
1562 return __appControlSelectionMode;
1566 FileListPresentationModel::SetUpdateProgressStatus(const bool status)
1568 AppLogDebug("ENTER status = %d",status);
1569 __updateProgressStatus = status;
1570 AppLogDebug("EXIT");
1574 FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
1576 result r = E_SUCCESS;
1577 ImageBuffer rotateBuffer;
1578 ImageBuffer* pRotatedBuffer = null;
1579 ImageFormat imageFormat;
1581 String filePath = GetContentFilePath(index);
1582 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1583 if (contentType == CONTENT_TYPE_VIDEO)
1588 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;
1612 ContentManager::ScanFile(filePath);
1618 FileListPresentationModel::ClearImageCache(void)
1620 AppLogDebug("FileListPresentationModel::ClearImageCache ++");
1622 if(__pIconListViewCache != null && __providerId.Equals(APPCONTROL_PROVIDER_ID_IMAGE, false) == true)
1624 AppLogDebug("rashmi __providerId(%ls)", __providerId.GetPointer());
1625 bool clearThumbnailReq = true;
1626 while(__pIconListViewCache->GetCount() != 0)
1628 //This is to Clear the Thumbnail Reuqests only Once
1629 if(clearThumbnailReq == true)
1631 ClearThumbnailRequests();
1632 clearThumbnailReq = false;
1634 __pIconListViewCache->RemoveAt(0, true);
1637 AppLogDebug("FileListPresentationModel::ClearImageCache --");
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()));