small extra check

This commit is contained in:
Ashley Hughes 2014-02-08 12:12:17 +00:00
parent 8d1047d05c
commit cd2b493ea8

View File

@ -326,7 +326,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home: case android.R.id.home:
cancelClicked(); cancelClicked(); //TODO: why isn't this triggered on my tablet - one of many ui problems I've had with this device. A code compatibility issue or a Samsung fail?
return true; return true;
case R.id.menu_key_edit_cancel: case R.id.menu_key_edit_cancel:
cancelClicked(); cancelClicked();
@ -520,25 +520,27 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
private void saveClicked() { private void saveClicked() {
long masterKeyId = getMasterKeyId(); long masterKeyId = getMasterKeyId();
try { if (needsSaving()) { //make sure, as some versions don't support invalidateOptionsMenu
if (!isPassphraseSet()) { try {
throw new PgpGeneralException(this.getString(R.string.set_a_passphrase)); if (!isPassphraseSet()) {
} throw new PgpGeneralException(this.getString(R.string.set_a_passphrase));
}
String passphrase = null; String passphrase = null;
if (mIsPassPhraseSet) if (mIsPassPhraseSet)
passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId); passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId);
else else
passphrase = ""; passphrase = "";
if (passphrase == null) { if (passphrase == null) {
showPassphraseDialog(masterKeyId, masterCanSign); showPassphraseDialog(masterKeyId, masterCanSign);
} else { } else {
mCurrentPassPhrase = passphrase; mCurrentPassPhrase = passphrase;
finallySaveClicked(); finallySaveClicked();
}
} catch (PgpGeneralException e) {
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
Toast.LENGTH_SHORT).show();
} }
} catch (PgpGeneralException e) {
//Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
// Toast.LENGTH_SHORT).show();
} }
} }