mirror of https://github.com/M66B/FairEmail.git
Undo move trash / leave deleted
This commit is contained in:
parent
0822d14be0
commit
ed4ffce5ec
|
@ -1600,6 +1600,7 @@ class Core {
|
|||
|
||||
// Move from trash/drafts only
|
||||
if (!EntityFolder.DRAFTS.equals(folder.type) &&
|
||||
!(EntityFolder.INBOX.equals(folder.type) && account.leave_deleted) &&
|
||||
!(EntityFolder.TRASH.equals(folder.type) && account.leave_deleted))
|
||||
throw new IllegalArgumentException("Invalid POP3 folder" +
|
||||
" source=" + folder.type + " target=" + target.type +
|
||||
|
|
|
@ -2523,9 +2523,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
} else if (EntityMessage.SWIPE_ACTION_DELETE.equals(action) ||
|
||||
(action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)) ||
|
||||
(EntityFolder.TRASH.equals(actionType) && EntityFolder.JUNK.equals(message.folderType))) {
|
||||
if (!(message.accountLeaveDeleted && EntityFolder.INBOX.equals(message.folderType)))
|
||||
if (message.accountLeaveDeleted && EntityFolder.INBOX.equals(message.folderType))
|
||||
onSwipeTrash(message);
|
||||
else {
|
||||
adapter.notifyItemChanged(pos);
|
||||
onSwipeDelete(message);
|
||||
onSwipeDelete(message);
|
||||
}
|
||||
} else
|
||||
swipeFolder(message, action);
|
||||
}
|
||||
|
@ -2691,6 +2694,35 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
ask.show(getParentFragmentManager(), "swipe:junk");
|
||||
}
|
||||
|
||||
private void onSwipeTrash(@NonNull TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("account", message.account);
|
||||
|
||||
new SimpleTask<EntityFolder>() {
|
||||
@Override
|
||||
protected EntityFolder onExecute(Context context, Bundle args) throws Throwable {
|
||||
long account = args.getLong("account");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
return db.folder().getFolderByType(account, EntityFolder.TRASH);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EntityFolder trash) {
|
||||
if (trash == null)
|
||||
onSwipeDelete(message);
|
||||
else
|
||||
swipeFolder(message, trash.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(FragmentMessages.this, args, "");
|
||||
}
|
||||
|
||||
private void onSwipeDelete(@NonNull TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("question", getString(R.string.title_ask_delete));
|
||||
|
|
Loading…
Reference in New Issue