X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/aae90eb1aa42a11449e30330e3e23e1e9e5eebb6..705d2eb7733e23fa1f7e0b6e23ced754b7f07dcc:/src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java diff --git a/src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java b/src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java index 29b3be28..52e0425f 100644 --- a/src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java +++ b/src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java @@ -1,5 +1,8 @@ -/* ownCloud Android client application - * Copyright (C) 2014 ownCloud Inc. +/** + * ownCloud Android client application + * + * @author David A. Velasco + * 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, @@ -18,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; @@ -37,9 +41,7 @@ import android.widget.Toast; /** * Dialog to input the name for a new folder to create. * - * Triggers the folder creation when name is confirmed. - * - * @author David A. Velasco + * Triggers the folder creation when name is confirmed. */ public class CreateFolderDialogFragment extends SherlockDialogFragment implements DialogInterface.OnClickListener { @@ -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,12 +107,18 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener { Toast.LENGTH_LONG).show(); return; } - - if (!FileUtils.isValidName(newFolderName)) { - Toast.makeText( - getSherlockActivity(), - R.string.filename_forbidden_characters, - Toast.LENGTH_LONG).show(); + + boolean serverWithForbiddenChars = ((ComponentsGetter)getSherlockActivity()). + getFileOperationsHelper().isVersionWithForbiddenCharacters(); + + if (!FileUtils.isValidName(newFolderName, serverWithForbiddenChars)) { + int messageId = 0; + if (serverWithForbiddenChars) { + messageId = R.string.filename_forbidden_charaters_from_server; + } else { + messageId = R.string.filename_forbidden_characters; + } + Toast.makeText(getSherlockActivity(), messageId, Toast.LENGTH_LONG).show(); return; }