diff --git a/k9mail/src/main/java/com/fsck/k9/K9.java b/k9mail/src/main/java/com/fsck/k9/K9.java index 6840bda21..21ae168c0 100644 --- a/k9mail/src/main/java/com/fsck/k9/K9.java +++ b/k9mail/src/main/java/com/fsck/k9/K9.java @@ -242,8 +242,8 @@ public class K9 extends Application { private static boolean mHideUserAgent = false; private static boolean mHideTimeZone = false; - private static String sCryptoProvider = ""; - private static boolean sCryptoSupportSignOnly = false; + private static String sOpenPgpProvider = ""; + private static boolean sOpenPgpSupportSignOnly = false; private static SortType mSortType; private static Map mSortAscending = new HashMap(); @@ -314,7 +314,7 @@ public class K9 extends Application { public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000; - public static final String NO_CRYPTO_PROVIDER = ""; + public static final String NO_OPENPGP_PROVIDER = ""; public static class Intents { @@ -469,8 +469,8 @@ public class K9 extends Application { editor.putBoolean("hideUserAgent", mHideUserAgent); editor.putBoolean("hideTimeZone", mHideTimeZone); - editor.putString("cryptoProvider", sCryptoProvider); - editor.putBoolean("cryptoSupportSignOnly", sCryptoSupportSignOnly); + editor.putString("openPgpProvider", sOpenPgpProvider); + editor.putBoolean("openPgpSupportSignOnly", sOpenPgpSupportSignOnly); editor.putString("language", language); editor.putInt("theme", theme.ordinal()); @@ -690,8 +690,8 @@ public class K9 extends Application { mHideUserAgent = storage.getBoolean("hideUserAgent", false); mHideTimeZone = storage.getBoolean("hideTimeZone", false); - sCryptoProvider = storage.getString("cryptoProvider", NO_CRYPTO_PROVIDER); - sCryptoSupportSignOnly = storage.getBoolean("cryptoSupportSignOnly", false); + sOpenPgpProvider = storage.getString("openPgpProvider", NO_OPENPGP_PROVIDER); + sOpenPgpSupportSignOnly = storage.getBoolean("openPgpSupportSignOnly", false); mConfirmDelete = storage.getBoolean("confirmDelete", false); mConfirmDiscardMessage = storage.getBoolean("confirmDiscardMessage", true); @@ -1238,24 +1238,24 @@ public class K9 extends Application { mHideTimeZone = state; } - public static boolean isCryptoProviderConfigured() { - return !NO_CRYPTO_PROVIDER.equals(sCryptoProvider); + public static boolean isOpenPgpProviderConfigured() { + return !NO_OPENPGP_PROVIDER.equals(sOpenPgpProvider); } - public static String getCryptoProvider() { - return sCryptoProvider; + public static String getOpenPgpProvider() { + return sOpenPgpProvider; } - public static void setCryptoProvider(String cryptoProvider) { - sCryptoProvider = cryptoProvider; + public static void setOpenPgpProvider(String openPgpProvider) { + sOpenPgpProvider = openPgpProvider; } - public static boolean getCryptoSupportSignOnly() { - return sCryptoSupportSignOnly; + public static boolean getOpenPgpSupportSignOnly() { + return sOpenPgpSupportSignOnly; } - public static void setCryptoSupportSignOnly(boolean supportSignOnly) { - sCryptoSupportSignOnly = supportSignOnly; + public static void setOpenPgpSupportSignOnly(boolean supportSignOnly) { + sOpenPgpSupportSignOnly = supportSignOnly; } public static String getAttachmentDefaultPath() { diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java index d30ea355d..256730847 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java @@ -202,7 +202,7 @@ public class MessageLoaderHelper { return; } - if (K9.isCryptoProviderConfigured()) { + if (K9.isOpenPgpProviderConfigured()) { startOrResumeCryptoOperation(); return; } diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java index 222307a86..e18bc65cd 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java @@ -67,7 +67,7 @@ public class RecipientPresenter implements PermissionPingCallback { private final RecipientsChangedListener listener; private ReplyToParser replyToParser; private Account account; - private String cryptoProvider; + private String openPgpProvider; private Boolean hasContactPicker; private ComposeCryptoStatus cachedCryptoStatus; private PendingIntent pendingUserInteractionIntent; @@ -251,7 +251,7 @@ public class RecipientPresenter implements PermissionPingCallback { menu.findItem(R.id.openpgp_inline_enable).setVisible(isCryptoConfigured && !cryptoEnablePgpInline); menu.findItem(R.id.openpgp_inline_disable).setVisible(isCryptoConfigured && cryptoEnablePgpInline); - boolean showSignOnly = isCryptoConfigured && K9.getCryptoSupportSignOnly(); + boolean showSignOnly = isCryptoConfigured && K9.getOpenPgpSupportSignOnly(); boolean isSignOnly = cachedCryptoStatus.isSignOnly(); menu.findItem(R.id.openpgp_sign_only).setVisible(showSignOnly && !isSignOnly); menu.findItem(R.id.openpgp_sign_only_disable).setVisible(showSignOnly && isSignOnly); @@ -442,7 +442,7 @@ public class RecipientPresenter implements PermissionPingCallback { } private void addRecipientsFromAddresses(final RecipientType recipientType, final Address... addresses) { - new RecipientLoader(context, cryptoProvider, addresses) { + new RecipientLoader(context, openPgpProvider, addresses) { @Override public void deliverResult(List result) { Recipient[] recipientArray = result.toArray(new Recipient[result.size()]); @@ -455,7 +455,7 @@ public class RecipientPresenter implements PermissionPingCallback { } private void addRecipientFromContactUri(final RecipientType recipientType, final Uri uri) { - new RecipientLoader(context, cryptoProvider, uri, false) { + new RecipientLoader(context, openPgpProvider, uri, false) { @Override public void deliverResult(List result) { // TODO handle multiple available mail addresses for a contact? @@ -611,13 +611,13 @@ public class RecipientPresenter implements PermissionPingCallback { } private void setupCryptoProvider() { - String cryptoProvider = K9.getCryptoProvider(); - if (TextUtils.isEmpty(cryptoProvider)) { - cryptoProvider = null; + String openPgpProvider = K9.getOpenPgpProvider(); + if (TextUtils.isEmpty(openPgpProvider)) { + openPgpProvider = null; } boolean providerIsBound = openPgpServiceConnection != null && openPgpServiceConnection.isBound(); - boolean isSameProvider = cryptoProvider != null && cryptoProvider.equals(this.cryptoProvider); + boolean isSameProvider = openPgpProvider != null && openPgpProvider.equals(this.openPgpProvider); if (isSameProvider && providerIsBound) { cryptoProviderBindOrCheckPermission(); return; @@ -628,15 +628,15 @@ public class RecipientPresenter implements PermissionPingCallback { openPgpServiceConnection = null; } - this.cryptoProvider = cryptoProvider; + this.openPgpProvider = openPgpProvider; - if (cryptoProvider == null) { + if (openPgpProvider == null) { cryptoProviderState = CryptoProviderState.UNCONFIGURED; return; } cryptoProviderState = CryptoProviderState.UNINITIALIZED; - openPgpServiceConnection = new OpenPgpServiceConnection(context, cryptoProvider, new OnBound() { + openPgpServiceConnection = new OpenPgpServiceConnection(context, openPgpProvider, new OnBound() { @Override public void onBound(IOpenPgpService2 service) { cryptoProviderBindOrCheckPermission(); @@ -649,7 +649,7 @@ public class RecipientPresenter implements PermissionPingCallback { }); cryptoProviderBindOrCheckPermission(); - recipientMvpView.setCryptoProvider(cryptoProvider); + recipientMvpView.setCryptoProvider(openPgpProvider); } private void cryptoProviderBindOrCheckPermission() { @@ -784,7 +784,7 @@ public class RecipientPresenter implements PermissionPingCallback { @VisibleForTesting void setOpenPgpServiceConnection(OpenPgpServiceConnection openPgpServiceConnection, String cryptoProvider) { this.openPgpServiceConnection = openPgpServiceConnection; - this.cryptoProvider = cryptoProvider; + this.openPgpProvider = cryptoProvider; } public enum CryptoProviderState { diff --git a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java index 096c76b8f..8db66b91c 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java @@ -693,13 +693,13 @@ public class AccountSettings extends K9PreferenceActivity { } }); - mHasCrypto = K9.isCryptoProviderConfigured(); + mHasCrypto = K9.isOpenPgpProviderConfigured(); PreferenceScreen cryptoMenu = (PreferenceScreen) findPreference(PREFERENCE_CRYPTO); if (mHasCrypto) { mCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY); mCryptoKey.setValue(mAccount.getCryptoKey()); - mCryptoKey.setOpenPgpProvider(K9.getCryptoProvider()); + mCryptoKey.setOpenPgpProvider(K9.getOpenPgpProvider()); // TODO: other identities? mCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(mAccount.getIdentity(0))); mCryptoKey.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { diff --git a/k9mail/src/main/java/com/fsck/k9/activity/setup/Prefs.java b/k9mail/src/main/java/com/fsck/k9/activity/setup/Prefs.java index c4bfc2d1b..5beabdef2 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/setup/Prefs.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/setup/Prefs.java @@ -93,8 +93,8 @@ public class Prefs extends K9PreferenceActivity { private static final String PREFERENCE_HIDE_USERAGENT = "privacy_hide_useragent"; private static final String PREFERENCE_HIDE_TIMEZONE = "privacy_hide_timezone"; - private static final String PREFERENCE_CRYPTO_APP = "crypto_app"; - private static final String PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY = "crypto_support_sign_only"; + private static final String PREFERENCE_OPENPGP_PROVIDER = "openpgp_provider"; + private static final String PREFERENCE_OPENPGP_SUPPORT_SIGN_ONLY = "openpgp_support_sign_only"; private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width"; private static final String PREFERENCE_BACKGROUND_OPS = "background_ops"; @@ -155,8 +155,8 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mWrapFolderNames; private CheckBoxListPreference mVisibleRefileActions; - private OpenPgpAppPreference mCryptoProvider; - private CheckBoxPreference mCryptoSupportSignOnly; + private OpenPgpAppPreference mOpenPgpProvider; + private CheckBoxPreference mOpenPgpSupportSignOnly; private CheckBoxPreference mQuietTimeEnabled; private CheckBoxPreference mDisableNotificationDuringQuietTime; @@ -384,27 +384,27 @@ public class Prefs extends K9PreferenceActivity { mHideUserAgent.setChecked(K9.hideUserAgent()); mHideTimeZone.setChecked(K9.hideTimeZone()); - mCryptoProvider = (OpenPgpAppPreference) findPreference(PREFERENCE_CRYPTO_APP); - mCryptoProvider.setValue(K9.getCryptoProvider()); + mOpenPgpProvider = (OpenPgpAppPreference) findPreference(PREFERENCE_OPENPGP_PROVIDER); + mOpenPgpProvider.setValue(K9.getOpenPgpProvider()); if (OpenPgpAppPreference.isApgInstalled(getApplicationContext())) { - mCryptoProvider.addLegacyProvider( + mOpenPgpProvider.addLegacyProvider( APG_PROVIDER_PLACEHOLDER, getString(R.string.apg), R.drawable.ic_apg_small); } - mCryptoProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + mOpenPgpProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { String value = newValue.toString(); if (APG_PROVIDER_PLACEHOLDER.equals(value)) { - mCryptoProvider.setValue(""); + mOpenPgpProvider.setValue(""); showDialog(DIALOG_APG_DEPRECATION_WARNING); } else { - mCryptoProvider.setValue(value); + mOpenPgpProvider.setValue(value); } return false; } }); - mCryptoSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY); - mCryptoSupportSignOnly.setChecked(K9.getCryptoSupportSignOnly()); + mOpenPgpSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_OPENPGP_SUPPORT_SIGN_ONLY); + mOpenPgpSupportSignOnly.setChecked(K9.getOpenPgpSupportSignOnly()); mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH); mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath()); @@ -561,8 +561,8 @@ public class Prefs extends K9PreferenceActivity { K9.setHideUserAgent(mHideUserAgent.isChecked()); K9.setHideTimeZone(mHideTimeZone.isChecked()); - K9.setCryptoProvider(mCryptoProvider.getValue()); - K9.setCryptoSupportSignOnly(mCryptoSupportSignOnly.isChecked()); + K9.setOpenPgpProvider(mOpenPgpProvider.getValue()); + K9.setOpenPgpSupportSignOnly(mOpenPgpSupportSignOnly.isChecked()); StorageEditor editor = storage.edit(); K9.save(editor); @@ -601,7 +601,7 @@ public class Prefs extends K9PreferenceActivity { dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { - mCryptoProvider.show(); + mOpenPgpProvider.show(); } }); break; diff --git a/k9mail/src/main/java/com/fsck/k9/preferences/GlobalSettings.java b/k9mail/src/main/java/com/fsck/k9/preferences/GlobalSettings.java index e44b7f5b9..e691f2768 100644 --- a/k9mail/src/main/java/com/fsck/k9/preferences/GlobalSettings.java +++ b/k9mail/src/main/java/com/fsck/k9/preferences/GlobalSettings.java @@ -290,10 +290,10 @@ public class GlobalSettings { s.put("pgpSignOnlyDialogCounter", Settings.versions( new V(45, new IntegerRangeSetting(0, Integer.MAX_VALUE, 0)) )); - s.put("cryptoProvider", Settings.versions( - new V(46, new StringSetting(K9.NO_CRYPTO_PROVIDER)) + s.put("openpgpProvider", Settings.versions( + new V(46, new StringSetting(K9.NO_OPENPGP_PROVIDER)) )); - s.put("cryptoSupportSignOnly", Settings.versions( + s.put("openpgpSupportSignOnly", Settings.versions( new V(47, new BooleanSetting(false)) )); diff --git a/k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java b/k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java index 65f4d253b..1389e7bd6 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java @@ -89,7 +89,7 @@ public class MessageCryptoHelper { public MessageCryptoHelper(Context context) { this.context = context.getApplicationContext(); - if (!K9.isCryptoProviderConfigured()) { + if (!K9.isOpenPgpProviderConfigured()) { throw new IllegalStateException("MessageCryptoHelper must only be called with a openpgp provider!"); } } @@ -207,7 +207,7 @@ public class MessageCryptoHelper { } private void connectToCryptoProviderService() { - String openPgpProviderPackage = K9.getCryptoProvider(); + String openPgpProviderPackage = K9.getOpenPgpProvider(); openPgpServiceConnection = new OpenPgpServiceConnection(context, openPgpProviderPackage, new OnBound() { @Override diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java index e1b2021c7..f09bbfec7 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageCryptoPresenter.java @@ -59,7 +59,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { return false; } - boolean suppressSignOnlyMessages = !K9.getCryptoSupportSignOnly(); + boolean suppressSignOnlyMessages = !K9.getOpenPgpSupportSignOnly(); if (suppressSignOnlyMessages && displayStatus.isUnencryptedSigned()) { return false; } @@ -222,8 +222,8 @@ public class MessageCryptoPresenter implements OnCryptoClickListener { @Nullable private static Drawable getOpenPgpApiProviderIcon(Context context) { try { - String openPgpProvider = K9.getCryptoProvider(); - if (K9.NO_CRYPTO_PROVIDER.equals(openPgpProvider)) { + String openPgpProvider = K9.getOpenPgpProvider(); + if (K9.NO_OPENPGP_PROVIDER.equals(openPgpProvider)) { return null; } return context.getPackageManager().getApplicationIcon(openPgpProvider); diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java index 9c0fbcd1e..e934900b7 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java @@ -115,7 +115,7 @@ public class MessageTopView extends LinearLayout { containerView, false); containerView.addView(view); - boolean hideUnsignedTextDivider = !K9.getCryptoSupportSignOnly(); + boolean hideUnsignedTextDivider = !K9.getOpenPgpSupportSignOnly(); view.displayMessageViewContainer(messageViewInfo, new OnRenderingFinishedListener() { @Override public void onLoadFinished() { diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java index 5757c0f0d..68e1fabd2 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java @@ -234,7 +234,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF mMessageView, mAccount, messageViewInfo); if (!handledByCryptoPresenter) { mMessageView.showMessage(mAccount, messageViewInfo); - if (K9.isCryptoProviderConfigured()) { + if (K9.isOpenPgpProviderConfigured()) { mMessageView.getMessageHeaderView().setCryptoStatusDisabled(); } else { mMessageView.getMessageHeaderView().hideCryptoStatus(); @@ -244,7 +244,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF private void displayHeaderForLoadingMessage(LocalMessage message) { mMessageView.setHeaders(message, mAccount); - if (K9.isCryptoProviderConfigured()) { + if (K9.isOpenPgpProviderConfigured()) { mMessageView.getMessageHeaderView().setCryptoStatusLoading(); } displayMessageSubject(getSubjectForMessage(message)); diff --git a/k9mail/src/main/res/xml/global_preferences.xml b/k9mail/src/main/res/xml/global_preferences.xml index b0935d5b8..8f2f713d8 100644 --- a/k9mail/src/main/res/xml/global_preferences.xml +++ b/k9mail/src/main/res/xml/global_preferences.xml @@ -415,12 +415,12 @@ diff --git a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java index 742dd6508..ce4f4266b 100644 --- a/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java +++ b/k9mail/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.java @@ -254,7 +254,7 @@ public class RecipientPresenterTest { IOpenPgpService2 openPgpService2 = mock(IOpenPgpService2.class); Intent permissionPingIntent = new Intent(); - K9.setCryptoProvider(CRYPTO_PROVIDER); + K9.setOpenPgpProvider(CRYPTO_PROVIDER); permissionPingIntent.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); when(account.getCryptoKey()).thenReturn(CRYPTO_KEY_ID); when(openPgpServiceConnection.isBound()).thenReturn(true);