Refactor Entry::truncateHistory().

This allows us to drop Entry::getSize() and EntryAttachments::attachmentsSize()
which have weird semantics.
This commit is contained in:
Felix Geyer 2012-07-20 00:45:34 +02:00
parent 0c1fecfb2b
commit ef579cbe3c
4 changed files with 16 additions and 27 deletions

View file

@ -27,6 +27,11 @@ QList<QString> EntryAttachments::keys() const
return m_attachments.keys();
}
QList<QByteArray> EntryAttachments::values() const
{
return m_attachments.values();
}
QByteArray EntryAttachments::value(const QString& key) const
{
return m_attachments.value(key);
@ -87,21 +92,6 @@ void EntryAttachments::clear()
Q_EMIT modified();
}
int EntryAttachments::attachmentsSize(QList<QByteArray>* foundAttachements)
{
int size = 0;
QMapIterator<QString, QByteArray> i(m_attachments);
while (i.hasNext()) {
i.next();
if (!foundAttachements->contains(i.value())) {
foundAttachements->append(i.value());
size += i.value().size();
}
}
return size;
}
bool EntryAttachments::operator==(const EntryAttachments& other) const
{
return m_attachments == other.m_attachments;