mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 03:32:16 -05:00
Remove unused LocalAttachment* classes
This commit is contained in:
parent
c9b2ec533c
commit
64e92ab1c1
@ -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 {
|
||||
|
||||
|
@ -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,18 +2623,20 @@ 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 {
|
||||
//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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user