|
|
|
@ -2484,6 +2484,22 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
Log.i("Load action id=" + draft.id + " action=" + getActionName(action));
|
|
|
|
|
|
|
|
|
|
if (action == R.id.action_delete) {
|
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH);
|
|
|
|
|
if (empty || trash == null)
|
|
|
|
|
EntityOperation.queue(context, draft, EntityOperation.DELETE);
|
|
|
|
|
else
|
|
|
|
|
EntityOperation.queue(context, draft, EntityOperation.MOVE, trash.id);
|
|
|
|
|
|
|
|
|
|
if (!empty) {
|
|
|
|
|
Handler handler = new Handler(context.getMainLooper());
|
|
|
|
|
handler.post(new Runnable() {
|
|
|
|
|
public void run() {
|
|
|
|
|
ToastEx.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
// Move draft to new account
|
|
|
|
|
if (draft.account != aid && aid >= 0) {
|
|
|
|
|
Log.i("Account changed");
|
|
|
|
@ -2692,22 +2708,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Execute action
|
|
|
|
|
if (action == R.id.action_delete) {
|
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(draft.account, EntityFolder.TRASH);
|
|
|
|
|
if (empty || trash == null)
|
|
|
|
|
EntityOperation.queue(context, draft, EntityOperation.DELETE);
|
|
|
|
|
else
|
|
|
|
|
EntityOperation.queue(context, draft, EntityOperation.MOVE, trash.id);
|
|
|
|
|
|
|
|
|
|
if (!empty) {
|
|
|
|
|
Handler handler = new Handler(context.getMainLooper());
|
|
|
|
|
handler.post(new Runnable() {
|
|
|
|
|
public void run() {
|
|
|
|
|
ToastEx.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (action == R.id.action_save ||
|
|
|
|
|
if (action == R.id.action_save ||
|
|
|
|
|
action == R.id.action_undo ||
|
|
|
|
|
action == R.id.action_redo ||
|
|
|
|
|
action == R.id.menu_encrypt) {
|
|
|
|
@ -2781,6 +2782,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
|
} finally {
|
|
|
|
|