Commit a43f162d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Mercurial: Disable hidden menu entries

To avoid shortcut ambiguity

Task-number: QTCREATORBUG-13364
Change-Id: Ibce1701be72376845624856b5de097332aaaccae
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 895e0d84
......@@ -307,6 +307,18 @@ Command *ActionContainerPrivate::addSeparator(const Context &context, Id group,
return cmd;
}
void ActionContainerPrivate::setEnabled(bool enabled)
{
foreach (const Group &group, m_groups) {
foreach (QObject *item, group.items) {
if (Command *command = qobject_cast<Command *>(item))
command->action()->setEnabled(enabled);
else if (ActionContainer *container = qobject_cast<ActionContainer *>(item))
container->setEnabled(enabled);
}
}
}
void ActionContainerPrivate::clear()
{
QMutableListIterator<Group> it(m_groups);
......
......@@ -72,6 +72,7 @@ public:
virtual void addMenu(ActionContainer *menu, Id group = Id()) = 0;
virtual void addMenu(ActionContainer *before, ActionContainer *menu, Id group = Id()) = 0;
virtual Command *addSeparator(const Context &context, Id group = Id(), QAction **outSeparator = 0) = 0;
virtual void setEnabled(bool enabled) = 0;
// This clears this menu and submenus from all actions and submenus.
// It does not destroy the submenus and commands, just removes them from their parents.
......
......@@ -64,6 +64,7 @@ public:
void addMenu(ActionContainer *menu, Id group = Id());
void addMenu(ActionContainer *before, ActionContainer *menu, Id group = Id());
Command *addSeparator(const Context &context, Id group = Id(), QAction **outSeparator = 0);
void setEnabled(bool enabled);
virtual void clear();
Id id() const;
......
This diff is collapsed.
......@@ -144,7 +144,7 @@ private:
Core::ICore *core;
Core::CommandLocator *m_commandLocator;
Core::ActionContainer *mercurialContainer;
Core::ActionContainer *m_mercurialContainer;
QList<QAction *> m_repositoryActionList;
......
Markdown is supported
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