grant minimal access to the toolbox so we can avoid nasty hacks in containments. see next commit to PanelContainment for what i meant ;)

svn path=/trunk/KDE/kdelibs/; revision=886223
This commit is contained in:
Aaron J. Seigo 2008-11-18 20:49:42 +00:00
parent c027fb3886
commit 8a68d06f0d
2 changed files with 13 additions and 7 deletions

View File

@ -1024,6 +1024,11 @@ void Containment::dropEvent(QGraphicsSceneDragDropEvent *event)
}
}
const QGraphicsItem *Containment::toolBoxItem() const
{
return d->toolBox;
}
void Containment::resizeEvent(QGraphicsSceneResizeEvent *event)
{
Applet::resizeEvent(event);
@ -1529,7 +1534,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
return;
}
//kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolBox;
kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolBox;
if (constraints & Plasma::ImmutableConstraint) {
//update actions
bool unlocked = q->immutability() == Mutable;
@ -1558,11 +1563,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
}
if (q->isContainment() && type == Containment::PanelContainment) {
if (unlocked) {
toolBox->show();
} else {
toolBox->hide();
}
toolBox->setVisible(unlocked);
}
}
@ -1590,7 +1591,6 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
positionPanel();
break;
default:
positionContainment();
break;
}
}
@ -1599,6 +1599,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
constraints & Plasma::FormFactorConstraint ||
constraints & Plasma::ScreenConstraint ||
constraints & Plasma::StartupCompletedConstraint)) {
kDebug() << "BWUHA!";
positionToolBox();
}
}

View File

@ -494,6 +494,11 @@ class PLASMA_EXPORT Containment : public Applet
*/
void resizeEvent(QGraphicsSceneResizeEvent *event);
/**
* @returns the toolbox associated with this containment, or a null pointer if none
*/
const QGraphicsItem *toolBoxItem() const;
private:
Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*))
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *item,