Disable double confirm for POP

This commit is contained in:
M66B 2021-05-15 09:04:42 +02:00
parent 6a822f09be
commit 692c742020
1 changed files with 11 additions and 10 deletions

View File

@ -2742,7 +2742,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
boolean pop = false;
MoreResult result = new MoreResult(); MoreResult result = new MoreResult();
result.folders = new ArrayList<>(); result.folders = new ArrayList<>();
@ -2777,9 +2776,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
folders.put(folder.id, folder); folders.put(folder.id, folder);
} }
if (account.protocol != EntityAccount.TYPE_IMAP)
pop = true;
if (!result.folders.contains(message.folder)) if (!result.folders.contains(message.folder))
result.folders.add(message.folder); result.folders.add(message.folder);
@ -2790,7 +2786,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean isDrafts = EntityFolder.DRAFTS.equals(folder.type); boolean isDrafts = EntityFolder.DRAFTS.equals(folder.type);
boolean isSent = EntityFolder.SENT.equals(folder.type); boolean isSent = EntityFolder.SENT.equals(folder.type);
if (pop && isSent) if (account.protocol == EntityAccount.TYPE_POP && isSent)
isInbox = true; isInbox = true;
result.isInbox = (result.isInbox == null ? isInbox : result.isInbox && isInbox); result.isInbox = (result.isInbox == null ? isInbox : result.isInbox && isInbox);
@ -2840,6 +2836,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean hasJunk = false; boolean hasJunk = false;
if (account.protocol == EntityAccount.TYPE_IMAP) { if (account.protocol == EntityAccount.TYPE_IMAP) {
result.hasImap = true;
EntityFolder inbox = db.folder().getFolderByType(account.id, EntityFolder.INBOX); EntityFolder inbox = db.folder().getFolderByType(account.id, EntityFolder.INBOX);
EntityFolder archive = db.folder().getFolderByType(account.id, EntityFolder.ARCHIVE); EntityFolder archive = db.folder().getFolderByType(account.id, EntityFolder.ARCHIVE);
EntityFolder trash = db.folder().getFolderByType(account.id, EntityFolder.TRASH); EntityFolder trash = db.folder().getFolderByType(account.id, EntityFolder.TRASH);
@ -2849,7 +2847,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
hasArchive = (archive != null && archive.selectable); hasArchive = (archive != null && archive.selectable);
hasTrash = (trash != null && trash.selectable); hasTrash = (trash != null && trash.selectable);
hasJunk = (junk != null && junk.selectable); hasJunk = (junk != null && junk.selectable);
} } else
result.hasPop = true;
result.hasInbox = (result.hasInbox == null ? hasInbox : result.hasInbox && hasInbox); result.hasInbox = (result.hasInbox == null ? hasInbox : result.hasInbox && hasInbox);
result.hasArchive = (result.hasArchive == null ? hasArchive : result.hasArchive && hasArchive); result.hasArchive = (result.hasArchive == null ? hasArchive : result.hasArchive && hasArchive);
@ -2872,7 +2871,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (result.hasJunk == null) result.hasJunk = false; if (result.hasJunk == null) result.hasJunk = false;
result.accounts = new ArrayList<>(); result.accounts = new ArrayList<>();
if (!pop) if (!result.hasPop)
for (EntityAccount account : db.account().getSynchronizingAccounts()) for (EntityAccount account : db.account().getSynchronizingAccounts())
if (account.protocol == EntityAccount.TYPE_IMAP) if (account.protocol == EntityAccount.TYPE_IMAP)
result.accounts.add(account); result.accounts.add(account);
@ -3024,7 +3023,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
onActionMoveSelection(EntityFolder.TRASH); onActionMoveSelection(EntityFolder.TRASH);
return true; return true;
} else if (itemId == R.string.title_delete_permanently) { } else if (itemId == R.string.title_delete_permanently) {
onActionDeleteSelection(); onActionDeleteSelection(result.hasPop && !result.hasImap);
return true; return true;
} else if (itemId == R.string.title_raw_send) { } else if (itemId == R.string.title_raw_send) {
onActionRaw(); onActionRaw();
@ -3309,7 +3308,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}.execute(this, args, "messages:set:importance"); }.execute(this, args, "messages:set:importance");
} }
private void onActionDeleteSelection() { private void onActionDeleteSelection(boolean pop) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLongArray("selected", getSelection()); args.putLongArray("selected", getSelection());
@ -3352,7 +3351,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Bundle aargs = new Bundle(); Bundle aargs = new Bundle();
aargs.putString("question", getResources() aargs.putString("question", getResources()
.getQuantityString(R.plurals.title_deleting_messages, ids.size(), ids.size())); .getQuantityString(R.plurals.title_deleting_messages, ids.size(), ids.size()));
if (!EntityFolder.TRASH.equals(type) && !EntityFolder.JUNK.equals(type)) if (!pop && !EntityFolder.TRASH.equals(type) && !EntityFolder.JUNK.equals(type))
aargs.putString("confirm", getString(R.string.title_no_undo)); aargs.putString("confirm", getString(R.string.title_no_undo));
aargs.putLongArray("ids", Helper.toLongArray(ids)); aargs.putLongArray("ids", Helper.toLongArray(ids));
aargs.putBoolean("warning", true); aargs.putBoolean("warning", true);
@ -8075,6 +8074,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Boolean isTrash; Boolean isTrash;
Boolean isJunk; Boolean isJunk;
Boolean isDrafts; Boolean isDrafts;
boolean hasPop;
boolean hasImap;
List<Long> folders; List<Long> folders;
List<EntityAccount> accounts; List<EntityAccount> accounts;
EntityAccount copyto; EntityAccount copyto;