Fixed prevent issue
[apps/osp/Gallery.git] / src / GlAllListEditorPanel.cpp
index c4c28ea..d019e21 100644 (file)
@@ -38,9 +38,9 @@ using namespace Tizen::Media;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
-static const int H_COUNT_LABEL = 48;
-static const int H_COUNT_LABEL_BUTTON = 42;
-static const int W_COUNT_LABEL_BUTTON = 42;
+static const float H_COUNT_LABEL = 48.0f;
+static const float H_COUNT_LABEL_BUTTON = 42.0f;
+static const float W_COUNT_LABEL_BUTTON = 42.0f;
 static const int COUNT_LABEL_FONT_SIZE = 33;
 static const int H_CONTENT_MARGIN = 9;
 static const int W_CONTENT_MARGIN = 6;
@@ -96,8 +96,9 @@ AllListEditorPanel::OnInitializing(void)
        __pPresentationModel->ClearThumbnailRequests();
        __pPresentationModel->AddPresentationModelListener(this);
 
-       Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
-       SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
+       FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
+       SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
+
 
        __pContentIconListView = new (std::nothrow) IconListView();
        __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
@@ -118,24 +119,24 @@ 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();
        String strTmp;
        strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED").GetPointer();
        __pLabelSelectCnt->Construct(
-                       Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), strTmp);
+                       FloatRectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL), strTmp);
        __pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
        __pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
        __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();
-       __pButtonSelectRegion->Construct(Rectangle(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10,
+       __pButtonSelectRegion->Construct(FloatRectangle(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10,
                        clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON),
                        EMPTY_SPACE);
        __pButtonSelectRegion->SetActionId(IDA_BUTTON_MOVE_TO_SELECTION);
@@ -148,7 +149,7 @@ AllListEditorPanel::OnInitializing(void)
                __pButtonSelectRegion->SetNormalBitmap(Point(buttonRegionRect.width, buttonRegionRect.height),
                                *pSelectionBitmap);
        }
-       AddControl(*__pButtonSelectRegion);
+       AddControl(__pButtonSelectRegion);
 
        if (pSelectionBitmap != null)
        {
@@ -425,6 +426,9 @@ AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                                                                const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER");
+
+       ChangeOrientation();
+
        __pPresentationModel = FileListPresentationModel::GetInstance();
 
        SceneManager* pSceneManager = SceneManager::GetInstance();
@@ -444,18 +448,22 @@ AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                                {
                                        __pContentIconListView->SetItemChecked(i, false);
                                }
+                               __pContentIconListView->UpdateList();
                        }
 
-                       ifpArgs->GetCount() > 0) //SomeItems are Still Selected.
+                       if (pArgs->GetCount() > 0) //SomeItems are Still Selected.
                        {
                                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);
+                                       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);
                        }
                }
 
@@ -618,6 +626,21 @@ void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum Fil
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
+void
+AllListEditorPanel::ChangeOrientation(void)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
+       TryReturn(pForm != null,, "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
+
+       FloatRectangle clientAreaBounds = pForm->GetClientAreaBoundsF();
+       SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height);
+       __pContentIconListView->SetBounds(0.0f, 0.0f, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL);
+       __pLabelSelectCnt->SetBounds(0.0f, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL);
+       __pButtonSelectRegion->SetBounds(clientAreaBounds.width - W_COUNT_LABEL_BUTTON - 10.0f,
+                       clientAreaBounds.height - H_COUNT_LABEL_BUTTON - 4.0f, W_COUNT_LABEL_BUTTON, H_COUNT_LABEL_BUTTON);
+}
+
 result
 AllListEditorPanel::OnRequestMessage(void)
 {
@@ -655,7 +678,7 @@ AllListEditorPanel::OnRequestMessage(void)
        r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE, null,
                        null, pDataList, null);
 
-       if(r == E_MAX_EXCEEDED)
+       if (r == E_MAX_EXCEEDED)
        {
                MessageBox messageBox;
                messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
@@ -698,14 +721,15 @@ AllListEditorPanel::OnRequestEmail(void)
                }
        }
 
+       const String uriData = APPCONTROL_URI_MAIL_TO;
        HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
        pDataList->Construct();
        pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
 
        r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
-                       new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
+                       &uriData, null, pDataList, null);
 
-       if(r == E_MAX_EXCEEDED)
+       if (r == E_MAX_EXCEEDED)
        {
                MessageBox messageBox;
                messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
@@ -751,11 +775,12 @@ AllListEditorPanel::OnRequestSlideShow(void)
        pDataList->Construct();
        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);
+       const String mimeType = APPCONTROL_MIME_IMAGE_ALL;
 
        r = __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_IMAGE, APPCONTROL_OPERATION_ID_VIEW, null,
-                       new (std::nothrow) String(APPCONTROL_MIME_IMAGE_ALL), pDataList, null);
+                       &mimeType, pDataList, null);
 
-       if(r == E_MAX_EXCEEDED)
+       if (r == E_MAX_EXCEEDED)
        {
                MessageBox messageBox;
                messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
@@ -776,14 +801,14 @@ AllListEditorPanel::ResetSelection(void)
        AppLogDebug("ENTER");
        __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
        __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
+       __pContentIconListView->UpdateList();
 
-       for ( int index = 0; index < __itemCount; index++)
+       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");
 
@@ -899,3 +924,28 @@ AllListEditorPanel::OnRequestRotate(RotateMode rotateMode)
        }
        return E_SUCCESS;
 }
+
+void AllListEditorPanel::CancelUpdateProgress(void)
+{
+       if (__pFileUpdateTimer!= null && __pFileUpdateTimer->IsStarted())
+       {
+               __pFileUpdateTimer->Cancel();
+               delete __pFileUpdateTimer;
+               __pFileUpdateTimer = null;
+       }
+}
+
+void
+AllListEditorPanel::OnScanDirStart()
+{
+       AppLogDebug("ENTER");
+       __pFileListEditorForm->SetProgressState(true);
+       AppLogDebug("EXIT");
+}
+void
+AllListEditorPanel::OnScanDirComplete()
+{
+       AppLogDebug("ENTER");
+       __pFileListEditorForm->SetProgressState(false);
+       AppLogDebug("EXIT");
+}