| 2073 | } |
| 2074 | |
| 2075 | void |
| 2076 | AbstractMenu::get_shortcuts (const std::string &root, std::map<std::string, std::string> &bindings, bool with_defaults) |
| 2077 | { |
| 2078 | std::vector<std::string> items = this->items (root); |
| 2079 | for (std::vector<std::string>::const_iterator i = items.begin (); i != items.end (); ++i) { |
| 2080 | if (i->size () > 0) { |
| 2081 | const AbstractMenuItem *item = find_item_exact (*i); |
| 2082 | if (item && item->action () && item->action ()->is_visible ()) { |
| 2083 | if (item->has_submenu ()) { |
| 2084 | // a menu must be listed (so it can be hidden), but does not have a shortcut |
| 2085 | // but we don't include special menus |
| 2086 | if (i->at (0) != '@') { |
| 2087 | bindings.insert (std::make_pair (*i, std::string ())); |
| 2088 | } |
| 2089 | get_shortcuts (*i, bindings, with_defaults); |
| 2090 | } else if (! item->action ()->is_separator () && item->primary ()) { |
| 2091 | bindings.insert (std::make_pair (*i, with_defaults ? item->action ()->get_default_shortcut () : item->action ()->get_effective_shortcut ())); |
| 2092 | } |
| 2093 | } |
| 2094 | } |
| 2095 | } |
| 2096 | } |
| 2097 | |
| 2098 | } |
no test coverage detected