Fixed issue 42036
[apps/osp/Gallery.git] / src / GlAllListEditorPanel.cpp
index 182b7c0..5314ae9 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
 //
@@ -118,7 +118,7 @@ AllListEditorPanel::OnInitializing(void)
        __pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT);
        __pContentIconListView->AddIconListViewItemEventListener(*this);
        __pContentIconListView->SetTouchAnimationEnabled(false);
-       AddControl(*__pContentIconListView);
+       AddControl(__pContentIconListView);
        __pContentIconListView->SetShowState(true);
 
        __pLabelSelectCnt = new (std::nothrow) Label();
@@ -131,7 +131,7 @@ AllListEditorPanel::OnInitializing(void)
        __pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
        __pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
        __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
-       AddControl(*__pLabelSelectCnt);
+       AddControl(__pLabelSelectCnt);
        __pLabelSelectCnt->Invalidate(true);
 
        __pButtonSelectRegion = new (std::nothrow) Button();
@@ -148,7 +148,7 @@ AllListEditorPanel::OnInitializing(void)
                __pButtonSelectRegion->SetNormalBitmap(Point(buttonRegionRect.width, buttonRegionRect.height),
                                *pSelectionBitmap);
        }
-       AddControl(*__pButtonSelectRegion);
+       AddControl(__pButtonSelectRegion);
 
        if (pSelectionBitmap != null)
        {
@@ -435,16 +435,32 @@ AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
 
        if (previousSceneId == IDSCN_ALL_LIST_SELECTION)
        {
-               if (pArgs != null && pArgs->GetCount() > 0)
+               if (pArgs != null)
                {
-                       IList* pSeletedIndexList = pArgs;
-                       int loopCount = pSeletedIndexList->GetCount();
-                       for (int i = 0; i < loopCount; ++i)
+                       if (__pContentIconListView != null)
                        {
-                               int index = static_cast<Integer*>(pSeletedIndexList->GetAt(i))->ToInt();
-                               __pContentIconListView->SetItemChecked(index, true);
+                               int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
+                               for (int i = 0; i < loopCount; ++i)
+                               {
+                                       __pContentIconListView->SetItemChecked(i, false);
+                               }
+                               __pContentIconListView->UpdateList();
+                       }
+
+                       if (pArgs->GetCount() > 0) //SomeItems are Still Selected.
+                       {
+                               IList* pSeletedIndexList = pArgs;
+                               int loopCount = pSeletedIndexList->GetCount();
+                               if (__pContentIconListView != null)
+                               {
+                                       for (int i = 0; i < loopCount; ++i)
+                                       {
+                                               int index = static_cast<Integer*>(pSeletedIndexList->GetAt(i))->ToInt();
+                                               __pContentIconListView->SetItemChecked(index, true);
+                                       }
+                                       __pContentIconListView->UpdateList();
+                               }
                        }
-                       __pContentIconListView->RequestRedraw(true);
                }
 
                int checkedCount = GetItemCheckedCount();
@@ -466,7 +482,6 @@ AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
 
                __pLabelSelectCnt->SetText(strTmp);
                __pLabelSelectCnt->RequestRedraw(true);
-               SetButtonState();
        }
        else if (previousSceneId == IDSCN_ALL_LIST)
        {
@@ -511,6 +526,10 @@ AllListEditorPanel::GetItemCheckedCount(void) const
                        {
                                ++count;
                        }
+                       else
+                       {
+                               AppLog("Index i = %d is Not Checked", i);
+                       }
                }
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -592,11 +611,13 @@ void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum Fil
        SceneManager* pSceneManager = SceneManager::GetInstance();
        if (GetItemCount() > 0)
        {
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST));
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
+                                                                  SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
        }
        else
        {
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST,SCENE_TRANSITION_ANIMATION_TYPE_NONE,
+                                                                  SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -605,6 +626,7 @@ result
 AllListEditorPanel::OnRequestMessage(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        IList* pIndexList = GetItemCheckedIndexListN();
        if (pIndexList == null || pIndexList->GetCount() <= 0)
        {
@@ -634,17 +656,28 @@ AllListEditorPanel::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, null,
+       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()));
 
-       return E_SUCCESS;
+       return r;
 }
 
 result
 AllListEditorPanel::OnRequestEmail(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
+
        IList* pIndexList = GetItemCheckedIndexListN();
        if (pIndexList == null || pIndexList->GetCount() <= 0)
        {
@@ -673,17 +706,28 @@ AllListEditorPanel::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()));
 
-       return E_SUCCESS;
+       return r;
 }
 
 result
 AllListEditorPanel::OnRequestSlideShow(void)
 {
        AppLogDebug("ENTER");
+       result r = E_SUCCESS;
        IList* pIndexList = GetItemCheckedIndexListN();
        if (pIndexList == null)
        {
@@ -712,13 +756,22 @@ AllListEditorPanel::OnRequestSlideShow(void)
        pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_SLIDE_SHOW));
        pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
 
-       __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);
+       }
+
        delete pIndexList;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return E_SUCCESS;
+       return r;
 }
 
 void
@@ -727,14 +780,14 @@ AllListEditorPanel::ResetSelection(void)
        AppLogDebug("ENTER");
        __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
        __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
+       __pContentIconListView->UpdateList();
 
        for ( int index = 0; index < __itemCount; index++)
        {
                __pContentIconListView->SetItemChecked(index, false);
+               __pContentIconListView->RefreshList(index,LIST_REFRESH_TYPE_ITEM_MODIFY);
        }
 
-       __pContentIconListView->UpdateList();
-
        String strTmp;
        strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
 
@@ -850,3 +903,13 @@ AllListEditorPanel::OnRequestRotate(RotateMode rotateMode)
        }
        return E_SUCCESS;
 }
+
+void AllListEditorPanel::CancelUpdateProgress(void)
+{
+       if( __pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted())
+       {
+               __pFileUpdateTimer->Cancel();
+               delete __pFileUpdateTimer;
+               __pFileUpdateTimer = null;
+       }
+}