X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/61b267d30983900ab1d4c61195e9034144d6fcf1..14bbe5bf01b8983de8011f217356b40d912bd4a1:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java?ds=sidebyside diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 0dee54f9..8bdc55e0 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -165,6 +165,11 @@ public class SynchronizeFolderOperation extends SyncOperation { sendBroadcastForNotifyingUIUpdate(result.isSuccess()); } } + + if (mCancellationRequested.get()) { + throw new OperationCancelledException(); + } + } catch (OperationCancelledException e) { result = new RemoteOperationResult(e); @@ -172,6 +177,14 @@ public class SynchronizeFolderOperation extends SyncOperation { for (SyncOperation synchOp: mFoldersToWalkDown) { ((SynchronizeFolderOperation) synchOp).cancel(); } + + /// cancellation of download needs to be done separately in any case; a SynchronizeFolderOperation + // may finish much sooner than the real download of the files in the folder + Intent intent = new Intent(mContext, FileDownloader.class); + intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); + intent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); + intent.putExtra(FileDownloader.EXTRA_FILE, mLocalFolder); + mContext.startService(intent); } return result;