Added permanent message delete

pull/162/head
M66B 5 years ago
parent 3506cbf1ee
commit aeff4e3169

@ -1954,11 +1954,11 @@ However, not all servers support IMAP keywords and besides that there are no sta
<br /> <br />
<a name="faq108"></a> <a name="faq108"></a>
**(108) Can you add permanently delete messages from any folder?** **~~(108) Can you add permanently delete messages from any folder?~~**
When you delete messages from a folder the messages will be moved to the trash folder, so you have a chance to restore the messages. ~~When you delete messages from a folder the messages will be moved to the trash folder, so you have a chance to restore the messages.~~
You can permanently delete messages from the trash folder. ~~You can permanently delete messages from the trash folder.~~
Permanently delete messages from other folders would defeat the purpose of the trash folder, so this will not be added. ~~Permanently delete messages from other folders would defeat the purpose of the trash folder, so this will not be added.~~
<br /> <br />

@ -2412,7 +2412,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_flag_color).setEnabled(message.uid != null && !message.folderReadOnly); popupMenu.getMenu().findItem(R.id.menu_flag_color).setEnabled(message.uid != null && !message.folderReadOnly);
popupMenu.getMenu().findItem(R.id.menu_copy).setEnabled(message.uid != null && !message.folderReadOnly); popupMenu.getMenu().findItem(R.id.menu_copy).setEnabled(message.uid != null && !message.folderReadOnly);
popupMenu.getMenu().findItem(R.id.menu_delete).setVisible(debug);
popupMenu.getMenu().findItem(R.id.menu_junk).setEnabled(message.uid != null && !message.folderReadOnly); popupMenu.getMenu().findItem(R.id.menu_junk).setEnabled(message.uid != null && !message.folderReadOnly);
popupMenu.getMenu().findItem(R.id.menu_junk).setVisible(hasJunk && !EntityFolder.JUNK.equals(message.folderType)); popupMenu.getMenu().findItem(R.id.menu_junk).setVisible(hasJunk && !EntityFolder.JUNK.equals(message.folderType));
@ -2457,7 +2456,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onActionMove(message, true); onActionMove(message, true);
return true; return true;
case R.id.menu_delete: case R.id.menu_delete:
// For emergencies
onMenuDelete(message); onMenuDelete(message);
return true; return true;
case R.id.menu_junk: case R.id.menu_junk:
@ -2836,24 +2834,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
private void onMenuDelete(final TupleMessageEx message) { private void onMenuDelete(final TupleMessageEx message) {
Bundle args = new Bundle(); Bundle aargs = new Bundle();
args.putLong("id", message.id); aargs.putString("question", context.getString(R.string.title_ask_delete));
aargs.putLong("id", message.id);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
DB db = DB.getInstance(context);
db.message().deleteMessage(id);
return null;
}
@Override FragmentDialogAsk ask = new FragmentDialogAsk();
protected void onException(Bundle args, Throwable ex) { ask.setArguments(aargs);
Helper.unexpectedError(parentFragment.getFragmentManager(), ex); ask.setTargetFragment(parentFragment, FragmentMessages.REQUEST_MESSAGE_DELETE);
} ask.show(parentFragment.getFragmentManager(), "message:delete");
}.execute(context, owner, args, "message:delete");
} }
private void onMenuJunk(final TupleMessageEx message) { private void onMenuJunk(final TupleMessageEx message) {

@ -3964,6 +3964,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel("send:" + message.identity, 1); nm.cancel("send:" + message.identity, 1);
} }
} else if (message.uid == null) {
db.message().deleteMessage(id);
db.folder().setFolderError(message.folder, null);
} else } else
EntityOperation.queue(context, message, EntityOperation.DELETE); EntityOperation.queue(context, message, EntityOperation.DELETE);

Loading…
Cancel
Save