Fixed issue 41991
[apps/osp/Gallery.git] / src / GlAlbumListEditorForm.cpp
index 3f069d0..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
 //
@@ -43,6 +43,7 @@ static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Val
 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;
@@ -141,6 +142,21 @@ void
 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()));
@@ -187,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(
@@ -206,9 +224,9 @@ AlbumListEditorForm::InitializePopup(void)
                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
        {
@@ -323,7 +341,7 @@ AlbumListEditorForm::CreateItem(int index)
 
                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_MEDIA_PATH.Equals(albumPath, true) || RESERVED_EXTERNAL_MEDIA_PATH.Equals(albumPath, true))
                {
                        // rename disabled
                }
@@ -396,6 +414,14 @@ AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconList
        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()));
 }
@@ -608,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)
+       if ( previousSceneId == IDSCN_ALBUM_NAME_EDITOR )
        {
-               tempString = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
-       }
-       else if (__checkedCount == 1)
-       {
-               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()));
@@ -750,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()));
 }
@@ -816,8 +855,17 @@ 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()));
 }