Hide 'upload sent messages' setting when Backend doesn't support uploads

This commit is contained in:
cketti 2018-09-04 18:00:05 +02:00
parent 7af007ad2f
commit 0351dc8694
6 changed files with 22 additions and 0 deletions

View file

@ -1823,6 +1823,10 @@ public class MessagingController {
return getBackend(account).getSupportsSearchByDate();
}
public boolean supportsUpload(Account account) {
return getBackend(account).getSupportsUpload();
}
public void checkIncomingServerSettings(Account account) throws MessagingException {
getBackend(account).checkIncomingServerSettings();
}

View file

@ -52,6 +52,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
initializeIncomingServer()
initializeComposition()
initializeManageIdentities()
initializeUploadSentMessages(account)
initializeOutgoingServer()
initializeQuoteStyle()
initializeDeletePolicy(account)
@ -86,6 +87,14 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
}
}
private fun initializeUploadSentMessages(account: Account) {
findPreference(PREFERENCE_UPLOAD_SENT_MESSAGES)?.apply {
if (!messagingController.supportsUpload(account)) {
remove()
}
}
}
private fun initializeOutgoingServer() {
findPreference(PREFERENCE_OUTGOING_SERVER)?.onClick {
AccountSetupOutgoing.actionEditOutgoingSettings(requireActivity(), accountUuid)
@ -261,6 +270,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
private const val PREFERENCE_COMPOSITION = "composition"
private const val PREFERENCE_MANAGE_IDENTITIES = "manage_identities"
private const val PREFERENCE_OUTGOING_SERVER = "outgoing"
private const val PREFERENCE_UPLOAD_SENT_MESSAGES = "upload_sent_messages"
private const val PREFERENCE_QUOTE_STYLE = "quote_style"
private const val PREFERENCE_DELETE_POLICY = "delete_policy"
private const val PREFERENCE_EXPUNGE_POLICY = "expunge_policy"

View file

@ -17,6 +17,7 @@ interface Backend {
val supportsExpunge: Boolean
val supportsMove: Boolean
val supportsCopy: Boolean
val supportsUpload: Boolean
val supportsTrashFolder: Boolean
val supportsSearchByDate: Boolean
val isPushCapable: Boolean

View file

@ -82,6 +82,11 @@ public class ImapBackend implements Backend {
return true;
}
@Override
public boolean getSupportsUpload() {
return true;
}
@Override
public boolean getSupportsTrashFolder() {
return true;

View file

@ -31,6 +31,7 @@ class Pop3Backend(
override val supportsExpunge = false
override val supportsMove = false
override val supportsCopy = false
override val supportsUpload = false
override val supportsTrashFolder = false
override val supportsSearchByDate = false
override val isPushCapable = false

View file

@ -35,6 +35,7 @@ class WebDavBackend(
override val supportsExpunge = true
override val supportsMove = true
override val supportsCopy = true
override val supportsUpload = true
override val supportsTrashFolder = true
override val supportsSearchByDate = false
override val isPushCapable = false