1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00

Minor cleanup

This commit is contained in:
cketti 2012-01-20 23:15:11 +01:00
parent 773d1e30f1
commit 2c5f640b9e

View File

@ -1525,16 +1525,13 @@ 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;
} }
mDraftNeedsSaving = false; mDraftNeedsSaving = false;
if (!draftsDisabled()) {
saveMessage(); saveMessage();
} }
}
public void onEncryptionKeySelectionDone() { public void onEncryptionKeySelectionDone() {
if (mPgpData.hasEncryptionKeys()) { if (mPgpData.hasEncryptionKeys()) {
@ -2012,8 +2009,8 @@ 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 // Disable the 'Save' menu option if Drafts folder is set to -NONE-
if (draftsDisabled()) { if (isDraftsFolderDisabled()) {
menu.findItem(R.id.save).setEnabled(false); menu.findItem(R.id.save).setEnabled(false);
} }
@ -2042,18 +2039,16 @@ 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 || draftsDisabled()) { } else if (!mDraftNeedsSaving || isDraftsFolderDisabled()) {
Toast.makeText(MessageCompose.this, getString(R.string.message_discarded_toast), Toast.LENGTH_LONG).show(); Toast.makeText(MessageCompose.this, getString(R.string.message_discarded_toast), Toast.LENGTH_LONG).show();
super.onBackPressed(); super.onBackPressed();
} else } else {
showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE); showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
} }
}
private boolean draftsDisabled() { private boolean isDraftsFolderDisabled() {
if (mAccount.getDraftsFolderName().equals(K9.FOLDER_NONE)) return mAccount.getDraftsFolderName().equals(K9.FOLDER_NONE);
return true;
else
return false;
} }
@Override @Override