From 9498725fd066ea4a73bac56725a2c036b2ee855c Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 10 Jan 2018 02:05:50 +0100 Subject: [PATCH] Add prefer-encrypt setting --- k9mail/src/main/java/com/fsck/k9/Account.java | 9 +++++++++ .../java/com/fsck/k9/activity/setup/AccountSettings.java | 7 ++++++- k9mail/src/main/res/values/strings.xml | 3 +++ k9mail/src/main/res/xml/account_settings_preferences.xml | 6 ++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/k9mail/src/main/java/com/fsck/k9/Account.java b/k9mail/src/main/java/com/fsck/k9/Account.java index 7b75149fb..ba56293b9 100644 --- a/k9mail/src/main/java/com/fsck/k9/Account.java +++ b/k9mail/src/main/java/com/fsck/k9/Account.java @@ -220,6 +220,7 @@ public class Account implements BaseAccount, StoreConfig { private boolean stripSignature; private boolean syncRemoteDeletions; private long pgpCryptoKey; + private boolean autocryptPreferEncryptMutual; private boolean markMessageAsReadOnView; private boolean alwaysShowCcBcc; private boolean allowRemoteSearch; @@ -1644,6 +1645,14 @@ public class Account implements BaseAccount, StoreConfig { pgpCryptoKey = keyId; } + public boolean getAutocryptPreferEncryptMutual() { + return autocryptPreferEncryptMutual; + } + + public void setAutocryptPreferEncryptMutual(boolean autocryptPreferEncryptMutual) { + this.autocryptPreferEncryptMutual = autocryptPreferEncryptMutual; + } + public boolean allowRemoteSearch() { return allowRemoteSearch; } 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 c9a417e4e..2bee31a0f 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 @@ -112,6 +112,7 @@ public class AccountSettings extends K9PreferenceActivity { private static final String PREFERENCE_SYNC_REMOTE_DELETIONS = "account_sync_remote_deletetions"; private static final String PREFERENCE_CRYPTO = "crypto"; private static final String PREFERENCE_CRYPTO_KEY = "crypto_key"; + private static final String PREFERENCE_AUTOCRYPT_PREFER_ENCRYPT = "autocrypt_prefer_encrypt"; private static final String PREFERENCE_CLOUD_SEARCH_ENABLED = "remote_search_enabled"; private static final String PREFERENCE_REMOTE_SEARCH_NUM_RESULTS = "account_remote_search_num_results"; private static final String PREFERENCE_REMOTE_SEARCH_FULL_TEXT = "account_remote_search_full_text"; @@ -178,7 +179,7 @@ public class AccountSettings extends K9PreferenceActivity { private ListPreference mMaxPushFolders; private boolean hasPgpCrypto = false; private OpenPgpKeyPreference pgpCryptoKey; - private CheckBoxPreference pgpSupportSignOnly; + private CheckBoxPreference autocryptPreferEncryptMutual; private PreferenceScreen searchScreen; private CheckBoxPreference cloudSearchEnabled; @@ -711,6 +712,9 @@ public class AccountSettings extends K9PreferenceActivity { }); cryptoMenu.setOnPreferenceClickListener(null); + + autocryptPreferEncryptMutual = (CheckBoxPreference) findPreference(PREFERENCE_AUTOCRYPT_PREFER_ENCRYPT); + autocryptPreferEncryptMutual.setChecked(account.getAutocryptPreferEncryptMutual()); } else { cryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_configured); cryptoMenu.setOnPreferenceClickListener(new OnPreferenceClickListener() { @@ -791,6 +795,7 @@ public class AccountSettings extends K9PreferenceActivity { } else { account.setCryptoKey(Account.NO_OPENPGP_KEY); } + account.setAutocryptPreferEncryptMutual(autocryptPreferEncryptMutual.isChecked()); // In webdav account we use the exact folder name also for inbox, // since it varies because of internationalization diff --git a/k9mail/src/main/res/values/strings.xml b/k9mail/src/main/res/values/strings.xml index 2e644a244..52604ba23 100644 --- a/k9mail/src/main/res/values/strings.xml +++ b/k9mail/src/main/res/values/strings.xml @@ -1282,4 +1282,7 @@ Please submit bug reports, contribute new features and ask questions at Back Disable Encryption OpenPGP Encryption + Encryption preference + By default when replying to encrypted, or if all recipients also checked this option + By default, when replying to encrypted messages diff --git a/k9mail/src/main/res/xml/account_settings_preferences.xml b/k9mail/src/main/res/xml/account_settings_preferences.xml index c4235b6ea..018fcf3e5 100644 --- a/k9mail/src/main/res/xml/account_settings_preferences.xml +++ b/k9mail/src/main/res/xml/account_settings_preferences.xml @@ -479,6 +479,12 @@ android:key="crypto_key" android:title="@string/account_settings_crypto_key" /> +