X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5e0f46cc2e9c2a7202430a4aef8ed43e3851802e..6c1c63ac16d98fd94dd9adfcf0ae7480fdabcd70:/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java diff --git a/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java b/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java index 14490944..52baa417 100644 --- a/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java +++ b/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java @@ -30,7 +30,6 @@ import android.content.Context; import android.content.Intent; import com.owncloud.android.R; -import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.RemoteOperation; @@ -44,10 +43,6 @@ import com.owncloud.android.operations.common.SyncOperation; public class CreateShareViaLinkOperation extends SyncOperation { - private static final int READ_ONLY = 1; - - protected FileDataStorageManager mStorageManager; - private String mPath; private String mPassword; private Intent mSendIntent; @@ -87,7 +82,7 @@ public class CreateShareViaLinkOperation extends SyncOperation { "", false, mPassword, - READ_ONLY + OCShare.DEFAULT_PERMISSION ); result = operation.execute(client); } @@ -116,7 +111,8 @@ public class CreateShareViaLinkOperation extends SyncOperation { public Intent getSendIntentWithSubject(Context context) { if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) { - if (getClient() == null || getClient().getCredentials().getUsername() == null) { + if (getClient() == null || getClient().getCredentials() == null || + getClient().getCredentials().getUsername() == null) { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString(R.string.subject_shared_with_you, mFileName) @@ -143,17 +139,18 @@ public class CreateShareViaLinkOperation extends SyncOperation { } else { share.setIsFolder(false); } - share.setPermissions(READ_ONLY); - + getStorageManager().saveShare(share); // Update OCFile with data from share: ShareByLink and publicLink OCFile file = getStorageManager().getFileByPath(mPath); if (file!=null) { - mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink()); file.setPublicLink(share.getShareLink()); file.setShareViaLink(true); getStorageManager().saveFile(file); + if (mSendIntent != null) { + mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink()); + } } }