projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Context handling made consistent
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
operations
/
DownloadFileOperation.java
diff --git
a/src/com/owncloud/android/operations/DownloadFileOperation.java
b/src/com/owncloud/android/operations/DownloadFileOperation.java
index
a35a016
..
2704654
100644
(file)
--- a/
src/com/owncloud/android/operations/DownloadFileOperation.java
+++ b/
src/com/owncloud/android/operations/DownloadFileOperation.java
@@
-32,9
+32,9
@@
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.http.HttpStatus;
import com.owncloud.android.datamodel.OCFile;
import org.apache.http.HttpStatus;
import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.operations.RemoteOperation;
import com.owncloud.android.operations.RemoteOperationResult;
import com.owncloud.android.operations.RemoteOperation;
import com.owncloud.android.operations.RemoteOperationResult;
+import com.owncloud.android.utils.FileStorageUtils;
import eu.alefzero.webdav.OnDatatransferProgressListener;
import eu.alefzero.webdav.WebdavClient;
import eu.alefzero.webdav.OnDatatransferProgressListener;
import eu.alefzero.webdav.WebdavClient;
@@
-50,9
+50,9
@@
import android.webkit.MimeTypeMap;
*/
public class DownloadFileOperation extends RemoteOperation {
*/
public class DownloadFileOperation extends RemoteOperation {
- private static final String TAG = DownloadFileOperation.class.get
Canonical
Name();
+ private static final String TAG = DownloadFileOperation.class.get
Simple
Name();
- private Account mAccount
= null
;
+ private Account mAccount;
private OCFile mFile;
private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
private OCFile mFile;
private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
@@
-78,11
+78,15
@@
public class DownloadFileOperation extends RemoteOperation {
}
public String getSavePath() {
}
public String getSavePath() {
- return FileDownloader.getSavePath(mAccount.name) + mFile.getRemotePath();
+ String path = mFile.getStoragePath(); // re-downloads should be done over the original file
+ if (path != null && path.length() > 0) {
+ return path;
+ }
+ return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile);
}
public String getTmpPath() {
}
public String getTmpPath() {
- return File
Downloader
.getTemporalPath(mAccount.name) + mFile.getRemotePath();
+ return File
StorageUtils
.getTemporalPath(mAccount.name) + mFile.getRemotePath();
}
public String getRemotePath() {
}
public String getRemotePath() {
@@
-90,7
+94,7
@@
public class DownloadFileOperation extends RemoteOperation {
}
public String getMimeType() {
}
public String getMimeType() {
- String mimeType = mFile.getMimetype();
+ String mimeType = mFile.getMimetype();
// TODO fix the mime types in OCFiles FOREVER
if (mimeType == null || mimeType.length() <= 0) {
try {
mimeType = MimeTypeMap.getSingleton()
if (mimeType == null || mimeType.length() <= 0) {
try {
mimeType = MimeTypeMap.getSingleton()
@@
-119,7
+123,7
@@
public class DownloadFileOperation extends RemoteOperation {
protected RemoteOperationResult run(WebdavClient client) {
RemoteOperationResult result = null;
File newFile = null;
protected RemoteOperationResult run(WebdavClient client) {
RemoteOperationResult result = null;
File newFile = null;
- boolean moved =
fals
e;
+ boolean moved =
tru
e;
/// download will be performed to a temporal file, then moved to the final location
File tmpFile = new File(getTmpPath());
/// download will be performed to a temporal file, then moved to the final location
File tmpFile = new File(getTmpPath());