[tx-robot] updated from transifex
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / RenameFileDialogFragment.java
index 4093060..24e1b14 100644 (file)
@@ -25,7 +25,7 @@ package com.owncloud.android.ui.dialog;
  * 
  *  Triggers the rename operation. 
  */
-import android.app.AlertDialog;
+import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
@@ -118,17 +118,24 @@ public class RenameFileDialogFragment
                         Toast.LENGTH_LONG).show();
                 return;
             }
-            
-            if (!FileUtils.isValidName(newFileName)) {
-                Toast.makeText(
-                        getActivity(),
-                        R.string.filename_forbidden_characters, 
-                        Toast.LENGTH_LONG).show();
+
+            boolean serverWithForbiddenChars = ((ComponentsGetter)getActivity()).
+                    getFileOperationsHelper().isVersionWithForbiddenCharacters();
+
+            if (!FileUtils.isValidName(newFileName, serverWithForbiddenChars)) {
+                int messageId = 0;
+                if (serverWithForbiddenChars) {
+                    messageId = R.string.filename_forbidden_charaters_from_server;
+                } else {
+                    messageId = R.string.filename_forbidden_characters;
+                }
+                Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();
                 return;
             }
 
-            ((ComponentsGetter)getActivity()).getFileOperationsHelper().renameFile(mTargetFile,
-                    newFileName);
+            ((ComponentsGetter)getActivity()).getFileOperationsHelper().
+                    renameFile(mTargetFile, newFileName);
+
         }
     }
 }