* 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 */
| 594 | * menu: entry to be updated |
| 595 | */ |
| 596 | void 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 | } |
| 649 | hide: |
| 650 | if (item && item->menu == child) { |
| 651 | last = parent->firstChild(); |
| 652 | if (last == item) |
| 653 | last = 0; |
nothing calls this directly
no test coverage detected