MCPcopy Create free account
hub / github.com/YACReader/yacreader / addLabelIntoList

Method addLabelIntoList

YACReaderLibrary/db/reading_list_model.cpp:684–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682}
683
684int ReadingListModel::addLabelIntoList(LabelItem *item)
685{
686 if (labels.isEmpty())
687 labels << item;
688 else {
689 int i = 0;
690
691 while (i < labels.count() && (labels.at(i)->colorid() < item->colorid()))
692 i++;
693
694 if (i < labels.count()) {
695 if (labels.at(i)->colorid() == item->colorid()) // sort by name
696 {
697 while (i < labels.count() && labels.at(i)->colorid() == item->colorid() && naturalSortLessThanCI(labels.at(i)->name(), item->name()))
698 i++;
699 }
700 }
701
702 if (i >= labels.count()) {
703 QLOG_DEBUG() << "insertando label al final " << item->name();
704 labels << item;
705 } else {
706 QLOG_DEBUG() << "insertando label en " << i << "-" << item->name();
707 labels.insert(i, item);
708 }
709
710 return i;
711 }
712
713 return 0;
714}
715
716void ReadingListModel::reorderingChildren(QList<ReadingListItem *> children)
717{

Callers

nothing calls this directly

Calls 5

naturalSortLessThanCIFunction · 0.85
isEmptyMethod · 0.80
coloridMethod · 0.80
nameMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected