Fix for 48036
[apps/osp/Gallery.git] / src / GlAllListPanel.cpp
index fbdd774..beeefd6 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
 //
@@ -90,6 +90,18 @@ AllListPanel::Refresh(void)
 
                pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_ALBUM_LIST));
        }
+       else
+       {
+               SceneManager* pSceneManager = SceneManager::GetInstance();
+               TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager", GetErrorMessage(GetLastResult()));
+
+               FileListForm* pFileListForm = dynamic_cast<FileListForm*>(pSceneManager->GetCurrentScene()->GetForm());
+               if (pFileListForm != null)
+               {
+                       pFileListForm->SetMenuState(true);
+               }
+       }
+
        __pContentIconListView->UpdateList();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -138,7 +150,7 @@ AllListPanel::OnInitializing(void)
        __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
        __pContentIconListView->AddIconListViewItemEventListener(*this);
        __pContentIconListView->SetTouchAnimationEnabled(false);
-       result r = AddControl(*__pContentIconListView);
+       result r = AddControl(__pContentIconListView);
        __pContentIconListView->SetShowState(true);
 
        __itemCount = 0;
@@ -236,6 +248,7 @@ void
 AllListPanel::OnIconListViewItemStateChanged(IconListView& view, int index, IconListViewItemStatus status)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        if (status == ICON_LIST_VIEW_ITEM_SELECTED)
        {
                if (__pPresentationModel->GetCurrentAlbumContentInfoCount() <= 0)
@@ -262,9 +275,18 @@ AllListPanel::OnIconListViewItemStateChanged(IconListView& view, int index, Icon
                pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pArrayList);
                pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_INDEX), new (std::nothrow) String(listIndex));
 
-               __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null,
+               r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null,
                                new (std::nothrow) String(APPCONTROL_MIME_IMAGE_ALL), 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);
+               }
+
                String* pTemp = null;
                loopCount = pArrayList->GetCount();
                for (int i = 0; i < loopCount; ++i)
@@ -301,10 +323,24 @@ AllListPanel::OnThumbnailDecoded(const int index)
 }
 
 void
+AllListPanel::ChangeOrientation(void)
+{
+       AppLogDebug("ENTER");
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
+       TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
+
+       Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
+       SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
+       __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
+}
+
+void
 AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                                                                const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER");
+       ChangeOrientation();
 
        __pPresentationModel = FileListPresentationModel::GetInstance();
 
@@ -346,6 +382,16 @@ AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                if (pFileListForm != null)
                {
                        pFileListForm->SetTitleText(__pPresentationModel->GetCurrentAlbumName());
+
+                       if (__itemCount == 0)
+                       {
+                               pFileListForm->SetMenuState(false);
+                       }
+                       else
+                       {
+                               pFileListForm->SetMenuState(true);
+                       }
+
                }
                __pPresentationModel->AddContentEventListener(pFileListForm);
        }