|
@@ -60,6 +60,7 @@ import com.nextcloud.utils.ShortcutUtil;
|
|
import com.nextcloud.utils.extensions.BundleExtensionsKt;
|
|
import com.nextcloud.utils.extensions.BundleExtensionsKt;
|
|
import com.nextcloud.utils.extensions.FileExtensionsKt;
|
|
import com.nextcloud.utils.extensions.FileExtensionsKt;
|
|
import com.nextcloud.utils.extensions.IntentExtensionsKt;
|
|
import com.nextcloud.utils.extensions.IntentExtensionsKt;
|
|
|
|
+import com.nextcloud.utils.fileNameValidator.FileNameValidator;
|
|
import com.nextcloud.utils.view.FastScrollUtils;
|
|
import com.nextcloud.utils.view.FastScrollUtils;
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
@@ -1246,6 +1247,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|
mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(checkedFiles, false);
|
|
mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(checkedFiles, false);
|
|
return true;
|
|
return true;
|
|
} else if (itemId == R.id.action_move_or_copy) {
|
|
} else if (itemId == R.id.action_move_or_copy) {
|
|
|
|
+ boolean isFilenamesCorrect = checkFilenames(checkedFiles);
|
|
|
|
+
|
|
|
|
+ if (!isFilenamesCorrect) {
|
|
|
|
+ DisplayUtils.showSnackMessage(requireActivity(),R.string.file_name_validator_rename_before_move_or_copy);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
pickFolderForMoveOrCopy(checkedFiles);
|
|
pickFolderForMoveOrCopy(checkedFiles);
|
|
return true;
|
|
return true;
|
|
} else if (itemId == R.id.action_select_all_action_menu) {
|
|
} else if (itemId == R.id.action_select_all_action_menu) {
|
|
@@ -1264,6 +1272,25 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private OCCapability getCapabilities() {
|
|
|
|
+ final User currentUser = accountManager.getUser();
|
|
|
|
+ return mContainerActivity.getStorageManager().getCapability(currentUser.getAccountName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean checkFilenames(Set<OCFile> checkedFiles) {
|
|
|
|
+ boolean result = true;
|
|
|
|
+
|
|
|
|
+ for (OCFile file : checkedFiles) {
|
|
|
|
+ String errorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext(), null);
|
|
|
|
+ if (errorMessage != null) {
|
|
|
|
+ result = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void pickFolderForMoveOrCopy(final Set<OCFile> checkedFiles) {
|
|
private void pickFolderForMoveOrCopy(final Set<OCFile> checkedFiles) {
|
|
int requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
|
|
int requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
|
|
String extraAction = FolderPickerActivity.MOVE_OR_COPY;
|
|
String extraAction = FolderPickerActivity.MOVE_OR_COPY;
|