1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Disable "Enable refile buttons" preference for POP3 users

This commit is contained in:
cketti 2011-04-01 06:44:50 +02:00
parent 4b5fe32504
commit 8a112f04f9

View File

@ -19,6 +19,7 @@ import java.util.List;
import com.fsck.k9.Account;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.Account.ScrollButtons;
import com.fsck.k9.K9;
import com.fsck.k9.NotificationSetting;
import com.fsck.k9.Preferences;
@ -104,6 +105,7 @@ public class AccountSettings extends K9PreferenceActivity {
private Account mAccount;
private boolean mIsMoveCapable = false;
private boolean mIsPushCapable = false;
private boolean mIsExpungeCapable = false;
@ -177,6 +179,7 @@ public class AccountSettings extends K9PreferenceActivity {
try {
final Store store = mAccount.getRemoteStore();
mIsMoveCapable = store.isMoveCapable();
mIsPushCapable = store.isPushCapable();
mIsExpungeCapable = store.isExpungeCapable();
} catch (Exception e) {
@ -421,9 +424,11 @@ public class AccountSettings extends K9PreferenceActivity {
});
mAccountEnableMoveButtons = (CheckBoxPreference) findPreference(PREFERENCE_ENABLE_MOVE_BUTTONS);
mAccountEnableMoveButtons.setEnabled(mIsMoveCapable);
mAccountEnableMoveButtons.setChecked(mAccount.getEnableMoveButtons());
mAccountScrollMoveButtons = (ListPreference) findPreference(PREFERENCE_HIDE_MOVE_BUTTONS);
mAccountScrollMoveButtons.setEnabled(mIsMoveCapable);
mAccountScrollMoveButtons.setValue("" + mAccount.getScrollMessageViewMoveButtons());
mAccountScrollMoveButtons.setSummary(mAccountScrollMoveButtons.getEntry());
mAccountScrollMoveButtons.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@ -709,6 +714,14 @@ public class AccountSettings extends K9PreferenceActivity {
mAccount.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
}
if (!mIsMoveCapable) {
mAccount.setEnableMoveButtons(false);
mAccount.setScrollMessageViewMoveButtons(ScrollButtons.NEVER);
} else {
mAccount.setEnableMoveButtons(mAccountEnableMoveButtons.isChecked());
mAccount.setScrollMessageViewMoveButtons(Account.ScrollButtons.valueOf(mAccountScrollMoveButtons.getValue()));
}
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
@ -732,9 +745,7 @@ public class AccountSettings extends K9PreferenceActivity {
}
mAccount.setScrollMessageViewButtons(Account.ScrollButtons.valueOf(mAccountScrollButtons.getValue()));
mAccount.setScrollMessageViewMoveButtons(Account.ScrollButtons.valueOf(mAccountScrollMoveButtons.getValue()));
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue()));
mAccount.setEnableMoveButtons(mAccountEnableMoveButtons.isChecked());
mAccount.save(Preferences.getPreferences(this));
if (needsRefresh && needsPushRestart) {