| 1715 | } |
| 1716 | |
| 1717 | void |
| 1718 | AbstractMenu::delete_item (const std::string &p) |
| 1719 | { |
| 1720 | typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type; |
| 1721 | tl::Extractor extr (p.c_str ()); |
| 1722 | path_type path = find_item (extr); |
| 1723 | if (! path.empty ()) { |
| 1724 | |
| 1725 | for (path_type::const_reverse_iterator p = path.rbegin (); p != path.rend (); ++p) { |
| 1726 | |
| 1727 | if (p->second == p->first->children.end ()) { |
| 1728 | break; |
| 1729 | } else if (p != path.rbegin () && (! p->second->remove_on_empty () || ! p->second->children.empty ())) { |
| 1730 | // stop on non-empty parent menus |
| 1731 | break; |
| 1732 | } |
| 1733 | |
| 1734 | p->first->children.erase (p->second); |
| 1735 | |
| 1736 | } |
| 1737 | |
| 1738 | } |
| 1739 | |
| 1740 | emit_changed (); |
| 1741 | } |
| 1742 | |
| 1743 | static void do_delete_items (AbstractMenuItem &parent, Action *action) |
| 1744 | { |