mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
Allow multiple selection of read-only messages, with limitations
This commit is contained in:
parent
ed08936b62
commit
d56068c650
2 changed files with 36 additions and 31 deletions
|
@ -3042,6 +3042,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
folder = db.folder().getFolder(message.folder);
|
folder = db.folder().getFolder(message.folder);
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
continue;
|
continue;
|
||||||
|
if (folder.read_only)
|
||||||
|
result.read_only = true;
|
||||||
folders.put(folder.id, folder);
|
folders.put(folder.id, folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3213,43 +3215,45 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_raw_send, order++, R.string.title_raw_send)
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_raw_send, order++, R.string.title_raw_send)
|
||||||
.setIcon(R.drawable.twotone_attachment_24);
|
.setIcon(R.drawable.twotone_attachment_24);
|
||||||
|
|
||||||
if (result.hasInbox && !result.isInbox) // not is inbox
|
if (!result.read_only) {
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_folder_inbox, order++, R.string.title_folder_inbox)
|
if (result.hasInbox && !result.isInbox) // not is inbox
|
||||||
.setIcon(R.drawable.twotone_move_to_inbox_24);
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_folder_inbox, order++, R.string.title_folder_inbox)
|
||||||
|
.setIcon(R.drawable.twotone_move_to_inbox_24);
|
||||||
|
|
||||||
if (result.hasArchive && !result.isArchive) // has archive and not is archive
|
if (result.hasArchive && !result.isArchive) // has archive and not is archive
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_archive, order++, R.string.title_archive)
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_archive, order++, R.string.title_archive)
|
||||||
.setIcon(R.drawable.twotone_archive_24);
|
.setIcon(R.drawable.twotone_archive_24);
|
||||||
|
|
||||||
if (result.hasJunk && !result.isJunk && !result.isDrafts) // has junk and not junk/drafts
|
if (result.hasJunk && !result.isJunk && !result.isDrafts) // has junk and not junk/drafts
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_spam, order++, R.string.title_spam)
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_spam, order++, R.string.title_spam)
|
||||||
.setIcon(R.drawable.twotone_report_24);
|
.setIcon(R.drawable.twotone_report_24);
|
||||||
|
|
||||||
if (!result.isTrash && result.hasTrash && !result.isJunk) // not trash and has trash and not is junk
|
if (!result.isTrash && result.hasTrash && !result.isJunk) // not trash and has trash and not is junk
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_trash, order++, R.string.title_trash)
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_trash, order++, R.string.title_trash)
|
||||||
.setIcon(R.drawable.twotone_delete_24);
|
.setIcon(R.drawable.twotone_delete_24);
|
||||||
|
|
||||||
if (result.isTrash || !result.hasTrash || result.isJunk || true) // is trash or no trash or is junk
|
if (result.isTrash || !result.hasTrash || result.isJunk || true) // is trash or no trash or is junk
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_delete_permanently, order++, R.string.title_delete_permanently)
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_delete_permanently, order++, R.string.title_delete_permanently)
|
||||||
.setIcon(R.drawable.twotone_delete_forever_24);
|
.setIcon(R.drawable.twotone_delete_forever_24);
|
||||||
|
|
||||||
for (EntityAccount account : result.accounts) {
|
for (EntityAccount account : result.accounts) {
|
||||||
String title = getString(R.string.title_move_to_account, account.name);
|
String title = getString(R.string.title_move_to_account, account.name);
|
||||||
SpannableString ss = new SpannableString(title);
|
SpannableString ss = new SpannableString(title);
|
||||||
if (account.name != null && account.color != null) {
|
if (account.name != null && account.color != null) {
|
||||||
int i = title.indexOf(account.name);
|
int i = title.indexOf(account.name);
|
||||||
int first = title.codePointAt(i);
|
int first = title.codePointAt(i);
|
||||||
int count = Character.charCount(first);
|
int count = Character.charCount(first);
|
||||||
ss.setSpan(new ForegroundColorSpan(account.color), i, i + count, 0);
|
ss.setSpan(new ForegroundColorSpan(account.color), i, i + count, 0);
|
||||||
|
}
|
||||||
|
MenuItem item = popupMenu.getMenu().add(Menu.FIRST, R.string.title_move_to_account, order++, ss)
|
||||||
|
.setIcon(R.drawable.twotone_drive_file_move_24);
|
||||||
|
item.setIntent(new Intent().putExtra("account", account.id));
|
||||||
}
|
}
|
||||||
MenuItem item = popupMenu.getMenu().add(Menu.FIRST, R.string.title_move_to_account, order++, ss)
|
|
||||||
.setIcon(R.drawable.twotone_drive_file_move_24);
|
|
||||||
item.setIntent(new Intent().putExtra("account", account.id));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.copyto != null)
|
if (result.copyto != null)
|
||||||
popupMenu.getMenu().add(Menu.FIRST, R.string.title_copy_to, order++, R.string.title_copy_to)
|
popupMenu.getMenu().add(Menu.FIRST, R.string.title_copy_to, order++, R.string.title_copy_to)
|
||||||
.setIcon(R.drawable.twotone_file_copy_24);
|
.setIcon(R.drawable.twotone_file_copy_24);
|
||||||
|
}
|
||||||
|
|
||||||
popupMenu.insertIcons(context);
|
popupMenu.insertIcons(context);
|
||||||
|
|
||||||
|
@ -8824,6 +8828,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
boolean hasImap;
|
boolean hasImap;
|
||||||
boolean hasPop;
|
boolean hasPop;
|
||||||
Boolean leave_deleted;
|
Boolean leave_deleted;
|
||||||
|
boolean read_only;
|
||||||
List<Long> folders;
|
List<Long> folders;
|
||||||
List<EntityAccount> accounts;
|
List<EntityAccount> accounts;
|
||||||
EntityAccount copyto;
|
EntityAccount copyto;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class SelectionPredicateMessage extends SelectionTracker.SelectionPredica
|
||||||
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
|
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (message.uid != null && !message.folderReadOnly)
|
if (message.uid != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue