X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/ebbc1793e23f67dc7aa2214a542fa2c037fcf4c2..10f99ceb9ca7a65b2d59f30a7ddfbfa7ffc60a7a:/src/com/owncloud/android/datamodel/FileDataStorageManager.java diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index f886e16c..5abdd892 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -27,9 +27,9 @@ import java.util.Vector; import com.owncloud.android.MainApp; import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; -import com.owncloud.android.lib.operations.common.OCShare; -import com.owncloud.android.lib.operations.common.ShareType; -import com.owncloud.android.lib.utils.FileUtils; +import com.owncloud.android.lib.resources.shares.OCShare; +import com.owncloud.android.lib.resources.shares.ShareType; +import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.utils.FileStorageUtils; import com.owncloud.android.utils.Log_OC; @@ -858,8 +858,33 @@ public class FileDataStorageManager { return share; } - public OCShare getShareByPath(String path) { - Cursor c = getShareCursorForValue(ProviderTableMeta.OCSHARES_PATH, path); + public OCShare getFirstShareByPathAndType(String path, ShareType type) { + Cursor c = null; + if (getContentResolver() != null) { + c = getContentResolver().query( + ProviderTableMeta.CONTENT_URI_SHARE, + null, + ProviderTableMeta.OCSHARES_PATH + "=? AND " + + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? AND " + + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?", + new String[] { path, Integer.toString(type.getValue()), mAccount.name }, + null); + } else { + try { + c = getContentProviderClient().query( + ProviderTableMeta.CONTENT_URI_SHARE, + null, + ProviderTableMeta.OCSHARES_PATH + "=? AND " + + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? AND " + + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?", + new String[] { path, Integer.toString(type.getValue()), mAccount.name }, + null); + + } catch (RemoteException e) { + Log_OC.e(TAG, "Could not get file details: " + e.getMessage()); + c = null; + } + } OCShare share = null; if (c.moveToFirst()) { share = createShareInstance(c);