passphrase changes update need to save

This commit is contained in:
Ashley Hughes 2014-02-06 15:21:29 +00:00
parent 53dc044ab4
commit 6dbf482755

View File

@ -109,15 +109,22 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
ExportHelper mExportHelper;
public void somethingChanged()
{
mNeedsSaving = mUserIdsView.needsSaving();
mNeedsSaving |= mKeysView.needsSaving();
mNeedsSaving |= hasPassphraseChanged();
Toast.makeText(this, "Needs saving: " + Boolean.toString(mNeedsSaving) + "(" + Boolean.toString(mUserIdsView.needsSaving()) + ", " + Boolean.toString(mKeysView.needsSaving()) + ")", Toast.LENGTH_LONG).show();
}
public void onDeleted(Editor e, boolean wasNewItem)
{
somethingChanged();
}
public void onEdited()
{
mNeedsSaving = mUserIdsView.needsSaving();
mNeedsSaving |= mKeysView.needsSaving();
Toast.makeText(this, "Needs saving: " + Boolean.toString(mNeedsSaving), Toast.LENGTH_LONG).show();
somethingChanged();
}
@Override
@ -400,6 +407,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE);
updatePassPhraseButtonText();
somethingChanged();
}
}
};
@ -471,6 +479,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
mNewPassPhrase = mSavedNewPassPhrase;
mChangePassPhrase.setVisibility(View.VISIBLE);
}
somethingChanged();
}
});
}
@ -493,6 +502,15 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
}
}
public boolean hasPassphraseChanged()
{
if (mNoPassphrase.isChecked()) {
return mIsPassPhraseSet;
} else {
return (mNewPassPhrase != null && !mNewPassPhrase.equals(""));
}
}
private void saveClicked() {
long masterKeyId = getMasterKeyId();
try {