Search in sources :

Example 1 with SendErrorState

use of com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState in project k-9 by k9mail.

the class MessageCompose method createMessageBuilder.

@Nullable
private MessageBuilder createMessageBuilder(boolean isDraft) {
    MessageBuilder builder;
    recipientPresenter.updateCryptoStatus();
    ComposeCryptoStatus cryptoStatus = recipientPresenter.getCurrentCryptoStatus();
    // TODO encrypt drafts for storage
    if (!isDraft && cryptoStatus.shouldUsePgpMessageBuilder()) {
        SendErrorState maybeSendErrorState = cryptoStatus.getSendErrorStateOrNull();
        if (maybeSendErrorState != null) {
            recipientPresenter.showPgpSendError(maybeSendErrorState);
            return null;
        }
        PgpMessageBuilder pgpBuilder = PgpMessageBuilder.newInstance();
        recipientPresenter.builderSetProperties(pgpBuilder);
        builder = pgpBuilder;
    } else {
        builder = SimpleMessageBuilder.newInstance();
    }
    builder.setSubject(Utility.stripNewLines(subjectView.getText().toString())).setSentDate(new Date()).setHideTimeZone(K9.hideTimeZone()).setTo(recipientPresenter.getToAddresses()).setCc(recipientPresenter.getCcAddresses()).setBcc(recipientPresenter.getBccAddresses()).setInReplyTo(repliedToMessageId).setReferences(referencedMessageIds).setRequestReadReceipt(requestReadReceipt).setIdentity(identity).setMessageFormat(currentMessageFormat).setText(messageContentView.getCharacters()).setAttachments(attachmentPresenter.createAttachmentList()).setSignature(signatureView.getCharacters()).setSignatureBeforeQuotedText(account.isSignatureBeforeQuotedText()).setIdentityChanged(identityChanged).setSignatureChanged(signatureChanged).setCursorPosition(messageContentView.getSelectionStart()).setMessageReference(relatedMessageReference).setDraft(isDraft).setIsPgpInlineEnabled(cryptoStatus.isPgpInlineModeEnabled());
    quotedMessagePresenter.builderSetProperties(builder);
    return builder;
}
Also used : SendErrorState(com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState) PgpMessageBuilder(com.fsck.k9.message.PgpMessageBuilder) SimpleMessageBuilder(com.fsck.k9.message.SimpleMessageBuilder) MessageBuilder(com.fsck.k9.message.MessageBuilder) PgpMessageBuilder(com.fsck.k9.message.PgpMessageBuilder) ComposeCryptoStatus(com.fsck.k9.activity.compose.ComposeCryptoStatus) Date(java.util.Date) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 ComposeCryptoStatus (com.fsck.k9.activity.compose.ComposeCryptoStatus)1 SendErrorState (com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState)1 MessageBuilder (com.fsck.k9.message.MessageBuilder)1 PgpMessageBuilder (com.fsck.k9.message.PgpMessageBuilder)1 SimpleMessageBuilder (com.fsck.k9.message.SimpleMessageBuilder)1 Date (java.util.Date)1