mirror of https://github.com/M66B/FairEmail.git
Allow local POP3 flagging
This commit is contained in:
parent
2f7c84c50f
commit
afa030d29e
|
@ -973,10 +973,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ibFlagged.setImageTintList(ColorStateList.valueOf(message.color));
|
||||
}
|
||||
|
||||
ibFlagged.setEnabled(message.uid != null);
|
||||
ibFlagged.setEnabled(message.uid != null || message.accountPop);
|
||||
|
||||
if (flags)
|
||||
ibFlagged.setVisibility(message.folderReadOnly || message.accountPop ? View.INVISIBLE : View.VISIBLE);
|
||||
ibFlagged.setVisibility(message.folderReadOnly ? View.INVISIBLE : View.VISIBLE);
|
||||
else
|
||||
ibFlagged.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -1798,10 +1798,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (message == null)
|
||||
return null;
|
||||
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
message.account, message.thread, threading && thread ? null : id, null);
|
||||
for (EntityMessage threaded : messages)
|
||||
EntityOperation.queue(context, threaded, EntityOperation.FLAG, flagged);
|
||||
EntityAccount account = db.account().getAccount(message.account);
|
||||
if (account == null)
|
||||
return null;
|
||||
|
||||
if (account.pop)
|
||||
EntityOperation.queue(context, message, EntityOperation.FLAG, flagged);
|
||||
else {
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
message.account, message.thread, threading && thread ? null : id, null);
|
||||
for (EntityMessage threaded : messages)
|
||||
EntityOperation.queue(context, threaded, EntityOperation.FLAG, flagged);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
@ -2443,8 +2451,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
popupMenu.getMenu().findItem(R.id.menu_unseen).setEnabled(message.uid != null && !message.folderReadOnly);
|
||||
popupMenu.getMenu().findItem(R.id.menu_unseen).setVisible(!message.accountPop);
|
||||
|
||||
popupMenu.getMenu().findItem(R.id.menu_flag_color).setEnabled(message.uid != null && !message.folderReadOnly);
|
||||
popupMenu.getMenu().findItem(R.id.menu_flag_color).setVisible(!message.accountPop);
|
||||
popupMenu.getMenu().findItem(R.id.menu_flag_color).setEnabled(
|
||||
(message.uid != null && !message.folderReadOnly) || message.accountPop);
|
||||
|
||||
popupMenu.getMenu().findItem(R.id.menu_copy).setEnabled(message.uid != null && !message.folderReadOnly);
|
||||
popupMenu.getMenu().findItem(R.id.menu_copy).setVisible(!message.accountPop);
|
||||
|
|
|
@ -212,17 +212,25 @@ class Core {
|
|||
case EntityOperation.SEEN:
|
||||
onSeen(context, jargs, folder, message, (POP3Folder) ifolder);
|
||||
break;
|
||||
|
||||
case EntityOperation.FLAG:
|
||||
onFlag(context, jargs, folder, message, (POP3Folder) ifolder);
|
||||
break;
|
||||
|
||||
case EntityOperation.ANSWERED:
|
||||
case EntityOperation.ADD:
|
||||
case EntityOperation.EXISTS:
|
||||
// Do nothing
|
||||
break;
|
||||
|
||||
case EntityOperation.DELETE:
|
||||
onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, state);
|
||||
break;
|
||||
|
||||
case EntityOperation.SYNC:
|
||||
onSynchronizeMessages(context, jargs, account, folder, (POP3Folder) ifolder, (POP3Store) istore, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.w(folder.name + " ignored=" + op.name);
|
||||
}
|
||||
|
@ -485,6 +493,14 @@ class Core {
|
|||
db.message().setMessageFlagged(message.id, flagged);
|
||||
}
|
||||
|
||||
private static void onFlag(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, POP3Folder ifolder) throws MessagingException, JSONException {
|
||||
// Star/unstar message
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
boolean flagged = jargs.getBoolean(0);
|
||||
db.message().setMessageFlagged(message.id, flagged);
|
||||
}
|
||||
|
||||
private static void onAnswered(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder) throws MessagingException, JSONException {
|
||||
// Mark message (un)answered
|
||||
DB db = DB.getInstance(context);
|
||||
|
|
Loading…
Reference in New Issue