forked from qt-creator/qt-creator
Implement renaming of tools and categories.
Not possible to reset them yet. Saves the change in the settings instead of writing new tools xml files. This probably needs to be adapted for tools that are "local" from the beginning.
This commit is contained in:
@@ -268,10 +268,32 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group
|
||||
QAction *beforeAction = insertLocation(groupIt);
|
||||
m_groups[groupIt-m_groups.constBegin()].items.append(menu);
|
||||
|
||||
connect(menu, SIGNAL(destroyed()), this, SLOT(itemDestroyed()));
|
||||
insertMenu(beforeAction, container->menu());
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
void ActionContainerPrivate::clear()
|
||||
{
|
||||
QMutableListIterator<Group> it(m_groups);
|
||||
while (it.hasNext()) {
|
||||
Group &group = it.next();
|
||||
foreach (QObject *item, group.items) {
|
||||
if (Command *command = qobject_cast<Command *>(item)) {
|
||||
removeAction(command->action());
|
||||
disconnect(command, SIGNAL(activeStateChanged()), this, SLOT(scheduleUpdate()));
|
||||
disconnect(command, SIGNAL(destroyed()), this, SLOT(itemDestroyed()));
|
||||
} else if (ActionContainer *container = qobject_cast<ActionContainer *>(item)) {
|
||||
container->clear();
|
||||
disconnect(container, SIGNAL(destroyed()), this, SLOT(itemDestroyed()));
|
||||
removeMenu(container->menu());
|
||||
}
|
||||
}
|
||||
group.items.clear();
|
||||
}
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
void ActionContainerPrivate::itemDestroyed()
|
||||
{
|
||||
QObject *obj = sender();
|
||||
@@ -350,6 +372,16 @@ void MenuActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||
m_menu->insertMenu(before, menu);
|
||||
}
|
||||
|
||||
void MenuActionContainer::removeAction(QAction *action)
|
||||
{
|
||||
m_menu->removeAction(action);
|
||||
}
|
||||
|
||||
void MenuActionContainer::removeMenu(QMenu *menu)
|
||||
{
|
||||
m_menu->removeAction(menu->menuAction());
|
||||
}
|
||||
|
||||
bool MenuActionContainer::updateInternal()
|
||||
{
|
||||
if (onAllDisabledBehavior() == Show)
|
||||
@@ -442,6 +474,16 @@ void MenuBarActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||
m_menuBar->insertMenu(before, menu);
|
||||
}
|
||||
|
||||
void MenuBarActionContainer::removeAction(QAction *action)
|
||||
{
|
||||
m_menuBar->removeAction(action);
|
||||
}
|
||||
|
||||
void MenuBarActionContainer::removeMenu(QMenu *menu)
|
||||
{
|
||||
m_menuBar->removeAction(menu->menuAction());
|
||||
}
|
||||
|
||||
bool MenuBarActionContainer::updateInternal()
|
||||
{
|
||||
if (onAllDisabledBehavior() == Show)
|
||||
|
||||
Reference in New Issue
Block a user