1
0
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:
cketti 2015-01-22 04:12:05 +01:00
parent c9b2ec533c
commit 64e92ab1c1
6 changed files with 22 additions and 140 deletions

View File

@ -11,10 +11,7 @@ import com.fsck.k9.mail.CompositeBody;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
/** /**
* A {@link BinaryTempFileBody} extension containing a body of type * A {@link BinaryTempFileBody} extension containing a body of type message/rfc822.
* message/rfc822. This relates to a BinaryTempFileBody the same way that a
* {@link LocalAttachmentMessageBody} relates to a {@link LocalAttachmentBody}.
*
*/ */
public class BinaryTempFileMessageBody extends BinaryTempFileBody implements CompositeBody { public class BinaryTempFileMessageBody extends BinaryTempFileBody implements CompositeBody {

View File

@ -109,7 +109,6 @@ import com.fsck.k9.mail.internet.MimeMessageHelper;
import com.fsck.k9.mail.internet.MimeMultipart; import com.fsck.k9.mail.internet.MimeMultipart;
import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.internet.TextBody; import com.fsck.k9.mail.internet.TextBody;
import com.fsck.k9.mailstore.LocalAttachmentBody;
import com.fsck.k9.mailstore.LocalMessage; import com.fsck.k9.mailstore.LocalMessage;
import com.fsck.k9.mailstore.TempFileBody; import com.fsck.k9.mailstore.TempFileBody;
import com.fsck.k9.mailstore.TempFileMessageBody; import com.fsck.k9.mailstore.TempFileMessageBody;
@ -2624,18 +2623,20 @@ public class MessageCompose extends K9Activity implements OnClickListener,
String name = MimeUtility.getHeaderParameter(contentType, "name"); String name = MimeUtility.getHeaderParameter(contentType, "name");
if (name != null) { if (name != null) {
Body body = part.getBody(); Body body = part.getBody();
if (body instanceof LocalAttachmentBody) { //FIXME
final Uri uri = ((LocalAttachmentBody) body).getContentUri(); // if (body instanceof LocalAttachmentBody) {
mHandler.post(new Runnable() { // final Uri uri = ((LocalAttachmentBody) body).getContentUri();
@Override // mHandler.post(new Runnable() {
public void run() { // @Override
addAttachment(uri); // public void run() {
} // addAttachment(uri);
}); // }
} else { // });
// } else {
// return false;
// }
return false; return false;
} }
}
return true; return true;
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -9,8 +9,7 @@ import com.fsck.k9.mail.CompositeBody;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
/** /**
* An attachment containing a body of type message/rfc822 * An attachment containing a body of type message/rfc822 whose contents are contained in a file.
* whose contents are contained in a file.
*/ */
public class TempFileMessageBody extends TempFileBody implements CompositeBody { public class TempFileMessageBody extends TempFileBody implements CompositeBody {
@ -25,7 +24,12 @@ public class TempFileMessageBody extends TempFileBody implements CompositeBody {
@Override @Override
public void setUsing7bitTransport() throws MessagingException { 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 @Override