Filter only '/' character in user input when version of server is 8.1 or later
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / RenameFileDialogFragment.java
index d285f1e..700a0ca 100644 (file)
@@ -1,4 +1,7 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
@@ -43,9 +46,7 @@ import com.owncloud.android.ui.activity.ComponentsGetter;
 /**
  *  Dialog to input a new name for a file or folder to rename.  
  * 
- *  Triggers the rename operation when name is confirmed. 
- *  
- *  @author David A. Velasco
+ *  Triggers the rename operation when name is confirmed.
  */
 public class RenameFileDialogFragment
 extends SherlockDialogFragment implements DialogInterface.OnClickListener {
@@ -118,7 +119,9 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
                 return;
             }
             
-            if (!FileUtils.isValidName(newFileName)) {
+            if (!FileUtils.isValidName(newFileName,
+                    ((ComponentsGetter)getSherlockActivity()).
+                            getFileOperationsHelper().isVersionWithForbiddenCharacters())) {
                 Toast.makeText(
                         getSherlockActivity(), 
                         R.string.filename_forbidden_characters, 
@@ -126,7 +129,8 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
                 return;
             }
 
-            ((ComponentsGetter)getSherlockActivity()).getFileOperationsHelper().renameFile(mTargetFile, newFileName);
+            ((ComponentsGetter)getSherlockActivity()).getFileOperationsHelper().
+                    renameFile(mTargetFile, newFileName);
         }
     }
 }