mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 19:34:15 +01:00
Delete drafts instead of trash
Reason: A51 NO [ALERT] Cannot MOVE messages out of the Drafts folder
This commit is contained in:
@@ -72,7 +72,7 @@ public class FragmentAnswer extends FragmentEx {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.action_trash:
|
||||
case R.id.action_delete:
|
||||
onActionTrash();
|
||||
return true;
|
||||
case R.id.action_save:
|
||||
@@ -99,7 +99,7 @@ public class FragmentAnswer extends FragmentEx {
|
||||
public void onChanged(EntityAnswer answer) {
|
||||
etName.setText(answer == null ? null : answer.name);
|
||||
etText.setText(answer == null ? null : answer.text);
|
||||
bottom_navigation.findViewById(R.id.action_trash).setVisibility(answer == null ? View.GONE : View.VISIBLE);
|
||||
bottom_navigation.findViewById(R.id.action_delete).setVisibility(answer == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
pbWait.setVisibility(View.GONE);
|
||||
grpReady.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
@@ -75,6 +76,7 @@ import javax.mail.internet.InternetAddress;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.cursoradapter.widget.SimpleCursorAdapter;
|
||||
@@ -226,7 +228,21 @@ public class FragmentCompose extends FragmentEx {
|
||||
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
onAction(item.getItemId());
|
||||
int action = item.getItemId();
|
||||
if (action == R.id.action_delete) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder
|
||||
.setMessage(R.string.title_ask_delete)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onAction(R.id.action_delete);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null).show();
|
||||
|
||||
} else
|
||||
onAction(action);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -960,14 +976,12 @@ public class FragmentCompose extends FragmentEx {
|
||||
String pbody = "<pre>" + body.replaceAll("\\r?\\n", "<br />") + "</pre>";
|
||||
|
||||
// Execute action
|
||||
if (action == R.id.action_trash) {
|
||||
draft.ui_seen = true;
|
||||
if (action == R.id.action_delete) {
|
||||
draft.msgid = null;
|
||||
draft.ui_hide = true;
|
||||
db.message().updateMessage(draft);
|
||||
draft.write(context, pbody);
|
||||
|
||||
EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH);
|
||||
EntityOperation.queue(db, draft, EntityOperation.MOVE, trash.id);
|
||||
EntityOperation.queue(db, draft, EntityOperation.DELETE);
|
||||
|
||||
} else if (action == R.id.action_save) {
|
||||
db.message().updateMessage(draft);
|
||||
@@ -1041,10 +1055,10 @@ public class FragmentCompose extends FragmentEx {
|
||||
Helper.setViewsEnabled(view, true);
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
||||
if (action == R.id.action_trash) {
|
||||
if (action == R.id.action_delete) {
|
||||
autosave = false;
|
||||
getFragmentManager().popBackStack();
|
||||
Toast.makeText(getContext(), R.string.title_draft_trashed, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
|
||||
|
||||
} else if (action == R.id.action_save) {
|
||||
if (draft != null)
|
||||
|
||||
@@ -289,7 +289,7 @@ public class FragmentMessage extends FragmentEx {
|
||||
case R.id.action_spam:
|
||||
onActionSpam();
|
||||
return true;
|
||||
case R.id.action_trash:
|
||||
case R.id.action_delete:
|
||||
onActionDelete();
|
||||
return true;
|
||||
case R.id.action_move:
|
||||
@@ -465,7 +465,7 @@ public class FragmentMessage extends FragmentEx {
|
||||
bottom_navigation.setTag(inTrash || !hasTrash || inOutbox);
|
||||
|
||||
bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(message.uid != null && !inArchive && !inJunk && hasJunk);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_trash).setVisible((message.uid != null && hasTrash) || (inOutbox && !TextUtils.isEmpty(message.error)));
|
||||
bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible((message.uid != null && hasTrash) || (inOutbox && !TextUtils.isEmpty(message.error)));
|
||||
bottom_navigation.getMenu().findItem(R.id.action_move).setVisible(message.uid != null && (!inInbox || hasUser));
|
||||
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(message.uid != null && !inArchive && hasArchive);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!inOutbox);
|
||||
|
||||
Reference in New Issue
Block a user