diff --git a/res/layout/account_setup_incoming.xml b/res/layout/account_setup_incoming.xml
index db816eb16..cea8fcc6b 100644
--- a/res/layout/account_setup_incoming.xml
+++ b/res/layout/account_setup_incoming.xml
@@ -245,51 +245,6 @@
android:contentDescription="@string/account_setup_incoming_compression_label"
/>
-
-
-
-
-
-
-
-
-
Edit details
Continue
+ Advanced
General settings
Default account
Default account
diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml
index 3a2dcbd1e..e0519ce0b 100644
--- a/res/xml/account_settings_preferences.xml
+++ b/res/xml/account_settings_preferences.xml
@@ -82,7 +82,7 @@
-
+
+
+
+
+
+
diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java
index 6d2712823..6979ccbb7 100644
--- a/src/com/fsck/k9/activity/setup/AccountSettings.java
+++ b/src/com/fsck/k9/activity/setup/AccountSettings.java
@@ -61,6 +61,9 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_DISPLAY_MODE = "folder_display_mode";
private static final String PREFERENCE_SYNC_MODE = "folder_sync_mode";
private static final String PREFERENCE_PUSH_MODE = "folder_push_mode";
+ private static final String PREFERENCE_PUSH_POLL_ON_CONNECT = "push_poll_on_connect";
+ private static final String PREFERENCE_MAX_PUSH_FOLDERS = "max_push_folders";
+ private static final String PREFERENCE_IDLE_REFRESH_PERIOD = "idle_refresh_period";
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
private static final String PREFERENCE_DELETE_POLICY = "delete_policy";
private static final String PREFERENCE_EXPUNGE_POLICY = "expunge_policy";
@@ -114,6 +117,12 @@ public class AccountSettings extends K9PreferenceActivity
private CheckBoxPreference mReplyAfterQuote;
private CheckBoxPreference mSyncRemoteDeletions;
private CheckBoxPreference mSaveAllHeaders;
+
+ private CheckBoxPreference mPushPollOnConnect;
+ private ListPreference mIdleRefreshPeriod;
+ private ListPreference mMaxPushFolders;
+
+
private ListPreference mCryptoApp;
private CheckBoxPreference mCryptoAutoSignature;
@@ -416,6 +425,58 @@ public class AccountSettings extends K9PreferenceActivity
}
});
+
+ // IMAP-specific preferences
+
+ mPushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
+ mIdleRefreshPeriod = (ListPreference) findPreference(PREFERENCE_IDLE_REFRESH_PERIOD);
+ mMaxPushFolders = (ListPreference) findPreference(PREFERENCE_MAX_PUSH_FOLDERS);
+ if (isPushCapable)
+ {
+ mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
+
+
+ mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes()));
+ mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry());
+ mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
+ {
+ public boolean onPreferenceChange(Preference preference, Object newValue)
+ {
+ final String summary = newValue.toString();
+ int index = mIdleRefreshPeriod.findIndexOfValue(summary);
+ mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntries()[index]);
+ mIdleRefreshPeriod.setValue(summary);
+ return false;
+ }
+ });
+
+
+ mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders()));
+ mMaxPushFolders.setSummary(mMaxPushFolders.getEntry());
+ mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
+ {
+ public boolean onPreferenceChange(Preference preference, Object newValue)
+ {
+ final String summary = newValue.toString();
+ int index = mMaxPushFolders.findIndexOfValue(summary);
+ mMaxPushFolders.setSummary(mMaxPushFolders.getEntries()[index]);
+ mMaxPushFolders.setValue(summary);
+ return false;
+ }
+ });
+
+
+
+
+ }
+ else
+ {
+ mPushPollOnConnect.setEnabled(false);
+ mMaxPushFolders.setEnabled(false);
+ mIdleRefreshPeriod.setEnabled(false);
+
+ }
+
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
@@ -645,6 +706,10 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setCryptoApp(mCryptoApp.getValue());
mAccount.setCryptoAutoSignature(mCryptoAutoSignature.isChecked());
+ mAccount.setPushPollOnConnect(mPushPollOnConnect.isChecked());
+ mAccount.setIdleRefreshMinutes(Integer.parseInt(mIdleRefreshPeriod.getValue()));
+ mAccount.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
+
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java
index 961151366..ceaa5f189 100644
--- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java
+++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java
@@ -88,9 +88,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
private CheckBox compressionMobile;
private CheckBox compressionWifi;
private CheckBox compressionOther;
- private CheckBox pushPollOnConnect;
- private Spinner idleRefreshPeriod;
- private Spinner folderPushLimit;
private CheckBox subscribedFoldersOnly;
public static void actionIncomingSettings(Activity context, Account account, boolean makeDefault)
@@ -136,12 +133,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
compressionMobile = (CheckBox)findViewById(R.id.compression_mobile);
compressionWifi = (CheckBox)findViewById(R.id.compression_wifi);
compressionOther = (CheckBox)findViewById(R.id.compression_other);
- pushPollOnConnect = (CheckBox)findViewById(R.id.push_poll_on_connect);
-
subscribedFoldersOnly = (CheckBox)findViewById(R.id.subscribed_folders_only);
- idleRefreshPeriod = (Spinner)findViewById(R.id.idle_refresh_period);
-
- folderPushLimit = (Spinner)findViewById(R.id.folder_push_limit);
mImapFolderDrafts.setOnClickListener(this);
mImapFolderSent.setOnClickListener(this);
@@ -310,11 +302,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.account_auth_type).setVisibility(View.GONE);
findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE);
- findViewById(R.id.push_poll_on_connect_section).setVisibility(View.GONE);
- findViewById(R.id.idle_refresh_period_label).setVisibility(View.GONE);
- findViewById(R.id.idle_refresh_period).setVisibility(View.GONE);
- findViewById(R.id.account_setup_push_limit_label).setVisibility(View.GONE);
- findViewById(R.id.folder_push_limit).setVisibility(View.GONE);
mAccount.setDeletePolicy(Account.DELETE_POLICY_NEVER);
@@ -351,11 +338,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.account_auth_type).setVisibility(View.GONE);
findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE);
- findViewById(R.id.push_poll_on_connect_section).setVisibility(View.GONE);
- findViewById(R.id.idle_refresh_period_label).setVisibility(View.GONE);
- findViewById(R.id.idle_refresh_period).setVisibility(View.GONE);
- findViewById(R.id.account_setup_push_limit_label).setVisibility(View.GONE);
- findViewById(R.id.folder_push_limit).setVisibility(View.GONE);
subscribedFoldersOnly.setVisibility(View.GONE);
if (uri.getPath() != null && uri.getPath().length() > 0)
{
@@ -421,13 +403,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
updatePortFromSecurityType();
}
- pushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
subscribedFoldersOnly.setChecked(mAccount.subscribedFoldersOnly());
- SpinnerHelper.initSpinner(this, idleRefreshPeriod, R.array.idle_refresh_period_entries,
- R.array.idle_refresh_period_values, String.valueOf(mAccount.getIdleRefreshMinutes()));
- SpinnerHelper.initSpinner(this, folderPushLimit, R.array.account_settings_push_limit_entries,
- R.array.account_settings_push_limit_values, String.valueOf(mAccount.getMaxPushFolders()));
validateFields();
}
@@ -585,28 +562,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
mAccount.setCompression(Account.TYPE_MOBILE, compressionMobile.isChecked());
mAccount.setCompression(Account.TYPE_WIFI, compressionWifi.isChecked());
mAccount.setCompression(Account.TYPE_OTHER, compressionOther.isChecked());
- mAccount.setPushPollOnConnect(pushPollOnConnect.isChecked());
mAccount.setSubscribedFoldersOnly(subscribedFoldersOnly.isChecked());
- String idleRefreshPeriodValue = SpinnerHelper.getSpinnerValue(idleRefreshPeriod);
- try
- {
- mAccount.setIdleRefreshMinutes(Integer.parseInt(idleRefreshPeriodValue));
- }
- catch (Exception e)
- {
- Log.e(K9.LOG_TAG, "Unable to parse idle refresh period value '" + idleRefreshPeriodValue + "'", e);
- mAccount.setIdleRefreshMinutes(24);
- }
- String maxPushFoldersValue = SpinnerHelper.getSpinnerValue(folderPushLimit);
- try
- {
- mAccount.setMaxPushFolders(Integer.parseInt(maxPushFoldersValue));
- }
- catch (Exception e)
- {
- Log.e(K9.LOG_TAG, "Unable to parse max push folders value '" + maxPushFoldersValue + "'", e);
- mAccount.setMaxPushFolders(10);
- }
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, true, false);
}