mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 22:51:02 +00:00
Undo save: optional add operation
This commit is contained in:
parent
88b60eaf48
commit
b0e0169f7e
1 changed files with 7 additions and 1 deletions
|
@ -294,6 +294,9 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|||
static Long undoSend(long id, Context context) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean save_drafts = prefs.getBoolean("save_drafts", true);
|
||||
|
||||
// Cancel send
|
||||
EntityOperation operation = db.operation().getOperation(id, EntityOperation.SEND);
|
||||
if (operation != null)
|
||||
|
@ -336,7 +339,10 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|||
for (EntityAttachment attachment : attachments)
|
||||
db.attachment().setMessage(attachment.id, message.id);
|
||||
|
||||
EntityOperation.queue(context, message, EntityOperation.ADD);
|
||||
if (save_drafts &&
|
||||
(message.ui_encrypt == null ||
|
||||
EntityMessage.ENCRYPT_NONE.equals(message.ui_encrypt)))
|
||||
EntityOperation.queue(context, message, EntityOperation.ADD);
|
||||
|
||||
// Delete from outbox
|
||||
db.message().deleteMessage(id); // will delete operation too
|
||||
|
|
Loading…
Reference in a new issue