1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Don't save to drafts if drafts folder is -NONE-

This commit is contained in:
Nick Nikolaou 2012-01-20 17:02:35 +00:00
parent 96b0a7b28b
commit 1a01c10fc5

View File

@ -1530,6 +1530,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
} }
mDraftNeedsSaving = false; mDraftNeedsSaving = false;
if (!draftsDisabled())
saveMessage(); saveMessage();
} }
@ -2009,6 +2011,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.message_compose_option, menu); getMenuInflater().inflate(R.menu.message_compose_option, menu);
// Disable the 'Save' menu option if folder is set to NONE
if (draftsDisabled())
menu.findItem(R.id.save).setEnabled(false);
/* /*
* Show the menu items "Add attachment (Image)" and "Add attachment (Video)" * Show the menu items "Add attachment (Image)" and "Add attachment (Video)"
* if the work-around for the Gallery bug is enabled (see Issue 1186). * if the work-around for the Gallery bug is enabled (see Issue 1186).
@ -2034,12 +2040,18 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
public void onBackPressed() { public void onBackPressed() {
if (mEncryptCheckbox.isChecked()) { if (mEncryptCheckbox.isChecked()) {
showDialog(DIALOG_REFUSE_TO_SAVE_DRAFT_MARKED_ENCRYPTED); showDialog(DIALOG_REFUSE_TO_SAVE_DRAFT_MARKED_ENCRYPTED);
} } else if (!mDraftNeedsSaving || (mDraftNeedsSaving && draftsDisabled())) {
else if (mDraftNeedsSaving) { Toast.makeText(MessageCompose.this, getString(R.string.message_discarded_toast), Toast.LENGTH_LONG).show();
showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
} else {
super.onBackPressed(); super.onBackPressed();
} else
showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
} }
private boolean draftsDisabled() {
if (mAccount.getDraftsFolderName().equals(K9.FOLDER_NONE))
return true;
else
return false;
} }
@Override @Override