Merge pull request #1048 from owncloud/shareWithYou_icon_in_fileList
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / MoveFileOperation.java
index a4838ec..be254e7 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -17,6 +20,7 @@
 
 package com.owncloud.android.operations;
 
 
 package com.owncloud.android.operations;
 
+import com.owncloud.android.MainApp;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -29,8 +33,6 @@ import android.accounts.Account;
 
 /**
  * Operation mmoving an {@link OCFile} to a different folder.
 
 /**
  * Operation mmoving an {@link OCFile} to a different folder.
- * 
- * @author David A. Velasco
  */
 public class MoveFileOperation extends SyncOperation {
     
  */
 public class MoveFileOperation extends SyncOperation {
     
@@ -46,8 +48,8 @@ public class MoveFileOperation extends SyncOperation {
     /**
      * Constructor
      * 
     /**
      * Constructor
      * 
-     * @param path              Remote path of the {@link OCFile} to move.
-     * @param newParentPath     Path to the folder where the file will be moved into. 
+     * @param srcPath           Remote path of the {@link OCFile} to move.
+     * @param targetParentPath  Path to the folder where the file will be moved into.
      * @param account           OwnCloud account containing both the file and the target folder 
      */
     public MoveFileOperation(String srcPath, String targetParentPath, Account account) {
      * @param account           OwnCloud account containing both the file and the target folder 
      */
     public MoveFileOperation(String srcPath, String targetParentPath, Account account) {
@@ -80,6 +82,9 @@ public class MoveFileOperation extends SyncOperation {
         
         /// 2. remote move
         String targetPath = mTargetParentPath + mFile.getFileName();
         
         /// 2. remote move
         String targetPath = mTargetParentPath + mFile.getFileName();
+        if (mFile.isFolder()) {
+            targetPath += OCFile.PATH_SEPARATOR;
+        }
         MoveRemoteFileOperation operation = new MoveRemoteFileOperation(
                 mSrcPath, 
                 targetPath, 
         MoveRemoteFileOperation operation = new MoveRemoteFileOperation(
                 mSrcPath, 
                 targetPath, 
@@ -89,8 +94,7 @@ public class MoveFileOperation extends SyncOperation {
         
         /// 3. local move
         if (result.isSuccess()) {
         
         /// 3. local move
         if (result.isSuccess()) {
-            // TODO work in progress
-            //getStorageManager().moveLocalFile(mFile, targetPath);
+            getStorageManager().moveLocalFile(mFile, targetPath, mTargetParentPath);
         } 
         // TODO handle ResultCode.PARTIAL_MOVE_DONE in client Activity, for the moment
         
         } 
         // TODO handle ResultCode.PARTIAL_MOVE_DONE in client Activity, for the moment