X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/8e3787909f253c66a91c137d25cb2b430cfe9dc3..c0c52fa16a79f6be71ffbe7c7cb587af67335793:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 78b6a7ba..36955a51 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -60,7 +60,8 @@ import java.util.concurrent.atomic.AtomicBoolean; * Fetches the list and properties of the files contained in the given folder, including their * properties, and updates the local database with them. * - * Does NOT enter in the child folders to synchronize their contents also. + * Does NOT enter in the child folders to synchronize their contents also, BUT requests for a new operation instance + * doing so. */ public class SynchronizeFolderOperation extends SyncOperation { @@ -96,10 +97,7 @@ public class SynchronizeFolderOperation extends SyncOperation { private List mFilesForDirectDownload; // to avoid extra PROPFINDs when there was no change in the folder - private List mFilesToSyncContentsWithoutUpload; - // this will go out when 'folder synchronization' replaces 'folder download'; step by step - - private List mFavouriteFilesToSyncContents; + private List mFilesToSyncContents; // this will be used for every file when 'folder synchronization' replaces 'folder download' private final AtomicBoolean mCancellationRequested; @@ -120,8 +118,7 @@ public class SynchronizeFolderOperation extends SyncOperation { mContext = context; mRemoteFolderChanged = false; mFilesForDirectDownload = new Vector(); - mFilesToSyncContentsWithoutUpload = new Vector(); - mFavouriteFilesToSyncContents = new Vector(); + mFilesToSyncContents = new Vector(); mCancellationRequested = new AtomicBoolean(false); } @@ -290,8 +287,7 @@ public class SynchronizeFolderOperation extends SyncOperation { List updatedFiles = new Vector(folderAndFiles.size() - 1); mFilesForDirectDownload.clear(); - mFilesToSyncContentsWithoutUpload.clear(); - mFavouriteFilesToSyncContents.clear(); + mFilesToSyncContents.clear(); if (mCancellationRequested.get()) { throw new OperationCancelledException(); @@ -353,14 +349,15 @@ public class SynchronizeFolderOperation extends SyncOperation { /// classify file to sync/download contents later if (remoteFile.isFolder()) { /// to download children files recursively - synchronized(mCancellationRequested) { + synchronized (mCancellationRequested) { if (mCancellationRequested.get()) { throw new OperationCancelledException(); } startSyncFolderOperation(remoteFile.getRemotePath()); } - } else if (remoteFile.isFavorite()) { + //} else if (remoteFile.isFavorite()) { + } else { /// prepare content synchronization for kept-in-sync files SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile, @@ -369,9 +366,9 @@ public class SynchronizeFolderOperation extends SyncOperation { true, mContext ); - mFavouriteFilesToSyncContents.add(operation); + mFilesToSyncContents.add(operation); - } else { + /*} else { /// prepare limited synchronization for regular files SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile, @@ -381,7 +378,7 @@ public class SynchronizeFolderOperation extends SyncOperation { false, mContext ); - mFilesToSyncContentsWithoutUpload.add(operation); + mFilesToSyncContentsWithoutUpload.add(operation);*/ } updatedFiles.add(remoteFile); @@ -411,7 +408,20 @@ public class SynchronizeFolderOperation extends SyncOperation { /// prepare limited synchronization for regular files if (!child.isDown()) { mFilesForDirectDownload.add(child); + + } else { + /// this should result in direct upload of files that were locally modified + SynchronizeFileOperation operation = new SynchronizeFileOperation( + child, + child, // cheating with the remote file to get an upadte to server; to refactor + mAccount, + true, + mContext + ); + mFilesToSyncContents.add(operation); + } + } } } @@ -419,8 +429,7 @@ public class SynchronizeFolderOperation extends SyncOperation { private void syncContents(OwnCloudClient client) throws OperationCancelledException { startDirectDownloads(); - startContentSynchronizations(mFilesToSyncContentsWithoutUpload, client); - startContentSynchronizations(mFavouriteFilesToSyncContents, client); + startContentSynchronizations(mFilesToSyncContents, client); }