Fix history truncation based on max size and extend unit tests

This commit is contained in:
Janek Bevendorff
2018-01-23 02:31:29 +01:00
parent 258438f01f
commit 8dd6cdeb69
5 changed files with 147 additions and 84 deletions

View File

@@ -153,13 +153,11 @@ bool EntryAttachments::operator!=(const EntryAttachments& other) const
return m_attachments != other.m_attachments;
}
int EntryAttachments::attachmentsSize(const QSet<QByteArray>& ignoredAttachments) const
int EntryAttachments::attachmentsSize() const
{
int size = 0;
for (auto it = m_attachments.constBegin(); it != m_attachments.constEnd(); ++it) {
if (!ignoredAttachments.contains(it.value())) {
size += it.key().toUtf8().size() + it.value().size();
}
size += it.key().toUtf8().size() + it.value().size();
}
return size;
}