NSE_42715
[apps/osp/Gallery.git] / src / GlFileListPresentationModel.cpp
index 69ff684..d71a4eb 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -82,10 +82,12 @@ IList* FileListPresentationModel::__pDirectoryList = null;
 IList* FileListPresentationModel::__pContentInfoList = null;
 
 FileListPresentationModel::FileListPresentationModel(void)
-       : __albumContentType(CONTENT_TYPE_ALL)
-       , __appControlMode(APP_CONTROL_MODE_MAIN)
+       : __pContentManager(null)
+       , __albumContentType(CONTENT_TYPE_ALL)
+       , __appControlMode(APPCONTROL_MODE_MAIN)
        , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE)
        , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE)
+       , __pContentIdList(null)
        , __updateProgressStatus(false)
 {
        AppLogDebug("ENTER");
@@ -95,6 +97,7 @@ FileListPresentationModel::FileListPresentationModel(void)
 FileListPresentationModel::~FileListPresentationModel(void)
 {
        AppLogDebug("ENTER");
+       DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -120,6 +123,8 @@ FileListPresentationModel::Construct(void)
        __pThumbnailEvent = new (std::nothrow) ThumbnailEvent();
        __pThumbnailEvent->AddListener(*pThumbnailEventListener, true);
 
+       DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+
        ContentUpdateEventListener::GetInstance();
        __pContentManager = new (std::nothrow) ContentManager();
        __pContentManager->Construct();
@@ -157,12 +162,20 @@ FileListPresentationModel::Construct(void)
 
        if (operationId.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0)
        {
-               __appControlMode = APP_CONTROL_MODE_MAIN;
+               __appControlMode = APPCONTROL_MODE_MAIN;
        }
        else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0)
        {
-               __appControlMode = APP_CONTROL_MODE_PICK;
+               __appControlMode = APPCONTROL_MODE_PICK;
 
+               String mimeType = pApp->GetMimeType();
+               if (mimeType.IsEmpty() != true)
+               {
+                       if (mimeType.StartsWith(APPCONTROL_DATA_VIDEO, 0) == true)
+                       {
+                               __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO;
+                       }
+               }
                if (pArguments != null)
                {
                        const String* selectionMode = static_cast<const String*>(pArguments->GetValue(String(APPCONTROL_KEY_SELECTION_MODE)));
@@ -180,7 +193,7 @@ FileListPresentationModel::Construct(void)
        }
        else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0)
        {
-               __appControlMode = APP_CONTROL_MODE_SETTING;
+               __appControlMode = APPCONTROL_MODE_SETTING;
        }
 
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -252,7 +265,7 @@ FileListPresentationModel::DestroyInstance(void)
 }
 
 String
-FileListPresentationModel::GetFileNameFromFullPath(const String& fullPath, bool withExt) const
+FileListPresentationModel::GetFileNameFromFullPath(const String& fullPath, const bool withExt) const
 {
        AppLogDebug("ENTER");
        if (fullPath.CompareTo(EMPTY_SPACE) == 0)
@@ -368,8 +381,8 @@ result
 FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pName, Bitmap*& pThumbnail)
 {
        AppLogDebug("ENTER : index(%d)", index);
-       Bitmap* pOrgBitmap = null;
-       Bitmap* pDstBitmap = null;
+       Bitmap* pOriginalBitmap = null;
+       Bitmap* pDestinationBitmap = null;
        ContentInfo* pContentInfo = null;
 
        if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
@@ -392,38 +405,38 @@ FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pN
        if (pThumbnailInfo != null)
        {
                pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
-               pOrgBitmap = pThumbnailInfo->GetBitmapN();
+               pOriginalBitmap = pThumbnailInfo->GetBitmapN();
        }
 
        if ((pThumbnailInfo != null)&&(pThumbnailInfo->GetContentType() == CONTENT_TYPE_VIDEO))
        {
-               if (pOrgBitmap != null)
+               if (pOriginalBitmap != null)
                {
-                       pDstBitmap = CoverVideoOverlayedImageOnThumbnailN(*pOrgBitmap, *pThumbnailInfo);
-                       delete pOrgBitmap;
+                       pDestinationBitmap = CoverVideoOverlayedImageOnThumbnailN(*pOriginalBitmap, *pThumbnailInfo);
+                       delete pOriginalBitmap;
                }
        }
        else
        {
-               pDstBitmap = pOrgBitmap;
+               pDestinationBitmap = pOriginalBitmap;
        }
 
-       if (pDstBitmap != null)
+       if (pDestinationBitmap != null)
        {
                Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
                Rectangle thumbnailRect(RECTANGLE_THUMBNAIL_OFFSET_POSION);
-               pDstBitmap->Scale(Dimension(RECTANGLE_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_THUMBNAIL_OFFSET_POSION.x
+               pDestinationBitmap->Scale(Dimension(RECTANGLE_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_THUMBNAIL_OFFSET_POSION.x
                                , RECTANGLE_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_THUMBNAIL_OFFSET_POSION.y));
                if (pThumbnailBgBitmap != null)
                {
                        pThumbnailBgBitmap->Scale(DIMENSION_REAL_ICON);
-                       pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pDstBitmap, thumbnailRect);
+                       pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pDestinationBitmap, thumbnailRect);
                        delete pThumbnailBgBitmap;
-                       delete pDstBitmap;
+                       delete pDestinationBitmap;
                }
                else
                {
-                       pThumbnail = pDstBitmap;
+                       pThumbnail = pDestinationBitmap;
                }
        }
        else
@@ -441,11 +454,12 @@ FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pN
 }
 
 result
-FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index, String*& pName, Bitmap*& pThumbnail, String*& pDuration)
+FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index,
+               String*& pName, Bitmap*& pThumbnail, String*& pDuration) const
 {
        AppLogDebug("ENTER : index(%d)", index);
        ContentInfo* pContentInfo = null;
-       Bitmap* pOrgBitmap = null;
+       Bitmap* pOriginalBitmap = null;
 
        if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
        {
@@ -466,7 +480,7 @@ FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index, String
        if (pThumbnailInfo != null)
        {
                pName = new (std::nothrow) String(pThumbnailInfo->GetFilePath());
-               pOrgBitmap = pThumbnailInfo->GetBitmapN();
+               pOriginalBitmap = pThumbnailInfo->GetBitmapN();
                pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(pThumbnailInfo->GetDuration()));
        }
        else
@@ -475,19 +489,19 @@ FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index, String
                pDuration = new (std::nothrow) String(CommonUtil::DurationToTimeString(0));
        }
 
-       if (pOrgBitmap != null)
+       if (pOriginalBitmap != null)
        {
                Bitmap* pThumbnailBgBitmap = ResourceManager::GetBitmapN(IDB_VIDEOTHUMBNAIL_BG);
                Rectangle thumbnailRect(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION);
-               pOrgBitmap->Scale(Dimension(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.x
+               pOriginalBitmap->Scale(Dimension(RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.width - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.x
                                , RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.y));
                if (pThumbnailBgBitmap != null)
                {
                        pThumbnailBgBitmap->Scale(Dimension(W_WIDE_THUMBNAIL, H_WIDE_THUMBNAIL));
-                       pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pOrgBitmap, thumbnailRect);
+                       pThumbnail = GetShadedBackgroundBitmapN(*pThumbnailBgBitmap, *pOriginalBitmap, thumbnailRect);
                        delete pThumbnailBgBitmap;
                }
-               delete pOrgBitmap;
+               delete pOriginalBitmap;
        }
        else
        {
@@ -535,26 +549,7 @@ FileListPresentationModel::RequestThumbnail(const int index)
 }
 
 void
-FileListPresentationModel::CancelThumbnailRequest(const int index)
-{
-       AppLogDebug("ENTER : index(%d)", index);
-       /*ContentInfo* pContentInfo = null;
-
-       if (__pContentInfoList != null && index < __pContentInfoList->GetCount())
-       {
-               pContentInfo = static_cast<ContentInfo*>(__pContentInfoList->GetAt(index));
-               if (pContentInfo == null)
-               {
-                       AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-                       return;
-               }
-               __pThumbnailProvider->CancelThumbnailRequest(pContentInfo->GetContentId(), __pThumbnailEvent);
-       }*/
-       AppLogDebug("EXIT");
-}
-
-void
-FileListPresentationModel::ClearThumbnailRequests(bool appTerminating)
+FileListPresentationModel::ClearThumbnailRequests(const bool appTerminating)
 {
        AppLogDebug("ENTER");
 
@@ -620,7 +615,7 @@ FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
                                {
                                        __pIconListViewCache->RemoveAt(0, true);
                                }
-                               AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)",__pIconListViewCache->GetCount(),
+                               AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)", __pIconListViewCache->GetCount(),
                                                pThumbnailInfo->GetFilePath().GetPointer());
                                __pIconListViewCache->Add(pThumbnailInfo);
                        }
@@ -650,7 +645,7 @@ FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
 }
 
 void
-FileListPresentationModel::OnContentCreated()
+FileListPresentationModel::OnContentCreated(void)
 {
        AppLogDebug("ENTER");
        if (__updateProgressStatus == true)
@@ -678,7 +673,7 @@ FileListPresentationModel::OnContentCreated()
 }
 
 void
-FileListPresentationModel::OnContentUpdated()
+FileListPresentationModel::OnContentUpdated(void)
 {
        AppLogDebug("ENTER");
        if (__updateProgressStatus == true)
@@ -686,6 +681,9 @@ FileListPresentationModel::OnContentUpdated()
                AppLogDebug("EXIT update in application");
                return;
        }
+       //Clear the ImageCaches when content is updated like rotate.
+       ClearImageCache();
+
        IFormContentUpdateEventListener* pInterface = null;
        if (__pContentEventListener == null)
        {
@@ -703,7 +701,7 @@ FileListPresentationModel::OnContentUpdated()
 }
 
 void
-FileListPresentationModel::OnContentDeleted()
+FileListPresentationModel::OnContentDeleted(void)
 {
        AppLogDebug("ENTER");
        if (__updateProgressStatus == true)
@@ -772,7 +770,7 @@ FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId&
        if (__pIconListViewCache != null)
        {
                int loopCount = __pIconListViewCache->GetCount();
-               for (int i = 0 ; i < loopCount; ++i)
+               for (int i = 0; i < loopCount; ++i)
                {
                        pTempThumbnailInfo = static_cast<ThumbnailInfo*>(__pIconListViewCache->GetAt(i));
                        if (contentId == pTempThumbnailInfo->GetContentId())
@@ -780,9 +778,8 @@ FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId&
 
                                pThumbnailInfo = new (std::nothrow) ThumbnailInfo();
                                Bitmap* pBitmap = pTempThumbnailInfo->GetBitmapN();
-                               pThumbnailInfo->Construct(pTempThumbnailInfo->GetContentId(),
-                                               pTempThumbnailInfo->GetFilePath(), *pBitmap,
-                                               pTempThumbnailInfo->GetContentType(), pTempThumbnailInfo->GetDuration());
+                               pThumbnailInfo->Construct(pTempThumbnailInfo->GetContentId(), pTempThumbnailInfo->GetFilePath(),
+                                               *pBitmap, pTempThumbnailInfo->GetContentType(), pTempThumbnailInfo->GetDuration());
                                delete pBitmap;
                                break;
                        }
@@ -989,49 +986,23 @@ FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const S
                File::Remove(destPath);
        }
 
-       if (pContentInfo->GetContentType() == CONTENT_TYPE_IMAGE)
+       r = File::Copy(filePath, destPath, false);
+
+       if ( r == E_STORAGE_FULL)
        {
-               r = File::Copy(filePath, destPath, false);
-               if (r == E_SUCCESS)
-               {
-                       if (r == E_SUCCESS)
-                       {
-                               ImageContentInfo contentInfo;
-                               r = contentInfo.Construct(&destPath);
-                               if (r == E_SUCCESS)
-                               {
-                                       __pContentManager->CreateContent(contentInfo);
-                                       r = GetLastResult();
-                                       TryCatch(!IsFailed(r),,"CreateContent::the value is %s",GetErrorMessage(r));
-                                       if (!isCopyOperation)
-                                       {
-                                               r = __pContentManager->DeleteContent(contentId);
-                                               TryCatch(!IsFailed(r),,"DeleteContent::the value is %s",GetErrorMessage(r));
-                                       }
-                               }
-                       }
-               }
+               File::Remove(destPath);
        }
-       else if (pContentInfo->GetContentType() == CONTENT_TYPE_VIDEO)
+       ContentManager::ScanFile(destPath);
+
+       if ( r == E_SUCCESS )
        {
-               r = File::Copy(filePath, destPath, false);
-               if (r == E_SUCCESS)
+               if ( isCopyOperation == false)
                {
-                       VideoContentInfo contentInfo;
-                       r = contentInfo.Construct(&destPath);
-                       {
-                               __pContentManager->CreateContent(contentInfo);
-                               r = GetLastResult();
-                               TryCatch(!IsFailed(r),,"CreateContent::the value is %s",GetErrorMessage(r));
-                               if (!isCopyOperation)
-                               {
-                                       r = __pContentManager->DeleteContent(contentId);
-                                       TryCatch(!IsFailed(r),,"DeleteContent::the value is %s",GetErrorMessage(r));
-                               }
-                       }
+                       File::Remove(filePath);               // if Move Op remove original file
+                       ContentManager::ScanFile(filePath);
                }
        }
-       CATCH:
+
        delete pContentInfo;
 
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1039,6 +1010,12 @@ FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const S
        return r;
 }
 
+void
+FileListPresentationModel::ClearProviderId(void)
+{
+       __providerId.Clear();
+}
+
 result
 FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId,
                const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList,
@@ -1046,6 +1023,10 @@ FileListPresentationModel::StartAppControl(const String& providerId, const Strin
 {
        AppLogDebug("ENTER");
        AppControl* pAc = AppManager::FindAppControlN(providerId, operationId);
+
+       ClearProviderId();
+       __providerId.Append(providerId);
+
        if (pAc == null)
        {
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
@@ -1112,6 +1093,7 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
        }
 
        __albumName = albumName;
+       __providerId.Clear();
 
        if (__pDirectoryList != null)
        {
@@ -1132,7 +1114,7 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
                __pContentInfoList = null;
        }
 
-       if (GetAppControlMode() == APP_CONTROL_MODE_PICK)
+       if (GetAppControlMode() == APPCONTROL_MODE_PICK)
        {
                AppControlMediaType appControlMediaType = GetAppControlMediaType();
                if (appControlMediaType == APPCONTROL_MEDIA_TYPE_IMAGE)
@@ -1151,7 +1133,7 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
 }
 
 result
-FileListPresentationModel::RefreshCurrentAlbumContentInfoList(ContentType contentType)
+FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
 {
        AppLogDebug("ENTER");
        result r = RefreshContentInfoList(contentType);
@@ -1161,7 +1143,7 @@ FileListPresentationModel::RefreshCurrentAlbumContentInfoList(ContentType conten
 }
 
 result
-FileListPresentationModel::RefreshContentInfoList(ContentType contentType)
+FileListPresentationModel::RefreshContentInfoList(const ContentType contentType)
 {
        AppLogDebug("ENTER");
        if ((contentType != CONTENT_TYPE_ALL) && (contentType != CONTENT_TYPE_IMAGE) && (contentType != CONTENT_TYPE_VIDEO))
@@ -1192,7 +1174,7 @@ FileListPresentationModel::RefreshContentInfoList(ContentType contentType)
 }
 
 String
-FileListPresentationModel::GetCurrentAlbumName(void)
+FileListPresentationModel::GetCurrentAlbumName(void) const
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1201,7 +1183,7 @@ FileListPresentationModel::GetCurrentAlbumName(void)
 }
 
 void
-FileListPresentationModel::SetCurrentAlbumName(String& albumName)
+FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
 {
        AppLogDebug("ENTER");
        if (&albumName == null)
@@ -1216,7 +1198,7 @@ FileListPresentationModel::SetCurrentAlbumName(String& albumName)
 }
 
 ContentType
-FileListPresentationModel::GetCurrentAlbumContentType(void)
+FileListPresentationModel::GetCurrentAlbumContentType(void) const
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1225,7 +1207,7 @@ FileListPresentationModel::GetCurrentAlbumContentType(void)
 }
 
 void
-FileListPresentationModel::SetCurrentAlbumContentType(ContentType contentType)
+FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
 {
        AppLogDebug("ENTER");
        __albumContentType = contentType;
@@ -1233,7 +1215,7 @@ FileListPresentationModel::SetCurrentAlbumContentType(ContentType contentType)
 }
 
 IList*
-FileListPresentationModel::GetAlbumDirectoryListN(void)
+FileListPresentationModel::GetAlbumDirectoryListN(void) const
 {
        AppLogDebug("ENTER");
        IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -1257,7 +1239,7 @@ FileListPresentationModel::GetAlbumDirectoryListN(void)
 }
 
 IList*
-FileListPresentationModel::GetAlbumContentInfoList(void)
+FileListPresentationModel::GetAlbumContentInfoList(void) const
 {
        AppLogDebug("ENTER");
        IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -1281,7 +1263,7 @@ FileListPresentationModel::GetAlbumContentInfoList(void)
 }
 
 ContentInfo*
-FileListPresentationModel::GetContentInfo(int index)
+FileListPresentationModel::GetContentInfo(const int index) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
@@ -1303,7 +1285,7 @@ FileListPresentationModel::GetContentInfo(int index)
        return pContentInfo;
 }
 
-IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList)
+IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
 {
        IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        int loopCount = indexList.GetCount();
@@ -1321,7 +1303,7 @@ IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexLis
 }
 
 int
-FileListPresentationModel::GetCurrentAlbumContentInfoCount(void)
+FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null)
@@ -1336,7 +1318,7 @@ FileListPresentationModel::GetCurrentAlbumContentInfoCount(void)
 }
 
 ContentId
-FileListPresentationModel::GetContentInfoIndex(int index)
+FileListPresentationModel::GetContentInfoIndex(const int index) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
@@ -1360,7 +1342,7 @@ FileListPresentationModel::GetContentInfoIndex(int index)
 }
 
 String
-FileListPresentationModel::GetContentFilePath(int index)
+FileListPresentationModel::GetContentFilePath(const int index) const
 {
        AppLogDebug("ENTER index(%d)", index);
        if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
@@ -1389,7 +1371,7 @@ FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnai
                const ThumbnailInfo& thumbmailInfo)
 {
        AppLogDebug("ENTER");
-       Bitmap* overlayedImage = null;
+       Bitmap* pOverlayedImage = null;
 
        if (&thumbmailInfo != null)
        {
@@ -1428,26 +1410,26 @@ FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnai
                Font durFont;
                durFont.Construct(FONT_STYLE_PLAIN, FONT_SIZE_DURATION);
                durCanvas.SetFont(durFont);
-               durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT), CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
+               durCanvas.DrawText(Point(W_DURATION_TEXT, H_DURATION_TEXT),
+                               CommonUtil::DurationToTimeString(duration), COLOR_TEXT_OUTLINE);
                Bitmap durBitmap;
-               durBitmap.Construct(durCanvas,durCanvas.GetBounds());
-               mainCanvas.DrawBitmap(durRect,durBitmap);
+               durBitmap.Construct(durCanvas, durCanvas.GetBounds());
+               mainCanvas.DrawBitmap(durRect, durBitmap);
 
-               overlayedImage = new (std::nothrow) Bitmap();
-               overlayedImage->Construct(mainCanvas,mainCanvas.GetBounds());
+               pOverlayedImage = new (std::nothrow) Bitmap();
+               pOverlayedImage->Construct(mainCanvas, mainCanvas.GetBounds());
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return overlayedImage;
+       return pOverlayedImage;
 }
 
 Bitmap*
 FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
-               const Bitmap& orgBitmap,
-               const Rectangle& orgBitmapPosition)
+               const Bitmap& originalBitmap, const Rectangle& originalBitmapPosition) const
 {
        AppLogDebug("ENTER");
-       if (&orgBitmap == null || &orgBitmap == null)
+       if (&originalBitmap == null || &originalBitmap == null)
        {
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
 
@@ -1460,7 +1442,7 @@ FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
        Canvas mainCanvas;
        mainCanvas.Construct(bufferInfo);
        mainCanvas.Clear();
-       mainCanvas.DrawBitmap(orgBitmapPosition, orgBitmap);
+       mainCanvas.DrawBitmap(originalBitmapPosition, originalBitmap);
 
        Bitmap* pMainImage = new (std::nothrow) Bitmap();
        pMainImage->Construct(mainCanvas,mainCanvas.GetBounds());
@@ -1579,7 +1561,7 @@ FileListPresentationModel::GetAppControlSelectionMode(void) const
 }
 
 void
-FileListPresentationModel::SetUpdateProgressStatus(bool status)
+FileListPresentationModel::SetUpdateProgressStatus(const bool status)
 {
        AppLogDebug("ENTER status = %d",status);
        __updateProgressStatus = status;
@@ -1595,8 +1577,13 @@ FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
        ImageFormat imageFormat;
        Image img;
        String filePath = GetContentFilePath(index);
-       r = img.Construct();
+       ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
+       if (contentType == CONTENT_TYPE_VIDEO)
+       {
+               return r;
+       }
 
+       r = img.Construct();
 
        if (r == E_SUCCESS)
        {
@@ -1620,8 +1607,47 @@ FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
        {
                r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
                delete pRotatedBuffer;
+               ContentManager::ScanFile(filePath);
        }
-
-       ContentManager::ScanFile(filePath);
        return r;
 }
+
+void
+FileListPresentationModel::ClearImageCache(void)
+{
+       AppLogDebug("ENTER");
+
+       if(__pIconListViewCache != null)
+       {
+               bool clearThumbnailReq = true;
+               while(__pIconListViewCache->GetCount() != 0)
+               {
+                       //This is to Clear the Thumbnail Reuqests only Once
+                       if(clearThumbnailReq == true)
+                       {
+                               ClearThumbnailRequests();
+                               clearThumbnailReq = false;
+                       }
+                       __pIconListViewCache->RemoveAt(0, true);
+               }
+       }
+       AppLogDebug("EXIT");
+}
+
+void
+FileListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
+{
+       AppLogDebug("ENTER");
+       if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
+       {
+               IFormContentUpdateEventListener* pInterface = null;
+               IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
+               while (pEventEnum->MoveNext() == E_SUCCESS)
+               {
+                       pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
+                       pInterface->OnContentUpdated();
+               }
+               delete pEventEnum;
+       }
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}