projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3468740
)
Local files are protected against removal because of synchronization when out of...
author
David A. Velasco
<dvelasco@solidgear.es>
Wed, 22 Aug 2012 10:50:06 +0000
(12:50 +0200)
committer
David A. Velasco
<dvelasco@solidgear.es>
Wed, 22 Aug 2012 10:50:06 +0000
(12:50 +0200)
src/com/owncloud/android/datamodel/DataStorageManager.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/datamodel/FileDataStorageManager.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
patch
|
blob
|
blame
|
history
diff --git
a/src/com/owncloud/android/datamodel/DataStorageManager.java
b/src/com/owncloud/android/datamodel/DataStorageManager.java
index
a73ab66
..
e824bde
100644
(file)
--- a/
src/com/owncloud/android/datamodel/DataStorageManager.java
+++ b/
src/com/owncloud/android/datamodel/DataStorageManager.java
@@
-37,5
+37,5
@@
public interface DataStorageManager {
public Vector<OCFile> getDirectoryContent(OCFile f);
public Vector<OCFile> getDirectoryContent(OCFile f);
- public void removeFile(OCFile file);
+ public void removeFile(OCFile file
, boolean removeLocalCopy
);
}
}
diff --git
a/src/com/owncloud/android/datamodel/FileDataStorageManager.java
b/src/com/owncloud/android/datamodel/FileDataStorageManager.java
index
49a88c3
..
7bb29d4
100644
(file)
--- a/
src/com/owncloud/android/datamodel/FileDataStorageManager.java
+++ b/
src/com/owncloud/android/datamodel/FileDataStorageManager.java
@@
-399,7
+399,7
@@
public class FileDataStorageManager implements DataStorageManager {
return file;
}
return file;
}
- public void removeFile(OCFile file) {
+ public void removeFile(OCFile file
, boolean removeLocalCopy
) {
Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, ""+file.getFileId());
if (getContentProvider() != null) {
try {
Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, ""+file.getFileId());
if (getContentProvider() != null) {
try {
@@
-414,7
+414,7
@@
public class FileDataStorageManager implements DataStorageManager {
ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
new String[]{mAccount.name});
}
ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
new String[]{mAccount.name});
}
- if (file.isDown()) {
+ if (file.isDown()
&& removeLocalCopy
) {
new File(file.getStoragePath()).delete();
}
}
new File(file.getStoragePath()).delete();
}
}
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index
1a3afe6
..
7b803fc
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@
-210,11
+210,12
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
Vector<OCFile> files = getStorageManager().getDirectoryContent(
\r
getStorageManager().getFileById(parentId));
\r
OCFile file;
\r
Vector<OCFile> files = getStorageManager().getDirectoryContent(
\r
getStorageManager().getFileById(parentId));
\r
OCFile file;
\r
+ String currentSavePath = FileDownloader.getSavePath(mAccount.name);
\r
for (int i=0; i < files.size(); ) {
\r
file = files.get(i);
\r
if (file.getLastSyncDate() != mCurrentSyncTime) {
\r
Log.v(TAG, "removing file: " + file);
\r
for (int i=0; i < files.size(); ) {
\r
file = files.get(i);
\r
if (file.getLastSyncDate() != mCurrentSyncTime) {
\r
Log.v(TAG, "removing file: " + file);
\r
- getStorageManager().removeFile(file);
\r
+ getStorageManager().removeFile(file
, (file.isDown() && file.getStoragePath().startsWith(currentSavePath))
);
\r
files.remove(i);
\r
} else {
\r
i++;
\r
files.remove(i);
\r
} else {
\r
i++;
\r
diff --git
a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
index
a77d9ad
..
979930d
100644
(file)
--- a/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
+++ b/
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
@@
-842,7
+842,7
@@
public class FileDetailFragment extends SherlockFragment implements
\r
if (success) {
\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());
\r
\r
if (success) {
\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());
\r
- fdsm.removeFile(mOld);
\r
+ fdsm.removeFile(mOld
, false
);
\r
fdsm.saveFile(mNew);
\r
mFile = mNew;
\r
mHandler.post(new Runnable() {
\r
fdsm.saveFile(mNew);
\r
mFile = mNew;
\r
mHandler.post(new Runnable() {
\r
@@
-1008,7
+1008,7
@@
public class FileDetailFragment extends SherlockFragment implements
\r
if (success) {
\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());
\r
\r
if (success) {
\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver());
\r
- fdsm.removeFile(mFileToRemove);
\r
+ fdsm.removeFile(mFileToRemove
, true
);
\r
mHandler.post(new Runnable() {
\r
@Override
\r
public void run() {
\r
mHandler.post(new Runnable() {
\r
@Override
\r
public void run() {
\r