mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
commit
34ad14ccec
@ -55,10 +55,10 @@ public final class Constants {
|
|||||||
public static final class Pref {
|
public static final class Pref {
|
||||||
public static final String DEFAULT_ENCRYPTION_ALGORITHM = "defaultEncryptionAlgorithm";
|
public static final String DEFAULT_ENCRYPTION_ALGORITHM = "defaultEncryptionAlgorithm";
|
||||||
public static final String DEFAULT_HASH_ALGORITHM = "defaultHashAlgorithm";
|
public static final String DEFAULT_HASH_ALGORITHM = "defaultHashAlgorithm";
|
||||||
public static final String DEFAULT_ASCII_ARMOUR = "defaultAsciiArmour";
|
public static final String DEFAULT_ASCII_ARMOR = "defaultAsciiArmor";
|
||||||
public static final String DEFAULT_MESSAGE_COMPRESSION = "defaultMessageCompression";
|
public static final String DEFAULT_MESSAGE_COMPRESSION = "defaultMessageCompression";
|
||||||
public static final String DEFAULT_FILE_COMPRESSION = "defaultFileCompression";
|
public static final String DEFAULT_FILE_COMPRESSION = "defaultFileCompression";
|
||||||
public static final String PASS_PHRASE_CACHE_TTL = "passphraseCacheTtl";
|
public static final String PASSPHRASE_CACHE_TTL = "passphraseCacheTtl";
|
||||||
public static final String LANGUAGE = "language";
|
public static final String LANGUAGE = "language";
|
||||||
public static final String FORCE_V3_SIGNATURES = "forceV3Signatures";
|
public static final String FORCE_V3_SIGNATURES = "forceV3Signatures";
|
||||||
public static final String KEY_SERVERS = "keyServers";
|
public static final String KEY_SERVERS = "keyServers";
|
||||||
|
@ -58,8 +58,8 @@ public class Preferences {
|
|||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPassPhraseCacheTtl() {
|
public long getPassphraseCacheTtl() {
|
||||||
int ttl = mSharedPreferences.getInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, 180);
|
int ttl = mSharedPreferences.getInt(Constants.Pref.PASSPHRASE_CACHE_TTL, 180);
|
||||||
// fix the value if it was set to "never" in previous versions, which currently is not
|
// fix the value if it was set to "never" in previous versions, which currently is not
|
||||||
// supported
|
// supported
|
||||||
if (ttl == 0) {
|
if (ttl == 0) {
|
||||||
@ -68,9 +68,9 @@ public class Preferences {
|
|||||||
return (long) ttl;
|
return (long) ttl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassPhraseCacheTtl(int value) {
|
public void setPassphraseCacheTtl(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, value);
|
editor.putInt(Constants.Pref.PASSPHRASE_CACHE_TTL, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ public class Preferences {
|
|||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDefaultAsciiArmour() {
|
public boolean getDefaultAsciiArmor() {
|
||||||
return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, false);
|
return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultAsciiArmour(boolean value) {
|
public void setDefaultAsciiArmor(boolean value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, value);
|
editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,25 +195,25 @@ public class PgpKeyOperation {
|
|||||||
sha1Calc, isMasterKey, keyEncryptor);
|
sha1Calc, isMasterKey, keyEncryptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGPSecretKeyRing changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassPhrase,
|
public PGPSecretKeyRing changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassphrase,
|
||||||
String newPassPhrase)
|
String newPassphrase)
|
||||||
throws IOException, PGPException, NoSuchProviderException {
|
throws IOException, PGPException, NoSuchProviderException {
|
||||||
|
|
||||||
updateProgress(R.string.progress_building_key, 0, 100);
|
updateProgress(R.string.progress_building_key, 0, 100);
|
||||||
if (oldPassPhrase == null) {
|
if (oldPassphrase == null) {
|
||||||
oldPassPhrase = "";
|
oldPassphrase = "";
|
||||||
}
|
}
|
||||||
if (newPassPhrase == null) {
|
if (newPassphrase == null) {
|
||||||
newPassPhrase = "";
|
newPassphrase = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
PGPSecretKeyRing newKeyRing = PGPSecretKeyRing.copyWithNewPassword(
|
PGPSecretKeyRing newKeyRing = PGPSecretKeyRing.copyWithNewPassword(
|
||||||
keyRing,
|
keyRing,
|
||||||
new JcePBESecretKeyDecryptorBuilder(new JcaPGPDigestCalculatorProviderBuilder()
|
new JcePBESecretKeyDecryptorBuilder(new JcaPGPDigestCalculatorProviderBuilder()
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build()).setProvider(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build()).setProvider(
|
||||||
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray()),
|
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassphrase.toCharArray()),
|
||||||
new JcePBESecretKeyEncryptorBuilder(keyRing.getSecretKey()
|
new JcePBESecretKeyEncryptorBuilder(keyRing.getSecretKey()
|
||||||
.getKeyEncryptionAlgorithm()).build(newPassPhrase.toCharArray()));
|
.getKeyEncryptionAlgorithm()).build(newPassphrase.toCharArray()));
|
||||||
|
|
||||||
return newKeyRing;
|
return newKeyRing;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ public class PgpKeyOperation {
|
|||||||
ArrayList<String> userIds, ArrayList<PGPSecretKey> keys,
|
ArrayList<String> userIds, ArrayList<PGPSecretKey> keys,
|
||||||
ArrayList<GregorianCalendar> keysExpiryDates,
|
ArrayList<GregorianCalendar> keysExpiryDates,
|
||||||
ArrayList<Integer> keysUsages,
|
ArrayList<Integer> keysUsages,
|
||||||
String newPassPhrase, String oldPassPhrase)
|
String newPassphrase, String oldPassphrase)
|
||||||
throws PgpGeneralMsgIdException, PGPException, SignatureException, IOException {
|
throws PgpGeneralMsgIdException, PGPException, SignatureException, IOException {
|
||||||
|
|
||||||
int usageId = keysUsages.get(0);
|
int usageId = keysUsages.get(0);
|
||||||
@ -236,7 +236,7 @@ public class PgpKeyOperation {
|
|||||||
PGPPublicKey masterPublicKey = masterKey.getPublicKey();
|
PGPPublicKey masterPublicKey = masterKey.getPublicKey();
|
||||||
|
|
||||||
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
||||||
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray());
|
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassphrase.toCharArray());
|
||||||
PGPPrivateKey masterPrivateKey = masterKey.extractPrivateKey(keyDecryptor);
|
PGPPrivateKey masterPrivateKey = masterKey.extractPrivateKey(keyDecryptor);
|
||||||
|
|
||||||
updateProgress(R.string.progress_certifying_master_key, 20, 100);
|
updateProgress(R.string.progress_certifying_master_key, 20, 100);
|
||||||
@ -294,7 +294,7 @@ public class PgpKeyOperation {
|
|||||||
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
|
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
|
||||||
PGPEncryptedData.CAST5, sha1Calc)
|
PGPEncryptedData.CAST5, sha1Calc)
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
||||||
newPassPhrase.toCharArray());
|
newPassphrase.toCharArray());
|
||||||
|
|
||||||
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
|
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
|
||||||
masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(),
|
masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(),
|
||||||
@ -310,7 +310,7 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
PBESecretKeyDecryptor keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
|
PBESecretKeyDecryptor keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
||||||
oldPassPhrase.toCharArray());
|
oldPassphrase.toCharArray());
|
||||||
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
|
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
|
||||||
|
|
||||||
// TODO: now used without algorithm and creation time?! (APG 1)
|
// TODO: now used without algorithm and creation time?! (APG 1)
|
||||||
@ -375,16 +375,16 @@ public class PgpKeyOperation {
|
|||||||
updateProgress(R.string.progress_building_key, 0, 100);
|
updateProgress(R.string.progress_building_key, 0, 100);
|
||||||
PGPSecretKey masterKey = saveParcel.keys.get(0);
|
PGPSecretKey masterKey = saveParcel.keys.get(0);
|
||||||
|
|
||||||
if (saveParcel.oldPassPhrase == null) {
|
if (saveParcel.oldPassphrase == null) {
|
||||||
saveParcel.oldPassPhrase = "";
|
saveParcel.oldPassphrase = "";
|
||||||
}
|
}
|
||||||
if (saveParcel.newPassPhrase == null) {
|
if (saveParcel.newPassphrase == null) {
|
||||||
saveParcel.newPassPhrase = "";
|
saveParcel.newPassphrase = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mKR == null) {
|
if (mKR == null) {
|
||||||
return buildNewSecretKey(saveParcel.userIDs, saveParcel.keys, saveParcel.keysExpiryDates,
|
return buildNewSecretKey(saveParcel.userIDs, saveParcel.keys, saveParcel.keysExpiryDates,
|
||||||
saveParcel.keysUsages, saveParcel.newPassPhrase, saveParcel.oldPassPhrase); //new Keyring
|
saveParcel.keysUsages, saveParcel.newPassphrase, saveParcel.oldPassphrase); //new Keyring
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -423,7 +423,7 @@ public class PgpKeyOperation {
|
|||||||
String mainUserId = saveParcel.userIDs.get(0);
|
String mainUserId = saveParcel.userIDs.get(0);
|
||||||
|
|
||||||
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
||||||
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(saveParcel.oldPassPhrase.toCharArray());
|
Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(saveParcel.oldPassphrase.toCharArray());
|
||||||
PGPPrivateKey masterPrivateKey = masterKey.extractPrivateKey(keyDecryptor);
|
PGPPrivateKey masterPrivateKey = masterKey.extractPrivateKey(keyDecryptor);
|
||||||
|
|
||||||
updateProgress(R.string.progress_certifying_master_key, 20, 100);
|
updateProgress(R.string.progress_certifying_master_key, 20, 100);
|
||||||
@ -565,7 +565,7 @@ public class PgpKeyOperation {
|
|||||||
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
|
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
|
||||||
PGPEncryptedData.CAST5, sha1Calc)
|
PGPEncryptedData.CAST5, sha1Calc)
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
||||||
saveParcel.oldPassPhrase.toCharArray());
|
saveParcel.oldPassphrase.toCharArray());
|
||||||
|
|
||||||
//this generates one more signature than necessary...
|
//this generates one more signature than necessary...
|
||||||
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
|
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
|
||||||
@ -586,7 +586,7 @@ public class PgpKeyOperation {
|
|||||||
} else {
|
} else {
|
||||||
keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
|
keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
||||||
saveParcel.oldPassPhrase.toCharArray());
|
saveParcel.oldPassphrase.toCharArray());
|
||||||
}
|
}
|
||||||
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
|
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
|
||||||
PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey, subPrivateKey);
|
PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey, subPrivateKey);
|
||||||
@ -667,7 +667,7 @@ public class PgpKeyOperation {
|
|||||||
PBESecretKeyEncryptor keyEncryptorNew = new JcePBESecretKeyEncryptorBuilder(
|
PBESecretKeyEncryptor keyEncryptorNew = new JcePBESecretKeyEncryptorBuilder(
|
||||||
PGPEncryptedData.CAST5, sha1Calc)
|
PGPEncryptedData.CAST5, sha1Calc)
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
|
||||||
saveParcel.newPassPhrase.toCharArray());
|
saveParcel.newPassphrase.toCharArray());
|
||||||
|
|
||||||
//update the passphrase
|
//update the passphrase
|
||||||
mKR = PGPSecretKeyRing.copyWithNewPassword(mKR, keyDecryptor, keyEncryptorNew);
|
mKR = PGPSecretKeyRing.copyWithNewPassword(mKR, keyDecryptor, keyEncryptorNew);
|
||||||
|
@ -488,16 +488,16 @@ public class KeychainIntentService extends IntentService
|
|||||||
try {
|
try {
|
||||||
/* Input */
|
/* Input */
|
||||||
SaveKeyringParcel saveParams = data.getParcelable(SAVE_KEYRING_PARCEL);
|
SaveKeyringParcel saveParams = data.getParcelable(SAVE_KEYRING_PARCEL);
|
||||||
String oldPassPhrase = saveParams.oldPassPhrase;
|
String oldPassphrase = saveParams.oldPassphrase;
|
||||||
String newPassPhrase = saveParams.newPassPhrase;
|
String newPassphrase = saveParams.newPassphrase;
|
||||||
boolean canSign = true;
|
boolean canSign = true;
|
||||||
|
|
||||||
if (data.containsKey(SAVE_KEYRING_CAN_SIGN)) {
|
if (data.containsKey(SAVE_KEYRING_CAN_SIGN)) {
|
||||||
canSign = data.getBoolean(SAVE_KEYRING_CAN_SIGN);
|
canSign = data.getBoolean(SAVE_KEYRING_CAN_SIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newPassPhrase == null) {
|
if (newPassphrase == null) {
|
||||||
newPassPhrase = oldPassPhrase;
|
newPassphrase = oldPassphrase;
|
||||||
}
|
}
|
||||||
|
|
||||||
long masterKeyId = saveParams.keys.get(0).getKeyID();
|
long masterKeyId = saveParams.keys.get(0).getKeyID();
|
||||||
@ -508,7 +508,7 @@ public class KeychainIntentService extends IntentService
|
|||||||
PGPSecretKeyRing keyRing = ProviderHelper
|
PGPSecretKeyRing keyRing = ProviderHelper
|
||||||
.getPGPSecretKeyRingByKeyId(this, masterKeyId);
|
.getPGPSecretKeyRingByKeyId(this, masterKeyId);
|
||||||
keyRing = keyOperations.changeSecretKeyPassphrase(keyRing,
|
keyRing = keyOperations.changeSecretKeyPassphrase(keyRing,
|
||||||
oldPassPhrase, newPassPhrase);
|
oldPassphrase, newPassphrase);
|
||||||
setProgress(R.string.progress_saving_key_ring, 50, 100);
|
setProgress(R.string.progress_saving_key_ring, 50, 100);
|
||||||
ProviderHelper.saveKeyRing(this, keyRing);
|
ProviderHelper.saveKeyRing(this, keyRing);
|
||||||
setProgress(R.string.progress_done, 100, 100);
|
setProgress(R.string.progress_done, 100, 100);
|
||||||
@ -526,7 +526,7 @@ public class KeychainIntentService extends IntentService
|
|||||||
ProviderHelper.saveKeyRing(this, pair.second);
|
ProviderHelper.saveKeyRing(this, pair.second);
|
||||||
setProgress(R.string.progress_done, 100, 100);
|
setProgress(R.string.progress_done, 100, 100);
|
||||||
}
|
}
|
||||||
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassphrase);
|
||||||
|
|
||||||
/* Output */
|
/* Output */
|
||||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY);
|
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY);
|
||||||
@ -816,9 +816,9 @@ public class KeychainIntentService extends IntentService
|
|||||||
ArrayList<String> userIds = data.getStringArrayList(CERTIFY_KEY_UIDS);
|
ArrayList<String> userIds = data.getStringArrayList(CERTIFY_KEY_UIDS);
|
||||||
|
|
||||||
/* Operation */
|
/* Operation */
|
||||||
String signaturePassPhrase = PassphraseCacheService.getCachedPassphrase(this,
|
String signaturePassphrase = PassphraseCacheService.getCachedPassphrase(this,
|
||||||
masterKeyId);
|
masterKeyId);
|
||||||
if (signaturePassPhrase == null) {
|
if (signaturePassphrase == null) {
|
||||||
throw new PgpGeneralException("Unable to obtain passphrase");
|
throw new PgpGeneralException("Unable to obtain passphrase");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ public class KeychainIntentService extends IntentService
|
|||||||
PGPSecretKey certificationKey = PgpKeyHelper.getCertificationKey(this,
|
PGPSecretKey certificationKey = PgpKeyHelper.getCertificationKey(this,
|
||||||
masterKeyId);
|
masterKeyId);
|
||||||
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
|
||||||
userIds, signaturePassPhrase);
|
userIds, signaturePassphrase);
|
||||||
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
|
||||||
|
|
||||||
// store the signed key in our local cache
|
// store the signed key in our local cache
|
||||||
|
@ -95,7 +95,7 @@ public class PassphraseCacheService extends Service {
|
|||||||
|
|
||||||
Intent intent = new Intent(context, PassphraseCacheService.class);
|
Intent intent = new Intent(context, PassphraseCacheService.class);
|
||||||
intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
|
intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
|
||||||
intent.putExtra(EXTRA_TTL, Preferences.getPreferences(context).getPassPhraseCacheTtl());
|
intent.putExtra(EXTRA_TTL, Preferences.getPreferences(context).getPassphraseCacheTtl());
|
||||||
intent.putExtra(EXTRA_PASSPHRASE, passphrase);
|
intent.putExtra(EXTRA_PASSPHRASE, passphrase);
|
||||||
intent.putExtra(EXTRA_KEY_ID, keyId);
|
intent.putExtra(EXTRA_KEY_ID, keyId);
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ public class SaveKeyringParcel implements Parcelable {
|
|||||||
public ArrayList<PGPSecretKey> deletedKeys;
|
public ArrayList<PGPSecretKey> deletedKeys;
|
||||||
public ArrayList<GregorianCalendar> keysExpiryDates;
|
public ArrayList<GregorianCalendar> keysExpiryDates;
|
||||||
public ArrayList<Integer> keysUsages;
|
public ArrayList<Integer> keysUsages;
|
||||||
public String newPassPhrase;
|
public String newPassphrase;
|
||||||
public String oldPassPhrase;
|
public String oldPassphrase;
|
||||||
public boolean[] newKeys;
|
public boolean[] newKeys;
|
||||||
public ArrayList<PGPSecretKey> keys;
|
public ArrayList<PGPSecretKey> keys;
|
||||||
public String originalPrimaryID;
|
public String originalPrimaryID;
|
||||||
@ -61,8 +61,8 @@ public class SaveKeyringParcel implements Parcelable {
|
|||||||
}
|
}
|
||||||
keysExpiryDates = (ArrayList<GregorianCalendar>) source.readSerializable();
|
keysExpiryDates = (ArrayList<GregorianCalendar>) source.readSerializable();
|
||||||
keysUsages = source.readArrayList(Integer.class.getClassLoader());
|
keysUsages = source.readArrayList(Integer.class.getClassLoader());
|
||||||
newPassPhrase = source.readString();
|
newPassphrase = source.readString();
|
||||||
oldPassPhrase = source.readString();
|
oldPassphrase = source.readString();
|
||||||
newKeys = source.createBooleanArray();
|
newKeys = source.createBooleanArray();
|
||||||
keys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray());
|
keys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray());
|
||||||
originalPrimaryID = source.readString();
|
originalPrimaryID = source.readString();
|
||||||
@ -83,8 +83,8 @@ public class SaveKeyringParcel implements Parcelable {
|
|||||||
destination.writeByteArray(tmp);
|
destination.writeByteArray(tmp);
|
||||||
destination.writeSerializable(keysExpiryDates);
|
destination.writeSerializable(keysExpiryDates);
|
||||||
destination.writeList(keysUsages);
|
destination.writeList(keysUsages);
|
||||||
destination.writeString(newPassPhrase);
|
destination.writeString(newPassphrase);
|
||||||
destination.writeString(oldPassPhrase);
|
destination.writeString(oldPassphrase);
|
||||||
destination.writeBooleanArray(newKeys);
|
destination.writeBooleanArray(newKeys);
|
||||||
destination.writeByteArray(PgpConversionHelper.PGPSecretKeyArrayListToBytes(keys));
|
destination.writeByteArray(PgpConversionHelper.PGPSecretKeyArrayListToBytes(keys));
|
||||||
destination.writeString(originalPrimaryID);
|
destination.writeString(originalPrimaryID);
|
||||||
|
@ -97,9 +97,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
private SectionView mKeysView;
|
private SectionView mKeysView;
|
||||||
|
|
||||||
private String mCurrentPassphrase = null;
|
private String mCurrentPassphrase = null;
|
||||||
private String mNewPassPhrase = null;
|
private String mNewPassphrase = null;
|
||||||
private String mSavedNewPassPhrase = null;
|
private String mSavedNewPassphrase = null;
|
||||||
private boolean mIsPassPhraseSet;
|
private boolean mIsPassphraseSet;
|
||||||
private boolean mNeedsSaving;
|
private boolean mNeedsSaving;
|
||||||
private boolean mIsBrandNewKeyring = false;
|
private boolean mIsBrandNewKeyring = false;
|
||||||
|
|
||||||
@ -403,8 +403,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
mCurrentPassphrase = "";
|
mCurrentPassphrase = "";
|
||||||
buildLayout(false);
|
buildLayout(false);
|
||||||
|
|
||||||
mIsPassPhraseSet = PassphraseCacheService.hasPassphrase(this, masterKeyId);
|
mIsPassphraseSet = PassphraseCacheService.hasPassphrase(this, masterKeyId);
|
||||||
if (!mIsPassPhraseSet) {
|
if (!mIsPassphraseSet) {
|
||||||
// check "no passphrase" checkbox and remove button
|
// check "no passphrase" checkbox and remove button
|
||||||
mNoPassphrase.setChecked(true);
|
mNoPassphrase.setChecked(true);
|
||||||
mChangePassphrase.setVisibility(View.GONE);
|
mChangePassphrase.setVisibility(View.GONE);
|
||||||
@ -423,10 +423,10 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
Bundle data = message.getData();
|
Bundle data = message.getData();
|
||||||
|
|
||||||
// set new returned passphrase!
|
// set new returned passphrase!
|
||||||
mNewPassPhrase = data
|
mNewPassphrase = data
|
||||||
.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE);
|
.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE);
|
||||||
|
|
||||||
updatePassPhraseButtonText();
|
updatePassphraseButtonText();
|
||||||
somethingChanged();
|
somethingChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,23 +466,23 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
LinearLayout container = (LinearLayout) findViewById(R.id.edit_key_container);
|
LinearLayout container = (LinearLayout) findViewById(R.id.edit_key_container);
|
||||||
if (mIsPassPhraseSet) {
|
if (mIsPassphraseSet) {
|
||||||
mChangePassphrase.setText(getString(R.string.btn_change_passphrase));
|
mChangePassphrase.setText(getString(R.string.btn_change_passphrase));
|
||||||
}
|
}
|
||||||
mUserIdsView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
mUserIdsView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
||||||
mUserIdsView.setType(Id.type.user_id);
|
mUserIdsView.setType(Id.type.user_id);
|
||||||
mUserIdsView.setCanEdit(mMasterCanSign);
|
mUserIdsView.setCanBeEdited(mMasterCanSign);
|
||||||
mUserIdsView.setUserIds(mUserIds);
|
mUserIdsView.setUserIds(mUserIds);
|
||||||
mUserIdsView.setEditorListener(this);
|
mUserIdsView.setEditorListener(this);
|
||||||
container.addView(mUserIdsView);
|
container.addView(mUserIdsView);
|
||||||
mKeysView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
mKeysView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
|
||||||
mKeysView.setType(Id.type.key);
|
mKeysView.setType(Id.type.key);
|
||||||
mKeysView.setCanEdit(mMasterCanSign);
|
mKeysView.setCanBeEdited(mMasterCanSign);
|
||||||
mKeysView.setKeys(mKeys, mKeysUsages, newKeys);
|
mKeysView.setKeys(mKeys, mKeysUsages, newKeys);
|
||||||
mKeysView.setEditorListener(this);
|
mKeysView.setEditorListener(this);
|
||||||
container.addView(mKeysView);
|
container.addView(mKeysView);
|
||||||
|
|
||||||
updatePassPhraseButtonText();
|
updatePassphraseButtonText();
|
||||||
|
|
||||||
mChangePassphrase.setOnClickListener(new OnClickListener() {
|
mChangePassphrase.setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -497,11 +497,11 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
// remove passphrase
|
// remove passphrase
|
||||||
mSavedNewPassPhrase = mNewPassPhrase;
|
mSavedNewPassphrase = mNewPassphrase;
|
||||||
mNewPassPhrase = "";
|
mNewPassphrase = "";
|
||||||
mChangePassphrase.setVisibility(View.GONE);
|
mChangePassphrase.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
mNewPassPhrase = mSavedNewPassPhrase;
|
mNewPassphrase = mSavedNewPassphrase;
|
||||||
mChangePassphrase.setVisibility(View.VISIBLE);
|
mChangePassphrase.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
somethingChanged();
|
somethingChanged();
|
||||||
@ -519,8 +519,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
public boolean isPassphraseSet() {
|
public boolean isPassphraseSet() {
|
||||||
if (mNoPassphrase.isChecked()) {
|
if (mNoPassphrase.isChecked()) {
|
||||||
return true;
|
return true;
|
||||||
} else if ((mIsPassPhraseSet)
|
} else if ((mIsPassphraseSet)
|
||||||
|| (mNewPassPhrase != null && !mNewPassPhrase.equals(""))) {
|
|| (mNewPassphrase != null && !mNewPassphrase.equals(""))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -530,9 +530,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
public boolean hasPassphraseChanged() {
|
public boolean hasPassphraseChanged() {
|
||||||
if (mNoPassphrase != null) {
|
if (mNoPassphrase != null) {
|
||||||
if (mNoPassphrase.isChecked()) {
|
if (mNoPassphrase.isChecked()) {
|
||||||
return mIsPassPhraseSet;
|
return mIsPassphraseSet;
|
||||||
} else {
|
} else {
|
||||||
return (mNewPassPhrase != null && !mNewPassPhrase.equals(""));
|
return (mNewPassphrase != null && !mNewPassphrase.equals(""));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -548,7 +548,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
String passphrase;
|
String passphrase;
|
||||||
if (mIsPassPhraseSet) {
|
if (mIsPassphraseSet) {
|
||||||
passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId);
|
passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId);
|
||||||
} else {
|
} else {
|
||||||
passphrase = "";
|
passphrase = "";
|
||||||
@ -638,8 +638,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
saveParams.deletedKeys = mKeysView.getDeletedKeys();
|
saveParams.deletedKeys = mKeysView.getDeletedKeys();
|
||||||
saveParams.keysExpiryDates = getKeysExpiryDates(mKeysView);
|
saveParams.keysExpiryDates = getKeysExpiryDates(mKeysView);
|
||||||
saveParams.keysUsages = getKeysUsages(mKeysView);
|
saveParams.keysUsages = getKeysUsages(mKeysView);
|
||||||
saveParams.newPassPhrase = mNewPassPhrase;
|
saveParams.newPassphrase = mNewPassphrase;
|
||||||
saveParams.oldPassPhrase = mCurrentPassphrase;
|
saveParams.oldPassphrase = mCurrentPassphrase;
|
||||||
saveParams.newKeys = toPrimitiveArray(mKeysView.getNewKeysArray());
|
saveParams.newKeys = toPrimitiveArray(mKeysView.getNewKeysArray());
|
||||||
saveParams.keys = getKeys(mKeysView);
|
saveParams.keys = getKeys(mKeysView);
|
||||||
saveParams.originalPrimaryID = mUserIdsView.getOriginalPrimaryID();
|
saveParams.originalPrimaryID = mUserIdsView.getOriginalPrimaryID();
|
||||||
@ -819,7 +819,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
return keysExpiryDates;
|
return keysExpiryDates;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePassPhraseButtonText() {
|
private void updatePassphraseButtonText() {
|
||||||
mChangePassphrase.setText(isPassphraseSet() ? getString(R.string.btn_change_passphrase)
|
mChangePassphrase.setText(isPassphraseSet() ? getString(R.string.btn_change_passphrase)
|
||||||
: getString(R.string.btn_set_passphrase));
|
: getString(R.string.btn_set_passphrase));
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,8 @@ public class EncryptFileFragment extends Fragment {
|
|||||||
mDeleteAfter = (CheckBox) view.findViewById(R.id.deleteAfterEncryption);
|
mDeleteAfter = (CheckBox) view.findViewById(R.id.deleteAfterEncryption);
|
||||||
mShareAfter = (CheckBox) view.findViewById(R.id.shareAfterEncryption);
|
mShareAfter = (CheckBox) view.findViewById(R.id.shareAfterEncryption);
|
||||||
|
|
||||||
mAsciiArmor = (CheckBox) view.findViewById(R.id.asciiArmour);
|
mAsciiArmor = (CheckBox) view.findViewById(R.id.asciiArmor);
|
||||||
mAsciiArmor.setChecked(Preferences.getPreferences(getActivity()).getDefaultAsciiArmour());
|
mAsciiArmor.setChecked(Preferences.getPreferences(getActivity()).getDefaultAsciiArmor());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -224,9 +224,9 @@ public class EncryptFileFragment extends Fragment {
|
|||||||
if (mEncryptInterface.isModeSymmetric()) {
|
if (mEncryptInterface.isModeSymmetric()) {
|
||||||
// symmetric encryption
|
// symmetric encryption
|
||||||
|
|
||||||
boolean gotPassPhrase = (mEncryptInterface.getPassphrase() != null
|
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
|
||||||
&& mEncryptInterface.getPassphrase().length() != 0);
|
&& mEncryptInterface.getPassphrase().length() != 0);
|
||||||
if (!gotPassPhrase) {
|
if (!gotPassphrase) {
|
||||||
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
|
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
|
||||||
.show();
|
.show();
|
||||||
return;
|
return;
|
||||||
|
@ -125,9 +125,9 @@ public class EncryptMessageFragment extends Fragment {
|
|||||||
if (mEncryptInterface.isModeSymmetric()) {
|
if (mEncryptInterface.isModeSymmetric()) {
|
||||||
// symmetric encryption
|
// symmetric encryption
|
||||||
|
|
||||||
boolean gotPassPhrase = (mEncryptInterface.getPassphrase() != null
|
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
|
||||||
&& mEncryptInterface.getPassphrase().length() != 0);
|
&& mEncryptInterface.getPassphrase().length() != 0);
|
||||||
if (!gotPassPhrase) {
|
if (!gotPassphrase) {
|
||||||
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
|
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
|
||||||
.show();
|
.show();
|
||||||
return;
|
return;
|
||||||
|
@ -61,8 +61,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
if (action != null && action.equals(ACTION_PREFS_GEN)) {
|
if (action != null && action.equals(ACTION_PREFS_GEN)) {
|
||||||
addPreferencesFromResource(R.xml.gen_preferences);
|
addPreferencesFromResource(R.xml.gen_preferences);
|
||||||
|
|
||||||
initializePassPassPhraceCacheTtl(
|
initializePassPassphraceCacheTtl(
|
||||||
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = sPreferences.getKeyServers();
|
String servers[] = sPreferences.getKeyServers();
|
||||||
@ -110,8 +110,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
||||||
entries, values);
|
entries, values);
|
||||||
|
|
||||||
initializeAsciiArmour(
|
initializeAsciiArmor(
|
||||||
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
|
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOR));
|
||||||
|
|
||||||
initializeForceV3Signatures(
|
initializeForceV3Signatures(
|
||||||
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
||||||
@ -165,8 +165,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
// Load the preferences from an XML resource
|
// Load the preferences from an XML resource
|
||||||
addPreferencesFromResource(R.xml.gen_preferences);
|
addPreferencesFromResource(R.xml.gen_preferences);
|
||||||
|
|
||||||
initializePassPassPhraceCacheTtl(
|
initializePassPassphraceCacheTtl(
|
||||||
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = sPreferences.getKeyServers();
|
String servers[] = sPreferences.getKeyServers();
|
||||||
@ -247,8 +247,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
||||||
entries, values);
|
entries, values);
|
||||||
|
|
||||||
initializeAsciiArmour(
|
initializeAsciiArmor(
|
||||||
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
|
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOR));
|
||||||
|
|
||||||
initializeForceV3Signatures(
|
initializeForceV3Signatures(
|
||||||
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
||||||
@ -261,15 +261,15 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
|| super.isValidFragment(fragmentName);
|
|| super.isValidFragment(fragmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
|
private static void initializePassPassphraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
|
||||||
mPassphraseCacheTtl.setValue("" + sPreferences.getPassPhraseCacheTtl());
|
mPassphraseCacheTtl.setValue("" + sPreferences.getPassphraseCacheTtl());
|
||||||
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
||||||
mPassphraseCacheTtl
|
mPassphraseCacheTtl
|
||||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mPassphraseCacheTtl.setValue(newValue.toString());
|
mPassphraseCacheTtl.setValue(newValue.toString());
|
||||||
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
||||||
sPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
|
sPreferences.setPassphraseCacheTtl(Integer.parseInt(newValue.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -362,12 +362,12 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) {
|
private static void initializeAsciiArmor(final CheckBoxPreference mAsciiArmor) {
|
||||||
mAsciiArmour.setChecked(sPreferences.getDefaultAsciiArmour());
|
mAsciiArmor.setChecked(sPreferences.getDefaultAsciiArmor());
|
||||||
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mAsciiArmor.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mAsciiArmour.setChecked((Boolean) newValue);
|
mAsciiArmor.setChecked((Boolean) newValue);
|
||||||
sPreferences.setDefaultAsciiArmour((Boolean) newValue);
|
sPreferences.setDefaultAsciiArmor((Boolean) newValue);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -196,8 +196,8 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
|||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCanEdit(boolean bCanEdit) {
|
public void setCanBeEdited(boolean canBeEdited) {
|
||||||
if (!bCanEdit) {
|
if (!canBeEdited) {
|
||||||
mDeleteButton.setVisibility(View.INVISIBLE);
|
mDeleteButton.setVisibility(View.INVISIBLE);
|
||||||
mExpiryDateButton.setEnabled(false);
|
mExpiryDateButton.setEnabled(false);
|
||||||
mChkSign.setEnabled(false); //certify is always disabled
|
mChkSign.setEnabled(false); //certify is always disabled
|
||||||
|
@ -64,7 +64,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
private boolean mOldItemDeleted = false;
|
private boolean mOldItemDeleted = false;
|
||||||
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
||||||
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
|
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
|
||||||
private boolean mCanEdit = true;
|
private boolean mCanBeEdited = true;
|
||||||
|
|
||||||
private ActionBarActivity mActivity;
|
private ActionBarActivity mActivity;
|
||||||
|
|
||||||
@ -107,9 +107,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCanEdit(boolean bCanEdit) {
|
public void setCanBeEdited(boolean canBeEdited) {
|
||||||
mCanEdit = bCanEdit;
|
mCanBeEdited = canBeEdited;
|
||||||
if (!mCanEdit) {
|
if (!mCanBeEdited) {
|
||||||
mPlusButton.setVisibility(View.INVISIBLE);
|
mPlusButton.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (mCanEdit) {
|
if (mCanBeEdited) {
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
case Id.type.user_id: {
|
case Id.type.user_id: {
|
||||||
UserIdEditor view = (UserIdEditor) mInflater.inflate(
|
UserIdEditor view = (UserIdEditor) mInflater.inflate(
|
||||||
@ -315,7 +315,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
mEditors, false);
|
mEditors, false);
|
||||||
view.setEditorListener(this);
|
view.setEditorListener(this);
|
||||||
view.setValue(userId, mEditors.getChildCount() == 0, false);
|
view.setValue(userId, mEditors.getChildCount() == 0, false);
|
||||||
view.setCanEdit(mCanEdit);
|
view.setCanBeEdited(mCanBeEdited);
|
||||||
mEditors.addView(view);
|
mEditors.addView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
view.setEditorListener(this);
|
view.setEditorListener(this);
|
||||||
boolean isMasterKey = (mEditors.getChildCount() == 0);
|
boolean isMasterKey = (mEditors.getChildCount() == 0);
|
||||||
view.setValue(list.get(i), isMasterKey, usages.get(i), newKeys);
|
view.setValue(list.get(i), isMasterKey, usages.get(i), newKeys);
|
||||||
view.setCanEdit(mCanEdit);
|
view.setCanBeEdited(mCanBeEdited);
|
||||||
mEditors.addView(view);
|
mEditors.addView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
|||||||
private boolean mOriginallyMainUserID;
|
private boolean mOriginallyMainUserID;
|
||||||
private boolean mIsNewId;
|
private boolean mIsNewId;
|
||||||
|
|
||||||
public void setCanEdit(boolean bCanEdit) {
|
public void setCanBeEdited(boolean canBeEdited) {
|
||||||
if (!bCanEdit) {
|
if (!canBeEdited) {
|
||||||
mDeleteButton.setVisibility(View.INVISIBLE);
|
mDeleteButton.setVisibility(View.INVISIBLE);
|
||||||
mName.setEnabled(false);
|
mName.setEnabled(false);
|
||||||
mIsMainUserId.setEnabled(false);
|
mIsMainUserId.setEnabled(false);
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/asciiArmour"
|
android:id="@+id/asciiArmor"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
android:title="@string/label_file_compression" />
|
android:title="@string/label_file_compression" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="defaultAsciiArmour"
|
android:key="defaultAsciiArmor"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/label_ascii_armor" />
|
android:title="@string/label_ascii_armor" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
Loading…
Reference in New Issue
Block a user