Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0351dc86 authored by cketti's avatar cketti
Browse files

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

parent 7af007ad
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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();
    }
+10 −0
Original line number Diff line number Diff line
@@ -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"
+1 −0
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -82,6 +82,11 @@ public class ImapBackend implements Backend {
        return true;
    }

    @Override
    public boolean getSupportsUpload() {
        return true;
    }

    @Override
    public boolean getSupportsTrashFolder() {
        return true;
+1 −0
Original line number Diff line number Diff line
@@ -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
Loading