From efcc2c612846c672e81f24e9096ad81bf1703499 Mon Sep 17 00:00:00 2001 From: Jason Stubbs Date: Mon, 24 Dec 2007 07:49:33 +0000 Subject: [PATCH] Addition of applets to a panel require different geometry handling than to a desktop. This patch just splits the handling into two branches so as to make the upcoming changes easier to read. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=752327 --- containment.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/containment.cpp b/containment.cpp index 8ddff09a0..af3c4900a 100644 --- a/containment.cpp +++ b/containment.cpp @@ -399,25 +399,30 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui applet = new Applet; } - //panels don't want backgrounds, which is important when setting geometry - if (containmentType() == PanelContainment) { + switch (containmentType()) { + case PanelContainment: + //panels don't want backgrounds, which is important when setting geometry applet->setDrawStandardBackground(false); - } - addApplet(applet); + addApplet(applet); + break; - //the applet needs to be given constraints before it can set its geometry - applet->updateConstraints(Plasma::AllConstraints); + default: + addApplet(applet); - //kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid(); - if (appletGeometry.isValid()) { - applet->setGeometry(appletGeometry); - } else if (appletGeometry.x() != -1 && appletGeometry.y() != -1) { - // yes, this means we can't have items start -1, -1 - applet->setGeometry(QRectF(appletGeometry.topLeft(), - applet->sizeHint())); - } else if (geometry().isValid()) { - applet->setGeometry(geometryForApplet(applet)); + //the applet needs to be given constraints before it can set its geometry + applet->updateConstraints(Plasma::AllConstraints); + + //kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid(); + if (appletGeometry.isValid()) { + applet->setGeometry(appletGeometry); + } else if (appletGeometry.x() != -1 && appletGeometry.y() != -1) { + // yes, this means we can't have items start -1, -1 + applet->setGeometry(QRectF(appletGeometry.topLeft(), + applet->sizeHint())); + } else if (geometry().isValid()) { + applet->setGeometry(geometryForApplet(applet)); + } } //kDebug() << applet->name() << "sizehint:" << applet->sizeHint() << "geometry:" << applet->geometry();