mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-16 22:05:05 -05:00
change how primary id changing is passed through
This commit is contained in:
parent
1b25ec5a0c
commit
1a28a4e921
@ -343,7 +343,7 @@ public class PgpKeyOperation {
|
|||||||
updateProgress(R.string.progress_done, 100, 100);
|
updateProgress(R.string.progress_done, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, ArrayList<PGPSecretKey> keys, boolean[] modded_keys, ArrayList<PGPSecretKey> deleted_keys, ArrayList<GregorianCalendar> keysExpiryDates, ArrayList<Integer> keysUsages, String newPassPhrase, String oldPassPhrase) throws PgpGeneralException,
|
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, boolean primaryIDChanged, boolean[] modded_keys, ArrayList<PGPSecretKey> deleted_keys, ArrayList<GregorianCalendar> keysExpiryDates, ArrayList<Integer> keysUsages, String newPassPhrase, String oldPassPhrase, ArrayList<PGPSecretKey> keys) throws PgpGeneralException,
|
||||||
PGPException, SignatureException, IOException {
|
PGPException, SignatureException, IOException {
|
||||||
|
|
||||||
updateProgress(R.string.progress_building_key, 0, 100);
|
updateProgress(R.string.progress_building_key, 0, 100);
|
||||||
@ -386,7 +386,7 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
PGPSignature certification = sGen.generateCertification(userId, masterPublicKey);
|
PGPSignature certification = sGen.generateCertification(userId, masterPublicKey);
|
||||||
|
|
||||||
masterPublicKey = PGPPublicKey.removeCertification();
|
//masterPublicKey = PGPPublicKey.removeCertification();
|
||||||
masterPublicKey = PGPPublicKey.addCertification(masterPublicKey, userId, certification);
|
masterPublicKey = PGPPublicKey.addCertification(masterPublicKey, userId, certification);
|
||||||
}
|
}
|
||||||
user_id_index++;
|
user_id_index++;
|
||||||
|
@ -128,6 +128,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
public static final String SAVE_KEYRING_NEW_PASSPHRASE = "new_passphrase";
|
public static final String SAVE_KEYRING_NEW_PASSPHRASE = "new_passphrase";
|
||||||
public static final String SAVE_KEYRING_CURRENT_PASSPHRASE = "current_passphrase";
|
public static final String SAVE_KEYRING_CURRENT_PASSPHRASE = "current_passphrase";
|
||||||
public static final String SAVE_KEYRING_USER_IDS = "user_ids";
|
public static final String SAVE_KEYRING_USER_IDS = "user_ids";
|
||||||
|
public static final String SAVE_KEYRING_PRIMARY_ID_CHANGED = "primary_id_changed";
|
||||||
public static final String SAVE_KEYRING_KEYS = "keys";
|
public static final String SAVE_KEYRING_KEYS = "keys";
|
||||||
public static final String SAVE_KEYRING_KEYS_USAGES = "keys_usages";
|
public static final String SAVE_KEYRING_KEYS_USAGES = "keys_usages";
|
||||||
public static final String SAVE_KEYRING_KEYS_EXPIRY_DATES = "keys_expiry_dates";
|
public static final String SAVE_KEYRING_KEYS_EXPIRY_DATES = "keys_expiry_dates";
|
||||||
@ -549,6 +550,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
boolean[] modded_keys = data.getBooleanArray(SAVE_KEYRING_MODDED_KEYS);
|
boolean[] modded_keys = data.getBooleanArray(SAVE_KEYRING_MODDED_KEYS);
|
||||||
ArrayList<PGPSecretKey> deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
|
ArrayList<PGPSecretKey> deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
|
||||||
.getByteArray(SAVE_KEYRING_DELETED_KEYS));
|
.getByteArray(SAVE_KEYRING_DELETED_KEYS));
|
||||||
|
boolean primaryChanged = data.getBoolean(SAVE_KEYRING_PRIMARY_ID_CHANGED);
|
||||||
|
|
||||||
long masterKeyId = data.getLong(SAVE_KEYRING_MASTER_KEY_ID);
|
long masterKeyId = data.getLong(SAVE_KEYRING_MASTER_KEY_ID);
|
||||||
|
|
||||||
@ -559,8 +561,9 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
ProviderHelper.getPGPSecretKeyRingByKeyId(this, masterKeyId),
|
ProviderHelper.getPGPSecretKeyRingByKeyId(this, masterKeyId),
|
||||||
oldPassPhrase, newPassPhrase);
|
oldPassPhrase, newPassPhrase);
|
||||||
} else {
|
} else {
|
||||||
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, keys, modded_keys,
|
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, primaryChanged,
|
||||||
deletedKeys, keysExpiryDates, keysUsages, newPassPhrase, oldPassPhrase);
|
modded_keys, deletedKeys, keysExpiryDates, keysUsages, newPassPhrase,
|
||||||
|
oldPassPhrase, keys);
|
||||||
}
|
}
|
||||||
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
||||||
|
|
||||||
|
@ -595,6 +595,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
mUserIdsView.getOriginalIDs());
|
mUserIdsView.getOriginalIDs());
|
||||||
data.putBooleanArray(KeychainIntentService.SAVE_KEYRING_MODDED_KEYS,
|
data.putBooleanArray(KeychainIntentService.SAVE_KEYRING_MODDED_KEYS,
|
||||||
toPrimitiveArray(mKeysView.getNeedsSavingArray()));
|
toPrimitiveArray(mKeysView.getNeedsSavingArray()));
|
||||||
|
data.putBoolean(KeychainIntentService.SAVE_KEYRING_PRIMARY_ID_CHANGED,
|
||||||
|
mUserIdsView.primaryChanged());
|
||||||
|
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
|
@ -169,6 +169,19 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
||||||
Editor editor = (Editor) mEditors.getChildAt(i);
|
Editor editor = (Editor) mEditors.getChildAt(i);
|
||||||
ret |= editor.needsSaving();
|
ret |= editor.needsSaving();
|
||||||
|
if (mType == Id.type.user_id)
|
||||||
|
ret |= ((UserIdEditor)editor).primarySwapped();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean primaryChanged()
|
||||||
|
{
|
||||||
|
boolean ret = false;
|
||||||
|
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
||||||
|
Editor editor = (Editor) mEditors.getChildAt(i);
|
||||||
|
if (mType == Id.type.user_id)
|
||||||
|
ret |= ((UserIdEditor)editor).primarySwapped();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsSaving() {
|
public boolean needsSaving() {
|
||||||
boolean retval = (mOriginallyMainUserID != isMainUserId());
|
boolean retval = false; //(mOriginallyMainUserID != isMainUserId());
|
||||||
retval |= !(mOriginalName.equals( ("" + mName.getText()).trim() ) );
|
retval |= !(mOriginalName.equals( ("" + mName.getText()).trim() ) );
|
||||||
retval |= !(mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
|
retval |= !(mOriginalEmail.equals( ("" + mEmail.getText()).trim() ) );
|
||||||
retval |= !(mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
|
retval |= !(mOriginalComment.equals( ("" + mComment.getText()).trim() ) );
|
||||||
@ -229,6 +229,11 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean primarySwapped()
|
||||||
|
{
|
||||||
|
return (mOriginallyMainUserID != isMainUserId());
|
||||||
|
}
|
||||||
|
|
||||||
public String getOriginalID()
|
public String getOriginalID()
|
||||||
{
|
{
|
||||||
return mOriginalID;
|
return mOriginalID;
|
||||||
|
Loading…
Reference in New Issue
Block a user