Commit 6d31f0b8 authored by hjk's avatar hjk
Browse files

ActionManager: Require a valid context for shortcuts

All callers provide one, and the fall-back construction from 0
has not been appropriate for a while.

Change-Id: I8bc5d094b70aac251fff1a7d34f1fad876cbdee2
Reviewed-by: default avatarDaniel Teske <>
parent 167316d7
...@@ -258,6 +258,7 @@ Command *ActionManager::registerAction(QAction *action, const Id &id, const Cont ...@@ -258,6 +258,7 @@ Command *ActionManager::registerAction(QAction *action, const Id &id, const Cont
*/ */
Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable) Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable)
{ {
Shortcut *sc = 0; Shortcut *sc = 0;
if (CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0)) { if (CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0)) {
sc = qobject_cast<Shortcut *>(c); sc = qobject_cast<Shortcut *>(c);
...@@ -282,11 +283,7 @@ Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, cons ...@@ -282,11 +283,7 @@ Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, cons
shortcut->setParent(ICore::mainWindow()); shortcut->setParent(ICore::mainWindow());
sc->setShortcut(shortcut); sc->setShortcut(shortcut);
sc->setScriptable(scriptable); sc->setScriptable(scriptable);
if (context.isEmpty())
emit m_instance->commandListChanged(); emit m_instance->commandListChanged();
emit m_instance->commandAdded(id.toString()); emit m_instance->commandAdded(id.toString());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment