Delete attachment improvements

pull/213/head
M66B 1 year ago
parent 8b7c882fdb
commit a70f8bb4b7

@ -510,7 +510,7 @@ class Core {
break;
case EntityOperation.DETACH:
onDetach(context, jargs, message, (IMAPFolder) ifolder);
onDetach(context, jargs, account, folder, message, (IMAPStore) istore, (IMAPFolder) ifolder, state);
break;
case EntityOperation.EXISTS:
@ -2092,7 +2092,7 @@ class Core {
EntityLog.log(context, "Operation attachment size=" + attachment.size);
}
private static void onDetach(Context context, JSONArray jargs, EntityMessage message, IMAPFolder ifolder) throws JSONException, MessagingException, IOException {
private static void onDetach(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
DB db = DB.getInstance(context);
JSONArray jids = jargs.getJSONArray(0);
@ -2126,6 +2126,13 @@ class Core {
ifolder.appendMessages(new Message[]{icopy});
Long uid = findUid(context, account, ifolder, msgid);
if (uid != null) {
JSONArray fargs = new JSONArray();
fargs.put(uid);
onFetch(context, fargs, folder, istore, ifolder, state);
}
if (trash == null) {
imessage.setFlag(Flags.Flag.DELETED, true);
expunge(context, ifolder, Arrays.asList(imessage));

@ -100,7 +100,7 @@ public class EntityAttachment {
public String error;
@Ignore
public boolean selected = true;
public boolean selected = false;
// Gmail sends inline images as attachments with a name and cid

@ -84,6 +84,9 @@ public class FragmentDialogDeleteAttachments extends FragmentDialogBase {
protected void onExecuted(final Bundle args, List<EntityAttachment> attachments) {
if (attachments == null)
attachments = new ArrayList<>();
for (EntityAttachment attachment : attachments)
if (attachment.encryption == null)
attachment.selected = true;
adapter.set(attachments);
}
@ -162,6 +165,7 @@ public class FragmentDialogDeleteAttachments extends FragmentDialogBase {
private void bindTo(EntityAttachment attachment) {
cbEnabled.setText(attachment.name);
cbEnabled.setChecked(attachment.selected);
cbEnabled.setEnabled(attachment.encryption == null);
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(attachment.type))

Loading…
Cancel
Save