clear this bit of code up

svn path=/trunk/KDE/kdelibs/; revision=1104111
This commit is contained in:
Aaron J. Seigo 2010-03-16 18:35:07 +00:00
parent 786913a995
commit 813f6a088f

View File

@ -772,18 +772,17 @@ void ExtenderItemPrivate::updateToolBox()
}
//add the actions that are actually set to visible.
QAction *closeAction = actions.value("close");
foreach (QAction *action, actionsInOrder) {
if (action->isVisible()) {
if (action->isVisible() && action != closeAction) {
IconWidget *icon = new IconWidget(q);
icon->setAction(action);
QSizeF size = icon->sizeFromIconSize(iconSize);
icon->setMinimumSize(size);
icon->setMaximumSize(size);
if (action != actions.value("close")) {
toolboxLayout->addItem(icon);
}
}
}
//add the returntosource icon if we are detached, and have a source applet.
if (q->isDetached() && sourceApplet) {
@ -800,23 +799,21 @@ void ExtenderItemPrivate::updateToolBox()
//add the close icon if desired.
if (destroyActionVisibility) {
destroyButton = new IconWidget(q);
if (!actions.contains("close")) {
QAction *destroyAction = new QAction(q);
actions["close"] = destroyAction;
if (!closeAction) {
closeAction = new QAction(q);
actions.insert("close", closeAction);
QObject::connect(closeAction, SIGNAL(triggered()), q, SLOT(destroy()));
}
destroyButton->setAction(actions["close"]);
destroyButton->setAction(closeAction);
destroyButton->setSvg("widgets/configuration-icons", "close");
QSizeF size = destroyButton->sizeFromIconSize(iconSize);
destroyButton->setMinimumSize(size);
destroyButton->setMaximumSize(size);
toolboxLayout->addItem(destroyButton);
QObject::connect(actions["close"], SIGNAL(triggered()), q, SLOT(destroy()));
} else if (actions.contains("close")) {
QAction *destroyAction = actions["close"];
} else if (closeAction) {
actions.remove("close");
destroyAction->deleteLater();
closeAction->deleteLater();
closeAction = 0;
}
toolboxLayout->updateGeometry();