Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 395f37ea authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

add account setting to support unencrypted authentication

parent 7fe6a903
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ public class Account implements BaseAccount, StoreConfig {
    private boolean mSyncRemoteDeletions;
    private String mCryptoApp;
    private long mCryptoKey;
    private boolean mCryptoSupportSignOnly;
    private boolean mMarkMessageAsReadOnView;
    private boolean mAlwaysShowCcBcc;
    private boolean mAllowRemoteSearch;
@@ -320,6 +321,7 @@ public class Account implements BaseAccount, StoreConfig {
        mSyncRemoteDeletions = true;
        mCryptoApp = NO_OPENPGP_PROVIDER;
        mCryptoKey = NO_OPENPGP_KEY;
        mCryptoSupportSignOnly = false;
        mAllowRemoteSearch = false;
        mRemoteSearchFullText = false;
        mRemoteSearchNumResults = DEFAULT_REMOTE_SEARCH_NUM_RESULTS;
@@ -471,6 +473,7 @@ public class Account implements BaseAccount, StoreConfig {
        String cryptoApp = storage.getString(mUuid + ".cryptoApp", NO_OPENPGP_PROVIDER);
        setCryptoApp(cryptoApp);
        mCryptoKey = storage.getLong(mUuid + ".cryptoKey", NO_OPENPGP_KEY);
        mCryptoSupportSignOnly = storage.getBoolean(mUuid + ".cryptoSupportSignOnly", false);
        mAllowRemoteSearch = storage.getBoolean(mUuid + ".allowRemoteSearch", false);
        mRemoteSearchFullText = storage.getBoolean(mUuid + ".remoteSearchFullText", false);
        mRemoteSearchNumResults = storage.getInt(mUuid + ".remoteSearchNumResults", DEFAULT_REMOTE_SEARCH_NUM_RESULTS);
@@ -736,6 +739,7 @@ public class Account implements BaseAccount, StoreConfig {
        editor.putBoolean(mUuid + ".stripSignature", mStripSignature);
        editor.putString(mUuid + ".cryptoApp", mCryptoApp);
        editor.putLong(mUuid + ".cryptoKey", mCryptoKey);
        editor.putBoolean(mUuid + ".cryptoSupportSignOnly", mCryptoSupportSignOnly);
        editor.putBoolean(mUuid + ".allowRemoteSearch", mAllowRemoteSearch);
        editor.putBoolean(mUuid + ".remoteSearchFullText", mRemoteSearchFullText);
        editor.putInt(mUuid + ".remoteSearchNumResults", mRemoteSearchNumResults);
@@ -1628,6 +1632,14 @@ public class Account implements BaseAccount, StoreConfig {
        mCryptoKey = keyId;
    }

    public boolean getCryptoSupportSignOnly() {
        return mCryptoSupportSignOnly;
    }

    public void setCryptoSupportSignOnly(boolean cryptoSupportSignOnly) {
        mCryptoSupportSignOnly = cryptoSupportSignOnly;
    }

    public boolean allowRemoteSearch() {
        return mAllowRemoteSearch;
    }
+14 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ public class AccountSettings extends K9PreferenceActivity {
    private static final String PREFERENCE_CRYPTO = "crypto";
    private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
    private static final String PREFERENCE_CRYPTO_KEY = "crypto_key";
    private static final String PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY = "crypto_support_sign_only";
    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";
@@ -181,6 +182,7 @@ public class AccountSettings extends K9PreferenceActivity {
    private boolean mHasCrypto = false;
    private OpenPgpAppPreference mCryptoApp;
    private OpenPgpKeyPreference mCryptoKey;
    private CheckBoxPreference mCryptoSupportSignOnly;

    private PreferenceScreen mSearchScreen;
    private CheckBoxPreference mCloudSearchEnabled;
@@ -698,6 +700,7 @@ public class AccountSettings extends K9PreferenceActivity {
        if (mHasCrypto) {
            mCryptoApp = (OpenPgpAppPreference) findPreference(PREFERENCE_CRYPTO_APP);
            mCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY);
            mCryptoSupportSignOnly = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_SUPPORT_SIGN_ONLY);

            mCryptoApp.setValue(String.valueOf(mAccount.getCryptoApp()));
            mCryptoApp.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@@ -721,6 +724,15 @@ public class AccountSettings extends K9PreferenceActivity {
                    return false;
                }
            });

            mCryptoSupportSignOnly.setChecked(mAccount.getCryptoSupportSignOnly());
            mCryptoSupportSignOnly.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
                public boolean onPreferenceChange(Preference preference, Object newValue) {
                    boolean value = (Boolean) newValue;
                    mCryptoSupportSignOnly.setChecked(value);
                    return false;
                }
            });
        } else {
            final Preference mCryptoMenu = findPreference(PREFERENCE_CRYPTO);
            mCryptoMenu.setEnabled(false);
@@ -789,9 +801,11 @@ public class AccountSettings extends K9PreferenceActivity {
        if (mHasCrypto) {
            mAccount.setCryptoApp(mCryptoApp.getValue());
            mAccount.setCryptoKey(mCryptoKey.getValue());
            mAccount.setCryptoSupportSignOnly(mCryptoSupportSignOnly.isChecked());
        } else {
            mAccount.setCryptoApp(Account.NO_OPENPGP_PROVIDER);
            mAccount.setCryptoKey(Account.NO_OPENPGP_KEY);
            mAccount.setCryptoSupportSignOnly(false);
        }

        // In webdav account we use the exact folder name also for inbox,
+1 −0
Original line number Diff line number Diff line
@@ -1218,5 +1218,6 @@ Please submit bug reports, contribute new features and ask questions at
    <string name="messageview_crypto_warning_error">There was an <b>error in this message\'s signature!</b></string>
    <string name="recipient_error_non_ascii">Special characters are currently not supported!</string>
    <string name="recipient_error_parse_failed">Error parsing address!</string>
    <string name="account_settings_crypto_support_sign_only">Support unencrypted authentication</string>

</resources>
+7 −0
Original line number Diff line number Diff line
@@ -484,6 +484,13 @@
            android:key="crypto_key"
            android:title="@string/account_settings_crypto_key" />

        <CheckBoxPreference
            android:persistent="false"
            android:key="crypto_support_sign_only"
            android:title="@string/account_settings_crypto_support_sign_only"
            />


    </PreferenceScreen>

</PreferenceScreen>