Commit 79085a3f authored by Laurent Montel's avatar Laurent Montel 😁

Move in cpp file

parent 9d6b00d7
......@@ -188,3 +188,39 @@ void ThreadingCache::save()
}
qCDebug(MESSAGELIST_LOG) << "Saved" << mParentCache.count() << "cache entries";
}
void ThreadingCache::addItemToCache(MessageItem *mi)
{
if (mEnabled) {
mItemCache.insert(mi->itemId(), mi);
}
}
void ThreadingCache::updateParent(MessageItem *mi, MessageItem *parent)
{
if (mEnabled) {
mParentCache.insert(mi->itemId(), parent ? parent->itemId() : 0);
}
}
MessageItem *ThreadingCache::parentForItem(MessageItem *mi, qint64 &parentId) const
{
if (mEnabled) {
parentId = mParentCache.value(mi->itemId(), -1);
if (parentId > -1) {
return mItemCache.value(parentId, nullptr);
} else {
return nullptr;
}
} else {
return nullptr;
}
}
void ThreadingCache::expireParent(MessageItem *item)
{
if (mEnabled) {
mParentCache.remove(item->itemId());
mItemCache.remove(item->itemId());
}
}
......@@ -44,41 +44,13 @@ public:
void load(const QString &id, const Aggregation *aggregation);
void save();
void addItemToCache(MessageItem *mi)
{
if (mEnabled) {
mItemCache.insert(mi->itemId(), mi);
}
}
void updateParent(MessageItem *mi, MessageItem *parent)
{
if (mEnabled) {
mParentCache.insert(mi->itemId(), parent ? parent->itemId() : 0);
}
}
MessageItem *parentForItem(MessageItem *mi, qint64 &parentId) const
{
if (mEnabled) {
parentId = mParentCache.value(mi->itemId(), -1);
if (parentId > -1) {
return mItemCache.value(parentId, nullptr);
} else {
return nullptr;
}
} else {
return nullptr;
}
}
void expireParent(MessageItem *item)
{
if (mEnabled) {
mParentCache.remove(item->itemId());
mItemCache.remove(item->itemId());
}
}
void addItemToCache(MessageItem *mi);
void updateParent(MessageItem *mi, MessageItem *parent);
MessageItem *parentForItem(MessageItem *mi, qint64 &parentId) const;
void expireParent(MessageItem *item);
private:
QString cacheFilePath(const QString &id) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment