mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 14:05:05 -05:00
Hide delete policy "Mark as read on server" for POP3 accounts
This commit is contained in:
parent
625c5f1874
commit
a619a9df93
@ -125,6 +125,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private boolean mIsMoveCapable = false;
|
||||
private boolean mIsPushCapable = false;
|
||||
private boolean mIsExpungeCapable = false;
|
||||
private boolean mIsSeenFlagSupported = false;
|
||||
|
||||
private PreferenceScreen mMainScreen;
|
||||
private PreferenceScreen mComposingScreen;
|
||||
@ -210,6 +211,7 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
mIsMoveCapable = store.isMoveCapable();
|
||||
mIsPushCapable = store.isPushCapable();
|
||||
mIsExpungeCapable = store.isExpungeCapable();
|
||||
mIsSeenFlagSupported = store.isSeenFlagSupported();
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
||||
}
|
||||
@ -354,7 +356,10 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
});
|
||||
|
||||
mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
|
||||
mDeletePolicy.setValue("" + mAccount.getDeletePolicy());
|
||||
if (!mIsSeenFlagSupported) {
|
||||
removeListEntry(mDeletePolicy, Integer.toString(Account.DELETE_POLICY_MARK_AS_READ));
|
||||
}
|
||||
mDeletePolicy.setValue(Integer.toString(mAccount.getDeletePolicy()));
|
||||
mDeletePolicy.setSummary(mDeletePolicy.getEntry());
|
||||
mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
@ -716,6 +721,26 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeListEntry(ListPreference listPreference, String remove) {
|
||||
CharSequence[] entryValues = listPreference.getEntryValues();
|
||||
CharSequence[] entries = listPreference.getEntries();
|
||||
|
||||
CharSequence[] newEntryValues = new String[entryValues.length - 1];
|
||||
CharSequence[] newEntries = new String[entryValues.length - 1];
|
||||
|
||||
for (int i = 0, out = 0; i < entryValues.length; i++) {
|
||||
CharSequence value = entryValues[i];
|
||||
if (!value.equals(remove)) {
|
||||
newEntryValues[out] = value;
|
||||
newEntries[out] = entries[i];
|
||||
out++;
|
||||
}
|
||||
}
|
||||
|
||||
listPreference.setEntryValues(newEntryValues);
|
||||
listPreference.setEntries(newEntries);
|
||||
}
|
||||
|
||||
private void handleCryptoAppDependencies() {
|
||||
if ("".equals(mCryptoApp.getValue())) {
|
||||
mCryptoAutoSignature.setEnabled(false);
|
||||
|
@ -194,6 +194,10 @@ public abstract class Store {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSeenFlagSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void sendMessages(Message[] messages) throws MessagingException {
|
||||
}
|
||||
|
||||
|
@ -287,6 +287,11 @@ public class Pop3Store extends Store {
|
||||
folder.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSeenFlagSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
class Pop3Folder extends Folder {
|
||||
private Socket mSocket;
|
||||
private InputStream mIn;
|
||||
|
Loading…
Reference in New Issue
Block a user