From 1436ab8d90853bfe2ba52d628a38a78368508fe8 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 11 Jul 2014 13:51:36 +0200 Subject: [PATCH] SaveKeyringParcel: follow attribute m prefix coding guideline --- .../keychain/tests/PgpKeyOperationTest.java | 34 +++++------ .../keychain/pgp/PgpKeyOperation.java | 30 +++++----- .../service/KeychainIntentService.java | 4 +- .../keychain/service/SaveKeyringParcel.java | 56 +++++++++---------- .../keychain/ui/EditKeyActivityOld.java | 2 +- .../keychain/ui/EditKeyFragment.java | 22 ++++---- .../keychain/ui/KeyListActivity.java | 11 ++-- .../keychain/ui/WizardActivity.java | 2 +- .../keychain/ui/adapter/UserIdsAdapter.java | 8 +-- 9 files changed, 83 insertions(+), 86 deletions(-) diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java index d1559c539..ba2371bae 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java @@ -49,16 +49,16 @@ public class PgpKeyOperationTest { @BeforeClass public static void setUpOnce() throws Exception { SaveKeyringParcel parcel = new SaveKeyringParcel(); - parcel.addSubKeys.add(new SaveKeyringParcel.SubkeyAdd( + parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd( Constants.choice.algorithm.rsa, 1024, KeyFlags.CERTIFY_OTHER, null)); - parcel.addSubKeys.add(new SaveKeyringParcel.SubkeyAdd( + parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd( Constants.choice.algorithm.rsa, 1024, KeyFlags.SIGN_DATA, null)); - parcel.addSubKeys.add(new SaveKeyringParcel.SubkeyAdd( + parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd( Constants.choice.algorithm.rsa, 1024, KeyFlags.ENCRYPT_COMMS, null)); - parcel.addUserIds.add("twi"); - parcel.addUserIds.add("pink"); - parcel.newPassphrase = "swag"; + parcel.mAddUserIds.add("twi"); + parcel.mAddUserIds.add("pink"); + parcel.mNewPassphrase = "swag"; PgpKeyOperation op = new PgpKeyOperation(null); OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog(); @@ -85,9 +85,9 @@ public class PgpKeyOperationTest { // subkey binding certificates public void testMasterFlags() throws Exception { SaveKeyringParcel parcel = new SaveKeyringParcel(); - parcel.addSubKeys.add(new SaveKeyringParcel.SubkeyAdd( + parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd( Constants.choice.algorithm.rsa, 1024, KeyFlags.CERTIFY_OTHER | KeyFlags.SIGN_DATA, null)); - parcel.addUserIds.add("luna"); + parcel.mAddUserIds.add("luna"); OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog(); ring = op.createSecretKeyRing(parcel, log, 0); @@ -143,7 +143,7 @@ public class PgpKeyOperationTest { @Test public void testSubkeyAdd() throws Exception { - parcel.addSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.SIGN_DATA, null)); + parcel.mAddSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.SIGN_DATA, null)); applyModificationWithChecks(parcel, ring, onlyA, onlyB); @@ -171,7 +171,7 @@ public class PgpKeyOperationTest { { Iterator it = ring.getPublicKeys(); it.next(); - parcel.revokeSubKeys.add(it.next().getKeyId()); + parcel.mRevokeSubKeys.add(it.next().getKeyId()); } applyModificationWithChecks(parcel, ring, onlyA, onlyB); @@ -199,7 +199,7 @@ public class PgpKeyOperationTest { { // revoke second user id - parcel.revokeUserIds.add(uid); + parcel.mRevokeUserIds.add(uid); modified = applyModificationWithChecks(parcel, ring, onlyA, onlyB); @@ -221,7 +221,7 @@ public class PgpKeyOperationTest { { // re-add second user id // new parcel parcel.reset(); - parcel.addUserIds.add(uid); + parcel.mAddUserIds.add(uid); applyModificationWithChecks(parcel, modified, onlyA, onlyB, true, false); @@ -257,7 +257,7 @@ public class PgpKeyOperationTest { @Test public void testUserIdAdd() throws Exception { - parcel.addUserIds.add("rainbow"); + parcel.mAddUserIds.add("rainbow"); UncachedKeyRing modified = applyModificationWithChecks(parcel, ring, onlyA, onlyB); @@ -293,8 +293,8 @@ public class PgpKeyOperationTest { String uid = ring.getPublicKey().getUnorderedUserIds().get(1); { // first part, add new user id which is also primary - parcel.addUserIds.add("jack"); - parcel.changePrimaryUserId = "jack"; + parcel.mAddUserIds.add("jack"); + parcel.mChangePrimaryUserId = "jack"; modified = applyModificationWithChecks(parcel, modified, onlyA, onlyB); @@ -304,7 +304,7 @@ public class PgpKeyOperationTest { { // second part, change primary to a different one parcel.reset(); - parcel.changePrimaryUserId = uid; + parcel.mChangePrimaryUserId = uid; modified = applyModificationWithChecks(parcel, modified, onlyA, onlyB); @@ -318,7 +318,7 @@ public class PgpKeyOperationTest { { // third part, change primary to a non-existent one parcel.reset(); //noinspection SpellCheckingInspection - parcel.changePrimaryUserId = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + parcel.mChangePrimaryUserId = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; WrappedSecretKeyRing secretRing = new WrappedSecretKeyRing(ring.getEncoded(), false, 0); OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index b0d458102..748707384 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -170,12 +170,12 @@ public class PgpKeyOperation { indent += 1; updateProgress(R.string.progress_building_key, 0, 100); - if (saveParcel.addSubKeys == null || saveParcel.addSubKeys.isEmpty()) { + if (saveParcel.mAddSubKeys == null || saveParcel.mAddSubKeys.isEmpty()) { log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_MASTER, indent); return null; } - SubkeyAdd add = saveParcel.addSubKeys.remove(0); + SubkeyAdd add = saveParcel.mAddSubKeys.remove(0); if ((add.mFlags & KeyFlags.CERTIFY_OTHER) != KeyFlags.CERTIFY_OTHER) { log.add(LogLevel.ERROR, LogType.MSG_CR_ERROR_NO_CERTIFY, indent); return null; @@ -299,7 +299,7 @@ public class PgpKeyOperation { PGPPublicKey modifiedPublicKey = masterPublicKey; // 2a. Add certificates for new user ids - for (String userId : saveParcel.addUserIds) { + for (String userId : saveParcel.mAddUserIds) { log.add(LogLevel.INFO, LogType.MSG_MF_UID_ADD, indent); // this operation supersedes all previous binding and revocation certificates, @@ -324,8 +324,8 @@ public class PgpKeyOperation { } // if it's supposed to be primary, we can do that here as well - boolean isPrimary = saveParcel.changePrimaryUserId != null - && userId.equals(saveParcel.changePrimaryUserId); + boolean isPrimary = saveParcel.mChangePrimaryUserId != null + && userId.equals(saveParcel.mChangePrimaryUserId); // generate and add new certificate PGPSignature cert = generateUserIdSignature(masterPrivateKey, masterPublicKey, userId, isPrimary, masterKeyFlags); @@ -333,7 +333,7 @@ public class PgpKeyOperation { } // 2b. Add revocations for revoked user ids - for (String userId : saveParcel.revokeUserIds) { + for (String userId : saveParcel.mRevokeUserIds) { log.add(LogLevel.INFO, LogType.MSG_MF_UID_REVOKE, indent); // a duplicate revocatin will be removed during canonicalization, so no need to // take care of that here. @@ -343,7 +343,7 @@ public class PgpKeyOperation { } // 3. If primary user id changed, generate new certificates for both old and new - if (saveParcel.changePrimaryUserId != null) { + if (saveParcel.mChangePrimaryUserId != null) { // keep track if we actually changed one boolean ok = false; @@ -387,7 +387,7 @@ public class PgpKeyOperation { // we definitely should not update certifications of revoked keys, so just leave it. if (isRevoked) { // revoked user ids cannot be primary! - if (userId.equals(saveParcel.changePrimaryUserId)) { + if (userId.equals(saveParcel.mChangePrimaryUserId)) { log.add(LogLevel.ERROR, LogType.MSG_MF_ERROR_REVOKED_PRIMARY, indent); return null; } @@ -397,7 +397,7 @@ public class PgpKeyOperation { // if this is~ the/a primary user id if (currentCert.hasSubpackets() && currentCert.getHashedSubPackets().isPrimaryUserID()) { // if it's the one we want, just leave it as is - if (userId.equals(saveParcel.changePrimaryUserId)) { + if (userId.equals(saveParcel.mChangePrimaryUserId)) { ok = true; continue; } @@ -415,7 +415,7 @@ public class PgpKeyOperation { // if we are here, this is not currently a primary user id // if it should be - if (userId.equals(saveParcel.changePrimaryUserId)) { + if (userId.equals(saveParcel.mChangePrimaryUserId)) { // add shiny new primary user id certificate log.add(LogLevel.DEBUG, LogType.MSG_MF_PRIMARY_NEW, indent); modifiedPublicKey = PGPPublicKey.removeCertification( @@ -447,7 +447,7 @@ public class PgpKeyOperation { } // 4a. For each subkey change, generate new subkey binding certificate - for (SaveKeyringParcel.SubkeyChange change : saveParcel.changeSubKeys) { + for (SaveKeyringParcel.SubkeyChange change : saveParcel.mChangeSubKeys) { log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_CHANGE, indent, PgpKeyHelper.convertKeyIdToHex(change.mKeyId)); PGPSecretKey sKey = sKR.getSecretKey(change.mKeyId); @@ -473,7 +473,7 @@ public class PgpKeyOperation { } // 4b. For each subkey revocation, generate new subkey revocation certificate - for (long revocation : saveParcel.revokeSubKeys) { + for (long revocation : saveParcel.mRevokeSubKeys) { log.add(LogLevel.INFO, LogType.MSG_MF_SUBKEY_REVOKE, indent, PgpKeyHelper.convertKeyIdToHex(revocation)); PGPSecretKey sKey = sKR.getSecretKey(revocation); @@ -492,7 +492,7 @@ public class PgpKeyOperation { } // 5. Generate and add new subkeys - for (SaveKeyringParcel.SubkeyAdd add : saveParcel.addSubKeys) { + for (SaveKeyringParcel.SubkeyAdd add : saveParcel.mAddSubKeys) { try { if (add.mExpiry != null && new Date(add.mExpiry).before(new Date())) { @@ -537,7 +537,7 @@ public class PgpKeyOperation { } // 6. If requested, change passphrase - if (saveParcel.newPassphrase != null) { + if (saveParcel.mNewPassphrase != null) { log.add(LogLevel.INFO, LogType.MSG_MF_PASSPHRASE, indent); PGPDigestCalculator sha1Calc = new JcaPGPDigestCalculatorProviderBuilder().build() .get(HashAlgorithmTags.SHA1); @@ -547,7 +547,7 @@ public class PgpKeyOperation { PBESecretKeyEncryptor keyEncryptorNew = new JcePBESecretKeyEncryptorBuilder( PGPEncryptedData.CAST5, sha1Calc) .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build( - saveParcel.newPassphrase.toCharArray()); + saveParcel.mNewPassphrase.toCharArray()); sKR = PGPSecretKeyRing.copyWithNewPassword(sKR, keyDecryptor, keyEncryptorNew); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index c4c31bdad..172e1418f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -349,9 +349,9 @@ public class KeychainIntentService extends IntentService providerHelper.saveSecretKeyRing(ring, new ProgressScaler(this, 10, 95, 100)); // cache new passphrase - if (saveParcel.newPassphrase != null) { + if (saveParcel.mNewPassphrase != null) { PassphraseCacheService.addCachedPassphrase(this, ring.getMasterKeyId(), - saveParcel.newPassphrase); + saveParcel.mNewPassphrase); } } catch (ProviderHelper.NotFoundException e) { sendErrorToHandler(e); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java index 9f29c15dc..a0dbf2b0b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java @@ -27,16 +27,16 @@ public class SaveKeyringParcel implements Parcelable { // the key fingerprint, for safety. MUST be null for a new key. public byte[] mFingerprint; - public String newPassphrase; + public String mNewPassphrase; - public ArrayList addUserIds; - public ArrayList addSubKeys; + public ArrayList mAddUserIds; + public ArrayList mAddSubKeys; - public ArrayList changeSubKeys; - public String changePrimaryUserId; + public ArrayList mChangeSubKeys; + public String mChangePrimaryUserId; - public ArrayList revokeUserIds; - public ArrayList revokeSubKeys; + public ArrayList mRevokeUserIds; + public ArrayList mRevokeSubKeys; public SaveKeyringParcel() { reset(); @@ -49,13 +49,13 @@ public class SaveKeyringParcel implements Parcelable { } public void reset() { - newPassphrase = null; - addUserIds = new ArrayList(); - addSubKeys = new ArrayList(); - changePrimaryUserId = null; - changeSubKeys = new ArrayList(); - revokeUserIds = new ArrayList(); - revokeSubKeys = new ArrayList(); + mNewPassphrase = null; + mAddUserIds = new ArrayList(); + mAddSubKeys = new ArrayList(); + mChangePrimaryUserId = null; + mChangeSubKeys = new ArrayList(); + mRevokeUserIds = new ArrayList(); + mRevokeSubKeys = new ArrayList(); } // performance gain for using Parcelable here would probably be negligible, @@ -88,16 +88,16 @@ public class SaveKeyringParcel implements Parcelable { mMasterKeyId = source.readInt() != 0 ? source.readLong() : null; mFingerprint = source.createByteArray(); - newPassphrase = source.readString(); + mNewPassphrase = source.readString(); - addUserIds = source.createStringArrayList(); - addSubKeys = (ArrayList) source.readSerializable(); + mAddUserIds = source.createStringArrayList(); + mAddSubKeys = (ArrayList) source.readSerializable(); - changeSubKeys = (ArrayList) source.readSerializable(); - changePrimaryUserId = source.readString(); + mChangeSubKeys = (ArrayList) source.readSerializable(); + mChangePrimaryUserId = source.readString(); - revokeUserIds = source.createStringArrayList(); - revokeSubKeys = (ArrayList) source.readSerializable(); + mRevokeUserIds = source.createStringArrayList(); + mRevokeSubKeys = (ArrayList) source.readSerializable(); } @Override @@ -108,16 +108,16 @@ public class SaveKeyringParcel implements Parcelable { } destination.writeByteArray(mFingerprint); - destination.writeString(newPassphrase); + destination.writeString(mNewPassphrase); - destination.writeStringList(addUserIds); - destination.writeSerializable(addSubKeys); + destination.writeStringList(mAddUserIds); + destination.writeSerializable(mAddSubKeys); - destination.writeSerializable(changeSubKeys); - destination.writeString(changePrimaryUserId); + destination.writeSerializable(mChangeSubKeys); + destination.writeString(mChangePrimaryUserId); - destination.writeStringList(revokeUserIds); - destination.writeSerializable(revokeSubKeys); + destination.writeStringList(mRevokeUserIds); + destination.writeSerializable(mRevokeSubKeys); } public static final Creator CREATOR = new Creator() { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java index 51457cd45..d9deb802c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java @@ -556,7 +556,7 @@ public class EditKeyActivityOld extends ActionBarActivity implements EditorListe saveParams.deletedKeys = mKeysView.getDeletedKeys(); saveParams.keysExpiryDates = getKeysExpiryDates(mKeysView); saveParams.keysUsages = getKeysUsages(mKeysView); - saveParams.newPassphrase = mNewPassphrase; + saveParams.mNewPassphrase = mNewPassphrase; saveParams.oldPassphrase = mCurrentPassphrase; saveParams.newKeys = toPrimitiveArray(mKeysView.getNewKeysArray()); saveParams.keys = getKeys(mKeysView); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java index c76dc0164..ae7cf02cf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java @@ -217,7 +217,7 @@ public class EditKeyFragment extends LoaderFragment implements mSubkeysAdapter = new SubkeysAdapter(getActivity(), null, 0); mSubkeysList.setAdapter(mSubkeysAdapter); - mSubkeysAddedAdapter = new SubkeysAddedAdapter(getActivity(), mSaveKeyringParcel.addSubKeys); + mSubkeysAddedAdapter = new SubkeysAddedAdapter(getActivity(), mSaveKeyringParcel.mAddSubKeys); mSubkeysAddedList.setAdapter(mSubkeysAddedAdapter); // Prepare the loaders. Either re-connect with an existing ones, @@ -287,7 +287,7 @@ public class EditKeyFragment extends LoaderFragment implements Bundle data = message.getData(); // cache new returned passphrase! - mSaveKeyringParcel.newPassphrase = data + mSaveKeyringParcel.mNewPassphrase = data .getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE); } } @@ -309,19 +309,19 @@ public class EditKeyFragment extends LoaderFragment implements switch (message.what) { case EditUserIdDialogFragment.MESSAGE_CHANGE_PRIMARY_USER_ID: // toggle - if (mSaveKeyringParcel.changePrimaryUserId != null - && mSaveKeyringParcel.changePrimaryUserId.equals(userId)) { - mSaveKeyringParcel.changePrimaryUserId = null; + if (mSaveKeyringParcel.mChangePrimaryUserId != null + && mSaveKeyringParcel.mChangePrimaryUserId.equals(userId)) { + mSaveKeyringParcel.mChangePrimaryUserId = null; } else { - mSaveKeyringParcel.changePrimaryUserId = userId; + mSaveKeyringParcel.mChangePrimaryUserId = userId; } break; case EditUserIdDialogFragment.MESSAGE_REVOKE: // toggle - if (mSaveKeyringParcel.revokeUserIds.contains(userId)) { - mSaveKeyringParcel.revokeUserIds.remove(userId); + if (mSaveKeyringParcel.mRevokeUserIds.contains(userId)) { + mSaveKeyringParcel.mRevokeUserIds.remove(userId); } else { - mSaveKeyringParcel.revokeUserIds.add(userId); + mSaveKeyringParcel.mRevokeUserIds.add(userId); } break; } @@ -374,9 +374,9 @@ public class EditKeyFragment extends LoaderFragment implements private void save(String passphrase) { Log.d(Constants.TAG, "add userids to parcel: " + mUserIdsAddedAdapter.getDataAsStringList()); - Log.d(Constants.TAG, "mSaveKeyringParcel.newPassphrase: " + mSaveKeyringParcel.newPassphrase); + Log.d(Constants.TAG, "mSaveKeyringParcel.mNewPassphrase: " + mSaveKeyringParcel.mNewPassphrase); - mSaveKeyringParcel.addUserIds = mUserIdsAddedAdapter.getDataAsStringList(); + mSaveKeyringParcel.mAddUserIds = mUserIdsAddedAdapter.getDataAsStringList(); // Message is received after importing is done in KeychainIntentService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java index 849576284..da9986890 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java @@ -32,8 +32,6 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants.choice.algorithm; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.ExportHelper; -import org.sufficientlysecure.keychain.helper.OtherHelper; -import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.service.KeychainIntentService; @@ -43,7 +41,6 @@ import org.sufficientlysecure.keychain.service.SaveKeyringParcel.SubkeyAdd; import org.sufficientlysecure.keychain.util.Log; import java.io.IOException; -import java.util.ArrayList; public class KeyListActivity extends DrawerActivity { @@ -153,10 +150,10 @@ public class KeyListActivity extends DrawerActivity { Bundle data = new Bundle(); SaveKeyringParcel parcel = new SaveKeyringParcel(); - parcel.addSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.CERTIFY_OTHER, null)); - parcel.addSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.SIGN_DATA, null)); - parcel.addUserIds.add("swagerinho"); - parcel.newPassphrase = "swag"; + parcel.mAddSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.CERTIFY_OTHER, null)); + parcel.mAddSubKeys.add(new SubkeyAdd(algorithm.rsa, 1024, KeyFlags.SIGN_DATA, null)); + parcel.mAddUserIds.add("swagerinho"); + parcel.mNewPassphrase = "swag"; // get selected key entries data.putParcelable(KeychainIntentService.SAVE_KEYRING_PARCEL, parcel); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/WizardActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/WizardActivity.java index 601fc09f9..7a2233524 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/WizardActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/WizardActivity.java @@ -328,7 +328,7 @@ public class WizardActivity extends ActionBarActivity { && isEditTextNotEmpty(this, passphraseEdit)) { // SaveKeyringParcel newKey = new SaveKeyringParcel(); -// newKey.addUserIds.add(nameEdit.getText().toString() + " <" +// newKey.mAddUserIds.add(nameEdit.getText().toString() + " <" // + emailEdit.getText().toString() + ">"); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java index d729648e5..92b652018 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java @@ -134,10 +134,10 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC // for edit key if (mSaveKeyringParcel != null) { - boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.changePrimaryUserId != null); - boolean changeThisPrimaryUserId = (mSaveKeyringParcel.changePrimaryUserId != null - && mSaveKeyringParcel.changePrimaryUserId.equals(userId)); - boolean revokeThisUserId = (mSaveKeyringParcel.revokeUserIds.contains(userId)); + boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null); + boolean changeThisPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null + && mSaveKeyringParcel.mChangePrimaryUserId.equals(userId)); + boolean revokeThisUserId = (mSaveKeyringParcel.mRevokeUserIds.contains(userId)); if (changeAnyPrimaryUserId) { // change all user ids, only this one should be primary