Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
ItemRep::ItemRep(CatItem it, Tuple internalId, int change_count,
                 short nthPiece, bool nameFromDescript){
    Q_ASSERT(!it.isEmpty());
    matchType = it.getMatchType();
    matchIndex = it.getMatchIndex();
    //description = it.fullDescription;
    m_internalId = internalId;
    m_name = it.getName();
    Q_ASSERT(!m_name.isEmpty());
    //Q_ASSERT(it.getFullWeight());
    totalWeight = it.getFullWeight();
    change_cn = change_count;
    l_to_match = -1;
    skip_m = false;
    this->itemType = it.getItemType();

    //change_cn = 0;

    m_nthPiece= nthPiece;
    m_name_from_description=nameFromDescript;

}