Fixed issue 41991
[apps/osp/Gallery.git] / src / GlAlbumListEditorForm.cpp
index 3ee907f..ba29b1c 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
 //
@@ -19,7 +19,6 @@
  * @brief              This is the implementation file for AlbumListEditorForm class.
  */
 
-#include <FApp.h>
 #include "GlAlbumInfo.h"
 #include "GlAlbumListEditorForm.h"
 #include "GlAlbumListPresentationModel.h"
@@ -41,6 +40,10 @@ using namespace Tizen::Ui::Scenes;
 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
+static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera" + DIRECTORY_SEPARATOR;
+static const String RESERVED_CAMERA_PATH_EXT = Environment::GetExternalStoragePath() + L"Camera" + DIRECTORY_SEPARATOR;
+static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
+static const String RESERVED_EXTERNAL_MEDIA_PATH = Environment::GetExternalStoragePath();
 
 static const int GAP_W_POPUP_ITEM = 5;
 static const int W_DELETE_POPUP = 600;
@@ -59,21 +62,20 @@ static const int ALPHA_FOLDER_BITMAP_DIM = 70;
 
 static const int IDA_ALBUM_EDIT = 503 ;
 
-AlbumListEditorForm::AlbumListEditorForm()
+AlbumListEditorForm::AlbumListEditorForm(void)
        : __checkedCount(0)
        , __pSelectCountLabel(null)
        , __pEditorFolderIconList(null)
        , __pShareContextMenu(null)
        , __pDeletePopup(null)
+       , __pFileUpdateTimer(null)
        , __pPresentationModel(null)
-       , __pFileDeleteTimer(null)
 {
        AppLogDebug("ENTER");
-       __overlayMsg = false;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
-AlbumListEditorForm::~AlbumListEditorForm()
+AlbumListEditorForm::~AlbumListEditorForm(void)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -93,15 +95,16 @@ result
 AlbumListEditorForm::OnInitializing(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        __pPresentationModel = AlbumListPresentationModel::GetInstance();
        __pPresentationModel->ClearThumbnailRequests();
-       __pPresentationModel->AddPresentationModelListener(this);
+       r = __pPresentationModel->AddPresentationModelListener(this);
 
        SetFormBackEventListener(this);
        GetHeader()->AddActionEventListener(*this);
        GetFooter()->AddActionEventListener(*this);
 
-       result r = InitializeControl();
+       r = InitializeControl();
        if (r != E_SUCCESS)
        {
                AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
@@ -116,36 +119,54 @@ result
 AlbumListEditorForm::OnTerminating(void)
 {
        AppLogDebug("ENTER");
-       __pPresentationModel->RemovePresentationModelListener(*this);
+       result r = E_SUCCESS;
+       r = __pPresentationModel->RemovePresentationModelListener(*this);
+       __pPresentationModel->RemoveContentEventListener(*this);
 
        if (__pDeletePopup != null)
        {
                delete __pDeletePopup;
                __pDeletePopup = null;
        }
-       if (__pFileDeleteTimer != null)
+       if (__pFileUpdateTimer != null)
        {
-               delete __pFileDeleteTimer;
-               __pFileDeleteTimer = null;
+               delete __pFileUpdateTimer;
+               __pFileUpdateTimer = null;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return E_SUCCESS;
+       return r;
 }
 
 void
-AlbumListEditorForm::OnContentUpdated()
+AlbumListEditorForm::OnContentUpdated(void)
 {
        AppLogDebug("ENTER");
+       int maxCount = __pPresentationModel->GetFolderCount();
+       if(__pDeletePopup != null)
+       {
+               if(__pDeletePopup->IsVisible() == true)
+               {
+                       __pDeletePopup->Destroy();
+                       __pDeletePopup = null;
+                       InitializePopup();
+               }
+       }
+
+       for (int i = 0; i < maxCount; ++i)
+       {
+               __pEditorFolderIconList->SetItemChecked(i, false);
+       }
        SceneManager* pSceneManager = SceneManager::GetInstance();
        pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 result
-AlbumListEditorForm::InitializeControl()
+AlbumListEditorForm::InitializeControl(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        String tempString;
 
        CreateIconListView();
@@ -154,18 +175,18 @@ AlbumListEditorForm::InitializeControl()
        __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
        AppAssert(__pSelectCountLabel);
 
-       __pShareContextMenu = new ContextMenu();
-       __pShareContextMenu->Construct(Point(X_POSITION_SHARE_CONTEXTMENU, Y_POSITION_SHARE_CONTEXTMENU),
+       __pShareContextMenu = new (std::nothrow) ContextMenu();
+       r = __pShareContextMenu->Construct(Point(X_POSITION_SHARE_CONTEXTMENU, Y_POSITION_SHARE_CONTEXTMENU),
                        CONTEXT_MENU_STYLE_LIST);
-       __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
-                       ACTION_ID_CONTEXT_MENU_MESSAGE);
-       __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXT_MENU_EMAIL);
+       r = __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
+                       IDA_CONTEXT_MENU_MESSAGE);
+       r = __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_EMAIL);
        __pShareContextMenu->AddActionEventListener(*this);
 
-       InitializePopup();
+       r = InitializePopup();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return E_SUCCESS;
+       return r;
 }
 
 result
@@ -182,6 +203,8 @@ AlbumListEditorForm::InitializePopup(void)
                Label* pLabel = new (std::nothrow) Label();
                pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
                                ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
+               pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+               pLabel->SetTextConfig(34,LABEL_TEXT_STYLE_BOLD);
 
                Button* pDeleteButton = new (std::nothrow) Button();
                pDeleteButton->Construct(
@@ -190,7 +213,7 @@ AlbumListEditorForm::InitializePopup(void)
                pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
                pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
                pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
-               pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
+               pDeleteButton->SetActionId(IDA_DELETE_POPUP_DEL);
                pDeleteButton->AddActionEventListener(*this);
 
                Button* pCancelButton = new (std::nothrow) Button();
@@ -198,12 +221,12 @@ AlbumListEditorForm::InitializePopup(void)
                                Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM, Y_DELETE_BUTTON,
                                                popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
                                                ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
-               pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
+               pCancelButton->SetActionId(IDA_DELETE_POPUP_CANCEL);
                pCancelButton->AddActionEventListener(*this);
 
-               __pDeletePopup->AddControl(*pLabel);
-               __pDeletePopup->AddControl(*pDeleteButton);
-               __pDeletePopup->AddControl(*pCancelButton);
+               __pDeletePopup->AddControl(pLabel);
+               __pDeletePopup->AddControl(pDeleteButton);
+               __pDeletePopup->AddControl(pCancelButton);
        }
        else
        {
@@ -219,7 +242,7 @@ void
 AlbumListEditorForm::CreateIconListView(void)
 {
        AppLogDebug("ENTER");
-       __pEditorFolderIconList = static_cast< IconListView* >(GetControl(L"IDC_ICONLISTVIEW_ALBUM_LIST_EDITOR"));
+       __pEditorFolderIconList = static_cast<IconListView*>(GetControl(L"IDC_ICONLISTVIEW_ALBUM_LIST_EDITOR"));
        AppAssert(__pEditorFolderIconList);
 
        __pEditorFolderIconList->SetItemProvider(*this);
@@ -250,7 +273,7 @@ AlbumListEditorForm::CreateItem(int index)
        int canvasWidth = 64;
        int canvasHeight = 64;
 
-       IconListViewItem* pIconListviewItem = new IconListViewItem();
+       IconListViewItem* pIconListviewItem = new (std::nothrow) IconListViewItem();
 
        IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
        AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
@@ -294,27 +317,31 @@ AlbumListEditorForm::CreateItem(int index)
        pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
        pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
 
-       if (pBitmapRenameBg != null &&  pBitmapRename != null)
+       if (pBitmapRenameBg != null && pBitmapRename != null)
        {
 
                pEditAlbumCanvas = new (std::nothrow) Canvas();
-               pEditAlbumCanvas->Construct(Rectangle(0,0,canvasWidth,canvasHeight));
-               pEditAlbumCanvas->DrawBitmap(Point(0,0),*pBitmapRenameBg);
-               pEditAlbumCanvas->DrawBitmap(Point(0,0),*pBitmapRename);
+               pEditAlbumCanvas->Construct(Rectangle(0, 0, canvasWidth, canvasHeight));
+               pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRenameBg);
+               pEditAlbumCanvas->DrawBitmap(Point(0, 0), *pBitmapRename);
 
 
                pEditAlbumBitmap = new (std::nothrow) Bitmap();
 
                if (pEditAlbumBitmap != NULL)
                {
-                       pEditAlbumBitmap->Construct(*pEditAlbumCanvas,Rectangle(0,0,canvasWidth,canvasHeight));
+                       pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
                        delete pEditAlbumCanvas;
                }
 
                albumName = pAlbumInfo->GetAlbumName();
                String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
+               String albumPath = pAlbumInfo->GetDirectory(0);
+               albumPath.Append(DIRECTORY_SEPARATOR);
 
-               if (index == 0  || reservedCameraName.Equals(albumName,true))
+               if (index == 0 || (reservedCameraName.Equals(albumName, true) &&
+                       (RESERVED_CAMERA_PATH.Equals(albumPath, true) || RESERVED_CAMERA_PATH_EXT.Equals(albumPath, true)))
+                       || RESERVED_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
                {
                        // rename disabled
                }
@@ -322,13 +349,13 @@ AlbumListEditorForm::CreateItem(int index)
                {
                        pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
                }
+
                if (pEditAlbumBitmap != null)
                {
                        delete pEditAlbumBitmap;
                }
        }
 
-
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return pIconListviewItem;
@@ -341,13 +368,13 @@ AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int inde
 
        if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
        {
-               if (status == ICON_LIST_VIEW_ITEM_CHECKED) //to be unchecked after this call
+               if (status == ICON_LIST_VIEW_ITEM_CHECKED)
                {
-                       --__checkedCount;
+                       ++__checkedCount;
                }
-               else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED) //will get checked after this call hence increment
+               else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
                {
-                       ++__checkedCount;
+                       --__checkedCount;
                }
 
                String tempString;
@@ -368,6 +395,7 @@ AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int inde
                __pSelectCountLabel->RequestRedraw();
                __pEditorFolderIconList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);
        }
+
        SetButtonState();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -383,9 +411,17 @@ AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconList
        pSelectedIndex->Construct();
        //Adding the Action Type
        pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
-       pSelectedIndex->Add(new (std::nothrow) Integer(FILE_MOVE_ACTION));
+       pSelectedIndex->Add(new (std::nothrow) Integer(FILE_ACTION_MOVE));
        pSelectedIndex->Add(new (std::nothrow) Integer(index));
 
+       if( __pEditorFolderIconList->IsItemChecked(index) == false )
+       {
+               __pEditorFolderIconList->SetItemChecked(index,true);
+       }
+       else
+       {
+               __pEditorFolderIconList->SetItemChecked(index,false);
+       }
        pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -401,7 +437,7 @@ AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
 }
 
 result
-AlbumListEditorForm::DeleteFolder()
+AlbumListEditorForm::DeleteFolder(void)
 {
 
        AppLogDebug("ENTER");
@@ -413,17 +449,17 @@ AlbumListEditorForm::DeleteFolder()
                return E_FAILURE;
        }
 
-       if (__pFileDeleteTimer != null)
+       if (__pFileUpdateTimer != null)
        {
-               delete __pFileDeleteTimer;
+               delete __pFileUpdateTimer;
        }
-       __pFileDeleteTimer = new FileDeleteTimer(pIndexList, __pPresentationModel, this);
-       result r = __pFileDeleteTimer->StartTimer();
+       __pFileUpdateTimer = new (std::nothrow) FileUpdateTimer(pIndexList, __pPresentationModel, this, FILE_ACTION_DELETE);
+       result r = __pFileUpdateTimer->StartTimer();
 
        if (IsFailed(r))
        {
-               delete __pFileDeleteTimer;
-               __pFileDeleteTimer = null;
+               delete __pFileUpdateTimer;
+               __pFileUpdateTimer = null;
                return E_FAILURE;
        }
        else
@@ -459,9 +495,10 @@ AlbumListEditorForm::GetItemCheckedIndexListN(void) const
 }
 
 void
-AlbumListEditorForm::SetAllCheckState(bool state)
+AlbumListEditorForm::SetAllCheckState(const bool state)
 {
        AppLogDebug("ENTER");
+
        int maxCount = __pPresentationModel->GetFolderCount();
        String tempString;
 
@@ -482,7 +519,7 @@ AlbumListEditorForm::SetAllCheckState(bool state)
                tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
        }
 
-       for (int i = 0 ; i < maxCount; ++i)
+       for (int i = 0; i < maxCount; ++i)
        {
                __pEditorFolderIconList->SetItemChecked(i, state);
                __pEditorFolderIconList->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
@@ -494,11 +531,12 @@ AlbumListEditorForm::SetAllCheckState(bool state)
        __checkedCount = GetCheckedFolderCount();
 
        SetButtonState();
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 int
-AlbumListEditorForm::GetCheckedFolderCount()
+AlbumListEditorForm::GetCheckedFolderCount(void) const
 {
        AppLogDebug("ENTER");
        int maxCount = __pPresentationModel->GetFolderCount();
@@ -522,7 +560,8 @@ AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
        AppLogDebug("ENTER");
        switch (actionId)
        {
-       case ACTION_ID_ALBUM_LIST_SELECT_ALL:
+       case IDA_ALBUM_LIST_SELECT_ALL:
+       {
                if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
                {
                        SetAllCheckState(false);
@@ -531,40 +570,50 @@ AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
                {
                        SetAllCheckState(true);
                }
-               break;
-       case ACTION_ID_FOOTER_DELETE:
+       }
+       break;
+
+       case IDA_FOOTER_DELETE:
        {
                __pDeletePopup->SetShowState(true);
                __pDeletePopup->Show();
        }
        break;
-       case ACTION_ID_FOOTER_SHARE:
+
+       case IDA_FOOTER_SHARE:
+       {
                __pShareContextMenu->SetShowState(true);
                __pShareContextMenu->Show();
-               break;
-       case ACTION_ID_CONTEXT_MENU_MESSAGE:
+       }
+       break;
+
+       case IDA_CONTEXT_MENU_MESSAGE:
        {
                OnRequestMessage();
-               break;
        }
-       case ACTION_ID_CONTEXT_MENU_EMAIL:
+       break;
+
+       case IDA_CONTEXT_MENU_EMAIL:
        {
                OnRequestEmail();
-               break;
        }
-       case ACTION_ID_DELETE_POPUP_DEL:
+       break;
+
+       case IDA_DELETE_POPUP_DEL:
        {
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Show();
                DeleteFolder();
-               break;
        }
-       case ACTION_ID_DELETE_POPUP_CANCEL:
+       break;
+
+       case IDA_DELETE_POPUP_CANCEL:
        {
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Show();
-               break;
        }
+       break;
+
        default:
                break;
        }
@@ -585,30 +634,34 @@ AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
                const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER OnSceneActivatedN");
+       String tempString;
        __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
-       __pEditorFolderIconList->UpdateList();
+
+       int count = __pPresentationModel->GetFolderCount();
+
        __pPresentationModel->AddContentEventListener(this);
 
        __checkedCount = GetCheckedFolderCount();
 
-       String tempString;
-
-       if (__checkedCount == 0)
-       {
-               tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
-       }
-       else if (__checkedCount == 1)
+       if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
        {
-               tempString = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
+               tempString.Format(FORMAT_BUFFER_SIZE,
+                                               ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
        }
        else
        {
-               tempString.Format(FORMAT_BUFFER_SIZE,
-                               ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
+               for ( int index = 0 ; index < count ; index++ )
+               {
+                       __pEditorFolderIconList->SetItemChecked(index,false);
+               }
+
+               __pEditorFolderIconList->UpdateList();
+
+               tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
        }
 
        __pSelectCountLabel->SetText(tempString);
-       __pSelectCountLabel->RequestRedraw();
+       __pSelectCountLabel->Invalidate(true);
 
        SetButtonState();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -695,7 +748,7 @@ AlbumListEditorForm::OnRequestMessage(void)
 
                ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
                pArrayList->Construct();
-               for (int i = 0 ; i < maxCount; ++i)
+               for (int i = 0; i < maxCount; ++i)
                {
                        if (__pEditorFolderIconList->IsItemChecked (i))
                        {
@@ -711,6 +764,7 @@ AlbumListEditorForm::OnRequestMessage(void)
                                        {
                                                break;
                                        }
+
                                        pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
                                }
 
@@ -726,8 +780,17 @@ AlbumListEditorForm::OnRequestMessage(void)
                pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_MESSAGE_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
                pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
 
-               __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
+               r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
                                null, null, pDataList, null);
+
+               if (r == E_MAX_EXCEEDED)
+               {
+                       MessageBox messageBox;
+                       messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
+                                       MSGBOX_STYLE_NONE, 3000);
+                       int modalResult;
+                       messageBox.ShowAndWait(modalResult);
+               }
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -761,9 +824,9 @@ AlbumListEditorForm::OnRequestEmail(void)
 
                ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
                pArrayList->Construct();
-               for (int i = 0 ; i < maxCount; ++i)
+               for (int i = 0; i < maxCount; ++i)
                {
-                       if (__pEditorFolderIconList->IsItemChecked (i))
+                       if (__pEditorFolderIconList->IsItemChecked(i))
                        {
                                AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(i));
                                IList* pContentIdList = pAlbumInfo->GetContentIdListN();
@@ -777,6 +840,7 @@ AlbumListEditorForm::OnRequestEmail(void)
                                        {
                                                break;
                                        }
+
                                        pArrayList->Add(new (std::nothrow) String(pContentInfo->GetContentPath()));
                                }
 
@@ -791,14 +855,23 @@ AlbumListEditorForm::OnRequestEmail(void)
                pDataList->Construct();
                pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
 
-               __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
+               r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
                                new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
+
+               if (r == E_MAX_EXCEEDED)
+               {
+                       MessageBox messageBox;
+                       messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
+                                       MSGBOX_STYLE_NONE, 3000);
+                       int modalResult;
+                       messageBox.ShowAndWait(modalResult);
+               }
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
-AlbumListEditorForm::SetFooterButtonsState(bool enableState)
+AlbumListEditorForm::SetFooterButtonsState(const bool enableState)
 {
        AppLogDebug("ENTER");
        Footer* pFooter = GetFooter();