Skip to content

Commit

Permalink
[qmf] Set new IMAP folders to inherit SynchronizationEnabled flag. Co…
Browse files Browse the repository at this point in the history
…ntributes to JB#47389

This is to support configurable email folder synchronisation. Applies
the following upstream patch.

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.
  • Loading branch information
llewelld committed Feb 14, 2020
1 parent 946e126 commit 00f846c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions rpm/0021-Set-new-IMAP-folders-to-inherit-SynchronizationEnab.patch
@@ -0,0 +1,35 @@
From 1bb1394a3501b593bc2ce0c42b13720cc67a9609 Mon Sep 17 00:00:00 2001
From: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
Date: Fri, 07 Feb 2020 19:29:59 +0200
Subject: [PATCH] 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
---

diff --git a/src/plugins/messageservices/imap/imapclient.cpp b/src/plugins/messageservices/imap/imapclient.cpp
index a710d48..7a6c80a 100644
--- a/src/plugins/messageservices/imap/imapclient.cpp
+++ b/src/plugins/messageservices/imap/imapclient.cpp
@@ -822,8 +822,11 @@
// 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;
2 changes: 2 additions & 0 deletions rpm/qmf-qt5.spec
Expand Up @@ -48,6 +48,7 @@ Patch17: 0017-Add-signature-settings-in-account.patch
Patch18: 0018-Use-socket-s-local-address-for-HELO-and-EHLO-message.patch
Patch19: 0019-Use-EightBit-encoding-instead-of-Base64-for-text-typ.patch
Patch20: 0020-Follow-the-synchronizationEnabled-flag-when-folders.patch
Patch21: 0021-Set-new-IMAP-folders-to-inherit-SynchronizationEnab.patch

%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
Expand Down Expand Up @@ -173,6 +174,7 @@ This package contains the tests for Qt Messaging Framework (QMF).
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1

%build

Expand Down

0 comments on commit 00f846c

Please sign in to comment.