CatItem CatBuilder::updateItem(CatItem& it, int childDepth, UserEvent::LoadType lt) { if(!it.shouldUpdate(childDepth, lt)) { return it; } CatItem realItem; QList<int> matches = it.getMatchIndex(); if(!it.getIsTempItem()) { QString path = it.getPath(); realItem = getItem(path, childDepth); addSynonymChildren(realItem); //Our plugins can return items not in the database if(!realItem.isEmpty()) { //realItem.merge(it); it.merge(realItem); } if(lt!=UserEvent::IGNORE) { for(int i=0; i<childDepth; i++) { //avoiding address of reference of smart-pointer itme CatItem holder = it; if(plugins_ptr->itemLoading(&holder,lt)) { cat->addItem(holder); it = holder; } } } } it.setMatchIndex(matches); return it; }
QList<CatItem> Catalog::indexItemList(QList<CatItem>* catListPtr){ Q_ASSERT(catListPtr); QList<CatItem> outList; cat_store.beginAddGroup(); for(int i=0;i< catListPtr->count();i++){ CatItem it = (*catListPtr)[i]; if(it.isEmpty()){ continue; } if(it.isForDBInsertOnly()){ cat_store.addItemInGroup(it); continue; } else if(it.getIsTempItem()){ outList.append((it)); } else { outList.append(cat_store.addItemInGroup(it)); } //THREAD_SLEEP; } cat_store.endAddGroup(); return outList; }