Merge branch 'develop' into videoInstandUploads
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / EditNameDialog.java
index a548524..0ab7e4d 100644 (file)
@@ -3,9 +3,8 @@
  *   Copyright (C) 2012-2013 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,9 +27,11 @@ import android.view.View;
 import android.view.WindowManager.LayoutParams;
 import android.widget.EditText;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.actionbarsherlock.app.SherlockDialogFragment;
 import com.owncloud.android.R;
+import com.owncloud.android.lib.resources.files.FileUtils;
 
 
 /**
@@ -129,6 +130,10 @@ public class EditNameDialog extends SherlockDialogFragment implements DialogInte
         switch (which) {
             case AlertDialog.BUTTON_POSITIVE: {
                 mNewFilename = ((TextView)(getDialog().findViewById(R.id.user_input))).getText().toString();
+                if (!FileUtils.isValidName(mNewFilename)) {
+                    Toast.makeText(getSherlockActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG).show();
+                    return;
+                }
                 mResult = true;
             }
             case AlertDialog.BUTTON_NEGATIVE: { // fall through