Merge branch 'issue3508'

This commit is contained in:
cketti 2012-01-20 23:19:22 +01:00
commit 7eccc1701d

View file

@ -1525,7 +1525,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
private void saveIfNeeded() { private void saveIfNeeded() {
if (!mDraftNeedsSaving || mPreventDraftSaving || mPgpData.hasEncryptionKeys() || if (!mDraftNeedsSaving || mPreventDraftSaving || mPgpData.hasEncryptionKeys() ||
mEncryptCheckbox.isChecked()) { mEncryptCheckbox.isChecked() || isDraftsFolderDisabled()) {
return; return;
} }
@ -2009,6 +2009,11 @@ 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 Drafts folder is set to -NONE-
if (isDraftsFolderDisabled()) {
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,14 +2039,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 || isDraftsFolderDisabled()) {
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 isDraftsFolderDisabled() {
return mAccount.getDraftsFolderName().equals(K9.FOLDER_NONE);
}
@Override @Override
public Dialog onCreateDialog(int id) { public Dialog onCreateDialog(int id) {
switch (id) { switch (id) {