コード例 #1
0
QString summarizeMessage(CatItem it){
    QString res;

    if(it.hasLabel(NAME_IS_TITLE_KEY_STR)){
        res+= it.getName() + " ";
    }

    if(it.hasLabel(AUTHOR_KEY_STR)){
        res+= QString("<br>") + FROM_PERSON__PHRASE + it.getAuthor();
    }

    if(!it.getDescription().isEmpty()){
        res+=it.getDescription();
    } else if(!it.getLongText().isEmpty()){
        res+=it.getLongText().left(UI_MAX_MESSAGE_DESCRIPTION_LEN);
    }

    if(it.hasLabel(TIME_EXPLICITELY_SET_KEY_STR)){
        res+="(";
        time_t tm = (MAX(it.getCreationTime(), it.getModificationTime()));
        QDateTime t;
        t.fromTime_t(tm);
        res+= contextualTimeString(t);
        res+=")";
    }

    return res;
}
コード例 #2
0
void TrieNode::insertFull(CatItem it, QList<int> kl,
                           int charChanges,Tuple tpl  )
{
    if(!it.hasRealName()){ return;}

    if(tpl.isEmpty())
        {tpl = mp_container->getInternalId(it); }

    ItemRep ir(it, tpl, charChanges);
    if(kl.length() > 0)
        {ir.setMatchKeyList(kl);}
    insertRep(ir);

    if(it.getName().contains(" ")){
        QList<QString> descriptionWords = it.getDescription().split(' ');
        for(int i=0; i<MIN(descriptionWords.length(),MAX_WORDS_IN_KEY_SEARCH); i++){
            if(!descriptionWords[i].isEmpty() && descriptionWords[i].count()>5){
                addItemPiece(it,tpl,descriptionWords[i],i, false);
            }
        }
    }
}