For NSE_43972
[apps/osp/Gallery.git] / src / GlFileListPresentationModel.cpp
index 7ae73b0..e59bc2f 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
 //
@@ -24,6 +24,7 @@
 #include <FSystem.h>
 #include "GlCommonUtil.h"
 #include "GlFileListPresentationModel.h"
+#include "GlContentUpdateEventListener.h"
 #include "GlGalleryApp.h"
 #include "GlThumbnailEvent.h"
 #include "GlThumbnailEventArg.h"
@@ -48,22 +49,22 @@ static const int SIZE_CONUNT_PER_PAGE = 3000;
 static const int SIZE_ICON_LIST_CACHE = 50;
 static const int W_DURATION_TEXT = 44;
 static const int H_DURATION_TEXT = 4;
-static const int W_DURATION = 158;
-static const int H_DURATION = 38;
-static const int W_DEFAULT_THUMBNAIL = 158;
-static const int H_DEFAULT_THUMBNAIL = 158;
-static const int W_WIDE_THUMBNAIL = 172;
-static const int H_WIDE_THUMBNAIL = 128;
+static const int W_DURATION = 171;
+static const int H_DURATION = 32;
+static const int W_DEFAULT_THUMBNAIL = 171;
+static const int H_DEFAULT_THUMBNAIL = 127;
+static const int W_WIDE_THUMBNAIL = 171;
+static const int H_WIDE_THUMBNAIL = 127;
 static const int W_PLAY_FG = 64;
 static const int H_PLAY_FG = 64;
-static const int GAP_W_PLAY_FG = 47;
-static const int GAP_H_PLAY_FG = 27;
-static const int GAP_H_DURATION = 27+64+28;
+static const int GAP_W_PLAY_FG = (W_DEFAULT_THUMBNAIL -W_PLAY_FG)/2 ;
+static const int GAP_H_PLAY_FG = (H_DEFAULT_THUMBNAIL - H_PLAY_FG)/2;
+static const int GAP_H_DURATION = H_DEFAULT_THUMBNAIL - H_DURATION;
 static const int ALPHA_DURATION = 70;
-static const int FONT_SIZE_DURATION = 28;
-static const Dimension DIMENSION_REAL_ICON (162,164);
-static const Rectangle RECTANGLE_THUMBNAIL_OFFSET_POSION (1, 1, 156, 158);
-static const Rectangle RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION (1, 1, 168, 124);
+static const int FONT_SIZE_DURATION = 24;
+static const Dimension DIMENSION_REAL_ICON (171,127);
+static const Rectangle RECTANGLE_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127);
+static const Rectangle RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION (1, 1, 171, 127);
 static const Color COLOR_DURATION_BG (Color::GetColor(COLOR_ID_BLACK));
 static const Color COLOR_TEXT_OUTLINE (Color::GetColor(COLOR_ID_WHITE));
 
@@ -75,15 +76,19 @@ FileListPresentationModel* FileListPresentationModel::__pPresentationModelInstan
 ThumbnailProvider* FileListPresentationModel::__pThumbnailProvider = null;
 ThumbnailEvent* FileListPresentationModel::__pThumbnailEvent = null;
 ArrayList* FileListPresentationModel::__pPresentationModelListener = null;
+ArrayList* FileListPresentationModel::__pContentEventListener = null;
 ArrayList* FileListPresentationModel::__pIconListViewCache = null;
 IList* FileListPresentationModel::__pDirectoryList = null;
 IList* FileListPresentationModel::__pContentInfoList = null;
 
 FileListPresentationModel::FileListPresentationModel(void)
-       :__albumContentType(CONTENT_TYPE_ALL)
-       ,__appControlMode(APP_CONTROL_MODE_MAIN)
-       ,__appControlMediaType(APPCONTROL_MEDIA_TYPE_UNKNOWN)
-       ,__appControlSelectionMode(APPCONTROL_SELECTION_MODE_UNKNOWN)
+       : __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");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -92,6 +97,7 @@ FileListPresentationModel::FileListPresentationModel(void)
 FileListPresentationModel::~FileListPresentationModel(void)
 {
        AppLogDebug("ENTER");
+       DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -117,9 +123,17 @@ 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();
+
        if (__pIconListViewCache != null)
        {
+               __pIconListViewCache->RemoveAll(true);
                delete __pIconListViewCache;
+               __pIconListViewCache = null;
        }
        __pIconListViewCache = new (std::nothrow) ArrayList(SingleObjectDeleter);
        __pIconListViewCache->Construct(SIZE_ICON_LIST_CACHE);
@@ -139,6 +153,9 @@ FileListPresentationModel::Construct(void)
        __pPresentationModelListener = new (std::nothrow) ArrayList();
        __pPresentationModelListener->Construct();
 
+       __pContentEventListener = new (std::nothrow) ArrayList();
+       __pContentEventListener->Construct();
+
        __pThumbnailProvider = ThumbnailProvider::GetInstance();
 
        GalleryApp* pApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
@@ -147,40 +164,40 @@ 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)));
-                       const String* mediaType = static_cast<const String*>(pArguments->GetValue(String(APPCONTROL_KEY_MEDIA_TYPE)));
 
-                       if (mediaType != null && mediaType->CompareTo(APPCONTROL_DATA_VIDEO) == 0)
+                       if (pApp->GetMimeType().StartsWith(APPCONTROL_DATA_VIDEO, 0) == true)
                        {
                                __appControlMediaType = APPCONTROL_MEDIA_TYPE_VIDEO;
                        }
-                       else
-                       {
-                               __appControlMediaType = APPCONTROL_MEDIA_TYPE_IMAGE;
-                       }
 
                        if (selectionMode != null && selectionMode->CompareTo(APPCONTROL_DATA_MULTIPLE) == 0)
                        {
                                __appControlSelectionMode = APPCONTROL_SELECTION_MODE_MULTIPLE;
                        }
-                       else
-                       {
-                               __appControlSelectionMode = APPCONTROL_SELECTION_MODE_SINGLE;
-                       }
                }
        }
        else if (operationId.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0)
        {
-               __appControlMode = APP_CONTROL_MODE_SETTING;
+               __appControlMode = APPCONTROL_MODE_SETTING;
        }
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return E_SUCCESS;
@@ -215,6 +232,7 @@ FileListPresentationModel::DestroyInstance(void)
 
        if (__pIconListViewCache != null)
        {
+               __pIconListViewCache->RemoveAll(true);
                delete __pIconListViewCache;
                __pIconListViewCache = null;
        }
@@ -237,6 +255,12 @@ FileListPresentationModel::DestroyInstance(void)
                __pPresentationModelListener = null;
        }
 
+       if (__pContentEventListener != null)
+       {
+               delete __pContentEventListener;
+               __pContentEventListener = null;
+       }
+
        delete __pPresentationModelInstance;
        __pPresentationModelInstance = null;
 
@@ -244,7 +268,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)
@@ -328,7 +352,6 @@ FileListPresentationModel::IsContainContentInDirectory(const String& directoryPa
        if (pContentTypeList != null)
        {
                delete pContentTypeList;
-               pContentTypeList = null;
        }
        TryReturn(r == E_SUCCESS, false, "[%s] Unable to construct ContentDirectory", GetErrorMessage(r));
 
@@ -336,7 +359,8 @@ FileListPresentationModel::IsContainContentInDirectory(const String& directoryPa
        int pageNo = SIZE_PAGE_NO;
        int countPerPage = SIZE_CONUNT_PER_PAGE;
 
-       IList* pContentList = contentDirectory.GetContentDirectoryItemListN(directoryPath, pageNo, countPerPage, CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING);
+       IList* pContentList = contentDirectory.GetContentDirectoryItemListN(directoryPath, pageNo, countPerPage,
+                       CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING);
 
        if (pContentList == null || pContentList->GetCount() <= 0)
        {
@@ -350,7 +374,6 @@ FileListPresentationModel::IsContainContentInDirectory(const String& directoryPa
        if (pContentList != null)
        {
                delete pContentList;
-               pContentList = null;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -361,8 +384,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())
@@ -385,41 +408,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;
-                       pOrgBitmap = null;
+                       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
-                                                                       , RECTANGLE_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_THUMBNAIL_OFFSET_POSION.y));
+               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;
-                       pThumbnailBgBitmap = null;
-                       delete pDstBitmap;
-                       pDstBitmap = null;
+                       delete pDestinationBitmap;
                }
                else
                {
-                       pThumbnail = pDstBitmap;
+                       pThumbnail = pDestinationBitmap;
                }
        }
        else
@@ -430,7 +450,6 @@ FileListPresentationModel::GetThumbnailInSyncCacheN(const int index, String*& pN
        if (pThumbnailInfo != null)
        {
                delete pThumbnailInfo;
-               pThumbnailInfo = null;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -438,11 +457,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())
        {
@@ -463,7 +483,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
@@ -472,21 +492,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
-                                                                       , RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.height - RECTANGLE_VIDEO_THUMBNAIL_OFFSET_POSION.y));
+               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;
-                       pThumbnailBgBitmap = null;
                }
-               delete pOrgBitmap;
-               pOrgBitmap = null;
+               delete pOriginalBitmap;
        }
        else
        {
@@ -501,7 +519,6 @@ FileListPresentationModel::GetThumbnailVideoInSyncCacheN(const int index, String
        if (pThumbnailInfo != null)
        {
                delete pThumbnailInfo;
-               pThumbnailInfo = null;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -530,37 +547,18 @@ FileListPresentationModel::RequestThumbnail(const int index)
                return;
        }
 
-        __pThumbnailProvider->RequestThumbnail(pContentInfo->GetContentId(), __pThumbnailEvent);
-       AppLogDebug("EXIT");
-}
-
-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);
-       }
+       __pThumbnailProvider->RequestThumbnail(pContentInfo->GetContentId(), __pThumbnailEvent);
        AppLogDebug("EXIT");
 }
 
 void
-FileListPresentationModel::ClearThumbnailRequests(bool appTerminating)
+FileListPresentationModel::ClearThumbnailRequests(const bool appTerminating)
 {
        AppLogDebug("ENTER");
 
        if (__pThumbnailProvider != null)
        {
-                __pThumbnailProvider->ClearThumbnailRequests(appTerminating);
+               __pThumbnailProvider->ClearThumbnailRequests(appTerminating);
        }
 
        AppLogDebug("EXIT");
@@ -609,19 +607,21 @@ FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
                                        pTempThumbnailInfo->SetContentType(pThumbnailInfo->GetContentType());
                                        pTempThumbnailInfo->SetDuration(pThumbnailInfo->GetDuration());
                                        delete pThumbnailInfo;
-                                       pThumbnailInfo = null;
                                        isMatch = true;
                                        break;
                                }
                        }
 
+                       delete pEnum;
+
                        if (isMatch == false)
                        {
                                if (SIZE_ICON_LIST_CACHE <= __pIconListViewCache->GetCount())
                                {
                                        __pIconListViewCache->RemoveAt(0, true);
                                }
-                               AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)",__pIconListViewCache->GetCount(), pThumbnailInfo->GetFilePath().GetPointer());
+                               AppLogDebug("[CHASEFIRE] (all:%d) Add Thumbail(%ls)", __pIconListViewCache->GetCount(),
+                                               pThumbnailInfo->GetFilePath().GetPointer());
                                __pIconListViewCache->Add(pThumbnailInfo);
                        }
                }
@@ -645,12 +645,92 @@ FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
                        pInterface->OnThumbnailDecoded(index);
                }
                delete pEventEnum;
-               pEventEnum = null;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
+FileListPresentationModel::OnContentCreated(void)
+{
+       AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
+       IFormContentUpdateEventListener* pInterface = null;
+       if (__pContentEventListener == null)
+       {
+               AppLogDebug("EXIT");
+               return;
+       }
+       IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
+       while (pEventEnum->MoveNext() == E_SUCCESS)
+       {
+               pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
+               if (pInterface != null)
+               {
+                       pInterface->OnContentUpdated();
+               }
+       }
+       delete pEventEnum;
+       AppLogDebug("EXIT");
+}
+
+void
+FileListPresentationModel::OnContentUpdated(void)
+{
+       AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
+       //Clear the ImageCaches when content is updated like rotate.
+       ClearImageCache();
+
+       IFormContentUpdateEventListener* pInterface = null;
+       if (__pContentEventListener == null)
+       {
+               AppLogDebug("EXIT");
+               return;
+       }
+       IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
+       while (pEventEnum->MoveNext() == E_SUCCESS)
+       {
+               pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
+               pInterface->OnContentUpdated();
+       }
+       delete pEventEnum;
+       AppLogDebug("EXIT");
+}
+
+void
+FileListPresentationModel::OnContentDeleted(void)
+{
+       AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
+       IFormContentUpdateEventListener* pInterface = null;
+       if (__pContentEventListener == null)
+       {
+               AppLogDebug("EXIT");
+               return;
+       }
+       IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
+       while (pEventEnum->MoveNext() == E_SUCCESS)
+       {
+               pInterface = static_cast<IFormContentUpdateEventListener*>(pEventEnum->GetCurrent());
+               pInterface->OnContentUpdated();
+       }
+       delete pEventEnum;
+       AppLogDebug("EXIT");
+}
+
+void
 FileListPresentationModel::AddPresentationModelListener(const IAlbumEventListener* listener)
 {
        AppLogDebug("ENTER");
@@ -666,6 +746,26 @@ FileListPresentationModel::RemovePresentationModelListener(const IAlbumEventList
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
+void
+FileListPresentationModel::AddContentEventListener(const IFormContentUpdateEventListener* listener)
+{
+       AppLogDebug("ENTER");
+       if (__pContentEventListener != null)
+       {
+               __pContentEventListener->RemoveAll();
+               __pContentEventListener->Add((Object*)listener);
+               AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+       }
+}
+
+void
+FileListPresentationModel::RemoveContentEventListener(const IFormContentUpdateEventListener* listener)
+{
+       AppLogDebug("ENTER");
+       __pContentEventListener->Remove(*listener);
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
 ThumbnailInfo*
 FileListPresentationModel::GetThumbnailInfoFromInternalBufferN(const ContentId& contentId) const
 {
@@ -675,7 +775,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())
@@ -683,9 +783,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;
                        }
@@ -715,7 +814,8 @@ FileListPresentationModel::DeleteContentFileList(const IList& contentIndexList)
 
                if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
                {
-                       pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
+                       pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>
+                                       (__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
                }
        }
 
@@ -737,7 +837,8 @@ IList*
 FileListPresentationModel::GetCollisionIndexListN(const IList& contentIndexList, const String& destDirectory)
 {
        AppLogDebug("ENTER");
-       if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null || destDirectory.IsEmpty() == true)
+       if (&contentIndexList == null || contentIndexList.GetCount() <= 0 || &destDirectory == null
+                       || destDirectory.IsEmpty() == true)
        {
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
 
@@ -805,7 +906,8 @@ FileListPresentationModel::MoveToContentFileList(const IList& contentIndexList,
                Directory::Create(destDirectory, true);
        }
 
-       IList * pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       delete __pContentIdList;
+       __pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        int loopCount = contentIndexList.GetCount();
        for (int i = 0; i < loopCount; ++i)
        {
@@ -813,19 +915,11 @@ FileListPresentationModel::MoveToContentFileList(const IList& contentIndexList,
 
                if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
                {
-                       pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
+                       __pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
                }
        }
 
-       loopCount = pContentIdList->GetCount();
-       for (int i = 0; i < loopCount; ++i)
-       {
-               ContentId* pContentId = static_cast<ContentId*>(pContentIdList->GetAt(i));
-               if (pContentId != null)
-               {
-                       MoveToContentFile(*pContentId, destDirectory);
-               }
-       }
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return E_SUCCESS;
@@ -841,19 +935,15 @@ FileListPresentationModel::DeleteContentFile(const ContentId& contentId)
 
                return E_SUCCESS;
        }
-       ContentManager contentManager;
-       result r = contentManager.Construct();
-       if (r == E_SUCCESS)
-       {
-               r = contentManager.DeleteContent(contentId);
-       }
+       result r = __pContentManager->DeleteContent(contentId);
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return r;
 }
 
 result
-FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const String& destDirectory)
+FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const String& destDirectory, const bool isCopyOperation)
 {
        AppLogDebug("ENTER");
        if (contentId.ToString().IsEmpty() == true || destDirectory.IsEmpty() == true)
@@ -861,129 +951,93 @@ FileListPresentationModel::MoveToContentFile(const ContentId& contentId, const S
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
                return E_FAILURE;
        }
+       result r = E_SUCCESS;
+       ContentInfo* pContentInfo = __pContentManager->GetContentInfoN(contentId);
+       if (pContentInfo == null)
+       {
+               AppLogDebug("Santhosh %s", destDirectory.GetPointer());
+               AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
+               return E_FAILURE;
+       }
 
-       ContentManager contentManager;
-       result r = contentManager.Construct();
-       if (r == E_SUCCESS)
+       String filePath = pContentInfo->GetContentPath();
+       if (filePath.GetLength() < 4)
        {
-               ContentInfo* pContentInfo = contentManager.GetContentInfoN(contentId);
-               if (pContentInfo == null)
-               {
-                       AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
-                       return E_FAILURE;
-               }
+               AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
+               return E_SUCCESS;
+       }
 
-               String filePath = pContentInfo->GetContentPath();
-               if (filePath.GetLength() < 4)
-               {
-                       AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
+       String destPath;
+       if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
+       {
+               destPath.Append(destDirectory);
+               destPath.Append(GetFileNameFromFullPath(filePath, true));
+       }
+       else
+       {
+               destPath.Append(destDirectory);
+               destPath.Append(DIRECTORY_SEPARATOR);
+               destPath.Append(GetFileNameFromFullPath(filePath, true));
+       }
 
-                       return E_SUCCESS;
-               }
+       if (destPath.CompareTo(filePath) == 0)
+       {
+               AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
+               return E_SUCCESS;
+       }
 
-               String destPath;
-               if (destDirectory.EndsWith(DIRECTORY_SEPARATOR) == true)
-               {
-                       destPath.Append(destDirectory);
-                       destPath.Append(GetFileNameFromFullPath(filePath, true));
-               }
-               else
-               {
-                       destPath.Append(destDirectory);
-                       destPath.Append(DIRECTORY_SEPARATOR);
-                       destPath.Append(GetFileNameFromFullPath(filePath, true));
-               }
+       if (File::IsFileExist(destPath) == true)
+       {
+               File::Remove(destPath);
+       }
 
-               if (destPath.CompareTo(filePath) == 0)
-               {
-                       AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
+       r = File::Copy(filePath, destPath, false);
 
-                       return E_SUCCESS;
-               }
+       if ( r == E_STORAGE_FULL)
+       {
+               File::Remove(destPath);
+       }
+       ContentManager::ScanFile(destPath);
 
-               if (File::IsFileExist(destPath) == true)
+       if ( r == E_SUCCESS )
+       {
+               if ( isCopyOperation == false)
                {
-                       File::Remove(destPath);
+                       File::Remove(filePath);               // if Move Op remove original file
+                       ContentManager::ScanFile(filePath);
                }
+       }
 
-               result r = E_SUCCESS;
-
-               if (pContentInfo->GetContentType() == CONTENT_TYPE_IMAGE)
-               {
-
-                       r = File::Copy(filePath, destPath, false);
-                       if (r == E_SUCCESS)
-                       {
-                               ContentManager cntManager;
-                               result rt = cntManager.Construct();
-                               if (rt == E_SUCCESS)
-                               {
-                                       ImageContentInfo contentInfo;
-                                       rt = contentInfo.Construct(&destPath);
-                                       if (rt == E_SUCCESS)
-                                       {
-                                               cntManager.CreateContent(contentInfo);
-                                               cntManager.DeleteContent(contentId);
-                                       }
-                               }
-                       }
-               }
-               else if (pContentInfo->GetContentType() == CONTENT_TYPE_VIDEO)
-               {
-                       r = File::Copy(filePath, destPath, false);
+       delete pContentInfo;
 
-                       if (r == E_SUCCESS)
-                       {
-                               ContentManager cntManager;
-                               result rt = cntManager.Construct();
-                               if (rt == E_SUCCESS)
-                               {
-                                       VideoContentInfo contentInfo;
-                                       rt = contentInfo.Construct(&destPath);
-                                       {
-                                               cntManager.CreateContent(contentInfo);
-                                               cntManager.DeleteContent(contentId);
-                                       }
-                               }
-                       }
-               }
-               delete pContentInfo;
-               pContentInfo = null;
-       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return r;
 }
 
+void
+FileListPresentationModel::ClearProviderId(void)
+{
+       __providerId.Clear();
+}
+
 result
-FileListPresentationModel::StartAppControl( const String& providerId, const String& operationId,
-                                                                       const IMap* pDataList, IAppControlResponseListener* pListener)
+FileListPresentationModel::StartAppControl(const String& providerId, const String& operationId,
+               const String* pUriData, const Tizen::Base::String* pMimeType, const HashMap* pDataList,
+               IAppControlResponseListener* pListener)
 {
        AppLogDebug("ENTER");
-       AppLogDebug("FindAppControlN(%ls, %ls)", providerId.GetPointer(), operationId.GetPointer());
-       if (pDataList != null)
-       {
-               IList* pKeyList = pDataList->GetKeysN();
-               if (pKeyList != null)
-               {
-                       int keyCount = pKeyList->GetCount();
-                       for (int i = 0 ; i < keyCount ; ++i)
-                       {
-                               String* pKey = const_cast<String*>(static_cast<const String*>(pKeyList->GetAt(i)));
-                               String* pValue = const_cast<String*>(static_cast<const String*>(pDataList->GetValue(*pKey)));
-
-                               AppLogDebug("(%ls:%ls)", pKey == null ? L"(null)" : pKey->GetPointer(), pValue == null ? L"(null)" : pValue->GetPointer());
-                       }
-               }
-       }
        AppControl* pAc = AppManager::FindAppControlN(providerId, operationId);
+
+       ClearProviderId();
+       __providerId.Append(providerId);
+
        if (pAc == null)
        {
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
                return E_FAILURE;
        }
-       result r = pAc->Start(null, null, pDataList, pListener);
+       result r = pAc->Start(pUriData, pMimeType, pDataList, pListener);
 
        if (r == E_SUCCESS)
        {
@@ -1044,6 +1098,7 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
        }
 
        __albumName = albumName;
+       __providerId.Clear();
 
        if (__pDirectoryList != null)
        {
@@ -1054,7 +1109,8 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
        int loopCount = directoryList.GetCount();
        for (int i = 0; i < loopCount; ++i)
        {
-               __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>(static_cast<const String*>(directoryList.GetAt(i))))));
+               __pDirectoryList->Add(new (std::nothrow) String(*(const_cast<String*>
+                       (static_cast<const String*>(directoryList.GetAt(i))))));
        }
 
        if (__pContentInfoList != null)
@@ -1063,7 +1119,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)
@@ -1082,7 +1138,7 @@ FileListPresentationModel::SetCurrentAlbumInfo(const String& albumName, const IL
 }
 
 result
-FileListPresentationModel::RefreshCurrentAlbumContentInfoList(ContentType contentType)
+FileListPresentationModel::RefreshCurrentAlbumContentInfoList(const ContentType contentType)
 {
        AppLogDebug("ENTER");
        result r = RefreshContentInfoList(contentType);
@@ -1091,8 +1147,36 @@ FileListPresentationModel::RefreshCurrentAlbumContentInfoList(ContentType conten
        return r;
 }
 
+void
+FileListPresentationModel::AddDirectoryIfNew(const String& dirName)
+{
+       bool isMatched = false;
+       int dirCount = __pDirectoryList->GetCount();
+       if (__albumName != ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS"))//we are not in All albums
+       {
+               return;
+       }
+       for (int i = 0; i < dirCount ; ++i)
+       {
+               if (static_cast<String*>(__pDirectoryList->GetAt(i))->CompareTo(dirName) == 0)
+               {
+                       isMatched = true;
+                       break;
+               }
+       }
+       if (!isMatched)
+       {
+               String fullPath = Environment::GetMediaPath();
+               fullPath.Append(dirName);
+               __pDirectoryList->Add(new (std::nothrow) String(fullPath));
+
+       }
+}
+
+
+
 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))
@@ -1114,7 +1198,9 @@ FileListPresentationModel::RefreshContentInfoList(ContentType contentType)
        if (__pContentInfoList != null)
        {
                delete __pContentInfoList;
+               __pContentInfoList = null;
        }
+
        __pContentInfoList = GetContentInfoListInDirectoryListN(*__pDirectoryList, __albumContentType);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -1122,7 +1208,7 @@ FileListPresentationModel::RefreshContentInfoList(ContentType contentType)
 }
 
 String
-FileListPresentationModel::GetCurrentAlbumName(void)
+FileListPresentationModel::GetCurrentAlbumName(void) const
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1131,7 +1217,7 @@ FileListPresentationModel::GetCurrentAlbumName(void)
 }
 
 void
-FileListPresentationModel::SetCurrentAlbumName(String& albumName)
+FileListPresentationModel::SetCurrentAlbumName(const String& albumName)
 {
        AppLogDebug("ENTER");
        if (&albumName == null)
@@ -1146,7 +1232,7 @@ FileListPresentationModel::SetCurrentAlbumName(String& albumName)
 }
 
 ContentType
-FileListPresentationModel::GetCurrentAlbumContentType(void)
+FileListPresentationModel::GetCurrentAlbumContentType(void) const
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -1155,7 +1241,7 @@ FileListPresentationModel::GetCurrentAlbumContentType(void)
 }
 
 void
-FileListPresentationModel::SetCurrentAlbumContentType(ContentType contentType)
+FileListPresentationModel::SetCurrentAlbumContentType(const ContentType contentType)
 {
        AppLogDebug("ENTER");
        __albumContentType = contentType;
@@ -1163,7 +1249,7 @@ FileListPresentationModel::SetCurrentAlbumContentType(ContentType contentType)
 }
 
 IList*
-FileListPresentationModel::GetAlbumDirectoryListN(void)
+FileListPresentationModel::GetAlbumDirectoryListN(void) const
 {
        AppLogDebug("ENTER");
        IList* pAlbumDirectoryList = new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -1187,7 +1273,7 @@ FileListPresentationModel::GetAlbumDirectoryListN(void)
 }
 
 IList*
-FileListPresentationModel::GetAlbumContentInfoList(void)
+FileListPresentationModel::GetAlbumContentInfoList(void) const
 {
        AppLogDebug("ENTER");
        IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -1211,7 +1297,7 @@ FileListPresentationModel::GetAlbumContentInfoList(void)
 }
 
 ContentInfo*
-FileListPresentationModel::GetContentInfo(int index)
+FileListPresentationModel::GetContentInfo(const int index) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
@@ -1233,8 +1319,25 @@ FileListPresentationModel::GetContentInfo(int index)
        return pContentInfo;
 }
 
+IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList) const
+{
+       IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       int loopCount = indexList.GetCount();
+       for (int i = 0; i < loopCount; ++i)
+       {
+               const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
+
+               if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
+               {
+                       pContentIdList->Add(new (std::nothrow) ContentId((static_cast<ContentInfo*>(__pContentInfoList->GetAt(pIndex->ToInt())))->GetContentId()));
+               }
+       }
+
+       return pContentIdList;
+}
+
 int
-FileListPresentationModel::GetCurrentAlbumContentInfoCount(void)
+FileListPresentationModel::GetCurrentAlbumContentInfoCount(void) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null)
@@ -1249,7 +1352,7 @@ FileListPresentationModel::GetCurrentAlbumContentInfoCount(void)
 }
 
 ContentId
-FileListPresentationModel::GetContentInfoIndex(int index)
+FileListPresentationModel::GetContentInfoIndex(const int index) const
 {
        AppLogDebug("ENTER");
        if (__pContentInfoList == null || __pContentInfoList->GetCount() == 0)
@@ -1273,7 +1376,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)
@@ -1299,10 +1402,10 @@ FileListPresentationModel::GetContentFilePath(int index)
 
 Bitmap*
 FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnail,
-                                                                                                                                       const ThumbnailInfo& thumbmailInfo)
+               const ThumbnailInfo& thumbmailInfo)
 {
        AppLogDebug("ENTER");
-       Bitmap* overlayedImage = null;
+       Bitmap* pOverlayedImage = null;
 
        if (&thumbmailInfo != null)
        {
@@ -1329,7 +1432,6 @@ FileListPresentationModel::CoverVideoOverlayedImageOnThumbnailN(Bitmap& thumbnai
                {
                        mainCanvas.DrawBitmap(playRect, *playBitmap);
                        delete playBitmap;
-                       playBitmap = null;
                }
 
                Canvas durCanvas;
@@ -1342,26 +1444,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()));
 
@@ -1374,7 +1476,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());
@@ -1385,7 +1487,7 @@ FileListPresentationModel::GetShadedBackgroundBitmapN(Bitmap& bgBitmap,
 
 IList*
 FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& contentDirectoryList,
-                                                                                                                       ContentType contentType)const
+               ContentType contentType)const
 {
        AppLogDebug("ENTER");
        IList* pContentList = new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -1430,10 +1532,6 @@ FileListPresentationModel::GetContentInfoListInDirectoryListN(const IList& conte
                                {
                                        pContentList->AddItems(*pIList);
                                }
-                               else
-                               {
-                                       delete pIList;
-                               }
                        }
                }
        }
@@ -1495,3 +1593,96 @@ FileListPresentationModel::GetAppControlSelectionMode(void) const
 
        return __appControlSelectionMode;
 }
+
+void
+FileListPresentationModel::SetUpdateProgressStatus(const bool status)
+{
+       AppLogDebug("ENTER status = %d",status);
+       __updateProgressStatus = status;
+       AppLogDebug("EXIT");
+}
+
+result
+FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
+{
+       result r = E_SUCCESS;
+       ImageBuffer rotateBuffer;
+       ImageBuffer* pRotatedBuffer = null;
+       ImageFormat imageFormat;
+       Image img;
+       String filePath = GetContentFilePath(index);
+       ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
+       if (contentType == CONTENT_TYPE_VIDEO)
+       {
+               return r;
+       }
+
+       r = img.Construct();
+
+       if (r == E_SUCCESS)
+       {
+               imageFormat = img.GetImageFormat(filePath);
+
+               r = rotateBuffer.Construct(filePath);
+               if (r == E_SUCCESS)
+               {
+                       if (rotateMode == ROTATE_MODE_RIGHT)
+                       {
+                               pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
+                       }
+                       else
+                       {
+                               pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
+                       }
+               }
+
+               if (pRotatedBuffer != null)
+               {
+                       r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
+                       delete pRotatedBuffer;
+                       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()));
+}