X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/007ca522ecce66d5e346ecca1daae0a7144dd530..d38a69abc1ba78df70fee65fc2434fc80b6be93b:/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 73daed3f..e93736c4 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -45,7 +45,7 @@ import com.owncloud.android.oc_framework.network.webdav.WebdavUtils; import com.owncloud.android.oc_framework.operations.RemoteOperation; import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; -import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation; +import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFolderOperation; import com.owncloud.android.oc_framework.operations.RemoteFile; import com.owncloud.android.syncadapter.FileSyncService; import com.owncloud.android.utils.FileStorageUtils; @@ -244,14 +244,12 @@ public class SynchronizeFolderOperation extends RemoteOperation { private RemoteOperationResult fetchAndSyncRemoteFolder(WebdavClient client) { String remotePath = mLocalFolder.getRemotePath(); - ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath); + ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath); RemoteOperationResult result = operation.execute(client); Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath); if (result.isSuccess()) { - RemoteFile folder = result.getFile(); - ArrayList files = result.getData(); - synchronizeData(folder, files, client); + synchronizeData(result.getData(), client); if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job } @@ -278,26 +276,24 @@ public class SynchronizeFolderOperation extends RemoteOperation { * * Grants that mChildren is updated with fresh data after execution. * - * @param folder Remote Folder to synchronize - * - * @param files Remote Files in Folder + * @param folderAndFiles Remote folder and children files in Folder * * @param client Client instance to the remote server where the data were * retrieved. * @return 'True' when any change was made in the local data, 'false' otherwise. */ - private void synchronizeData(RemoteFile folder, ArrayList files, WebdavClient client) { + private void synchronizeData(ArrayList folderAndFiles, WebdavClient client) { // get 'fresh data' from the database mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath()); // parse data from remote folder - OCFile remoteFolder = fillOCFile(folder); + OCFile remoteFolder = fillOCFile(folderAndFiles.get(0)); remoteFolder.setParentId(mLocalFolder.getParentId()); remoteFolder.setFileId(mLocalFolder.getFileId()); Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath() + " changed - starting update of local data "); - List updatedFiles = new Vector(files.size()); + List updatedFiles = new Vector(folderAndFiles.size() - 1); List filesToSyncContents = new Vector(); // get current data about local contents of the folder to synchronize @@ -309,9 +305,9 @@ public class SynchronizeFolderOperation extends RemoteOperation { // loop to update every child OCFile remoteFile = null, localFile = null; - for (RemoteFile file: files) { + for (int i=1; i