瀏覽代碼

merge fix

Bartek Przybylski 13 年之前
父節點
當前提交
3951aa97f0

+ 3 - 3
src/eu/alefzero/owncloud/datamodel/FileDataStorageManager.java

@@ -95,13 +95,13 @@ public class FileDataStorageManager implements DataStorageManager {
         cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
         cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
         if (file.getParentId() != 0)
         if (file.getParentId() != 0)
             cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
             cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
-        cv.put(ProviderTableMeta.FILE_PATH, file.getPath());
+        cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
         cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
         cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
         cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
         cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDate());
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDate());
 
 
-        if (fileExists(file.getPath())) {
-            OCFile tmpfile = getFileByPath(file.getPath());
+        if (fileExists(file.getRemotePath())) {
+            OCFile tmpfile = getFileByPath(file.getRemotePath());
             file.setStoragePath(tmpfile.getStoragePath());
             file.setStoragePath(tmpfile.getStoragePath());
             cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
             cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
             file.setFileId(tmpfile.getFileId());
             file.setFileId(tmpfile.getFileId());

+ 16 - 4
src/eu/alefzero/owncloud/datamodel/OCFile.java

@@ -86,11 +86,11 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     }
     }
 
 
     /**
     /**
-     * Returns the path of the file
+     * Returns the remote path of the file on ownCloud
      * 
      * 
-     * @return The path
+     * @return The remote path to the file
      */
      */
-    public String getPath() {
+    public String getRemotePath() {
         return mRemotePath;
         return mRemotePath;
     }
     }
 
 
@@ -119,7 +119,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
      * @return true if it is
      * @return true if it is
      */
      */
     public boolean isDownloaded() {
     public boolean isDownloaded() {
-        return mLocalPath != null || mLocalPath.equals("");
+        return mLocalPath != null && !mLocalPath.equals("");
     }
     }
 
 
     /**
     /**
@@ -333,4 +333,16 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         return getFileName().toLowerCase().compareTo(another.getFileName().toLowerCase());
         return getFileName().toLowerCase().compareTo(another.getFileName().toLowerCase());
     }
     }
 
 
+    public boolean equals(Object o) {
+        OCFile that = (OCFile) o;
+        return this.mId == that.mId;
+    }
+
+    @Override
+    public String toString() {
+        String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s]";
+        asString = String.format(asString, new Long(mId), getFileName(), mMimeType, isDownloaded(), mLocalPath, mRemotePath);
+        return asString;
+    }
+
 }
 }

+ 1 - 1
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java

@@ -137,7 +137,7 @@ public class FileDetailFragment extends SherlockFragment implements
         Intent i = new Intent(getActivity(), FileDownloader.class);
         Intent i = new Intent(getActivity(), FileDownloader.class);
         i.putExtra(FileDownloader.EXTRA_ACCOUNT,
         i.putExtra(FileDownloader.EXTRA_ACCOUNT,
                 mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));
                 mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));
-        i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getPath());
+        i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getRemotePath());
         getActivity().startService(i);
         getActivity().startService(i);
     }
     }