merge with master
[apps/osp/Gallery.git] / src / GlVideoListEditorPanel.cpp
index 5ed5ebd..5bbcb2b 100644 (file)
@@ -28,6 +28,8 @@
 #include "GlResourceManager.h"
 #include "GlTypes.h"
 #include "GlVideoListEditorPanel.h"
+#include "GlFileListEditorForm.h"
+#include "GlFileDeleteTimer.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -68,6 +70,7 @@ VideoListEditorPanel::VideoListEditorPanel()
        , __pLabelSelectCnt(null)
        , __itemCount(0)
        , __pPresentationModel(null)
+       , __pFileDelete(null)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -76,6 +79,7 @@ VideoListEditorPanel::VideoListEditorPanel()
 VideoListEditorPanel::~VideoListEditorPanel()
 {
        AppLogDebug("ENTER");
+       delete __pFileDelete;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -695,7 +699,7 @@ VideoListEditorPanel::GetItemCheckedIndexList(void) const
 }
 
 void
-VideoListEditorPanel::OnRequestDeleteAction(void)
+VideoListEditorPanel::OnRequestDelete(void)
 {
        AppLogDebug("ENTER");
        IList* pIndexList = GetItemCheckedIndexList();
@@ -707,14 +711,95 @@ VideoListEditorPanel::OnRequestDeleteAction(void)
 
                return;
        }
+       delete __pFileDelete;
+       __pFileDelete = new FileDeleteTimer(pIndexList,
+                       __pPresentationModel,
+                       this );
+       result r = __pFileDelete->StartTimer();
 
-       __pPresentationModel->DeleteContentFileList(*pIndexList);
-       delete pIndexList;
+       if (IsFailed(r))
+       {
+               delete __pFileDelete;
+               __pFileDelete = null;
+               return ;
+       }
+
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+void VideoListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       FileListEditorForm* pFileListEditorForm =
+                               dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
+       TryReturnVoid(pFileListEditorForm != null, "[%s] fail to get SceneManager.",
+                       GetErrorMessage(GetLastResult()));
+       pFileListEditorForm->Invalidate(true);
+}
+
+void VideoListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, result res)
+{
+       if ( actionId == FILE_DELETE_ACTION )
+       {
+               //Do nothing
+       }
+       else if ( actionId == FILE_MOVE_ACTION )
+       {
+
+       }
+}
+void
+VideoListEditorPanel::OnRequestMessage(void)
+{
+       AppLogDebug("ENTER");
+       IList* pIndexList = GetItemCheckedIndexList();
+       if (pIndexList->GetCount() <= 0)
+       {
+               AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+
+               return;
+       }
+
+       String combineText;
+       String path;
+
+       int loopCount = pIndexList->GetCount();
+       for (int i = 0; i < loopCount; ++i)
+       {
+               path = __pPresentationModel->GetContentFilePath(i);
+
+               if (    path.EndsWith(CONTENT_EXT_PNG)
+                       || path.EndsWith(CONTENT_EXT_BMP)
+                       || path.EndsWith(CONTENT_EXT_JPG)
+                       || path.EndsWith(CONTENT_EXT_GIF)
+                       || path.EndsWith(CONTENT_EXT_TIF)
+                       || path.EndsWith(CONTENT_EXT_MP4)
+                       || path.EndsWith(CONTENT_EXT_3GP)
+                       || path.EndsWith(CONTENT_EXT_AVI)
+                       || path.EndsWith(CONTENT_EXT_RM)
+                       || path.EndsWith(CONTENT_EXT_WMV)
+                       || path.EndsWith(CONTENT_EXT_ASF)
+                       )
+               {
+                       if (combineText.CompareTo(EMPTY_SPACE) != 0)
+                       {
+                               combineText.Append(L";");
+                       }
+                       combineText.Append(path);
+               }
+       }
+
+       HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
+       pDataList->Construct();
+       pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
+                       new (std::nothrow) String(combineText));
+
+       __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
+                       pDataList, null);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
-VideoListEditorPanel::OnRequestEmailAction(void)
+VideoListEditorPanel::OnRequestEmail(void)
 {
        AppLogDebug("ENTER");
        IList* pIndexList = GetItemCheckedIndexList();
@@ -759,13 +844,13 @@ VideoListEditorPanel::OnRequestEmailAction(void)
        pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
                        new (std::nothrow) String(combineText));
 
-       __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
-                       APPCONTROL_OPERATION_ID_COMPOSE, pDataList, null);
+       __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,     APPCONTROL_OPERATION_ID_COMPOSE,
+                       pDataList, null);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 void
-VideoListEditorPanel::OnRequestMoveToAction(String& destDirectory)
+VideoListEditorPanel::OnRequestMoveTo(String& destDirectory)
 {
        AppLogDebug("ENTER");
        if (&destDirectory == null || destDirectory.IsEmpty())
@@ -782,6 +867,7 @@ VideoListEditorPanel::OnRequestMoveToAction(String& destDirectory)
 
                return;
        }
+       //TODO TO rework this, update to use the FileMoveTimer, When this func is used..
        result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
        delete pIndexList;
        pIndexList = null;