Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89ba2c51 authored by Christian Frommeyer's avatar Christian Frommeyer
Browse files

More nested classes extracted from LocalStore.

parent f92da3af
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.store.local;

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;
    }
}
 No newline at end of file
+2 −53
Original line number Diff line number Diff line
@@ -3473,31 +3473,6 @@ public class LocalStore extends Store implements Serializable {
        }
    }

    public static class LocalTextBody extends TextBody {
        /**
         * This is an HTML-ified version of the message for display purposes.
         */
        private String mBodyForDisplay;

        public LocalTextBody(String body) {
            super(body);
        }

        public LocalTextBody(String body, String bodyForDisplay) {
            super(body);
            this.mBodyForDisplay = bodyForDisplay;
        }

        public String getBodyForDisplay() {
            return mBodyForDisplay;
        }

        public void setBodyForDisplay(String mBodyForDisplay) {
            this.mBodyForDisplay = mBodyForDisplay;
        }

    }//LocalTextBody

    public class LocalMessage extends MimeMessage {
        private long mId;
        private int mAttachmentCount;
@@ -3593,8 +3568,8 @@ public class LocalStore extends Store implements Serializable {
            if (part == null) {
                // If that fails, try and get a text part.
                part = MimeUtility.findFirstPartByMimeType(this, "text/plain");
                if (part != null && part.getBody() instanceof LocalStore.LocalTextBody) {
                    text = ((LocalStore.LocalTextBody) part.getBody()).getBodyForDisplay();
                if (part != null && part.getBody() instanceof LocalTextBody) {
                    text = ((LocalTextBody) part.getBody()).getBodyForDisplay();
                }
            } else {
                // We successfully found an HTML part; do the necessary character set decoding.
@@ -4028,32 +4003,6 @@ public class LocalStore extends Store implements Serializable {
        }
    }

    public static 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;
        }
    }

    static class ThreadInfo {
        public final long threadId;
        public final long msgId;
+28 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.store.local;

import com.fsck.k9.mail.internet.TextBody;

public class LocalTextBody extends TextBody {
    /**
     * This is an HTML-ified version of the message for display purposes.
     */
    private String mBodyForDisplay;

    public LocalTextBody(String body) {
        super(body);
    }

    public LocalTextBody(String body, String bodyForDisplay) {
        super(body);
        this.mBodyForDisplay = bodyForDisplay;
    }

    public String getBodyForDisplay() {
        return mBodyForDisplay;
    }

    public void setBodyForDisplay(String mBodyForDisplay) {
        this.mBodyForDisplay = mBodyForDisplay;
    }

}//LocalTextBody
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MimeHeader;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.store.local.LocalStore.LocalAttachmentBodyPart;
import com.fsck.k9.mail.store.local.LocalAttachmentBodyPart;
import com.fsck.k9.provider.AttachmentProvider;

public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener {
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Multipart;
import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.store.local.LocalStore;
import com.fsck.k9.mail.store.local.LocalAttachmentBodyPart;
import com.fsck.k9.mail.store.local.LocalStore.LocalMessage;
import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;

@@ -626,7 +626,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
            for (int i = 0; i < mp.getCount(); i++) {
                renderAttachments(mp.getBodyPart(i), depth + 1, message, account, controller, listener);
            }
        } else if (part instanceof LocalStore.LocalAttachmentBodyPart) {
        } else if (part instanceof LocalAttachmentBodyPart) {
            AttachmentView view = (AttachmentView)mInflater.inflate(R.layout.message_view_attachment, null);
            view.setCallback(attachmentCallback);