if the applet parent of this popupapplet is -not- a containment, always collapse the popup

svn path=/trunk/KDE/kdelibs/; revision=1148414
This commit is contained in:
Marco Martin 2010-07-10 15:10:08 +00:00
parent 836e012dd4
commit 12a3da4aa4

View File

@ -260,14 +260,27 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
}
//99% of the times q->parentWidget() is the containment, but using it we can also manage the applet-in-applet case (i.e. systray)
//there are also cases where the parentlayoutitem is bigger than the containment (e.g. newspaper)
if (q->parentLayoutItem()) {
parentSize = q->parentLayoutItem()->geometry().size();
} else if (q->parentWidget()) {
parentSize = q->parentWidget()->size();
}
//check if someone did the nasty trick of applets in applets, in this case we always want to be collapsed
QGraphicsWidget *candidateParentApplet = q;
Plasma::Applet *parentApplet = 0;
//this loop should be executed normally a single time, at most 2-3 times for quite complex containments
while (candidateParentApplet) {
candidateParentApplet = candidateParentApplet->parentWidget();
parentApplet = qobject_cast<Plasma::Applet *>(candidateParentApplet);
if (parentApplet) {
break;
}
}
//Applet on desktop
if (icon && (!icon->svg().isEmpty() || !icon->icon().isNull()) && ((f != Plasma::Vertical && f != Plasma::Horizontal) ||
if ((!parentApplet || parentApplet->isContainment() ) && icon && (!icon->svg().isEmpty() || !icon->icon().isNull()) && ((f != Plasma::Vertical && f != Plasma::Horizontal) ||
((f == Plasma::Vertical && parentSize.width() >= minimum.width()) ||
(f == Plasma::Horizontal && parentSize.height() >= minimum.height())))) {
//kDebug() << "we are expanding the popupapplet";