MCPcopy Create free account
hub / github.com/Entware/Entware / updateMenuList

Method updateMenuList

scripts/config/qconf.cc:596–659  ·  view source on GitHub ↗

* update all the children of a menu entry * removes/adds the entries from the parent widget as necessary * * parent: either the menu list widget or a menu entry widget * menu: entry to be updated */

Source from the content-addressed store, hash-verified

594 * menu: entry to be updated
595 */
596void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
597{
598 struct menu* child;
599 ConfigItem* item;
600 ConfigItem* last;
601 bool visible;
602 enum prop_type type;
603
604 if (!menu) {
605 while (parent->childCount() > 0)
606 {
607 delete parent->takeChild(0);
608 }
609
610 return;
611 }
612
613 last = parent->firstChild();
614 if (last && !last->goParent)
615 last = 0;
616 for (child = menu->list; child; child = child->next) {
617 item = last ? last->nextSibling() : parent->firstChild();
618 type = child->prompt ? child->prompt->type : P_UNKNOWN;
619
620 switch (mode) {
621 case menuMode:
622 if (!(child->flags & MENU_ROOT))
623 goto hide;
624 break;
625 case symbolMode:
626 if (child->flags & MENU_ROOT)
627 goto hide;
628 break;
629 default:
630 break;
631 }
632
633 visible = menu_is_visible(child);
634 if (!menuSkip(child)) {
635 if (!child->sym && !child->list && !child->prompt)
636 continue;
637 if (!item || item->menu != child)
638 item = new ConfigItem(parent, last, child, visible);
639 else
640 item->testUpdateMenu(visible);
641
642 if (mode == fullMode || mode == menuMode || type != P_MENU)
643 updateMenuList(item, child);
644 else
645 updateMenuList(item, 0);
646 last = item;
647 continue;
648 }
649hide:
650 if (item && item->menu == child) {
651 last = parent->firstChild();
652 if (last == item)
653 last = 0;

Callers

nothing calls this directly

Calls 4

menu_is_visibleFunction · 0.85
firstChildMethod · 0.80
nextSiblingMethod · 0.80
testUpdateMenuMethod · 0.80

Tested by

no test coverage detected