-/* ownCloud Android client application
- * Copyright (C) 2012-2015 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.httpclient.methods.PutMethod;
import android.net.Uri;
import com.owncloud.android.MainApp;
+import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.OwnCloudClient;
/**
* Remote operation performing the upload of a file to an ownCloud server
- *
- * @author David A. Velasco
*/
public class UploadFileOperation extends RemoteOperation {
int localBehaviour,
Context context) {
if (account == null)
- throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation creation");
+ throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation " +
+ "creation");
if (file == null)
throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
if (file.getStoragePath() == null || file.getStoragePath().length() <= 0) {
}
}
}
- localCopyPassed = result.isSuccess();
+ localCopyPassed = (result == null);
/// perform the upload
if ( mChunked &&
if (result.isSuccess()) {
if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_FORGET) {
mFile.setStoragePath(null);
-
+ } else if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_REMOVE){
+ mFile.setStoragePath(null);
+ originalFile.delete();
} else {
mFile.setStoragePath(expectedPath);
File fileToMove = null;
}
}
}
+ FileDataStorageManager.triggerMediaScan(originalFile.getAbsolutePath());
+ FileDataStorageManager.triggerMediaScan(expectedFile.getAbsolutePath());
}
}
newFile.setModificationTimestampAtLastSyncForData(
mFile.getModificationTimestampAtLastSyncForData());
// newFile.setEtag(mFile.getEtag())
- newFile.setKeepInSync(mFile.keepInSync());
+ newFile.setFavorite(mFile.isFavorite());
newFile.setLastSyncDateForProperties(mFile.getLastSyncDateForProperties());
newFile.setLastSyncDateForData(mFile.getLastSyncDateForData());
newFile.setStoragePath(mFile.getStoragePath());