bring back the toolbox reset after setIscontainment

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=797081
This commit is contained in:
Marco Martin 2008-04-14 21:26:40 +00:00
parent f4e44f397e
commit 4e7e2cb345
2 changed files with 19 additions and 6 deletions

View File

@ -249,6 +249,7 @@ void Containment::containmentConstraintsUpdated(Plasma::Constraints constraints)
if (constraints & Plasma::ScreenConstraint && d->toolbox) {
if (d->type == PanelContainment) {
//FIXME: geometry() always returns a 0x0 size in the panels
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), geometry().height()/2 - d->toolbox->size());
} else {
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), 0);
@ -298,7 +299,7 @@ void Containment::setContainmentType(Containment::Type type)
QGraphicsWidget *activityTool = addToolBoxTool("addSiblingContainment", "list-add", i18n("Add Activity"));
connect(activityTool, SIGNAL(clicked()), this, SLOT(addSiblingContainment()));
}
//FIXME: the isContainment fix kinda got vanished in the woc migration
} else if (isContainment() && type == PanelContainment) {
d->createToolbox();
d->toolbox->setSize(24);
@ -309,6 +310,17 @@ void Containment::setContainmentType(Containment::Type type)
}
}
void Containment::setIsContainment(bool isContainment)
{
Applet::setIsContainment(isContainment);
// reset the toolbox!
delete d->toolbox;
d->toolbox = 0;
setContainmentType(d->type);
}
Corona* Containment::corona() const
{
return dynamic_cast<Corona*>(scene());
@ -781,16 +793,12 @@ void Containment::appletAnimationComplete(QGraphicsItem *item, Plasma::Phase::An
{
if (anim == Phase::Disappear) {
QGraphicsItem *parent = item->parentItem();
QGraphicsLayout *lay = layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
while (parent) {
if (parent == this) {
Applet *applet = qgraphicsitem_cast<Applet*>(item);
if (applet) {
if (linearLay) {
linearLay->removeItem(applet);
}
applet->destroy();
}

View File

@ -143,6 +143,11 @@ class PLASMA_EXPORT Containment : public Applet
*/
void setContainmentType(Containment::Type type);
/**
* Reimplemented from Applet
*/
void setIsContainment(bool isContainment);
/**
* Returns the Corona (if any) that this Containment is hosted by
*/