mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Rather than disabling imap-specific preferences on POP3, hide em
This commit is contained in:
parent
87640719dd
commit
2e173150d5
@ -46,6 +46,8 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
|
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
|
||||||
|
|
||||||
private static final String PREFERENCE_SCREEN_COMPOSING = "composing";
|
private static final String PREFERENCE_SCREEN_COMPOSING = "composing";
|
||||||
|
private static final String PREFERENCE_SCREEN_INCOMING = "incoming_prefs";
|
||||||
|
private static final String PREFERENCE_SCREEN_PUSH_ADVANCED = "push_advanced";
|
||||||
|
|
||||||
private static final String PREFERENCE_DESCRIPTION = "account_description";
|
private static final String PREFERENCE_DESCRIPTION = "account_description";
|
||||||
private static final String PREFERENCE_COMPOSITION = "composition";
|
private static final String PREFERENCE_COMPOSITION = "composition";
|
||||||
@ -299,19 +301,6 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPushMode = (ListPreference) findPreference(PREFERENCE_PUSH_MODE);
|
|
||||||
mPushMode.setEnabled(mIsPushCapable);
|
|
||||||
mPushMode.setValue(mAccount.getFolderPushMode().name());
|
|
||||||
mPushMode.setSummary(mPushMode.getEntry());
|
|
||||||
mPushMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
final String summary = newValue.toString();
|
|
||||||
int index = mPushMode.findIndexOfValue(summary);
|
|
||||||
mPushMode.setSummary(mPushMode.getEntries()[index]);
|
|
||||||
mPushMode.setValue(summary);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mTargetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
|
mTargetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
|
||||||
mTargetMode.setValue(mAccount.getFolderTargetMode().name());
|
mTargetMode.setValue(mAccount.getFolderTargetMode().name());
|
||||||
@ -339,19 +328,24 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
|
mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
|
||||||
mExpungePolicy.setEnabled(mIsExpungeCapable);
|
if (mIsExpungeCapable) {
|
||||||
mExpungePolicy.setValue(mAccount.getExpungePolicy());
|
mExpungePolicy.setValue(mAccount.getExpungePolicy());
|
||||||
mExpungePolicy.setSummary(mExpungePolicy.getEntry());
|
mExpungePolicy.setSummary(mExpungePolicy.getEntry());
|
||||||
mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
final String summary = newValue.toString();
|
final String summary = newValue.toString();
|
||||||
int index = mExpungePolicy.findIndexOfValue(summary);
|
int index = mExpungePolicy.findIndexOfValue(summary);
|
||||||
mExpungePolicy.setSummary(mExpungePolicy.getEntries()[index]);
|
mExpungePolicy.setSummary(mExpungePolicy.getEntries()[index]);
|
||||||
mExpungePolicy.setValue(summary);
|
mExpungePolicy.setValue(summary);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mExpungePolicy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
|
mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
|
||||||
mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
|
mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
|
||||||
@ -390,8 +384,8 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
mMessageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);
|
mMessageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);
|
||||||
|
|
||||||
if (!mAccount.isSearchByDateCapable()) {
|
if (!mAccount.isSearchByDateCapable()) {
|
||||||
mMessageAge.setEnabled(false);
|
((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mMessageAge);
|
||||||
} else {
|
} else {
|
||||||
mMessageAge.setValue(String.valueOf(mAccount.getMaximumPolledMessageAge()));
|
mMessageAge.setValue(String.valueOf(mAccount.getMaximumPolledMessageAge()));
|
||||||
mMessageAge.setSummary(mMessageAge.getEntry());
|
mMessageAge.setSummary(mMessageAge.getEntry());
|
||||||
mMessageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mMessageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@ -523,10 +517,22 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mPushMode = (ListPreference) findPreference(PREFERENCE_PUSH_MODE);
|
||||||
|
mPushMode.setValue(mAccount.getFolderPushMode().name());
|
||||||
|
mPushMode.setSummary(mPushMode.getEntry());
|
||||||
|
mPushMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
final String summary = newValue.toString();
|
||||||
|
int index = mPushMode.findIndexOfValue(summary);
|
||||||
|
mPushMode.setSummary(mPushMode.getEntries()[index]);
|
||||||
|
mPushMode.setValue(summary);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
mPushPollOnConnect.setEnabled(false);
|
PreferenceScreen incomingPrefs = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING);
|
||||||
mMaxPushFolders.setEnabled(false);
|
incomingPrefs.removePreference( (PreferenceScreen) findPreference(PREFERENCE_SCREEN_PUSH_ADVANCED));
|
||||||
mIdleRefreshPeriod.setEnabled(false);
|
incomingPrefs.removePreference( (ListPreference) findPreference(PREFERENCE_PUSH_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
|
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
|
||||||
@ -703,7 +709,9 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
mAccount.setNotificationShowsUnreadCount(mNotificationUnreadCount.isChecked());
|
mAccount.setNotificationShowsUnreadCount(mNotificationUnreadCount.isChecked());
|
||||||
mAccount.setFolderTargetMode(Account.FolderMode.valueOf(mTargetMode.getValue()));
|
mAccount.setFolderTargetMode(Account.FolderMode.valueOf(mTargetMode.getValue()));
|
||||||
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
|
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
|
||||||
mAccount.setExpungePolicy(mExpungePolicy.getValue());
|
if (mIsExpungeCapable) {
|
||||||
|
mAccount.setExpungePolicy(mExpungePolicy.getValue());
|
||||||
|
};
|
||||||
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
|
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
|
||||||
mAccount.setSaveAllHeaders(mSaveAllHeaders.isChecked());
|
mAccount.setSaveAllHeaders(mSaveAllHeaders.isChecked());
|
||||||
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
|
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
|
||||||
@ -747,14 +755,8 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
||||||
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
|
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
|
||||||
|
|
||||||
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
|
|
||||||
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
||||||
|
|
||||||
if (mAccount.getFolderPushMode() != FolderMode.NONE) {
|
|
||||||
needsPushRestart |= displayModeChanged;
|
|
||||||
needsPushRestart |= mIncomingChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
||||||
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
|
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
|
||||||
if (newRingtone != null) {
|
if (newRingtone != null) {
|
||||||
@ -770,13 +772,21 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue()));
|
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue()));
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
|
|
||||||
if (needsRefresh && needsPushRestart) {
|
if (mIsPushCapable) {
|
||||||
MailService.actionReset(this, null);
|
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
|
||||||
} else if (needsRefresh) {
|
if (mAccount.getFolderPushMode() != FolderMode.NONE) {
|
||||||
MailService.actionReschedulePoll(this, null);
|
needsPushRestart |= displayModeChanged;
|
||||||
} else if (needsPushRestart) {
|
needsPushRestart |= mIncomingChanged;
|
||||||
MailService.actionRestartPushers(this, null);
|
}
|
||||||
}
|
|
||||||
|
if (needsRefresh && needsPushRestart) {
|
||||||
|
MailService.actionReset(this, null);
|
||||||
|
} else if (needsRefresh) {
|
||||||
|
MailService.actionReschedulePoll(this, null);
|
||||||
|
} else if (needsPushRestart) {
|
||||||
|
MailService.actionRestartPushers(this, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
// TODO: refresh folder list here
|
// TODO: refresh folder list here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user