Skip to content

Commit

Permalink
Complete the code to reload the default shortcut bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 5, 2017
1 parent 4a52eb9 commit 82615d9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions plugins/eventmanager/EventManager.cpp
Expand Up @@ -108,7 +108,29 @@ Accelerator& EventManager::addAccelerator(wxKeyEvent& ev)

void EventManager::resetAcceleratorBindings()
{
// Select the stock mappings
std::string xPathQuery = "user/ui/input/shortcuts[@name='default']//shortcut";

xml::NodeList shortcutList = GlobalRegistry().findXPath(xPathQuery);

if (shortcutList.empty())
{
// No accelerator definitions found!
rWarning() << "EventManager: No default shortcut definitions found..." << std::endl;
return;
}

// Disconnect all accelerators from all events
for (EventMap::value_type& pair : _events)
{
pair.second->disconnectAccelerators();
}

_accelerators.clear();

rMessage() << "EventManager: Default shortcuts found in Registry: " << shortcutList.size() << std::endl;

loadAcceleratorFromList(shortcutList);
}

IEventPtr EventManager::findEvent(const std::string& name)
Expand Down

0 comments on commit 82615d9

Please sign in to comment.