Merge pull request #508 from thi/naming-adjustments

Naming adjustments
This commit is contained in:
Dominik Schürmann 2014-04-02 20:29:26 +02:00
commit 34ad14ccec
15 changed files with 106 additions and 106 deletions

View File

@ -55,10 +55,10 @@ public final class Constants {
public static final class Pref {
public static final String DEFAULT_ENCRYPTION_ALGORITHM = "defaultEncryptionAlgorithm";
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_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 FORCE_V3_SIGNATURES = "forceV3Signatures";
public static final String KEY_SERVERS = "keyServers";

View File

@ -58,8 +58,8 @@ public class Preferences {
editor.commit();
}
public long getPassPhraseCacheTtl() {
int ttl = mSharedPreferences.getInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, 180);
public long getPassphraseCacheTtl() {
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
// supported
if (ttl == 0) {
@ -68,9 +68,9 @@ public class Preferences {
return (long) ttl;
}
public void setPassPhraseCacheTtl(int value) {
public void setPassphraseCacheTtl(int value) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, value);
editor.putInt(Constants.Pref.PASSPHRASE_CACHE_TTL, value);
editor.commit();
}
@ -118,13 +118,13 @@ public class Preferences {
editor.commit();
}
public boolean getDefaultAsciiArmour() {
return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, false);
public boolean getDefaultAsciiArmor() {
return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, false);
}
public void setDefaultAsciiArmour(boolean value) {
public void setDefaultAsciiArmor(boolean value) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, value);
editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOR, value);
editor.commit();
}

View File

@ -195,25 +195,25 @@ public class PgpKeyOperation {
sha1Calc, isMasterKey, keyEncryptor);
}
public PGPSecretKeyRing changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassPhrase,
String newPassPhrase)
public PGPSecretKeyRing changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassphrase,
String newPassphrase)
throws IOException, PGPException, NoSuchProviderException {
updateProgress(R.string.progress_building_key, 0, 100);
if (oldPassPhrase == null) {
oldPassPhrase = "";
if (oldPassphrase == null) {
oldPassphrase = "";
}
if (newPassPhrase == null) {
newPassPhrase = "";
if (newPassphrase == null) {
newPassphrase = "";
}
PGPSecretKeyRing newKeyRing = PGPSecretKeyRing.copyWithNewPassword(
keyRing,
new JcePBESecretKeyDecryptorBuilder(new JcaPGPDigestCalculatorProviderBuilder()
.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()
.getKeyEncryptionAlgorithm()).build(newPassPhrase.toCharArray()));
.getKeyEncryptionAlgorithm()).build(newPassphrase.toCharArray()));
return newKeyRing;
@ -223,7 +223,7 @@ public class PgpKeyOperation {
ArrayList<String> userIds, ArrayList<PGPSecretKey> keys,
ArrayList<GregorianCalendar> keysExpiryDates,
ArrayList<Integer> keysUsages,
String newPassPhrase, String oldPassPhrase)
String newPassphrase, String oldPassphrase)
throws PgpGeneralMsgIdException, PGPException, SignatureException, IOException {
int usageId = keysUsages.get(0);
@ -236,7 +236,7 @@ public class PgpKeyOperation {
PGPPublicKey masterPublicKey = masterKey.getPublicKey();
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);
updateProgress(R.string.progress_certifying_master_key, 20, 100);
@ -294,7 +294,7 @@ public class PgpKeyOperation {
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
PGPEncryptedData.CAST5, sha1Calc)
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
newPassPhrase.toCharArray());
newPassphrase.toCharArray());
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(),
@ -310,7 +310,7 @@ public class PgpKeyOperation {
PBESecretKeyDecryptor keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
oldPassPhrase.toCharArray());
oldPassphrase.toCharArray());
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
// 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);
PGPSecretKey masterKey = saveParcel.keys.get(0);
if (saveParcel.oldPassPhrase == null) {
saveParcel.oldPassPhrase = "";
if (saveParcel.oldPassphrase == null) {
saveParcel.oldPassphrase = "";
}
if (saveParcel.newPassPhrase == null) {
saveParcel.newPassPhrase = "";
if (saveParcel.newPassphrase == null) {
saveParcel.newPassphrase = "";
}
if (mKR == null) {
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);
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);
updateProgress(R.string.progress_certifying_master_key, 20, 100);
@ -565,7 +565,7 @@ public class PgpKeyOperation {
PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder(
PGPEncryptedData.CAST5, sha1Calc)
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
saveParcel.oldPassPhrase.toCharArray());
saveParcel.oldPassphrase.toCharArray());
//this generates one more signature than necessary...
PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
@ -586,7 +586,7 @@ public class PgpKeyOperation {
} else {
keyDecryptor2 = new JcePBESecretKeyDecryptorBuilder()
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
saveParcel.oldPassPhrase.toCharArray());
saveParcel.oldPassphrase.toCharArray());
}
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey, subPrivateKey);
@ -667,7 +667,7 @@ public class PgpKeyOperation {
PBESecretKeyEncryptor keyEncryptorNew = new JcePBESecretKeyEncryptorBuilder(
PGPEncryptedData.CAST5, sha1Calc)
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(
saveParcel.newPassPhrase.toCharArray());
saveParcel.newPassphrase.toCharArray());
//update the passphrase
mKR = PGPSecretKeyRing.copyWithNewPassword(mKR, keyDecryptor, keyEncryptorNew);

View File

@ -488,16 +488,16 @@ public class KeychainIntentService extends IntentService
try {
/* Input */
SaveKeyringParcel saveParams = data.getParcelable(SAVE_KEYRING_PARCEL);
String oldPassPhrase = saveParams.oldPassPhrase;
String newPassPhrase = saveParams.newPassPhrase;
String oldPassphrase = saveParams.oldPassphrase;
String newPassphrase = saveParams.newPassphrase;
boolean canSign = true;
if (data.containsKey(SAVE_KEYRING_CAN_SIGN)) {
canSign = data.getBoolean(SAVE_KEYRING_CAN_SIGN);
}
if (newPassPhrase == null) {
newPassPhrase = oldPassPhrase;
if (newPassphrase == null) {
newPassphrase = oldPassphrase;
}
long masterKeyId = saveParams.keys.get(0).getKeyID();
@ -508,7 +508,7 @@ public class KeychainIntentService extends IntentService
PGPSecretKeyRing keyRing = ProviderHelper
.getPGPSecretKeyRingByKeyId(this, masterKeyId);
keyRing = keyOperations.changeSecretKeyPassphrase(keyRing,
oldPassPhrase, newPassPhrase);
oldPassphrase, newPassphrase);
setProgress(R.string.progress_saving_key_ring, 50, 100);
ProviderHelper.saveKeyRing(this, keyRing);
setProgress(R.string.progress_done, 100, 100);
@ -526,7 +526,7 @@ public class KeychainIntentService extends IntentService
ProviderHelper.saveKeyRing(this, pair.second);
setProgress(R.string.progress_done, 100, 100);
}
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassphrase);
/* Output */
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY);
@ -816,9 +816,9 @@ public class KeychainIntentService extends IntentService
ArrayList<String> userIds = data.getStringArrayList(CERTIFY_KEY_UIDS);
/* Operation */
String signaturePassPhrase = PassphraseCacheService.getCachedPassphrase(this,
String signaturePassphrase = PassphraseCacheService.getCachedPassphrase(this,
masterKeyId);
if (signaturePassPhrase == null) {
if (signaturePassphrase == null) {
throw new PgpGeneralException("Unable to obtain passphrase");
}
@ -829,7 +829,7 @@ public class KeychainIntentService extends IntentService
PGPSecretKey certificationKey = PgpKeyHelper.getCertificationKey(this,
masterKeyId);
publicKey = keyOperation.certifyKey(certificationKey, publicKey,
userIds, signaturePassPhrase);
userIds, signaturePassphrase);
publicRing = PGPPublicKeyRing.insertPublicKey(publicRing, publicKey);
// store the signed key in our local cache

View File

@ -95,7 +95,7 @@ public class PassphraseCacheService extends Service {
Intent intent = new Intent(context, PassphraseCacheService.class);
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_KEY_ID, keyId);

View File

@ -38,8 +38,8 @@ public class SaveKeyringParcel implements Parcelable {
public ArrayList<PGPSecretKey> deletedKeys;
public ArrayList<GregorianCalendar> keysExpiryDates;
public ArrayList<Integer> keysUsages;
public String newPassPhrase;
public String oldPassPhrase;
public String newPassphrase;
public String oldPassphrase;
public boolean[] newKeys;
public ArrayList<PGPSecretKey> keys;
public String originalPrimaryID;
@ -61,8 +61,8 @@ public class SaveKeyringParcel implements Parcelable {
}
keysExpiryDates = (ArrayList<GregorianCalendar>) source.readSerializable();
keysUsages = source.readArrayList(Integer.class.getClassLoader());
newPassPhrase = source.readString();
oldPassPhrase = source.readString();
newPassphrase = source.readString();
oldPassphrase = source.readString();
newKeys = source.createBooleanArray();
keys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray());
originalPrimaryID = source.readString();
@ -83,8 +83,8 @@ public class SaveKeyringParcel implements Parcelable {
destination.writeByteArray(tmp);
destination.writeSerializable(keysExpiryDates);
destination.writeList(keysUsages);
destination.writeString(newPassPhrase);
destination.writeString(oldPassPhrase);
destination.writeString(newPassphrase);
destination.writeString(oldPassphrase);
destination.writeBooleanArray(newKeys);
destination.writeByteArray(PgpConversionHelper.PGPSecretKeyArrayListToBytes(keys));
destination.writeString(originalPrimaryID);

View File

@ -97,9 +97,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
private SectionView mKeysView;
private String mCurrentPassphrase = null;
private String mNewPassPhrase = null;
private String mSavedNewPassPhrase = null;
private boolean mIsPassPhraseSet;
private String mNewPassphrase = null;
private String mSavedNewPassphrase = null;
private boolean mIsPassphraseSet;
private boolean mNeedsSaving;
private boolean mIsBrandNewKeyring = false;
@ -403,8 +403,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
mCurrentPassphrase = "";
buildLayout(false);
mIsPassPhraseSet = PassphraseCacheService.hasPassphrase(this, masterKeyId);
if (!mIsPassPhraseSet) {
mIsPassphraseSet = PassphraseCacheService.hasPassphrase(this, masterKeyId);
if (!mIsPassphraseSet) {
// check "no passphrase" checkbox and remove button
mNoPassphrase.setChecked(true);
mChangePassphrase.setVisibility(View.GONE);
@ -423,10 +423,10 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
Bundle data = message.getData();
// set new returned passphrase!
mNewPassPhrase = data
mNewPassphrase = data
.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE);
updatePassPhraseButtonText();
updatePassphraseButtonText();
somethingChanged();
}
}
@ -466,23 +466,23 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout container = (LinearLayout) findViewById(R.id.edit_key_container);
if (mIsPassPhraseSet) {
if (mIsPassphraseSet) {
mChangePassphrase.setText(getString(R.string.btn_change_passphrase));
}
mUserIdsView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
mUserIdsView.setType(Id.type.user_id);
mUserIdsView.setCanEdit(mMasterCanSign);
mUserIdsView.setCanBeEdited(mMasterCanSign);
mUserIdsView.setUserIds(mUserIds);
mUserIdsView.setEditorListener(this);
container.addView(mUserIdsView);
mKeysView = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
mKeysView.setType(Id.type.key);
mKeysView.setCanEdit(mMasterCanSign);
mKeysView.setCanBeEdited(mMasterCanSign);
mKeysView.setKeys(mKeys, mKeysUsages, newKeys);
mKeysView.setEditorListener(this);
container.addView(mKeysView);
updatePassPhraseButtonText();
updatePassphraseButtonText();
mChangePassphrase.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
@ -497,11 +497,11 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// remove passphrase
mSavedNewPassPhrase = mNewPassPhrase;
mNewPassPhrase = "";
mSavedNewPassphrase = mNewPassphrase;
mNewPassphrase = "";
mChangePassphrase.setVisibility(View.GONE);
} else {
mNewPassPhrase = mSavedNewPassPhrase;
mNewPassphrase = mSavedNewPassphrase;
mChangePassphrase.setVisibility(View.VISIBLE);
}
somethingChanged();
@ -519,8 +519,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
public boolean isPassphraseSet() {
if (mNoPassphrase.isChecked()) {
return true;
} else if ((mIsPassPhraseSet)
|| (mNewPassPhrase != null && !mNewPassPhrase.equals(""))) {
} else if ((mIsPassphraseSet)
|| (mNewPassphrase != null && !mNewPassphrase.equals(""))) {
return true;
} else {
return false;
@ -530,9 +530,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
public boolean hasPassphraseChanged() {
if (mNoPassphrase != null) {
if (mNoPassphrase.isChecked()) {
return mIsPassPhraseSet;
return mIsPassphraseSet;
} else {
return (mNewPassPhrase != null && !mNewPassPhrase.equals(""));
return (mNewPassphrase != null && !mNewPassphrase.equals(""));
}
} else {
return false;
@ -548,7 +548,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
}
String passphrase;
if (mIsPassPhraseSet) {
if (mIsPassphraseSet) {
passphrase = PassphraseCacheService.getCachedPassphrase(this, masterKeyId);
} else {
passphrase = "";
@ -638,8 +638,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
saveParams.deletedKeys = mKeysView.getDeletedKeys();
saveParams.keysExpiryDates = getKeysExpiryDates(mKeysView);
saveParams.keysUsages = getKeysUsages(mKeysView);
saveParams.newPassPhrase = mNewPassPhrase;
saveParams.oldPassPhrase = mCurrentPassphrase;
saveParams.newPassphrase = mNewPassphrase;
saveParams.oldPassphrase = mCurrentPassphrase;
saveParams.newKeys = toPrimitiveArray(mKeysView.getNewKeysArray());
saveParams.keys = getKeys(mKeysView);
saveParams.originalPrimaryID = mUserIdsView.getOriginalPrimaryID();
@ -819,7 +819,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
return keysExpiryDates;
}
private void updatePassPhraseButtonText() {
private void updatePassphraseButtonText() {
mChangePassphrase.setText(isPassphraseSet() ? getString(R.string.btn_change_passphrase)
: getString(R.string.btn_set_passphrase));
}

View File

@ -138,8 +138,8 @@ public class EncryptFileFragment extends Fragment {
mDeleteAfter = (CheckBox) view.findViewById(R.id.deleteAfterEncryption);
mShareAfter = (CheckBox) view.findViewById(R.id.shareAfterEncryption);
mAsciiArmor = (CheckBox) view.findViewById(R.id.asciiArmour);
mAsciiArmor.setChecked(Preferences.getPreferences(getActivity()).getDefaultAsciiArmour());
mAsciiArmor = (CheckBox) view.findViewById(R.id.asciiArmor);
mAsciiArmor.setChecked(Preferences.getPreferences(getActivity()).getDefaultAsciiArmor());
return view;
}
@ -224,9 +224,9 @@ public class EncryptFileFragment extends Fragment {
if (mEncryptInterface.isModeSymmetric()) {
// symmetric encryption
boolean gotPassPhrase = (mEncryptInterface.getPassphrase() != null
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
&& mEncryptInterface.getPassphrase().length() != 0);
if (!gotPassPhrase) {
if (!gotPassphrase) {
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
.show();
return;

View File

@ -125,9 +125,9 @@ public class EncryptMessageFragment extends Fragment {
if (mEncryptInterface.isModeSymmetric()) {
// symmetric encryption
boolean gotPassPhrase = (mEncryptInterface.getPassphrase() != null
boolean gotPassphrase = (mEncryptInterface.getPassphrase() != null
&& mEncryptInterface.getPassphrase().length() != 0);
if (!gotPassPhrase) {
if (!gotPassphrase) {
AppMsg.makeText(getActivity(), R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT)
.show();
return;

View File

@ -61,8 +61,8 @@ public class PreferencesActivity extends PreferenceActivity {
if (action != null && action.equals(ACTION_PREFS_GEN)) {
addPreferencesFromResource(R.xml.gen_preferences);
initializePassPassPhraceCacheTtl(
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
initializePassPassphraceCacheTtl(
(IntegerListPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_TTL));
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
String servers[] = sPreferences.getKeyServers();
@ -110,8 +110,8 @@ public class PreferencesActivity extends PreferenceActivity {
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
entries, values);
initializeAsciiArmour(
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
initializeAsciiArmor(
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOR));
initializeForceV3Signatures(
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
@ -165,8 +165,8 @@ public class PreferencesActivity extends PreferenceActivity {
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.gen_preferences);
initializePassPassPhraceCacheTtl(
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
initializePassPassphraceCacheTtl(
(IntegerListPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_TTL));
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
String servers[] = sPreferences.getKeyServers();
@ -247,8 +247,8 @@ public class PreferencesActivity extends PreferenceActivity {
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
entries, values);
initializeAsciiArmour(
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
initializeAsciiArmor(
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOR));
initializeForceV3Signatures(
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
@ -261,15 +261,15 @@ public class PreferencesActivity extends PreferenceActivity {
|| super.isValidFragment(fragmentName);
}
private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
mPassphraseCacheTtl.setValue("" + sPreferences.getPassPhraseCacheTtl());
private static void initializePassPassphraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
mPassphraseCacheTtl.setValue("" + sPreferences.getPassphraseCacheTtl());
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
mPassphraseCacheTtl
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
mPassphraseCacheTtl.setValue(newValue.toString());
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
sPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
sPreferences.setPassphraseCacheTtl(Integer.parseInt(newValue.toString()));
return false;
}
});
@ -362,12 +362,12 @@ public class PreferencesActivity extends PreferenceActivity {
});
}
private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) {
mAsciiArmour.setChecked(sPreferences.getDefaultAsciiArmour());
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
private static void initializeAsciiArmor(final CheckBoxPreference mAsciiArmor) {
mAsciiArmor.setChecked(sPreferences.getDefaultAsciiArmor());
mAsciiArmor.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
mAsciiArmour.setChecked((Boolean) newValue);
sPreferences.setDefaultAsciiArmour((Boolean) newValue);
mAsciiArmor.setChecked((Boolean) newValue);
sPreferences.setDefaultAsciiArmor((Boolean) newValue);
return false;
}
});

View File

@ -196,8 +196,8 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
super.onFinishInflate();
}
public void setCanEdit(boolean bCanEdit) {
if (!bCanEdit) {
public void setCanBeEdited(boolean canBeEdited) {
if (!canBeEdited) {
mDeleteButton.setVisibility(View.INVISIBLE);
mExpiryDateButton.setEnabled(false);
mChkSign.setEnabled(false); //certify is always disabled

View File

@ -64,7 +64,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
private boolean mOldItemDeleted = false;
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
private boolean mCanEdit = true;
private boolean mCanBeEdited = true;
private ActionBarActivity mActivity;
@ -107,9 +107,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
}
}
public void setCanEdit(boolean bCanEdit) {
mCanEdit = bCanEdit;
if (!mCanEdit) {
public void setCanBeEdited(boolean canBeEdited) {
mCanBeEdited = canBeEdited;
if (!mCanBeEdited) {
mPlusButton.setVisibility(View.INVISIBLE);
}
}
@ -265,7 +265,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
* {@inheritDoc}
*/
public void onClick(View v) {
if (mCanEdit) {
if (mCanBeEdited) {
switch (mType) {
case Id.type.user_id: {
UserIdEditor view = (UserIdEditor) mInflater.inflate(
@ -315,7 +315,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
mEditors, false);
view.setEditorListener(this);
view.setValue(userId, mEditors.getChildCount() == 0, false);
view.setCanEdit(mCanEdit);
view.setCanBeEdited(mCanBeEdited);
mEditors.addView(view);
}
@ -336,7 +336,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
view.setEditorListener(this);
boolean isMasterKey = (mEditors.getChildCount() == 0);
view.setValue(list.get(i), isMasterKey, usages.get(i), newKeys);
view.setCanEdit(mCanEdit);
view.setCanBeEdited(mCanBeEdited);
mEditors.addView(view);
}

View File

@ -52,8 +52,8 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
private boolean mOriginallyMainUserID;
private boolean mIsNewId;
public void setCanEdit(boolean bCanEdit) {
if (!bCanEdit) {
public void setCanBeEdited(boolean canBeEdited) {
if (!canBeEdited) {
mDeleteButton.setVisibility(View.INVISIBLE);
mName.setEnabled(false);
mIsMainUserId.setEnabled(false);

View File

@ -54,10 +54,10 @@
android:orientation="horizontal">
<CheckBox
android:id="@+id/asciiArmour"
android:id="@+id/asciiArmor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/label_ascii_armor"/>
</LinearLayout>
</merge>
</merge>

View File

@ -35,7 +35,7 @@
android:title="@string/label_file_compression" />
<CheckBoxPreference
android:key="defaultAsciiArmour"
android:key="defaultAsciiArmor"
android:persistent="false"
android:title="@string/label_ascii_armor" />
</PreferenceCategory>
@ -45,4 +45,4 @@
android:persistent="false"
android:title="@string/label_force_v3_signature" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>