Merge branch 'develop' into refactor_remote_operation_to_rename_folder
authorDavid A. Velasco <dvelasco@solidgear.es>
Tue, 19 Nov 2013 10:25:30 +0000 (11:25 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Tue, 19 Nov 2013 10:25:30 +0000 (11:25 +0100)
oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java
oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java [new file with mode: 0644]
oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java
oc_framework/src/com/owncloud/android/oc_framework/network/webdav/OwnCloudClientFactory.java
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java [new file with mode: 0644]
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/files/services/FileUploader.java
src/com/owncloud/android/operations/RenameFileOperation.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

index 0c4b8ef..8414502 100644 (file)
@@ -54,7 +54,7 @@ public class CreateFolderTest extends ActivityInstrumentationTestCase2<TestActiv
        
        
        /**
-        * Test to Create Folder with special characters
+        * Test to Create Folder with special characters: /  \  < >  :  "  |  ?  *
         */
        public void testCreateFolderSpecialCharacters() {               
                boolean createFullPath = true;
diff --git a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/RenameFileTest.java
new file mode 100644 (file)
index 0000000..fe30550
--- /dev/null
@@ -0,0 +1,147 @@
+package com.owncloud.android.oc_framework_test_project.test;
+
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.oc_framework_test_project.TestActivity;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class RenameFileTest extends ActivityInstrumentationTestCase2<TestActivity> {
+
+       /* Folder data to rename. This folder must exist on the account */
+       private final String mOldFolderName = "folderToRename";
+       private final String mOldFolderPath = "/folderToRename";
+       private final String mNewFolderName = "renamedFolder"; 
+       private final String mNewFolderPath = "/renamedFolder";
+       
+       /* File data to rename. This file must exist on the account */
+       private final String mOldFileName = "fileToRename.png";
+       private final String mOldFilePath = "/fileToRename.png";
+       private final String mNewFileName = "renamedFile";
+       private final String mFileExtension = ".png";
+       private final String mNewFilePath ="/renamedFile.png";
+       
+       
+       private TestActivity mActivity;
+       
+       public RenameFileTest() {
+           super(TestActivity.class);
+          
+       }
+       
+       @Override
+         protected void setUp() throws Exception {
+           super.setUp();
+           setActivityInitialTouchMode(false);
+           mActivity = getActivity();
+       }
+       
+       /**
+        * Test Rename Folder
+        */
+       public void testRenameFolder() {
+
+               RemoteOperationResult result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName, true);
+               assertTrue(result.isSuccess());
+       }
+       
+       /**
+        * Test Rename Folder with forbidden characters : \  < >  :  "  |  ?  *
+        */
+       public void testRenameFolderForbiddenChars() {
+               
+               RemoteOperationResult result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "\\", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "<", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + ">", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + ":", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "\"", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "|", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "?", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFolderName, mOldFolderPath, 
+                               mNewFolderName + "*", true);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+       }
+       
+       /**
+        * Test Rename File
+        */
+       public void testRenameFile() {
+               RemoteOperationResult result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + mFileExtension, false);
+               assertTrue(result.isSuccess());
+       }
+       
+       
+       /**
+        * Test Rename Folder with forbidden characters: \  < >  :  "  |  ?  *
+        */
+       public void testRenameFileForbiddenChars() {            
+               RemoteOperationResult result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "\\" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "<" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + ">" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + ":" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "\"" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "|" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "?" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+               result = mActivity.renameFile(mOldFileName, mOldFilePath, 
+                               mNewFileName + "*" + mFileExtension, false);
+               assertTrue(result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME);
+               
+       }
+       
+       
+       /**
+        * Restore initial conditions
+        */
+       public void testRestoreInitialConditions() {
+               RemoteOperationResult result = mActivity.renameFile(mNewFolderName, mNewFolderPath, mOldFolderName, true);
+               assertTrue(result.isSuccess());
+               
+               result = mActivity.renameFile(mNewFileName + mFileExtension, mNewFilePath, mOldFileName, false);
+               assertTrue(result.isSuccess());
+       }
+       
+}
index e1c1edc..7fdf9cd 100644 (file)
@@ -7,6 +7,7 @@ import com.owncloud.android.oc_framework.network.webdav.OwnCloudClientFactory;
 import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.oc_framework.operations.remote.CreateRemoteFolderOperation;
+import com.owncloud.android.oc_framework.operations.remote.RenameRemoteFileOperation;
 
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -28,6 +29,13 @@ public class TestActivity extends Activity {
        
        private static final String TAG = "TestActivity";
        
+       // This account must exists on the simulator / device
+       private static final String mAccountHost = "beta.owncloud.com";
+       private static final String mAccountUser = "testandroid";
+       private static final String mAccountName = mAccountUser + "@"+ mAccountHost;
+       private static final String mAccountPass = "testandroid";
+       private static final String mAccountType = "owncloud";  
+       
        private Account mAccount = null;
        private WebdavClient mClient;
        
@@ -35,19 +43,12 @@ public class TestActivity extends Activity {
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_test);
-               
-               // This account must exists on the simulator / device
-               String accountHost = "beta.owncloud.com";
-               String accountUser = "testandroid";
-               String accountName = accountUser + "@"+ accountHost;
-               String accountPass = "testandroid";
-               String accountType = "owncloud";        
 
                AccountManager am = AccountManager.get(this);
                
-               Account[] ocAccounts = am.getAccountsByType(accountType);
+               Account[] ocAccounts = am.getAccountsByType(mAccountType);
         for (Account ac : ocAccounts) {
-           if (ac.name.equals(accountName)) {
+           if (ac.name.equals(mAccountName)) {
                   mAccount = ac;
                   break;
             }
@@ -70,6 +71,7 @@ public class TestActivity extends Activity {
         * Access to the library method to Create a Folder
         * @param remotePath
         * @param createFullPath
+        * 
         * @return
         */
        public RemoteOperationResult createFolder(String remotePath, boolean createFullPath) {
@@ -80,6 +82,24 @@ public class TestActivity extends Activity {
                return result;
        }
        
+       /**
+        * Access to the library method to Rename a File or Folder
+        * @param oldName                       Old name of the file.
+     * @param oldRemotePath            Old remote path of the file. For folders it starts and ends by "/"
+     * @param newName                  New name to set as the name of file.
+     * @param isFolder                 'true' for folder and 'false' for files
+     * 
+     * @return
+     */
+
+       public RemoteOperationResult renameFile(String oldName, String oldRemotePath, String newName, boolean isFolder) {
+               
+               RenameRemoteFileOperation renameOperation = new RenameRemoteFileOperation(oldName, oldRemotePath, newName, isFolder);
+               RemoteOperationResult result = renameOperation.execute(mClient);
+               
+               return result;
+       }
+       
        private class AuthTask extends AsyncTask<Context, Void, WebdavClient> {
 
                @Override
index 5c41edb..0c0c207 100644 (file)
@@ -78,8 +78,8 @@ public class OwnCloudClientFactory {
             
         } else {
             String username = account.name.substring(0, account.name.lastIndexOf('@'));
-            //String password = am.getPassword(account);
-            String password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false);
+            String password = am.getPassword(account);
+            //String password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false);
             client.setBasicCredentials(username, password);
         }
         
diff --git a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
new file mode 100644 (file)
index 0000000..ad6fffc
--- /dev/null
@@ -0,0 +1,129 @@
+package com.owncloud.android.oc_framework.operations.remote;
+
+import java.io.File;
+
+import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
+
+import android.util.Log;
+
+import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
+import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
+import com.owncloud.android.oc_framework.operations.RemoteOperation;
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.oc_framework.utils.FileUtils;
+
+
+/**
+ * Remote operation performing the rename of a remote file or folder in the ownCloud server.
+ * 
+ * @author David A. Velasco
+ * @author masensio
+ */
+public class RenameRemoteFileOperation extends RemoteOperation {
+
+       private static final String TAG = RenameRemoteFileOperation.class.getSimpleName();
+
+       private static final int RENAME_READ_TIMEOUT = 10000;
+       private static final int RENAME_CONNECTION_TIMEOUT = 5000;
+
+    private String mOldName;
+    private String mOldRemotePath;
+    private String mNewName;
+    private String mNewRemotePath;
+    
+    
+    /**
+     * Constructor
+     * 
+     * @param oldName                  Old name of the file.
+     * @param oldRemotePath            Old remote path of the file. 
+     * @param newName                  New name to set as the name of file.
+     * @param isFolder                 'true' for folder and 'false' for files
+     */
+       public RenameRemoteFileOperation(String oldName, String oldRemotePath, String newName, boolean isFolder) {
+               mOldName = oldName;
+               mOldRemotePath = oldRemotePath;
+               mNewName = newName;
+               
+        String parent = (new File(mOldRemotePath)).getParent();
+        parent = (parent.endsWith(FileUtils.PATH_SEPARATOR)) ? parent : parent + FileUtils.PATH_SEPARATOR; 
+        mNewRemotePath =  parent + mNewName;
+        if (isFolder) {
+            mNewRemotePath += FileUtils.PATH_SEPARATOR;
+        }
+       }
+
+        /**
+     * Performs the rename operation.
+     * 
+     * @param   client      Client object to communicate with the remote ownCloud server.
+     */
+       @Override
+       protected RemoteOperationResult run(WebdavClient client) {
+               RemoteOperationResult result = null;
+               
+               LocalMoveMethod move = null;
+        
+        boolean noInvalidChars = FileUtils.isValidPath(mNewRemotePath);
+        
+        if (noInvalidChars) {
+        try {
+               
+            if (mNewName.equals(mOldName)) {
+                return new RemoteOperationResult(ResultCode.OK);
+            }
+        
+            
+            // check if a file with the new name already exists
+            if (client.existsFile(mNewRemotePath)) {
+               return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE);
+            }
+            
+            move = new LocalMoveMethod( client.getBaseUri() + WebdavUtils.encodePath(mOldRemotePath),
+                       client.getBaseUri() + WebdavUtils.encodePath(mNewRemotePath));
+            int status = client.executeMethod(move, RENAME_READ_TIMEOUT, RENAME_CONNECTION_TIMEOUT);
+            
+            move.getResponseBodyAsString(); // exhaust response, although not interesting
+            result = new RemoteOperationResult(move.succeeded(), status, move.getResponseHeaders());
+            Log.i(TAG, "Rename " + mOldRemotePath + " to " + mNewRemotePath + ": " + result.getLogMessage());
+            
+        } catch (Exception e) {
+            result = new RemoteOperationResult(e);
+            Log.e(TAG, "Rename " + mOldRemotePath + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + result.getLogMessage(), e);
+            
+        } finally {
+            if (move != null)
+                move.releaseConnection();
+        }
+        } else {
+               result = new RemoteOperationResult(ResultCode.INVALID_CHARACTER_IN_NAME);
+        }
+               
+        return result;
+       }
+       
+       /**
+        * Move operation
+        * 
+        */
+    private class LocalMoveMethod extends DavMethodBase {
+
+        public LocalMoveMethod(String uri, String dest) {
+            super(uri);
+            addRequestHeader(new org.apache.commons.httpclient.Header("Destination", dest));
+        }
+
+        @Override
+        public String getName() {
+            return "MOVE";
+        }
+
+        @Override
+        protected boolean isSuccess(int status) {
+            return status == 201 || status == 204;
+        }
+            
+    }
+
+}
index 6928d41..85f4914 100644 (file)
@@ -23,7 +23,6 @@ import android.accounts.AccountManager;
 import android.app.AlertDialog;\r
 import android.app.Dialog;\r
 import android.app.ProgressDialog;\r
-import android.content.ContentResolver;\r
 import android.content.DialogInterface;\r
 import android.content.Intent;\r
 import android.content.SharedPreferences;\r
index d9f3a32..61f6179 100644 (file)
@@ -33,9 +33,7 @@ import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.MultiStatus;
 import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
-import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
index 2b352bd..ebeac79 100644 (file)
@@ -20,23 +20,20 @@ package com.owncloud.android.operations;
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
-
+import org.apache.commons.httpclient.HttpException;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
-import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
 import com.owncloud.android.oc_framework.operations.RemoteOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.oc_framework.operations.remote.RenameRemoteFileOperation;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.Log_OC;
-//import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
 
 import android.accounts.Account;
 
 
-
 /**
  * Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
  * 
@@ -45,9 +42,6 @@ import android.accounts.Account;
 public class RenameFileOperation extends RemoteOperation {
     
     private static final String TAG = RenameFileOperation.class.getSimpleName();
-
-    private static final int RENAME_READ_TIMEOUT = 10000;
-    private static final int RENAME_CONNECTION_TIMEOUT = 5000;
     
 
     private OCFile mFile;
@@ -87,69 +81,45 @@ public class RenameFileOperation extends RemoteOperation {
     protected RemoteOperationResult run(WebdavClient client) {
         RemoteOperationResult result = null;
         
-        LocalMoveMethod move = null;
-        mNewRemotePath = null;
+        // check if the new name is valid in the local file system
         try {
-            if (mNewName.equals(mFile.getFileName())) {
-                return new RemoteOperationResult(ResultCode.OK);
+            if (!isValidNewName()) {
+                return new RemoteOperationResult(ResultCode.INVALID_LOCAL_FILE_NAME);
             }
-        
             String parent = (new File(mFile.getRemotePath())).getParent();
             parent = (parent.endsWith(OCFile.PATH_SEPARATOR)) ? parent : parent + OCFile.PATH_SEPARATOR; 
             mNewRemotePath =  parent + mNewName;
             if (mFile.isFolder()) {
                 mNewRemotePath += OCFile.PATH_SEPARATOR;
             }
-            
-            // check if the new name is valid in the local file system
-            if (!isValidNewName()) {
-                return new RemoteOperationResult(ResultCode.INVALID_LOCAL_FILE_NAME);
-            }
-        
-            // check if a file with the new name already exists
-            if (client.existsFile(mNewRemotePath) ||                             // remote check could fail by network failure. by indeterminate behavior of HEAD for folders ... 
-                    mStorageManager.getFileByPath(mNewRemotePath) != null) {     // ... so local check is convenient
+
+            // ckeck local overwrite
+            if (mStorageManager.getFileByPath(mNewRemotePath) != null) {
                 return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE);
             }
-            move = new LocalMoveMethod( client.getBaseUri() + WebdavUtils.encodePath(mFile.getRemotePath()),
-                                        client.getBaseUri() + WebdavUtils.encodePath(mNewRemotePath));
-            int status = client.executeMethod(move, RENAME_READ_TIMEOUT, RENAME_CONNECTION_TIMEOUT);
-            if (move.succeeded()) {
+            
+            RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(), mFile.getRemotePath(), 
+                    mNewName, mFile.isFolder());
+            result = operation.execute(client);
 
+            if (result.isSuccess()) {
                 if (mFile.isFolder()) {
                     saveLocalDirectory();
-                    
+
                 } else {
                     saveLocalFile();
-                    
                 }
-             
-            /* 
-             *} else if (mFile.isDirectory() && (status == 207 || status >= 500)) {
-             *   // TODO 
-             *   // if server fails in the rename of a folder, some children files could have been moved to a folder with the new name while some others
-             *   // stayed in the old folder;
-             *   //
-             *   // easiest and heaviest solution is synchronizing the parent folder (or the full account);
-             *   //
-             *   // a better solution is synchronizing the folders with the old and new names;
-             *}
-             */
-                
             }
-            
-            move.getResponseBodyAsString(); // exhaust response, although not interesting
-            result = new RemoteOperationResult(move.succeeded(), status, move.getResponseHeaders());
-            Log_OC.i(TAG, "Rename " + mFile.getRemotePath() + " to " + mNewRemotePath + ": " + result.getLogMessage());
-            
-        } catch (Exception e) {
-            result = new RemoteOperationResult(e);
-            Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + result.getLogMessage(), e);
-            
-        } finally {
-            if (move != null)
-                move.releaseConnection();
+        } catch (HttpException e) {
+            Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + 
+                    ((result!= null) ? result.getLogMessage() : ""), e);
+            e.printStackTrace();
+        } catch (IOException e) {
+            Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ? mNewName : mNewRemotePath) + ": " + 
+                    ((result!= null) ? result.getLogMessage() : ""), e);
+            e.printStackTrace();
         }
+
         return result;
     }
 
@@ -225,26 +195,4 @@ public class RenameFileOperation extends RemoteOperation {
         return result;
     }
 
-
-    // move operation
-    private class LocalMoveMethod extends DavMethodBase {
-
-        public LocalMoveMethod(String uri, String dest) {
-            super(uri);
-            addRequestHeader(new org.apache.commons.httpclient.Header("Destination", dest));
-        }
-
-        @Override
-        public String getName() {
-            return "MOVE";
-        }
-
-        @Override
-        protected boolean isSuccess(int status) {
-            return status == 201 || status == 204;
-        }
-            
-    }
-    
-
 }
index 685cff2..0bf8207 100644 (file)
@@ -1375,6 +1375,9 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
                 Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG); 
                 msg.show();
                 // TODO throw again the new rename dialog
+            } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
+                Toast msg = Toast.makeText(this, R.string.filename_forbidden_characters, Toast.LENGTH_LONG); 
+                msg.show();
             } else {
                 Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); 
                 msg.show();
index 01ef8d0..ea0f814 100644 (file)
@@ -816,6 +816,9 @@ public class FileDetailFragment extends FileFragment implements
                 Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG); 
                 msg.show();
                 // TODO throw again the new rename dialog
+            } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
+                Toast msg = Toast.makeText(getActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG);
+                msg.show();
             } else {
                 Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG); 
                 msg.show();