Add prefer-encrypt setting

This commit is contained in:
Vincent Breitmoser 2018-01-10 02:05:50 +01:00
parent 3009752cac
commit 9498725fd0
4 changed files with 24 additions and 1 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -1282,4 +1282,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="openpgp_enabled_error_back">Back</string>
<string name="openpgp_enabled_error_disable">Disable Encryption</string>
<string name="openpgp_encryption">OpenPGP Encryption</string>
<string name="account_settings_crypto_prefer_encrypt">Encryption preference</string>
<string name="account_settings_crypto_prefer_encrypt_on">By default when replying to encrypted, or if all recipients also checked this option</string>
<string name="account_settings_crypto_prefer_encrypt_off">By default, when replying to encrypted messages</string>
</resources>

View file

@ -479,6 +479,12 @@
android:key="crypto_key"
android:title="@string/account_settings_crypto_key" />
<CheckBoxPreference
android:key="autocrypt_prefer_encrypt"
android:title="@string/account_settings_crypto_prefer_encrypt"
android:summaryOn="@string/account_settings_crypto_prefer_encrypt_on"
android:summaryOff="@string/account_settings_crypto_prefer_encrypt_off"
/>
</PreferenceScreen>
</PreferenceScreen>