setIsContainment wasn't virtual anyways, so don't reimp in containment; do it all in applet

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800682
This commit is contained in:
Aaron J. Seigo 2008-04-24 16:29:23 +00:00
parent 6053e33430
commit cb896a4ed2
3 changed files with 18 additions and 21 deletions

View File

@ -363,9 +363,11 @@ Applet::Applet(QObject* parentObject, const QVariantList& args)
d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()),
args.count() > 1 ? args[1].toInt() : 0))
{
setParent(parentObject);
// WARNING: do not access config() OR globalConfig() in this method!
// that requires a scene, which is not available at this point
d->init(this);
// the brain damage seen in the initialization list is due to the
// inflexibility of KService::createInstance
}
@ -1552,7 +1554,17 @@ void Applet::lower()
void Applet::setIsContainment(bool isContainment)
{
if (d->isContainment == isContainment) {
return;
}
d->isContainment = isContainment;
Containment *c = qobject_cast<Containment*>(this);
if (c) {
// set up the toolbox
c->setContainmentType(c->containmentType());
}
}
bool Applet::isContainment() const

View File

@ -329,17 +329,6 @@ 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());

View File

@ -124,16 +124,6 @@ class PLASMA_EXPORT Containment : public Applet
*/
Type containmentType() const;
/**
* Sets the type of this containment.
*/
void setContainmentType(Containment::Type type);
/**
* Reimplemented from Applet
*/
void setIsContainment(bool isContainment);
/**
* Returns the Corona (if any) that this Containment is hosted by
*/
@ -387,6 +377,11 @@ class PLASMA_EXPORT Containment : public Applet
void addSiblingContainment();
protected:
/**
* Sets the type of this containment.
*/
void setContainmentType(Containment::Type type);
/**
* Optionally creates a layout for the Containment for the new
* form factor. This is called before the current form factor is
@ -427,6 +422,7 @@ class PLASMA_EXPORT Containment : public Applet
void positionPanel(bool force = false);
void positionContainment();
friend class Applet;
class Private;
Private* const d;
};