Add removeShortcut method to the actionManager.

Almost working as the removeAction, but we don't need to check if the command is empty here.

Merge-request: 236
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Nicolas Arnaud-Cormos
2011-01-24 11:39:40 +01:00
committed by Tobias Hunger
parent c41d9412aa
commit f3d7bbff0c
3 changed files with 20 additions and 1 deletions

View File

@@ -377,7 +377,7 @@ void ActionManagerPrivate::unregisterAction(QAction *action, const Id &id)
QTC_ASSERT(c, return);
a = qobject_cast<Action *>(c);
if (!a) {
qWarning() << "registerAction: id" << id << "is registered with a different command type.";
qWarning() << "unregisterAction: id" << id << "is registered with a different command type.";
return;
}
a->removeOverrideAction(action);
@@ -517,3 +517,20 @@ void ActionManagerPrivate::saveSettings(QSettings *settings)
settings->endArray();
}
void ActionManagerPrivate::unregisterShortcut(const Core::Id &id)
{
Shortcut *sc = 0;
const int uid = UniqueIDManager::instance()->uniqueIdentifier(id);
CommandPrivate *c = m_idCmdMap.value(uid, 0);
QTC_ASSERT(c, return);
sc = qobject_cast<Shortcut *>(c);
if (!sc) {
qWarning() << "unregisterShortcut: id" << id << "is registered with a different command type.";
return;
}
delete sc->shortcut();
m_idCmdMap.remove(uid);
delete sc;
emit commandListChanged();
}