From bd35a625c2ef0403eea9ae2701a5bf36da8f19e4 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 9 Jan 2019 18:21:16 +0000 Subject: [PATCH] Simplification --- .../eu/faircode/email/FragmentCompose.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 3b857c80e6..6c6f40154a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1629,21 +1629,14 @@ public class FragmentCompose extends FragmentEx { for (EntityAttachment attachment : attachments) if (attachment.available && ("forward".equals(action) || attachment.isInline())) { - EntityAttachment copy = new EntityAttachment(); - copy.message = result.draft.id; - copy.sequence = ++sequence; - copy.name = attachment.name; - copy.type = attachment.type; - copy.disposition = attachment.disposition; - copy.cid = attachment.cid; - copy.encryption = attachment.encryption; - copy.size = attachment.size; - copy.progress = attachment.progress; - copy.available = attachment.available; - copy.id = db.attachment().insertAttachment(copy); + long orig = attachment.id; + attachment.id = null; + attachment.message = result.draft.id; + attachment.sequence = ++sequence; + attachment.id = db.attachment().insertAttachment(attachment); - File source = EntityAttachment.getFile(context, attachment.id); - File target = EntityAttachment.getFile(context, copy.id); + File source = EntityAttachment.getFile(context, orig); + File target = EntityAttachment.getFile(context, attachment.id); Helper.copy(source, target); }