013fed916aecf50ecab511c7d92cc6ea5f0d724f
[pub/Android/ownCloud.git] / src / com / owncloud / android / files / FileOperationsHelper.java
1 /**
2 * ownCloud Android client application
3 *
4 * @author masensio
5 * @author David A. Velasco
6 * Copyright (C) 2015 ownCloud Inc.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2,
10 * as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22 package com.owncloud.android.files;
23
24 import android.accounts.Account;
25 import android.content.ActivityNotFoundException;
26 import android.content.Context;
27 import android.content.Intent;
28 import android.content.pm.PackageManager;
29 import android.content.pm.ResolveInfo;
30 import android.net.Uri;
31 import android.support.v4.app.DialogFragment;
32 import android.webkit.MimeTypeMap;
33 import android.widget.Toast;
34
35 import com.owncloud.android.R;
36 import com.owncloud.android.authentication.AccountUtils;
37 import com.owncloud.android.datamodel.OCFile;
38 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
39 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
40 import com.owncloud.android.lib.common.network.WebdavUtils;
41 import com.owncloud.android.lib.common.utils.Log_OC;
42 import com.owncloud.android.lib.resources.shares.ShareType;
43 import com.owncloud.android.lib.resources.status.OwnCloudVersion;
44 import com.owncloud.android.services.OperationsService;
45 import com.owncloud.android.services.observer.FileObserverService;
46 import com.owncloud.android.ui.activity.FileActivity;
47 import com.owncloud.android.ui.activity.ShareActivity;
48 import com.owncloud.android.ui.dialog.ShareLinkToDialog;
49 import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
50
51
52 import java.util.List;
53
54 /**
55 *
56 */
57 public class FileOperationsHelper {
58
59 private static final String TAG = FileOperationsHelper.class.getName();
60
61 private static final String FTAG_CHOOSER_DIALOG = "CHOOSER_DIALOG";
62
63 protected FileActivity mFileActivity = null;
64
65 /// Identifier of operation in progress which result shouldn't be lost
66 private long mWaitingForOpId = Long.MAX_VALUE;
67
68 public FileOperationsHelper(FileActivity fileActivity) {
69 mFileActivity = fileActivity;
70 }
71
72
73 public void openFile(OCFile file) {
74 if (file != null) {
75 String storagePath = file.getStoragePath();
76 String encodedStoragePath = WebdavUtils.encodePath(storagePath);
77
78 Intent intentForSavedMimeType = new Intent(Intent.ACTION_VIEW);
79 intentForSavedMimeType.setDataAndType(Uri.parse("file://"+ encodedStoragePath),
80 file.getMimetype());
81 intentForSavedMimeType.setFlags(
82 Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
83 );
84
85 Intent intentForGuessedMimeType = null;
86 if (storagePath.lastIndexOf('.') >= 0) {
87 String guessedMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
88 storagePath.substring(storagePath.lastIndexOf('.') + 1)
89 );
90 if (guessedMimeType != null && !guessedMimeType.equals(file.getMimetype())) {
91 intentForGuessedMimeType = new Intent(Intent.ACTION_VIEW);
92 intentForGuessedMimeType.
93 setDataAndType(Uri.parse("file://"+ encodedStoragePath),
94 guessedMimeType);
95 intentForGuessedMimeType.setFlags(
96 Intent.FLAG_GRANT_READ_URI_PERMISSION |
97 Intent.FLAG_GRANT_WRITE_URI_PERMISSION
98 );
99 }
100 }
101
102 Intent openFileWithIntent;
103 if (intentForGuessedMimeType != null) {
104 openFileWithIntent = intentForGuessedMimeType;
105 } else {
106 openFileWithIntent = intentForSavedMimeType;
107 }
108
109 List<ResolveInfo> launchables = mFileActivity.getPackageManager().
110 queryIntentActivities(openFileWithIntent, PackageManager.GET_INTENT_FILTERS);
111
112 if(launchables != null && launchables.size() > 0) {
113 try {
114 mFileActivity.startActivity(
115 Intent.createChooser(
116 openFileWithIntent, mFileActivity.getString(R.string.actionbar_open_with)
117 )
118 );
119 } catch (ActivityNotFoundException anfe) {
120 showNoAppForFileTypeToast(mFileActivity.getApplicationContext());
121 }
122 } else {
123 showNoAppForFileTypeToast(mFileActivity.getApplicationContext());
124 }
125
126 } else {
127 Log_OC.wtf(TAG, "Trying to open a NULL OCFile");
128 }
129 }
130
131 /**
132 * Displays a toast stating that no application could be found to open the file.
133 *
134 * @param context the context to be able to show a toast.
135 */
136 private void showNoAppForFileTypeToast(Context context) {
137 Toast.makeText(context,
138 R.string.file_list_no_app_for_file_type, Toast.LENGTH_SHORT)
139 .show();
140 }
141
142
143 /**
144 * Helper method to share a file via a public link. Starts a request to do it in {@link OperationsService}
145 *
146 * @param file The file to share.
147 */
148 public void shareFileViaLink(OCFile file) {
149 if (isSharedSupported()) {
150 if (file != null) {
151 mFileActivity.showLoadingDialog(
152 mFileActivity.getApplicationContext().
153 getString(R.string.wait_a_moment)
154 );
155 Intent service = new Intent(mFileActivity, OperationsService.class);
156 service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
157 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
158 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
159 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
160
161 } else {
162 Log_OC.wtf(TAG, "Trying to share a NULL OCFile");
163 // TODO user-level error?
164 }
165
166 } else {
167 // Show a Message
168 Toast t = Toast.makeText(
169 mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
170 Toast.LENGTH_LONG
171 );
172 t.show();
173 }
174 }
175
176 public void getFileWithLink(OCFile file){
177 if (isSharedSupported()) {
178 if (file != null) {
179 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
180 getString(R.string.wait_a_moment));
181
182 Intent service = new Intent(mFileActivity, OperationsService.class);
183 service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
184 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
185 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
186 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
187
188 } else {
189 Log_OC.wtf(TAG, "Trying to share a NULL OCFile");
190 }
191 } else {
192 // Show a Message
193 Toast t = Toast.makeText(
194 mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
195 Toast.LENGTH_LONG
196 );
197 t.show();
198 }
199 }
200
201 public void shareFileWithLinkToApp(OCFile file, String password, Intent sendIntent) {
202
203 if (file != null) {
204 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
205 getString(R.string.wait_a_moment));
206
207 Intent service = new Intent(mFileActivity, OperationsService.class);
208 service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
209 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
210 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
211 service.putExtra(OperationsService.EXTRA_SHARE_PASSWORD, password);
212 service.putExtra(OperationsService.EXTRA_SEND_INTENT, sendIntent);
213 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
214
215 } else {
216 Log_OC.wtf(TAG, "Trying to open a NULL OCFile");
217 }
218 }
219
220 /**
221 * Helper method to share a file with a known sharee. Starts a request to do it in {@link OperationsService}
222 *
223 * @param file The file to share.
224 * @param shareeName Name (user name or group name) of the target sharee.
225 * @param shareType The share type determines the sharee type.
226 */
227 public void shareFileWithSharee(OCFile file, String shareeName, ShareType shareType) {
228 if (file != null) {
229 // TODO check capability?
230 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
231 getString(R.string.wait_a_moment));
232
233 Intent service = new Intent(mFileActivity, OperationsService.class);
234 service.setAction(OperationsService.ACTION_CREATE_SHARE_WITH_SHAREE);
235 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
236 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
237 service.putExtra(OperationsService.EXTRA_SHARE_WITH, shareeName);
238 service.putExtra(OperationsService.EXTRA_SHARE_TYPE, shareType);
239 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
240
241 } else {
242 Log_OC.wtf(TAG, "Trying to share a NULL OCFile");
243 }
244 }
245
246
247 /**
248 * @return 'True' if the server supports the Share API
249 */
250 public boolean isSharedSupported() {
251 if (mFileActivity.getAccount() != null) {
252 OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
253 return (serverVersion != null && serverVersion.isSharedSupported());
254 }
255 return false;
256 }
257
258
259 /**
260 * Helper method to unshare a file publicly shared via link.
261 * Starts a request to do it in {@link OperationsService}
262 *
263 * @param file The file to unshare.
264 */
265 public void unshareFileViaLink(OCFile file) {
266
267 // Unshare the file: Create the intent
268 Intent unshareService = new Intent(mFileActivity, OperationsService.class);
269 unshareService.setAction(OperationsService.ACTION_UNSHARE);
270 unshareService.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
271 unshareService.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
272 unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, ShareType.PUBLIC_LINK);
273 unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, "");
274
275 queueShareIntent(unshareService);
276 }
277
278 public void unshareFileWithUserOrGroup(OCFile file, ShareType shareType, String userOrGroup){
279
280 // Unshare the file: Create the intent
281 Intent unshareService = new Intent(mFileActivity, OperationsService.class);
282 unshareService.setAction(OperationsService.ACTION_UNSHARE);
283 unshareService.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
284 unshareService.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
285 unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, shareType);
286 unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, userOrGroup);
287
288 queueShareIntent(unshareService);
289 }
290
291
292 private void queueShareIntent(Intent shareIntent){
293 if (isSharedSupported()) {
294 // Unshare the file
295 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().
296 queueNewOperation(shareIntent);
297
298 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
299 getString(R.string.wait_a_moment));
300
301 } else {
302 // Show a Message
303 Toast t = Toast.makeText(mFileActivity,
304 mFileActivity.getString(R.string.share_link_no_support_share_api),
305 Toast.LENGTH_LONG);
306 t.show();
307
308 }
309 }
310
311 /**
312 * Show an instance of {@link ShareType} for sharing or unsharing the {@OCFile} received as parameter.
313 *
314 * @param file File to share or unshare.
315 */
316 public void showShareFile(OCFile file){
317 Intent intent = new Intent(mFileActivity, ShareActivity.class);
318 intent.putExtra(mFileActivity.EXTRA_FILE, file);
319 intent.putExtra(mFileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
320 mFileActivity.startActivity(intent);
321
322 }
323
324
325 /**
326 * Starts a dialog that requests a password to the user to protect a share link.
327 *
328 * @param file File which public share will be protected by the requested password
329 */
330 public void requestPasswordForShareViaLink(OCFile file) {
331 SharePasswordDialogFragment dialog =
332 SharePasswordDialogFragment.newInstance(file);
333 dialog.show(
334 mFileActivity.getSupportFragmentManager(),
335 SharePasswordDialogFragment.PASSWORD_FRAGMENT
336 );
337 }
338
339 /**
340 * Updates a public share on a file to set its password.
341 * Starts a request to do it in {@link OperationsService}
342 *
343 * @param file File which public share will be protected with a password.
344 * @param password Password to set for the public link; null or empty string to clear
345 * the current password
346 */
347 public void setPasswordToShareViaLink(OCFile file, String password) {
348 // Set password updating share
349 Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
350 updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
351 updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
352 updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
353 updateShareIntent.putExtra(
354 OperationsService.EXTRA_SHARE_PASSWORD,
355 (password == null) ? "" : password
356 );
357
358 queueShareIntent(updateShareIntent);
359 }
360
361
362 /**
363 * Updates a public share on a file to set its expiration date.
364 * Starts a request to do it in {@link OperationsService}
365 *
366 * @param file File which public share will be constrained with an expiration date.
367 * @param expirationTimeInMillis Expiration date to set. A negative value clears the current expiration
368 * date, leaving the link unrestricted. Zero makes no change.
369 */
370 public void setExpirationDateToShareViaLink(OCFile file, long expirationTimeInMillis) {
371 Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
372 updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
373 updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
374 updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
375 updateShareIntent.putExtra(
376 OperationsService.EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS,
377 expirationTimeInMillis
378 );
379 queueShareIntent(updateShareIntent);
380 }
381
382
383 /**
384 * @return 'True' if the server supports the Search Users API
385 */
386 public boolean isSearchUsersSupportedSupported() {
387 if (mFileActivity.getAccount() != null) {
388 OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
389 return (serverVersion != null && serverVersion.isSearchUsersSupported());
390 }
391 return false;
392 }
393
394 public void sendDownloadedFile(OCFile file) {
395 if (file != null) {
396 String storagePath = file.getStoragePath();
397 String encodedStoragePath = WebdavUtils.encodePath(storagePath);
398 Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
399 // set MimeType
400 sendIntent.setType(file.getMimetype());
401 sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + encodedStoragePath));
402 sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action
403
404 // Show dialog, without the own app
405 String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
406 DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude);
407 chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
408
409 } else {
410 Log_OC.wtf(TAG, "Trying to send a NULL OCFile");
411 }
412 }
413
414 /**
415 * Request the synchronization of a file or folder with the OC server, including its contents.
416 *
417 * @param file The file or folder to synchronize
418 */
419 public void syncFile(OCFile file) {
420 if (!file.isFolder()){
421 Intent intent = new Intent(mFileActivity, OperationsService.class);
422 intent.setAction(OperationsService.ACTION_SYNC_FILE);
423 intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
424 intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
425 intent.putExtra(OperationsService.EXTRA_SYNC_FILE_CONTENTS, true);
426 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(intent);
427 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
428 getString(R.string.wait_a_moment));
429
430 } else {
431 Intent intent = new Intent(mFileActivity, OperationsService.class);
432 intent.setAction(OperationsService.ACTION_SYNC_FOLDER);
433 intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
434 intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
435 mFileActivity.startService(intent);
436
437 }
438 }
439
440 public void toggleFavorite(OCFile file, boolean isFavorite) {
441 file.setFavorite(isFavorite);
442 mFileActivity.getStorageManager().saveFile(file);
443
444 /// register the OCFile instance in the observer service to monitor local updates
445 Intent observedFileIntent = FileObserverService.makeObservedFileIntent(
446 mFileActivity,
447 file,
448 mFileActivity.getAccount(),
449 isFavorite);
450 mFileActivity.startService(observedFileIntent);
451
452 /// immediate content synchronization
453 if (file.isFavorite()) {
454 syncFile(file);
455 }
456 }
457
458 public void renameFile(OCFile file, String newFilename) {
459 // RenameFile
460 Intent service = new Intent(mFileActivity, OperationsService.class);
461 service.setAction(OperationsService.ACTION_RENAME);
462 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
463 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
464 service.putExtra(OperationsService.EXTRA_NEWNAME, newFilename);
465 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
466
467 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
468 getString(R.string.wait_a_moment));
469 }
470
471
472 public void removeFile(OCFile file, boolean onlyLocalCopy) {
473 // RemoveFile
474 Intent service = new Intent(mFileActivity, OperationsService.class);
475 service.setAction(OperationsService.ACTION_REMOVE);
476 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
477 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
478 service.putExtra(OperationsService.EXTRA_REMOVE_ONLY_LOCAL, onlyLocalCopy);
479 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
480
481 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
482 getString(R.string.wait_a_moment));
483 }
484
485
486 public void createFolder(String remotePath, boolean createFullPath) {
487 // Create Folder
488 Intent service = new Intent(mFileActivity, OperationsService.class);
489 service.setAction(OperationsService.ACTION_CREATE_FOLDER);
490 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
491 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);
492 service.putExtra(OperationsService.EXTRA_CREATE_FULL_PATH, createFullPath);
493 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
494
495 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
496 getString(R.string.wait_a_moment));
497 }
498
499 /**
500 * Cancel the transference in downloads (files/folders) and file uploads
501 * @param file OCFile
502 */
503 public void cancelTransference(OCFile file) {
504 Account account = mFileActivity.getAccount();
505 if (file.isFolder()) {
506 OperationsService.OperationsServiceBinder opsBinder =
507 mFileActivity.getOperationsServiceBinder();
508 if (opsBinder != null) {
509 opsBinder.cancel(account, file);
510 }
511 }
512
513 // for both files and folders
514 FileDownloaderBinder downloaderBinder = mFileActivity.getFileDownloaderBinder();
515 if (downloaderBinder != null && downloaderBinder.isDownloading(account, file)) {
516 downloaderBinder.cancel(account, file);
517 }
518 FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder();
519 if (uploaderBinder != null && uploaderBinder.isUploading(account, file)) {
520 uploaderBinder.cancel(account, file);
521 }
522 }
523
524 /**
525 * Start move file operation
526 *
527 * @param newfile File where it is going to be moved
528 * @param currentFile File with the previous info
529 */
530 public void moveFile(OCFile newfile, OCFile currentFile) {
531 // Move files
532 Intent service = new Intent(mFileActivity, OperationsService.class);
533 service.setAction(OperationsService.ACTION_MOVE_FILE);
534 service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, newfile.getRemotePath());
535 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, currentFile.getRemotePath());
536 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
537 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
538
539 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
540 getString(R.string.wait_a_moment));
541 }
542
543 /**
544 * Start copy file operation
545 *
546 * @param newfile File where it is going to be moved
547 * @param currentFile File with the previous info
548 */
549 public void copyFile(OCFile newfile, OCFile currentFile) {
550 // Copy files
551 Intent service = new Intent(mFileActivity, OperationsService.class);
552 service.setAction(OperationsService.ACTION_COPY_FILE);
553 service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, newfile.getRemotePath());
554 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, currentFile.getRemotePath());
555 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
556 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
557
558 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
559 getString(R.string.wait_a_moment));
560 }
561
562 public long getOpIdWaitingFor() {
563 return mWaitingForOpId;
564 }
565
566
567 public void setOpIdWaitingFor(long waitingForOpId) {
568 mWaitingForOpId = waitingForOpId;
569 }
570
571 /**
572 * @return 'True' if the server doesn't need to check forbidden characters
573 */
574 public boolean isVersionWithForbiddenCharacters() {
575 if (mFileActivity.getAccount() != null) {
576 OwnCloudVersion serverVersion =
577 AccountUtils.getServerVersion(mFileActivity.getAccount());
578 return (serverVersion != null && serverVersion.isVersionWithForbiddenCharacters());
579 }
580 return false;
581 }
582
583 }