/
0008-Introduce-QMailAccount-HasPersistentConnection-statu.patch
64 lines (58 loc) · 3.79 KB
/
0008-Introduce-QMailAccount-HasPersistentConnection-statu.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 1c8ac90c0760b5ea00d5f5625dab35e7f4957b80 Mon Sep 17 00:00:00 2001
From: Pekka Vuorela <pekka.vuorela@jolla.com>
Date: Mon, 13 Aug 2018 17:24:36 +0300
Subject: [PATCH 08/24] Introduce QMailAccount::HasPersistentConnection status
flag
Use QMailAccount::HasPersistentConnection status flag for IMAP idle instead of
updating last sync time every minute, this reduces accounts db writes(they
trigger notifications to other processes) and also make use of a linger
keepalive(less state transitions).
---
src/libraries/qmfclient/qmailstore_p.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/libraries/qmfclient/qmailstore_p.cpp b/src/libraries/qmfclient/qmailstore_p.cpp
index 221fa7c5..ab509afd 100644
--- a/src/libraries/qmfclient/qmailstore_p.cpp
+++ b/src/libraries/qmfclient/qmailstore_p.cpp
@@ -2671,6 +2671,10 @@ bool SSOAccountSatisfyTheProperty(Accounts::Account* ssoAccount, const QMailAcco
status &= (~QMailAccount::AppendSignature);
status |= appendSignature?(QMailAccount::AppendSignature):0;
+ bool hasPersistentConnection = ssoAccount->valueAsBool("hasPersistentConnection", false);
+ status &= (~QMailAccount::HasPersistentConnection);
+ status |= hasPersistentConnection?(QMailAccount::HasPersistentConnection):0;
+
return SSOAccountCompareProperty<quint64>(ssoAccount,
status,
argument.op, argument.valueList);
@@ -3713,11 +3717,13 @@ QMailAccount QMailStorePrivate::extractAccount(const QSharedPointer<Accounts::Ac
const bool& isDefault = ssoAccount->valueAsBool("email/default");
const bool& canTransmit = ssoAccount->valueAsBool("canTransmit", true);
const bool& appendSignature = ssoAccount->valueAsBool("signatureEnabled", true);
+ const bool& hasPersistentConnection = ssoAccount->valueAsBool("hasPersistentConnection", false);
result.setStatus(QMailAccount::Enabled, enabled);
result.setStatus(QMailAccount::PreferredSender, isDefault);
result.setStatus(QMailAccount::CanTransmit, canTransmit);
result.setStatus(QMailAccount::AppendSignature, appendSignature);
+ result.setStatus(QMailAccount::HasPersistentConnection, hasPersistentConnection);
result.setSignature(ssoAccount->valueAsString("signature"));
result.setFromAddress(ssoAccount->contains("fullName")?
@@ -6222,6 +6228,8 @@ QMailStorePrivate::AttemptResult QMailStorePrivate::attemptAddAccount(QMailAccou
ssoAccount->setValue("status", account->status());
const bool appendSignature = (account->status() & QMailAccount::AppendSignature);
ssoAccount->setValue("signatureEnabled", appendSignature);
+ const bool hasPersistentConnection = (account->status() & QMailAccount::HasPersistentConnection);
+ ssoAccount->setValue("hasPersistentConnection", hasPersistentConnection);
ssoAccount->setValue("signature", account->signature());
ssoAccount->setValue("emailaddress", account->fromAddress().address());
ssoAccount->setValue("fullName", account->fromAddress().name());
@@ -7024,6 +7032,8 @@ QMailStorePrivate::AttemptResult QMailStorePrivate::attemptUpdateAccount(QMailAc
ssoAccount->setValue("status", account->status());
bool signatureEnabled = account->status() & QMailAccount::AppendSignature;
ssoAccount->setValue("signatureEnabled", signatureEnabled);
+ bool hasPersistentConnection = account->status() & QMailAccount::HasPersistentConnection;
+ ssoAccount->setValue("hasPersistentConnection", hasPersistentConnection);
ssoAccount->setValue("signature", account->signature());
ssoAccount->setValue("emailaddress", account->fromAddress().address());
ssoAccount->setValue("fullName", account->fromAddress().name());
--
2.17.1