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 / CreateFolderDialogFragment.java
index 501f752..5274a1b 100644 (file)
@@ -1,7 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2014 ownCloud Inc.
+ *   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,
@@ -20,6 +21,7 @@
 package com.owncloud.android.ui.dialog;
 
 import com.actionbarsherlock.app.SherlockDialogFragment;
+import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.files.FileUtils;
@@ -51,8 +53,8 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
     /**
      * Public factory method to create new CreateFolderDialogFragment instances.
      * 
-     * @param file            File to remove.
-     * @return                Dialog ready to show.
+     * @param parentFolder            Folder to create
+     * @return                        Dialog ready to show.
      */
     public static CreateFolderDialogFragment newInstance(OCFile parentFolder) {
         CreateFolderDialogFragment frag = new CreateFolderDialogFragment();
@@ -105,8 +107,11 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
                         Toast.LENGTH_LONG).show();
                 return;
             }
-            
-            if (!FileUtils.isValidName(newFolderName)) {
+
+
+            if (!FileUtils.isValidName(newFolderName,
+                    ((ComponentsGetter)getSherlockActivity()).
+                            getFileOperationsHelper().isVersionWithForbiddenCharacters())) {
                 Toast.makeText(
                         getSherlockActivity(), 
                         R.string.filename_forbidden_characters,