mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-16 05:45:04 -05:00
pass through info that keys are new without relying on new keys orginally being empty
This commit is contained in:
parent
abfe416503
commit
2ad616ed3f
@ -478,7 +478,9 @@ public class PgpKeyOperation {
|
||||
PGPSignature certification = sGen.generateCertification(userId, masterPublicKey);
|
||||
sigList.add(new Pair<String, PGPSignature>(userId, certification));
|
||||
}
|
||||
masterPublicKey = PGPPublicKey.removeCertification(masterPublicKey, origID);
|
||||
if (!saveParcel.newIDs[userIDIndex]) {
|
||||
masterPublicKey = PGPPublicKey.removeCertification(masterPublicKey, origID);
|
||||
}
|
||||
userIDIndex++;
|
||||
}
|
||||
for (Pair<String, PGPSignature> toAdd : sigList) {
|
||||
@ -500,7 +502,9 @@ public class PgpKeyOperation {
|
||||
sGen.setUnhashedSubpackets(unhashedPacketsGen.generate());
|
||||
}
|
||||
PGPSignature certification = sGen.generateCertification(userId, masterPublicKey);
|
||||
masterPublicKey = PGPPublicKey.removeCertification(masterPublicKey, origID);
|
||||
if (!saveParcel.newIDs[userIDIndex]) {
|
||||
masterPublicKey = PGPPublicKey.removeCertification(masterPublicKey, origID);
|
||||
}
|
||||
masterPublicKey = PGPPublicKey.addCertification(masterPublicKey, userId, certification);
|
||||
}
|
||||
userIDIndex++;
|
||||
|
@ -32,6 +32,7 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
public ArrayList<String> userIDs;
|
||||
public ArrayList<String> originalIDs;
|
||||
public ArrayList<String> deletedIDs;
|
||||
public boolean[] newIDs;
|
||||
public boolean primaryIDChanged;
|
||||
public boolean[] moddedKeys;
|
||||
public ArrayList<PGPSecretKey> deletedKeys;
|
||||
@ -50,6 +51,7 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
userIDs = (ArrayList<String>)source.readSerializable();
|
||||
originalIDs = (ArrayList<String>)source.readSerializable();
|
||||
deletedIDs = (ArrayList<String>)source.readSerializable();
|
||||
newIDs = source.createBooleanArray();
|
||||
primaryIDChanged = source.readByte() != 0;
|
||||
moddedKeys = source.createBooleanArray();
|
||||
byte[] tmp = source.createByteArray();
|
||||
@ -72,6 +74,7 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
destination.writeSerializable(userIDs); //might not be the best method to store.
|
||||
destination.writeSerializable(originalIDs);
|
||||
destination.writeSerializable(deletedIDs);
|
||||
destination.writeBooleanArray(newIDs);
|
||||
destination.writeByte((byte) (primaryIDChanged ? 1 : 0));
|
||||
destination.writeBooleanArray(moddedKeys);
|
||||
byte[] tmp = null;
|
||||
|
@ -584,6 +584,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
||||
saveParams.userIDs = getUserIds(mUserIdsView);
|
||||
saveParams.originalIDs = mUserIdsView.getOriginalIDs();
|
||||
saveParams.deletedIDs = mUserIdsView.getDeletedIDs();
|
||||
saveParams.newIDs = toPrimitiveArray(mUserIdsView.getNewIDFlags());
|
||||
saveParams.primaryIDChanged = mUserIdsView.primaryChanged();
|
||||
saveParams.moddedKeys = toPrimitiveArray(mKeysView.getNeedsSavingArray());
|
||||
saveParams.deletedKeys = mKeysView.getDeletedKeys();
|
||||
|
@ -252,6 +252,16 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
return mList;
|
||||
}
|
||||
|
||||
public List<Boolean> getNewIDFlags()
|
||||
{
|
||||
ArrayList<Boolean> mList = new ArrayList<Boolean>();
|
||||
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
||||
Editor editor = (Editor) mEditors.getChildAt(i);
|
||||
mList.add(((UserIdEditor)editor).getIsNewID());
|
||||
}
|
||||
return mList;
|
||||
}
|
||||
|
||||
public List<Boolean> getNewKeysArray()
|
||||
{
|
||||
ArrayList<Boolean> mList = new ArrayList<Boolean>();
|
||||
|
@ -261,4 +261,6 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
{
|
||||
return mOriginalID;
|
||||
}
|
||||
|
||||
public boolean getIsNewID() { return mIsNewId; }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user