delete progress bar implementation
authorDivya Darshini <d.darshini@samsung.com>
Fri, 5 Apr 2013 10:37:34 +0000 (16:07 +0530)
committerDivya Darshini <d.darshini@samsung.com>
Fri, 5 Apr 2013 10:37:34 +0000 (16:07 +0530)
Change-Id: I0985fcc135ed89c527f7143c9f0e4fe855f7f30c

15 files changed:
inc/GlAlbumListEditorForm.h
inc/GlAlbumListPresentationModel.h
inc/GlFileDeleteTimer.h
inc/GlFileListPresentationModel.h
inc/GlIContentFileDeleteManager.h [new file with mode: 0644]
src/GlAlbumListEditorForm.cpp
src/GlAlbumListForm.cpp
src/GlAlbumListPresentationModel.cpp
src/GlAllListEditorPanel.cpp
src/GlAllListPanel.cpp
src/GlFileDeleteTimer.cpp
src/GlFileListEditorForm.cpp
src/GlFileListForm.cpp
src/GlFileListPresentationModel.cpp
src/GlFileMoveTimer.cpp

index 30407d2..b65257a 100644 (file)
@@ -33,6 +33,7 @@
 #include "GlAlbumEventListener.h"
 #include "GlFormContentUpdateEventListener.h"
 #include "GlBaseForm.h"
+#include "GlFileDeleteTimer.h"
 
 class AlbumListPresentationModel;
 class AlbumListEditorForm
@@ -43,6 +44,7 @@ class AlbumListEditorForm
        , public Tizen::Ui::Controls::IIconListViewItemProvider
        , public Tizen::Ui::Scenes::ISceneEventListener
        , public IAlbumEventListener
+       , public IFileOpInvalidateListener
        , public IFormContentUpdateEventListener
 {
 public:
@@ -77,6 +79,9 @@ public:
        virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType);
        virtual void OnThumbnailDecoded(const int index);
 
+       virtual void OnFileOpInvalidate(enum FileActionMode __actionId);
+       virtual void OnFileOpComplete(enum FileActionMode __actionId, enum FileActionCompleteRes);
+
 private:
        result InitializeControl(void);
        result InitializePopup(void);
@@ -88,7 +93,8 @@ private:
        void OnRequestEmail(void);
 
        result DeleteFolder(void);
-       int GetCheckedFolder(void);
+       int GetCheckedFolderCount(void);
+       Tizen::Base::Collection::IList* GetItemCheckedIndexListN(void) const;
        result Update(void);
        void SetFooterButtonsState(bool enableState);
        void SetButtonState(void);
@@ -100,6 +106,7 @@ private:
        Tizen::Ui::Controls::ContextMenu* __pShareContextMenu;
        Tizen::Ui::Controls::Popup* __pDeletePopup;
        AlbumListPresentationModel* __pPresentationModel;
+       FileDeleteTimer* __pFileDeleteTimer;
 };
 
 #endif /* _GL_ALBUM_LIST_EDITOR_FORM_H_ */
index f290cb1..76b7c01 100644 (file)
@@ -32,6 +32,7 @@
 #include <FUi.h>
 #include "GlAlbumEventListener.h"
 #include "GlFormContentUpdateEventListener.h"
+#include "GlIContentFileDeleteManager.h"
 #include "GlResourceManager.h"
 #include "GlThumbnailEventListener.h"
 #include "GlThumbnailProvider.h"
@@ -42,6 +43,7 @@ class IAlbumRenameEventListener;
 
 class AlbumListPresentationModel
        : public Tizen::Base::Object
+       , public IContentFileDeleteManager
        , public IThumbnailEventListener
        , public Tizen::Content::IContentScanListener
        , public Tizen::System::IDeviceEventListener
@@ -64,7 +66,6 @@ public:
                        const Tizen::Base::Collection::HashMap* pDataList, Tizen::App::IAppControlResponseListener* pListener);
 
        void InitializeAlbumInfoList(const Tizen::Content::ContentType& contentType);
-       result DeleteContentInfoInDirectory(int index, Tizen::Content::ContentType contentType);
        void CallAlbumChangedEvent(void);
        int GetFolderCount(void);
 
@@ -77,6 +78,9 @@ public:
 
        result RenameAlbum(const Tizen::Base::String&, const Tizen::Base::String&, IAlbumRenameEventListener*);
 
+       virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList);
+       virtual result DeleteContentFile(const Tizen::Content::ContentId& contentId);
+
        virtual void OnThumbnailReceivedN(Tizen::Base::Runtime::IEventArg& eventArg);
 
        virtual void OnContentScanCompleted (RequestId reqId, const Tizen::Base::String &scanPath, result r);
@@ -86,6 +90,7 @@ public:
        void OnContentDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r);
 
        virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
+       void SetUpdateProgressStatus(bool status);
 
 private:
        AlbumListPresentationModel(void);
@@ -124,6 +129,7 @@ private:
        AppControlMode __appControlMode;
        AppControlMediaType __appControlMediaType;
        AppControlSelectionMode __appControlSelectionMode;
+       bool __updateProgressStatus;
 };
 
 #endif /* _GL_ALBUM_LIST_PRESENTATION_MODEL_H_ */
index 54a712a..917b185 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef _GL_FILE_DELETE_TIMER_H_
 #define _GL_FILE_DELETE_TIMER_H_
 
+#include "GlIContentFileDeleteManager.h"
 #include "GlTimerBase.h"
 
 class FileListPresentationModel;
@@ -29,7 +30,7 @@ class FileDeleteTimer
        : public GlTimerBase
 {
 public:
-       FileDeleteTimer(Tizen::Base::Collection::IList*, FileListPresentationModel*, IFileOpInvalidateListener*);
+       FileDeleteTimer(Tizen::Base::Collection::IList*, IContentFileDeleteManager*, IFileOpInvalidateListener*);
        virtual ~FileDeleteTimer(void);
 
 private:
@@ -40,7 +41,7 @@ private:
 
 private :
        Tizen::Base::Collection::IList* __pDeleteIndexList;
-       FileListPresentationModel* __pPresentationModel;
+       IContentFileDeleteManager* __pFileDeleteManager;
 };
 
 #endif // _GL_FILE_DELETE_TIMER_H_
index a67f05e..e3b4168 100644 (file)
@@ -31,6 +31,7 @@
 #include "GlAlbumEventListener.h"
 #include "GlFormContentUpdateEventListener.h"
 #include "GlCommonUtil.h"
+#include "GlIContentFileDeleteManager.h"
 #include "GlResourceManager.h"
 #include "GlThumbnailEventListener.h"
 #include "GlTypes.h"
@@ -41,6 +42,7 @@ class ThumbnailEvent;
 
 class FileListPresentationModel
        : public Tizen::Base::Object
+       , public IContentFileDeleteManager
        , public IThumbnailEventListener
 {
 public:
@@ -83,7 +85,8 @@ public:
        Tizen::Content::ContentId GetContentInfoIndex(int index);
        Tizen::Base::String GetContentFilePath(int index);
        Tizen::Base::String ConvertToAlbumName(const Tizen::Base::String& targetPath)const;
-       Tizen::Base::Collection::IList* GetContentIdListN(const Tizen::Base::Collection::IList& contentInfoList);
+
+       virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList);
 
        AppControlMode GetAppControlMode(void) const;
        AppControlMediaType GetAppControlMediaType(void) const;
diff --git a/inc/GlIContentFileDeleteManager.h b/inc/GlIContentFileDeleteManager.h
new file mode 100644 (file)
index 0000000..d850ad6
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file               GlIContentFileDeleteManager.h
+ * @brief              This is the header file for IContentFileDeleteManager class.
+ */
+
+#ifndef _GL_ICONTENT_FILE_DELETE_MANAGER_H_
+#define _GL_ICONTENT_FILE_DELETE_MANAGER_H_
+
+#include <FBase.h>
+
+class IContentFileDeleteManager
+{
+public:
+       IContentFileDeleteManager(){}
+       virtual ~IContentFileDeleteManager(){}
+       virtual Tizen::Base::Collection::IList* GetContentIdListAtIndexN(const Tizen::Base::Collection::IList& indexList) = 0;
+       virtual result DeleteContentFile(const Tizen::Content::ContentId& contentId) = 0;
+};
+
+#endif /* _GL_ICONTENT_FILE_DELETE_MANAGER_H_ */
index 2943b6c..e16cc68 100644 (file)
@@ -66,6 +66,7 @@ AlbumListEditorForm::AlbumListEditorForm()
        , __pShareContextMenu(null)
        , __pDeletePopup(null)
        , __pPresentationModel(null)
+       , __pFileDeleteTimer(null)
 {
        AppLogDebug("ENTER");
        __overlayMsg = false;
@@ -95,7 +96,6 @@ AlbumListEditorForm::OnInitializing(void)
        __pPresentationModel = AlbumListPresentationModel::GetInstance();
        __pPresentationModel->ClearThumbnailRequests();
        __pPresentationModel->AddPresentationModelListener(this);
-       __pPresentationModel->AddContentEventListener(this);
 
        SetFormBackEventListener(this);
        GetHeader()->AddActionEventListener(*this);
@@ -117,13 +117,17 @@ AlbumListEditorForm::OnTerminating(void)
 {
        AppLogDebug("ENTER");
        __pPresentationModel->RemovePresentationModelListener(*this);
-       __pPresentationModel->RemoveContentEventListener(*this);
 
        if (__pDeletePopup != null)
        {
                delete __pDeletePopup;
                __pDeletePopup = null;
        }
+       if (__pFileDeleteTimer != null)
+       {
+               delete __pFileDeleteTimer;
+               __pFileDeleteTimer = null;
+       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return E_SUCCESS;
@@ -145,7 +149,7 @@ AlbumListEditorForm::InitializeControl()
        String tempString;
 
        CreateIconListView();
-       __checkedCount = GetCheckedFolder();
+       __checkedCount = GetCheckedFolderCount();
 
        __pSelectCountLabel = static_cast<Label*>(GetControl(L"IDC_LABEL_ALBUM_LIST_EDITOR_SELECTED"));
        AppAssert(__pSelectCountLabel);
@@ -333,13 +337,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)
+               if (status == ICON_LIST_VIEW_ITEM_CHECKED) //to be unchecked after this call
                {
-                       ++__checkedCount;
+                       --__checkedCount;
                }
-               else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
+               else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED) //will get checked after this call hence increment
                {
-                       --__checkedCount;
+                       ++__checkedCount;
                }
 
                String tempString;
@@ -353,8 +357,7 @@ AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int inde
                }
                else
                {
-                       tempString.Format(FORMAT_BUFFER_SIZE,
-                                       ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
+                       tempString.Format(FORMAT_BUFFER_SIZE, ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), __checkedCount);
                }
 
                __pSelectCountLabel->SetText(tempString);
@@ -396,40 +399,59 @@ AlbumListEditorForm::DeleteItem(int index, IconListViewItem* pItem)
 result
 AlbumListEditorForm::DeleteFolder()
 {
-       AppLogDebug("ENTER");
-       int maxCount = __pPresentationModel->GetFolderCount();
-       result r = E_FAILURE;
 
-       int checkedCount = 0;
+       AppLogDebug("ENTER");
+       IList* pIndexList = GetItemCheckedIndexListN();
+       if (pIndexList->GetCount() <= 0)
+       {
+               delete pIndexList;
+               AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+               return E_FAILURE;
+       }
 
-       for (int i = 0 ; i < maxCount; ++i)
+       if (__pFileDeleteTimer != null)
        {
-               if (__pEditorFolderIconList->IsItemChecked(i) == true)
-               {
-                       ++checkedCount;
-                       __pPresentationModel->DeleteContentInfoInDirectory(i, CONTENT_TYPE_ALL);
-                       if (i == 0)
-                       {
-                               break;
-                       }
-               }
+               delete __pFileDeleteTimer;
        }
+       __pFileDeleteTimer = new FileDeleteTimer(pIndexList, __pPresentationModel, this);
+       result r = __pFileDeleteTimer->StartTimer();
 
-       if (checkedCount == 0)
+       if (IsFailed(r))
        {
-               r = E_FAILURE;
+               delete __pFileDeleteTimer;
+               __pFileDeleteTimer = null;
+               return E_FAILURE;
        }
        else
        {
-               r = E_SUCCESS;
+               __pPresentationModel->SetUpdateProgressStatus(true);
        }
+       return E_SUCCESS;
+}
 
-       SetAllCheckState(false);
-       __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
-       __pEditorFolderIconList->UpdateList();
+IList*
+AlbumListEditorForm::GetItemCheckedIndexListN(void) const
+{
+       AppLogDebug("ENTER");
+       IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       Integer* pIndex = null;
+
+       if (__pEditorFolderIconList!=null)
+       {
+               int loopCount = __pPresentationModel->GetFolderCount();
+               for (int i = 0; i < loopCount; ++i)
+               {
+                       if (__pEditorFolderIconList->IsItemChecked(i) == true)
+                       {
+                               pIndex = new (std::nothrow) Integer(i);
+                               pList->Add(pIndex);
+                               AppLogDebug("checked index(%d)", i);
+                       }
+               }
+       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return r;
+       return pList;
 }
 
 void
@@ -465,14 +487,14 @@ AlbumListEditorForm::SetAllCheckState(bool state)
        __pEditorFolderIconList->Draw();
        __pSelectCountLabel->SetText(tempString);
        __pSelectCountLabel->RequestRedraw();
-       __checkedCount = GetCheckedFolder();
+       __checkedCount = GetCheckedFolderCount();
 
        SetButtonState();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 int
-AlbumListEditorForm::GetCheckedFolder()
+AlbumListEditorForm::GetCheckedFolderCount()
 {
        AppLogDebug("ENTER");
        int maxCount = __pPresentationModel->GetFolderCount();
@@ -497,7 +519,7 @@ AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
        switch (actionId)
        {
        case ACTION_ID_ALBUM_LIST_SELECT_ALL:
-               if (__pPresentationModel->GetFolderCount() == GetCheckedFolder())
+               if (__pPresentationModel->GetFolderCount() == GetCheckedFolderCount())
                {
                        SetAllCheckState(false);
                }
@@ -530,16 +552,7 @@ AlbumListEditorForm::OnActionPerformed(const Control& source, int actionId)
        {
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Show();
-               result r = DeleteFolder();
-               AppLogDebug("CHECKBUTTONSTATE : R1");
-               if (r == E_SUCCESS)
-               {
-                       AppLogDebug("CHECKBUTTONSTATE : R2");
-                       SceneManager* pSceneManager = SceneManager::GetInstance();
-                       AppAssert(pSceneManager);
-                       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
-               }
-               AppLogDebug("CHECKBUTTONSTATE : R3");
+               DeleteFolder();
                break;
        }
        case ACTION_ID_DELETE_POPUP_CANCEL:
@@ -570,8 +583,9 @@ AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
        AppLogDebug("ENTER OnSceneActivatedN");
        __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
        __pEditorFolderIconList->UpdateList();
+       __pPresentationModel->AddContentEventListener(this);
 
-       __checkedCount = GetCheckedFolder();
+       __checkedCount = GetCheckedFolderCount();
 
        String tempString;
 
@@ -597,10 +611,10 @@ AlbumListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
 }
 
 void
-AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
-               const SceneId& nextSceneId)
+AlbumListEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
        AppLogDebug("ENTER");
+       __pPresentationModel->RemoveContentEventListener(*this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -620,6 +634,24 @@ AlbumListEditorForm::OnThumbnailDecoded(const int index)
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
+void AlbumListEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
+{
+       Invalidate(true);
+}
+
+void AlbumListEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
+{
+       AppLogDebug("ENTER");
+       __pPresentationModel->SetUpdateProgressStatus(false);
+       SetAllCheckState(false);
+       __pPresentationModel->InitializeAlbumInfoList(CONTENT_TYPE_ALL);
+       __pEditorFolderIconList->UpdateList();
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+}
+
 result
 AlbumListEditorForm::Update(void)
 {
@@ -635,7 +667,7 @@ AlbumListEditorForm::OnRequestMessage(void)
 {
        AppLogDebug("ENTER");
 
-       int checkCount = GetCheckedFolder();
+       int checkCount = GetCheckedFolderCount();
 
        if (checkCount <= 0)
        {
@@ -701,7 +733,7 @@ AlbumListEditorForm::OnRequestEmail(void)
 {
        AppLogDebug("ENTER");
 
-       int checkCount = GetCheckedFolder();
+       int checkCount = GetCheckedFolderCount();
 
        if (checkCount <= 0)
        {
@@ -787,7 +819,7 @@ void
 AlbumListEditorForm::SetButtonState(void)
 {
        AppLogDebug("ENTER");
-       if (GetCheckedFolder() > 0)
+       if (GetCheckedFolderCount() > 0)
        {
                AppLogDebug("BUTTONSTATE : Request Enable");
                SetFooterButtonsState(true);
index 24d57b0..8412e3c 100644 (file)
@@ -78,7 +78,6 @@ AlbumListForm::OnInitializing(void)
        __pPresentationModel = AlbumListPresentationModel::GetInstance();
        __pPresentationModel->ClearThumbnailRequests();
        __pPresentationModel->AddPresentationModelListener(this);
-       __pPresentationModel->AddContentEventListener(this);
 
        if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
        {
@@ -331,7 +330,6 @@ AlbumListForm::OnTerminating(void)
 {
        AppLogDebug("ENTER");
        __pPresentationModel->RemovePresentationModelListener(*this);
-       __pPresentationModel->RemoveContentEventListener(*this);
 
        if (__pContextMenuMore != null)
        {
@@ -422,6 +420,7 @@ AlbumListForm::OnSceneActivatedN(const SceneId& previousSceneId,
                                                                                  const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER");
+       __pPresentationModel->AddContentEventListener(this);
 
        if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
        {
@@ -458,6 +457,7 @@ AlbumListForm::OnSceneDeactivated(const SceneId& currentSceneId,
                                                                                   const SceneId& nextSceneId)
 {
        AppLogDebug("ENTER");
+       __pPresentationModel->RemoveContentEventListener(*this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
index 332c688..1052801 100644 (file)
@@ -98,6 +98,7 @@ AlbumListPresentationModel::AlbumListPresentationModel(void)
        , __appControlMode(APP_CONTROL_MODE_MAIN)
        , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE)
        , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE)
+       , __updateProgressStatus(false)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -876,67 +877,15 @@ AlbumListPresentationModel::GetContentIdListInDirectoryN(const String& directory
 }
 
 result
-AlbumListPresentationModel::DeleteContentInfoInDirectory(int index, ContentType contentType)
+AlbumListPresentationModel::DeleteContentFile(const ContentId& contentId)
 {
        AppLogDebug("ENTER");
        result r = E_SUCCESS;
-       if (__pAlbumInfoList == null)
-       {
-               AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
-               return r;
-       }
-
-       AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(__pAlbumInfoList->GetAt(index));
-
-       int loopCount = pAlbumInfo->GetDirectoryCount();
-       for (int i = 0; i < loopCount; ++i)
+       ContentManager contentManager;
+       r = contentManager.Construct();
+       if (r == E_SUCCESS)
        {
-               ContentDirectory directory;
-               const String contentDirectoryPath = pAlbumInfo->GetDirectory(i);
-
-               if (contentType == CONTENT_TYPE_ALL)
-               {
-                       IListT< ContentType >* pListT = new (std::nothrow) ArrayListT<ContentType>();
-                       pListT->Add(CONTENT_TYPE_IMAGE);
-                       pListT->Add(CONTENT_TYPE_VIDEO);
-                       r = directory.Construct(*pListT);
-                       delete pListT;
-               }
-               else
-               {
-                       r = directory.Construct(contentType);
-               }
-               if (r != E_SUCCESS)
-               {
-                       continue;
-               }
-
-               int pageNo = 1;
-               int countPerPage = directory.GetContentDirectoryItemCount(contentDirectoryPath);
-               IList* pContentInfoList = directory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo,
-                               countPerPage, CONTENT_INFO_ORDER, SORT_ORDER_ASCENDING);
-               ContentManager contentManager;
-               r = contentManager.Construct();
-               if (r != E_SUCCESS)
-               {
-                       delete pContentInfoList;
-                       continue;
-               }
-
-               if ((pContentInfoList != null) && (pContentInfoList->GetCount() > 0))
-               {
-                       IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
-                       while (pEnum->MoveNext() == E_SUCCESS || r == E_SUCCESS)
-                       {
-                               ContentInfo* pContentInfo =  static_cast<ContentInfo*>(pEnum->GetCurrent());
-                               ContentId contentId = pContentInfo->GetContentId();
-                               r = contentManager.DeleteContent(contentId);
-                       }
-                       delete pEnum;
-               }
-
-               delete pContentInfoList;
+               r = contentManager.DeleteContent(contentId);
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -976,6 +925,51 @@ AlbumListPresentationModel::GetAlbumInfoList(void)
        return __pAlbumInfoList;
 }
 
+IList* AlbumListPresentationModel::GetContentIdListAtIndexN(const IList& indexList)
+{
+       AppLogDebug("ENTER");
+       ContentDirectory directory;
+       IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+
+       IListT< ContentType >* pListT = new (std::nothrow) ArrayListT<ContentType>();
+       TryReturn(pListT != null,null, "Unable to Create ArrayListT");
+       pListT->Add(CONTENT_TYPE_IMAGE);
+       pListT->Add(CONTENT_TYPE_VIDEO);
+
+       directory.Construct(*pListT);
+       delete pListT;
+
+       IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING);
+       String* pDirPath = null;
+       if ((pContentDirectoryPathList != null) && (pContentDirectoryPathList->GetCount() > 0))
+       {
+               if (static_cast<const Integer*>(indexList.GetAt(0))->ToInt() == 0) //if all-album is selected, get all files for delete
+               {
+                       int loopCount = pContentDirectoryPathList->GetCount();
+                       for (int i = 0; i < loopCount; ++i)
+                       {
+                               pDirPath = static_cast<String*>(pContentDirectoryPathList->GetAt(i));
+                               pContentIdList->AddItems(*(GetContentIdListInDirectoryN(*pDirPath, CONTENT_TYPE_ALL)));
+                       }
+               }
+               else //get all files in directories which are checked for deletion
+               {
+                       int loopCount = indexList.GetCount();
+                       for (int i = 0; i < loopCount; ++i)
+                       {
+                               const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
+                               pDirPath = static_cast<String*>(pContentDirectoryPathList->GetAt(pIndex->ToInt() - 1)); //index 0 is all-album which is not counted as a directory. hence delete 1 index
+                               if (pDirPath == null)
+                               {
+                                       continue;
+                               }
+                               pContentIdList->AddItems(*(GetContentIdListInDirectoryN(*pDirPath, CONTENT_TYPE_ALL)));
+                       }
+               }
+       }
+       return pContentIdList;
+}
+
 void
 AlbumListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
 {
@@ -1054,6 +1048,11 @@ void
 AlbumListPresentationModel::OnContentCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r)
 {
        AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
        IFormContentUpdateEventListener* pInterface = null;
        IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
        while (pEventEnum->MoveNext() == E_SUCCESS)
@@ -1069,6 +1068,11 @@ void
 AlbumListPresentationModel::OnContentUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r)
 {
        AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
        IFormContentUpdateEventListener* pInterface = null;
        IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
        while (pEventEnum->MoveNext() == E_SUCCESS)
@@ -1084,6 +1088,11 @@ void
 AlbumListPresentationModel::OnContentDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r)
 {
        AppLogDebug("ENTER");
+       if (__updateProgressStatus == true)
+       {
+               AppLogDebug("EXIT update in application");
+               return;
+       }
        IFormContentUpdateEventListener* pInterface = null;
        IEnumerator* pEventEnum = __pContentEventListener->GetEnumeratorN();
        while (pEventEnum->MoveNext() == E_SUCCESS)
@@ -1114,6 +1123,14 @@ AlbumListPresentationModel::OnDeviceStateChanged(DeviceType deviceType, const Ti
 }
 
 void
+AlbumListPresentationModel::SetUpdateProgressStatus(bool status)
+{
+       AppLogDebug("ENTER status = %d",status);
+       __updateProgressStatus = status;
+       AppLogDebug("EXIT");
+}
+
+void
 AlbumListPresentationModel::RequestThumbnail(const int folderIndex, int pathIndex)
 {
        AppLogDebug("ENTER : folderIndex(%d), pathIndex(%d)", folderIndex, pathIndex);
index 8faf16e..a9ede81 100644 (file)
@@ -444,22 +444,8 @@ AllListEditorPanel::OnSceneActivatedN(const SceneId& previousSceneId,
        __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
        TryReturnVoid(__pFileListEditorForm != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
        __pPresentationModel->AddContentEventListener(__pFileListEditorForm);
-       if (previousSceneId == IDSCN_ALL_LIST_SELECTION)
-       {
-       /*      ResetSelection();
-               if (pArgs != null && pArgs->GetCount() > 0)
-               {
-                       IList* pSeletedIndexList = pArgs;
-                       int loopCount = pSeletedIndexList->GetCount();
-                       for (int i = 0; i < loopCount; ++i)
-                       {
-                               int index = static_cast<Integer*>(pSeletedIndexList->GetAt(i))->ToInt();
-                               __pContentIconListView->SetItemChecked(index, true);
-                       }
-                       __pContentIconListView->RequestRedraw(true);
-               }*/
-       }
-       else if (previousSceneId == IDSCN_ALL_LIST)
+
+       if (previousSceneId == IDSCN_ALL_LIST)
        {
                ResetSelection();
        }
@@ -560,21 +546,18 @@ AllListEditorPanel::OnRequestDelete(void)
        else
        {
                __pPresentationModel->SetUpdateProgressStatus(true);
-               //__deleteInProgress = true;
        }
        return E_SUCCESS;
 }
 
 void AllListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
 {
-       //SceneManager* pSceneManager = SceneManager::GetInstance();
        __pFileListEditorForm->Invalidate(true);
 }
 
 void AllListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
 {
        __pPresentationModel->SetUpdateProgressStatus(false);
-       //__deleteInProgress = false;
 
        __pLabelSelectCnt->SetText(ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
        __pLabelSelectCnt->RequestRedraw(true);
index 4b3fd86..ceabe31 100644 (file)
@@ -294,6 +294,7 @@ AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                                                                const SceneId& currentSceneId, IList* pArgs)
 {
        AppLogDebug("ENTER");
+
        __pPresentationModel = FileListPresentationModel::GetInstance();
 
        if (currentSceneId == IDSCN_ALL_LIST)
@@ -326,7 +327,6 @@ AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                        __pContentIconListView->UpdateList();
                }
        }
-
        SceneManager* pSceneManager = SceneManager::GetInstance();
        AppAssert(pSceneManager);
        if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST)
@@ -336,6 +336,7 @@ AllListPanel::OnSceneActivatedN(const SceneId& previousSceneId,
                {
                        pFileListForm->SetTitleText(__pPresentationModel->GetCurrentAlbumName());
                }
+               __pPresentationModel->AddContentEventListener(pFileListForm);
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
@@ -345,6 +346,13 @@ AllListPanel::OnSceneDeactivated(const SceneId& currentSceneId,
                                                                const SceneId& nextSceneId)
 {
        AppLogDebug("ENTER");
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+       if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST)
+       {
+               FileListForm* pFileListForm = dynamic_cast<FileListForm*>(pSceneManager->GetCurrentScene()->GetForm());
+               __pPresentationModel->RemoveContentEventListener(pFileListForm);
+       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
index c44ff29..7084131 100644 (file)
@@ -37,11 +37,12 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
-FileDeleteTimer::FileDeleteTimer(Tizen::Base::Collection::IList* pDelList, FileListPresentationModel* pPM,
-               IFileOpInvalidateListener* invalidate)
+FileDeleteTimer::FileDeleteTimer(Tizen::Base::Collection::IList* pDelList
+       , IContentFileDeleteManager* pFDM
+       , IFileOpInvalidateListener* invalidate)
        : GlTimerBase(invalidate, FILE_DELETE_ACTION)
        , __pDeleteIndexList(pDelList)
-       , __pPresentationModel(pPM)
+       , __pFileDeleteManager(pFDM)
 {
 }
 
@@ -52,12 +53,12 @@ FileDeleteTimer::~FileDeleteTimer(void)
 
 IList * FileDeleteTimer::TimerStart(void)
 {
-       return __pPresentationModel->GetContentIdListN(*__pDeleteIndexList);
+       return __pFileDeleteManager->GetContentIdListAtIndexN(*__pDeleteIndexList);
 }
 
 result FileDeleteTimer::TimerExpired(const ContentId& contentId)
 {
-       return __pPresentationModel->DeleteContentFile(contentId);
+       return __pFileDeleteManager->DeleteContentFile(contentId);
 }
 
 void FileDeleteTimer::TimerCancel(int, enum FileActionCancelRes res)
index 4b6f746..0fce3c9 100644 (file)
@@ -114,7 +114,6 @@ FileListEditorForm::OnInitializing(void)
 
        __pPresentationModel = FileListPresentationModel::GetInstance();
        __pPresentationModel->ClearThumbnailRequests();
-       //__pPresentationModel->AddContentEventListener(this);
 
        pHeader->SetStyle(HEADER_STYLE_TITLE);
        pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
@@ -329,7 +328,6 @@ FileListEditorForm::OnTerminating(void)
 {
        AppLogDebug("ENTER");
 
-       //__pPresentationModel->RemoveContentEventListener(this);
        if (__pContextMenuMore != null)
        {
                __pContextMenuMore->RemoveActionEventListener(*this);
@@ -468,17 +466,16 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
                break;
        }
        case ACTION_ID_CONTEXT_MENU_MORE_COPY:
-       {
-               //__pFileMove->SetCopy();
-               __isCopyOperation = true;
-               //Fall through to next case.
-       }
        case ACTION_ID_CONTEXT_MENU_MORE_MOVE:
        {
-               if(actionId == ACTION_ID_CONTEXT_MENU_MORE_MOVE)
+               if (actionId == ACTION_ID_CONTEXT_MENU_MORE_MOVE)
                {
                        __isCopyOperation = false;
                }
+               else if (actionId == ACTION_ID_CONTEXT_MENU_MORE_COPY)
+               {
+                       __isCopyOperation = true;
+               }
                RefreshFolderList();
                if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR)
                {
index 22d340e..9d9166d 100644 (file)
@@ -70,8 +70,6 @@ FileListForm::OnInitializing(void)
        __pPresentationModel = FileListPresentationModel::GetInstance();
        __pPresentationModel->ClearThumbnailRequests();
 
-       __pPresentationModel->AddContentEventListener(this);
-
        __pPopUp = new (std::nothrow) SlideShowPopUp();
 
        if (__pPopUp != null)
@@ -93,7 +91,6 @@ FileListForm::OnTerminating(void)
 {
        AppLogDebug("ENTER");
 
-       __pPresentationModel->RemoveContentEventListener(this);
        if (__pContextMenuMore != null)
        {
                delete __pContextMenuMore;
index 28a0d36..4e3726e 100644 (file)
@@ -1300,14 +1300,13 @@ FileListPresentationModel::GetContentInfo(int index)
        return pContentInfo;
 }
 
-
-IList* FileListPresentationModel::GetContentIdListN(const IList& contentInfoList)
+IList* FileListPresentationModel::GetContentIdListAtIndexN(const IList& indexList)
 {
        IList* pContentIdList = new (std::nothrow) ArrayList(SingleObjectDeleter);
-       int loopCount = contentInfoList.GetCount();
+       int loopCount = indexList.GetCount();
        for (int i = 0; i < loopCount; ++i)
        {
-               const Integer* pIndex = static_cast<const Integer*>(contentInfoList.GetAt(i));
+               const Integer* pIndex = static_cast<const Integer*>(indexList.GetAt(i));
 
                if ((pIndex != null) && (pIndex->ToInt())>=0 && __pContentInfoList->GetCount() > pIndex->ToInt())
                {
index d558943..bcc3450 100644 (file)
@@ -76,7 +76,7 @@ IList * FileMoveTimer::TimerStart(void)
                        Directory::Create(__moveToDir, true);
                }
                AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-               return __pPresentationModel->GetContentIdListN(*__pMoveIndexList);
+               return __pPresentationModel->GetContentIdListAtIndexN(*__pMoveIndexList);
        }
        else
        {