0e44794cb84f1a08fcd2ad4c7d110185ea649769
[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(
333 file,
334 null
335 );
336 dialog.show(
337 mFileActivity.getSupportFragmentManager(),
338 SharePasswordDialogFragment.PASSWORD_FRAGMENT
339 );
340 }
341
342 /**
343 * Updates a public share on a file to set its password.
344 * Starts a request to do it in {@link OperationsService}
345 *
346 * @param file File which public share will be protected with a password.
347 * @param password Password to set for the public link; null or empty string to clear
348 * the current password
349 */
350 public void setPasswordToShareViaLink(OCFile file, String password) {
351 // Set password updating share
352 Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
353 updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
354 updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
355 updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
356 updateShareIntent.putExtra(
357 OperationsService.EXTRA_SHARE_PASSWORD,
358 (password == null) ? "" : password
359 );
360
361 queueShareIntent(updateShareIntent);
362 }
363
364
365 /**
366 * Updates a public share on a file to set its expiration date.
367 * Starts a request to do it in {@link OperationsService}
368 *
369 * @param file File which public share will be constrained with an expiration date.
370 * @param expirationTimeInMillis Expiration date to set. A negative value clears the current expiration
371 * date, leaving the link unrestricted. Zero makes no change.
372 */
373 public void setExpirationDateToShareViaLink(OCFile file, long expirationTimeInMillis) {
374 Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
375 updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
376 updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
377 updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
378 updateShareIntent.putExtra(
379 OperationsService.EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS,
380 expirationTimeInMillis
381 );
382 queueShareIntent(updateShareIntent);
383 }
384
385
386 /**
387 * @return 'True' if the server supports the Search Users API
388 */
389 public boolean isSearchUsersSupportedSupported() {
390 if (mFileActivity.getAccount() != null) {
391 OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
392 return (serverVersion != null && serverVersion.isSearchUsersSupported());
393 }
394 return false;
395 }
396
397 public void sendDownloadedFile(OCFile file) {
398 if (file != null) {
399 String storagePath = file.getStoragePath();
400 String encodedStoragePath = WebdavUtils.encodePath(storagePath);
401 Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
402 // set MimeType
403 sendIntent.setType(file.getMimetype());
404 sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + encodedStoragePath));
405 sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action
406
407 // Show dialog, without the own app
408 String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
409 DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent,
410 packagesToExclude, file);
411 chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
412
413 } else {
414 Log_OC.wtf(TAG, "Trying to send a NULL OCFile");
415 }
416 }
417
418 /**
419 * Request the synchronization of a file or folder with the OC server, including its contents.
420 *
421 * @param file The file or folder to synchronize
422 */
423 public void syncFile(OCFile file) {
424 if (!file.isFolder()){
425 Intent intent = new Intent(mFileActivity, OperationsService.class);
426 intent.setAction(OperationsService.ACTION_SYNC_FILE);
427 intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
428 intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
429 intent.putExtra(OperationsService.EXTRA_SYNC_FILE_CONTENTS, true);
430 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(intent);
431 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
432 getString(R.string.wait_a_moment));
433
434 } else {
435 Intent intent = new Intent(mFileActivity, OperationsService.class);
436 intent.setAction(OperationsService.ACTION_SYNC_FOLDER);
437 intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
438 intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
439 mFileActivity.startService(intent);
440
441 }
442 }
443
444 public void toggleFavorite(OCFile file, boolean isFavorite) {
445 file.setFavorite(isFavorite);
446 mFileActivity.getStorageManager().saveFile(file);
447
448 /// register the OCFile instance in the observer service to monitor local updates
449 Intent observedFileIntent = FileObserverService.makeObservedFileIntent(
450 mFileActivity,
451 file,
452 mFileActivity.getAccount(),
453 isFavorite);
454 mFileActivity.startService(observedFileIntent);
455
456 /// immediate content synchronization
457 if (file.isFavorite()) {
458 syncFile(file);
459 }
460 }
461
462 public void renameFile(OCFile file, String newFilename) {
463 // RenameFile
464 Intent service = new Intent(mFileActivity, OperationsService.class);
465 service.setAction(OperationsService.ACTION_RENAME);
466 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
467 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
468 service.putExtra(OperationsService.EXTRA_NEWNAME, newFilename);
469 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
470
471 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
472 getString(R.string.wait_a_moment));
473 }
474
475
476 public void removeFile(OCFile file, boolean onlyLocalCopy) {
477 // RemoveFile
478 Intent service = new Intent(mFileActivity, OperationsService.class);
479 service.setAction(OperationsService.ACTION_REMOVE);
480 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
481 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
482 service.putExtra(OperationsService.EXTRA_REMOVE_ONLY_LOCAL, onlyLocalCopy);
483 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
484
485 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
486 getString(R.string.wait_a_moment));
487 }
488
489
490 public void createFolder(String remotePath, boolean createFullPath) {
491 // Create Folder
492 Intent service = new Intent(mFileActivity, OperationsService.class);
493 service.setAction(OperationsService.ACTION_CREATE_FOLDER);
494 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
495 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);
496 service.putExtra(OperationsService.EXTRA_CREATE_FULL_PATH, createFullPath);
497 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
498
499 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
500 getString(R.string.wait_a_moment));
501 }
502
503 /**
504 * Cancel the transference in downloads (files/folders) and file uploads
505 * @param file OCFile
506 */
507 public void cancelTransference(OCFile file) {
508 Account account = mFileActivity.getAccount();
509 if (file.isFolder()) {
510 OperationsService.OperationsServiceBinder opsBinder =
511 mFileActivity.getOperationsServiceBinder();
512 if (opsBinder != null) {
513 opsBinder.cancel(account, file);
514 }
515 }
516
517 // for both files and folders
518 FileDownloaderBinder downloaderBinder = mFileActivity.getFileDownloaderBinder();
519 if (downloaderBinder != null && downloaderBinder.isDownloading(account, file)) {
520 downloaderBinder.cancel(account, file);
521 }
522 FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder();
523 if (uploaderBinder != null && uploaderBinder.isUploading(account, file)) {
524 uploaderBinder.cancel(account, file);
525 }
526 }
527
528 /**
529 * Start move file operation
530 *
531 * @param newfile File where it is going to be moved
532 * @param currentFile File with the previous info
533 */
534 public void moveFile(OCFile newfile, OCFile currentFile) {
535 // Move files
536 Intent service = new Intent(mFileActivity, OperationsService.class);
537 service.setAction(OperationsService.ACTION_MOVE_FILE);
538 service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, newfile.getRemotePath());
539 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, currentFile.getRemotePath());
540 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
541 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
542
543 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
544 getString(R.string.wait_a_moment));
545 }
546
547 /**
548 * Start copy file operation
549 *
550 * @param newfile File where it is going to be moved
551 * @param currentFile File with the previous info
552 */
553 public void copyFile(OCFile newfile, OCFile currentFile) {
554 // Copy files
555 Intent service = new Intent(mFileActivity, OperationsService.class);
556 service.setAction(OperationsService.ACTION_COPY_FILE);
557 service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, newfile.getRemotePath());
558 service.putExtra(OperationsService.EXTRA_REMOTE_PATH, currentFile.getRemotePath());
559 service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
560 mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
561
562 mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
563 getString(R.string.wait_a_moment));
564 }
565
566 public long getOpIdWaitingFor() {
567 return mWaitingForOpId;
568 }
569
570
571 public void setOpIdWaitingFor(long waitingForOpId) {
572 mWaitingForOpId = waitingForOpId;
573 }
574
575 /**
576 * @return 'True' if the server doesn't need to check forbidden characters
577 */
578 public boolean isVersionWithForbiddenCharacters() {
579 if (mFileActivity.getAccount() != null) {
580 OwnCloudVersion serverVersion =
581 AccountUtils.getServerVersion(mFileActivity.getAccount());
582 return (serverVersion != null && serverVersion.isVersionWithForbiddenCharacters());
583 }
584 return false;
585 }
586
587 }