diff --git a/plugins/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java b/plugins/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java index 54c5b1348..3c21eaff0 100644 --- a/plugins/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java +++ b/plugins/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java @@ -16,6 +16,9 @@ package org.openintents.openpgp.util; +import java.util.ArrayList; +import java.util.List; + import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; @@ -31,10 +34,8 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.TextView; -import org.openintents.openpgp.R; -import java.util.ArrayList; -import java.util.List; +import org.openintents.openpgp.R; /** * Does not extend ListPreference, but is very similar to it! @@ -46,7 +47,6 @@ public class OpenPgpListPreference extends DialogPreference { private static final Intent MARKET_INTENT = new Intent(Intent.ACTION_VIEW, Uri.parse( String.format(MARKET_INTENT_URI_BASE, OPENKEYCHAIN_PACKAGE))); - private ArrayList mLegacyList = new ArrayList(); private ArrayList mList = new ArrayList(); private String mSelectedPackage; @@ -59,17 +59,6 @@ public class OpenPgpListPreference extends DialogPreference { this(context, null); } - /** - * Public method to add new entries for legacy applications - * - * @param packageName - * @param simpleName - * @param icon - */ - public void addLegacyProvider(int position, String packageName, String simpleName, Drawable icon) { - mLegacyList.add(position, new OpenPgpProviderEntry(packageName, simpleName, icon)); - } - @Override protected void onPrepareDialogBuilder(Builder builder) { mList.clear(); @@ -78,10 +67,7 @@ public class OpenPgpListPreference extends DialogPreference { mList.add(0, new OpenPgpProviderEntry("", getContext().getString(R.string.openpgp_list_preference_none), getContext().getResources().getDrawable(R.drawable.ic_action_cancel_launchersize_light))); - - // add all additional (legacy) providers - mList.addAll(mLegacyList); - + // search for OpenPGP providers... ArrayList providerList = new ArrayList(); Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT); diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml index 6c65658ed..a0c5f4a28 100644 --- a/res/xml/account_settings_preferences.xml +++ b/res/xml/account_settings_preferences.xml @@ -471,20 +471,6 @@ android:key="crypto_app" android:title="@string/account_settings_crypto_app" /> - - - - diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java index 9c27ae4de..32adbdd77 100644 --- a/src/com/fsck/k9/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -1,16 +1,12 @@ package com.fsck.k9.activity.setup; -import android.app.Dialog; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.openintents.openpgp.util.OpenPgpListPreference; -import org.openintents.openpgp.util.OpenPgpUtils; - +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -38,13 +34,15 @@ import com.fsck.k9.activity.ChooseIdentity; import com.fsck.k9.activity.ColorPickerDialog; import com.fsck.k9.activity.K9PreferenceActivity; import com.fsck.k9.activity.ManageIdentities; -import com.fsck.k9.crypto.Apg; import com.fsck.k9.mail.Folder; import com.fsck.k9.mail.Store; import com.fsck.k9.mail.store.LocalStore.LocalFolder; import com.fsck.k9.mail.store.StorageManager; import com.fsck.k9.service.MailService; +import org.openintents.openpgp.util.OpenPgpListPreference; +import org.openintents.openpgp.util.OpenPgpUtils; + public class AccountSettings extends K9PreferenceActivity { private static final String EXTRA_ACCOUNT = "account"; @@ -107,8 +105,6 @@ 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_APP = "crypto_app"; - private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature"; - private static final String PREFERENCE_CRYPTO_AUTO_ENCRYPT = "crypto_auto_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"; @@ -174,8 +170,6 @@ public class AccountSettings extends K9PreferenceActivity { private ListPreference mMaxPushFolders; private boolean mHasCrypto = false; private OpenPgpListPreference mCryptoApp; - private CheckBoxPreference mCryptoAutoSignature; - private CheckBoxPreference mCryptoAutoEncrypt; private PreferenceScreen mSearchScreen; private CheckBoxPreference mCloudSearchEnabled; @@ -686,15 +680,10 @@ public class AccountSettings extends K9PreferenceActivity { } }); - mHasCrypto = (new Apg().isAvailable(this) || OpenPgpUtils.isAvailable(this)); + mHasCrypto = OpenPgpUtils.isAvailable(this); if (mHasCrypto) { mCryptoApp = (OpenPgpListPreference) findPreference(PREFERENCE_CRYPTO_APP); - // add "apg" - if (new Apg().isAvailable(this)) { - mCryptoApp.addLegacyProvider(0, "apg", "APG", null); - } - mCryptoApp.setValue(String.valueOf(mAccount.getCryptoApp())); mCryptoApp.setSummary(mCryptoApp.getEntry()); mCryptoApp.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -702,21 +691,9 @@ public class AccountSettings extends K9PreferenceActivity { String value = newValue.toString(); mCryptoApp.setSummary(mCryptoApp.getEntryByValue(value)); mCryptoApp.setValue(value); - handleCryptoAppDependencies(); - if (Apg.NAME.equals(value)) { - Apg.createInstance(null).test(AccountSettings.this); - } return false; } }); - - mCryptoAutoSignature = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_AUTO_SIGNATURE); - mCryptoAutoSignature.setChecked(mAccount.getCryptoAutoSignature()); - - mCryptoAutoEncrypt = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_AUTO_ENCRYPT); - mCryptoAutoEncrypt.setChecked(mAccount.isCryptoAutoEncrypt()); - - handleCryptoAppDependencies(); } else { final Preference mCryptoMenu = findPreference(PREFERENCE_CRYPTO); mCryptoMenu.setEnabled(false); @@ -744,16 +721,6 @@ public class AccountSettings extends K9PreferenceActivity { listPreference.setEntries(newEntries); } - private void handleCryptoAppDependencies() { - if ("apg".equals(mCryptoApp.getValue())) { - mCryptoAutoSignature.setEnabled(true); - mCryptoAutoEncrypt.setEnabled(true); - } else { - mCryptoAutoSignature.setEnabled(false); - mCryptoAutoEncrypt.setEnabled(false); - } - } - private void saveSettings() { if (mAccountDefault.isChecked()) { Preferences.getPreferences(this).setDefaultAccount(mAccount); @@ -793,8 +760,6 @@ public class AccountSettings extends K9PreferenceActivity { mAccount.setLocalStorageProviderId(mLocalStorageProvider.getValue()); if (mHasCrypto) { mAccount.setCryptoApp(mCryptoApp.getValue()); - mAccount.setCryptoAutoSignature(mCryptoAutoSignature.isChecked()); - mAccount.setCryptoAutoEncrypt(mCryptoAutoEncrypt.isChecked()); } // In webdav account we use the exact folder name also for inbox,