diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/BinaryTempFileMessageBody.java b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/BinaryTempFileMessageBody.java index e5fe7c370..a47f2dffd 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/BinaryTempFileMessageBody.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/BinaryTempFileMessageBody.java @@ -11,10 +11,7 @@ import com.fsck.k9.mail.CompositeBody; import com.fsck.k9.mail.MessagingException; /** - * A {@link BinaryTempFileBody} extension containing a body of type - * message/rfc822. This relates to a BinaryTempFileBody the same way that a - * {@link LocalAttachmentMessageBody} relates to a {@link LocalAttachmentBody}. - * + * A {@link BinaryTempFileBody} extension containing a body of type message/rfc822. */ public class BinaryTempFileMessageBody extends BinaryTempFileBody implements CompositeBody { @@ -63,4 +60,4 @@ public class BinaryTempFileMessageBody extends BinaryTempFileBody implements Com */ } -} \ No newline at end of file +} diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java index e6f2f856d..bc434105b 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -109,7 +109,6 @@ import com.fsck.k9.mail.internet.MimeMessageHelper; import com.fsck.k9.mail.internet.MimeMultipart; import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.internet.TextBody; -import com.fsck.k9.mailstore.LocalAttachmentBody; import com.fsck.k9.mailstore.LocalMessage; import com.fsck.k9.mailstore.TempFileBody; import com.fsck.k9.mailstore.TempFileMessageBody; @@ -2624,17 +2623,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, String name = MimeUtility.getHeaderParameter(contentType, "name"); if (name != null) { Body body = part.getBody(); - if (body instanceof LocalAttachmentBody) { - final Uri uri = ((LocalAttachmentBody) body).getContentUri(); - mHandler.post(new Runnable() { - @Override - public void run() { - addAttachment(uri); - } - }); - } else { - return false; - } + //FIXME +// if (body instanceof LocalAttachmentBody) { +// final Uri uri = ((LocalAttachmentBody) body).getContentUri(); +// mHandler.post(new Runnable() { +// @Override +// public void run() { +// addAttachment(uri); +// } +// }); +// } else { +// return false; +// } + return false; } return true; } diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBody.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBody.java deleted file mode 100644 index 0b191472a..000000000 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBody.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fsck.k9.mailstore; - -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import android.content.Context; -import android.net.Uri; - -import com.fsck.k9.mail.MessagingException; - -/** - * An attachment whose contents are loaded from an URI. - */ -public class LocalAttachmentBody extends BinaryAttachmentBody { - private Context context; - private Uri mUri; - - public LocalAttachmentBody(Uri uri, Context context) { - this.context = context; - mUri = uri; - } - - @Override - public InputStream getInputStream() throws MessagingException { - try { - return context.getContentResolver().openInputStream(mUri); - } catch (FileNotFoundException fnfe) { - /* - * Since it's completely normal for us to try to serve up attachments that - * have been blown away, we just return an empty stream. - */ - return new ByteArrayInputStream(LocalStore.EMPTY_BYTE_ARRAY); - } - } - - public Uri getContentUri() { - return mUri; - } -} diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBodyPart.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBodyPart.java deleted file mode 100644 index ab6eae968..000000000 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentBodyPart.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fsck.k9.mailstore; - -import com.fsck.k9.mail.Body; -import com.fsck.k9.mail.MessagingException; -import com.fsck.k9.mail.internet.MimeBodyPart; - -public class LocalAttachmentBodyPart extends MimeBodyPart { - private long mAttachmentId = -1; - - public LocalAttachmentBodyPart(Body body, long attachmentId) throws MessagingException { - super(body); - mAttachmentId = attachmentId; - } - - /** - * Returns the local attachment id of this body, or -1 if it is not stored. - * @return - */ - public long getAttachmentId() { - return mAttachmentId; - } - - public void setAttachmentId(long attachmentId) { - mAttachmentId = attachmentId; - } - - @Override - public String toString() { - return "" + mAttachmentId; - } -} diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentMessageBody.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentMessageBody.java deleted file mode 100644 index 82d62e092..000000000 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalAttachmentMessageBody.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fsck.k9.mailstore; - -import java.io.IOException; -import java.io.OutputStream; - -import org.apache.james.mime4j.util.MimeUtil; - -import android.content.Context; -import android.net.Uri; - -import com.fsck.k9.mail.CompositeBody; -import com.fsck.k9.mail.MessagingException; - -/** - * A {@link LocalAttachmentBody} extension containing a message/rfc822 type body - * - */ -class LocalAttachmentMessageBody extends LocalAttachmentBody implements CompositeBody { - - public LocalAttachmentMessageBody(Uri uri, Context context) { - super(uri, context); - } - - @Override - public void writeTo(OutputStream out) throws IOException, MessagingException { - AttachmentMessageBodyUtil.writeTo(this, out); - } - - @Override - public void setUsing7bitTransport() throws MessagingException { - /* - * There's nothing to recurse into here, so there's nothing to do. - * The enclosing BodyPart already called setEncoding(MimeUtil.ENC_7BIT). Once - * writeTo() is called, the file with the rfc822 body will be opened - * for reading and will then be recursed. - */ - - } - - @Override - public void setEncoding(String encoding) throws MessagingException { - if (!MimeUtil.ENC_7BIT.equalsIgnoreCase(encoding) - && !MimeUtil.ENC_8BIT.equalsIgnoreCase(encoding)) { - throw new MessagingException( - "Incompatible content-transfer-encoding applied to a CompositeBody"); - } - mEncoding = encoding; - } -} diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/TempFileMessageBody.java b/k9mail/src/main/java/com/fsck/k9/mailstore/TempFileMessageBody.java index c310ae2e4..7730b20e5 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/TempFileMessageBody.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/TempFileMessageBody.java @@ -9,8 +9,7 @@ import com.fsck.k9.mail.CompositeBody; import com.fsck.k9.mail.MessagingException; /** - * An attachment containing a body of type message/rfc822 - * whose contents are contained in a file. + * An attachment containing a body of type message/rfc822 whose contents are contained in a file. */ public class TempFileMessageBody extends TempFileBody implements CompositeBody { @@ -25,7 +24,12 @@ public class TempFileMessageBody extends TempFileBody implements CompositeBody { @Override public void setUsing7bitTransport() throws MessagingException { - // see LocalAttachmentMessageBody.setUsing7bitTransport() + /* + * There's nothing to recurse into here, so there's nothing to do. + * The enclosing BodyPart already called setEncoding(MimeUtil.ENC_7BIT). Once + * writeTo() is called, the file with the rfc822 body will be opened + * for reading and will then be recursed. + */ } @Override