Commit 60ad8f72 authored by Lisa's avatar Lisa
Browse files

Group pool used

parent f59ce86b
......@@ -411,21 +411,20 @@ void BackendPrivate::groupQueryFinished()
}
QFuture< QList< Group* > > const& future = queryGroupFuturePool[uuid]->future();
QList< Group* > result;
GroupPool pool;
/*
* Since the same groups are repeated across different databases,
* avoid adding duplicates to the final list.
*/
foreach (QList< Group* > res, future.results()) {
foreach (Group* group, res) {
if (!result.contains(group)) {
result << group;
}
foreach (QList< Group* > groupList, future.results()) {
foreach (Group* g, groupList) {
pool.group( g->name() );
}
}
emit q->queryGroupsCompleted(uuid, result);
emit q->queryGroupsCompleted(uuid, pool.allGroups());
}
void BackendPrivate::__k__lockGranted(qlonglong pid)
......@@ -481,6 +480,12 @@ bool GroupPool::contains(const QString &name) const
return m_pool.contains(name);
}
QList< Group* > GroupPool::allGroups() const
{
QMutexLocker locker(m_mutex);
return m_pool.values();
}
///////////////////////////
class BackendHelper
......
......@@ -34,6 +34,8 @@ class GroupPool
Group *group(const QString &name);
bool contains(const QString &name) const;
QList< Group* > allGroups() const;
private:
GroupPool();
......
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