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:
con
2011-01-21 10:58:06 +01:00
parent d768008d60
commit eaea867e53
12 changed files with 408 additions and 45 deletions

View File

@@ -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)