diff options
author | David Llewellyn-Jones <david.llewellyn-jones@jolla.com> | 2020-02-07 19:29:59 +0200 |
---|---|---|
committer | Chris Adams <chris.adams@qinetic.com.au> | 2021-04-09 11:08:34 +1000 |
commit | a32d3378f342a1d3b289d71e11a1f68a94d5891e (patch) | |
tree | 6893fd81df8e88f8b2160ac890d427434b6a83b8 | |
parent | 93f3b4dc9bdcb44176b54a7fc32166ab6cf70e01 (diff) |
Set new IMAP folders to inherit SynchronizationEnabled flag
When new folders are received from the server, the client-side
SynchronizationEnabled flag must be set for them. Previously they were
always set to true, but if they're inside a folder that isn't being
synced, this probably doesn't reflect the user's intent.
This change makes it so that for IMAP any new folders received from the
server will have the SynchronizationEnabled flag set to whatever value
their parent has it set to. If they have no parent (i.e. are in the root
folder) then the flag is set to true as before.
Change-Id: If43d5e2b4469a402d203841c04cc4b1b30ffc3b1
Reviewed-by: Christopher Adams <chris.adams@jolla.com>
Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Reviewed-by: Damien Caliste <dcaliste@free.fr>
-rw-r--r-- | src/plugins/messageservices/imap/imapclient.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/messageservices/imap/imapclient.cpp b/src/plugins/messageservices/imap/imapclient.cpp index 4b997730..5154234c 100644 --- a/src/plugins/messageservices/imap/imapclient.cpp +++ b/src/plugins/messageservices/imap/imapclient.cpp @@ -822,8 +822,11 @@ void ImapClient::mailboxListed(const QString &flags, const QString &path) // This element needs to be created QMailFolder folder(mailboxPath, parentId, _config.id()); folder.setDisplayName(QMailCodec::decodeModifiedUtf7(*it)); - folder.setStatus(QMailFolder::SynchronizationEnabled, true); folder.setStatus(QMailFolder::Incoming, true); + // Set synchronization flag the same as parent folder, or true if there's no parent + bool synchronize = parentId.isValid() ? + QMailFolder(parentId).status() & QMailFolder::SynchronizationEnabled : true; + folder.setStatus(QMailFolder::SynchronizationEnabled, synchronize); // The reported flags pertain to the listed folder only QString folderFlags; |