projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f299079
)
OC-1990: Isolate code from RenameFileOperation to remove dependecies on local storage...
author
masensio
<masensio@solidgear.es>
Thu, 14 Nov 2013 16:44:23 +0000
(17:44 +0100)
committer
masensio
<masensio@solidgear.es>
Thu, 14 Nov 2013 16:44:23 +0000
(17:44 +0100)
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java
patch
|
blob
|
blame
|
history
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
patch
|
blob
|
blame
|
history
oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/files/services/FileUploader.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/operations/RenameFileOperation.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
patch
|
blob
|
blame
|
history
diff --git
a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java
b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java
index
5ee07d7
..
f25c22e
100644
(file)
--- a/
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java
+++ b/
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java
@@
-56,11
+56,7
@@
public class CreateRemoteFolderOperation extends RemoteOperation {
RemoteOperationResult result = null;
MkColMethod mkcol = null;
RemoteOperationResult result = null;
MkColMethod mkcol = null;
-<<<<<<< HEAD
- boolean noInvalidChars = FileUtils.validateName(mRemotePath, true);
-=======
boolean noInvalidChars = FileUtils.validateName(mFolderName);
boolean noInvalidChars = FileUtils.validateName(mFolderName);
->>>>>>> refactor_remote_operation_to_create_folder
if (noInvalidChars) {
try {
mkcol = new MkColMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath));
if (noInvalidChars) {
try {
mkcol = new MkColMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath));
diff --git
a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
index
799ce2f
..
05a58e2
100644
(file)
--- a/
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
+++ b/
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java
@@
-29,7
+29,6
@@
public class RenameRemoteFileOperation extends RemoteOperation {
private String mOldRemotePath;
private String mNewName;
private String mNewRemotePath;
private String mOldRemotePath;
private String mNewName;
private String mNewRemotePath;
- private boolean mIsFolder;
/**
/**
@@
-40,12
+39,11
@@
public class RenameRemoteFileOperation extends RemoteOperation {
* @param newName New name to set as the name of file.
* @param newRemotePath New remote path to move the file, for folders it starts and ends by "/"
*/
* @param newName New name to set as the name of file.
* @param newRemotePath New remote path to move the file, for folders it starts and ends by "/"
*/
- public RenameRemoteFileOperation(String oldName, String oldRemotePath, String newName, String newRemotePath
, boolean isFolder
) {
+ public RenameRemoteFileOperation(String oldName, String oldRemotePath, String newName, String newRemotePath) {
mOldName = oldName;
mOldRemotePath = oldRemotePath;
mNewName = newName;
mNewRemotePath = newRemotePath;
mOldName = oldName;
mOldRemotePath = oldRemotePath;
mNewName = newName;
mNewRemotePath = newRemotePath;
- mIsFolder = isFolder;
}
/**
}
/**
@@
-59,12
+57,7
@@
public class RenameRemoteFileOperation extends RemoteOperation {
LocalMoveMethod move = null;
LocalMoveMethod move = null;
- boolean noInvalidChars = true;
-
- if (mIsFolder)
- noInvalidChars = FileUtils.validateName(mNewRemotePath, mIsFolder);
- else
- noInvalidChars = FileUtils.validateName(mNewName, mIsFolder);
+ boolean noInvalidChars = FileUtils.validateName(mNewName);
if (noInvalidChars) {
try {
if (noInvalidChars) {
try {
diff --git
a/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
b/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
index
1ba399b
..
75bd566
100644
(file)
--- a/
oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
+++ b/
oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
@@
-20,15
+20,11
@@
public class FileUtils {
* @param fileName
* @return
*/
* @param fileName
* @return
*/
- public static boolean validateName(String fileName
, boolean isFolder
) {
+ public static boolean validateName(String fileName) {
boolean result = true;
Log.d("FileUtils", "fileName ======= " + fileName);
boolean result = true;
Log.d("FileUtils", "fileName ======= " + fileName);
- String name = fileName.substring(1);
- if (isFolder) {
- name = name.substring(0, name.length() - 1);
- }
- if (name.contains("/") || fileName.contains("\\") || fileName.contains("<") ||
+ if (fileName.contains("/") || fileName.contains("\\") || fileName.contains("<") ||
fileName.contains(">") || fileName.contains(":") || fileName.contains("\"") ||
fileName.contains("|") || fileName.contains("?") || fileName.contains("*")) {
result = false;
fileName.contains(">") || fileName.contains(":") || fileName.contains("\"") ||
fileName.contains("|") || fileName.contains("?") || fileName.contains("*")) {
result = false;
diff --git
a/src/com/owncloud/android/files/services/FileUploader.java
b/src/com/owncloud/android/files/services/FileUploader.java
index
6e80fd5
..
e8dcf94
100644
(file)
--- a/
src/com/owncloud/android/files/services/FileUploader.java
+++ b/
src/com/owncloud/android/files/services/FileUploader.java
@@
-33,9
+33,7
@@
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.MultiStatus;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.MultiStatus;
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
-import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.R;
-import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
diff --git
a/src/com/owncloud/android/operations/RenameFileOperation.java
b/src/com/owncloud/android/operations/RenameFileOperation.java
index
1eecfc2
..
69ca2f2
100644
(file)
--- a/
src/com/owncloud/android/operations/RenameFileOperation.java
+++ b/
src/com/owncloud/android/operations/RenameFileOperation.java
@@
-100,7
+100,7
@@
public class RenameFileOperation extends RemoteOperation {
}
RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(), mFile.getRemotePath(), mNewName,
}
RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(), mFile.getRemotePath(), mNewName,
- mNewRemotePath
, mFile.isFolder()
);
+ mNewRemotePath);
result = operation.execute(client);
if (result.isSuccess()) {
result = operation.execute(client);
if (result.isSuccess()) {
diff --git
a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
index
199f8c2
..
2ec9f2e
100644
(file)
--- a/
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@
-1375,6
+1375,9
@@
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG);
msg.show();
// TODO throw again the new rename dialog
Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG);
msg.show();
// TODO throw again the new rename dialog
+ } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
+ Toast msg = Toast.makeText(this, R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG);
+ msg.show();
} else {
Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG);
msg.show();
} else {
Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG);
msg.show();
diff --git
a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
index
01ef8d0
..
66febdf
100644
(file)
--- a/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
+++ b/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
@@
-816,6
+816,9
@@
public class FileDetailFragment extends FileFragment implements
Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG);
msg.show();
// TODO throw again the new rename dialog
Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG);
msg.show();
// TODO throw again the new rename dialog
+ } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
+ Toast msg = Toast.makeText(getActivity(), R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG);
+ msg.show();
} else {
Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG);
msg.show();
} else {
Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG);
msg.show();