in the encrypt activity automatically select the signature key as encryption key, if it is set, and if the button is pressed

This commit is contained in:
Thialfihar 2010-06-07 14:21:28 +00:00
parent 0c073ca8eb
commit 7b219c5f72

View File

@ -684,7 +684,23 @@ public class EncryptActivity extends BaseActivity {
private void selectPublicKeys() {
Intent intent = new Intent(this, SelectPublicKeyListActivity.class);
intent.putExtra(Apg.EXTRA_SELECTION, mEncryptionKeyIds);
Vector<Long> keyIds = new Vector<Long>();
if (getSecretKeyId() != 0) {
keyIds.add(getSecretKeyId());
}
if (mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0) {
for (int i = 0; i < mEncryptionKeyIds.length; ++i) {
keyIds.add(mEncryptionKeyIds[i]);
}
}
long [] initialKeyIds = null;
if (keyIds.size() > 0) {
initialKeyIds = new long[keyIds.size()];
for (int i = 0; i < keyIds.size(); ++i) {
initialKeyIds[i] = keyIds.get(i);
}
}
intent.putExtra(Apg.EXTRA_SELECTION, initialKeyIds);
startActivityForResult(intent, Id.request.public_keys);
}