make it harder for people to fall into the temptation of nesting containments
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=863619
This commit is contained in:
parent
b4b2a4a96a
commit
56a9ad52ce
@ -1532,15 +1532,15 @@ void Applet::lower()
|
||||
setZValue(--AppletPrivate::s_minZValue);
|
||||
}
|
||||
|
||||
void Applet::setIsContainment(bool isContainment)
|
||||
void AppletPrivate::setIsContainment(bool nowIsContainment)
|
||||
{
|
||||
if (d->isContainment == isContainment) {
|
||||
if (isContainment == nowIsContainment) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->isContainment = isContainment;
|
||||
isContainment = nowIsContainment;
|
||||
|
||||
Containment *c = qobject_cast<Containment*>(this);
|
||||
Containment *c = qobject_cast<Containment*>(q);
|
||||
if (c) {
|
||||
if (isContainment) {
|
||||
// set up the toolbox
|
||||
|
5
applet.h
5
applet.h
@ -695,11 +695,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
*/
|
||||
virtual void createConfigurationInterface(KConfigDialog *parent);
|
||||
|
||||
/**
|
||||
* Sets whether or not this Applet is acting as a Containment
|
||||
*/
|
||||
void setIsContainment(bool isContainment);
|
||||
|
||||
/**
|
||||
* Called when any of the geometry constraints have been updated.
|
||||
*
|
||||
|
@ -630,7 +630,7 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, co
|
||||
|
||||
void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
{
|
||||
if (!delayInit && immutability() != Mutable) {
|
||||
if (!isContainment() || (!delayInit && immutability() != Mutable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -857,6 +857,10 @@ void Containment::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
||||
void Containment::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
//kDebug() << event->mimeData()->text();
|
||||
if (!isContainment()) {
|
||||
Applet::dropEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
QString mimetype(static_cast<Corona*>(scene())->appletMimeType());
|
||||
|
||||
@ -1627,8 +1631,12 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
|
||||
}
|
||||
|
||||
Applet* ContainmentPrivate::addApplet(const QString& name, const QVariantList& args,
|
||||
const QRectF& appletGeometry, uint id, bool delayInit)
|
||||
const QRectF& appletGeometry, uint id, bool delayInit)
|
||||
{
|
||||
if (!q->isContainment()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!delayInit && q->immutability() != Mutable) {
|
||||
kDebug() << "addApplet for" << name << "requested, but we're currently immutable!";
|
||||
return 0;
|
||||
|
@ -499,6 +499,7 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
Q_PRIVATE_SLOT(d, void toggleDesktopImmutability())
|
||||
|
||||
friend class Applet;
|
||||
friend class AppletPrivate;
|
||||
friend class CoronaPrivate;
|
||||
friend class ContainmentPrivate;
|
||||
ContainmentPrivate* const d;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <KMimeType>
|
||||
|
||||
#include "containment.h"
|
||||
#include "private/applet_p.h"
|
||||
|
||||
using namespace Plasma;
|
||||
|
||||
@ -145,7 +146,7 @@ public:
|
||||
containment->setFormFactor(Plasma::Planar);
|
||||
}
|
||||
|
||||
containment->setIsContainment(true);
|
||||
static_cast<Applet*>(containment)->d->setIsContainment(true);
|
||||
q->addItem(containment);
|
||||
|
||||
if (!delayedInit) {
|
||||
|
@ -53,6 +53,11 @@ public:
|
||||
// package exists and that we have a script engin
|
||||
void setupScriptSupport();
|
||||
|
||||
/**
|
||||
* Sets whether or not this Applet is acting as a Containment
|
||||
*/
|
||||
void setIsContainment(bool isContainment);
|
||||
|
||||
QString globalName() const;
|
||||
QString instanceName();
|
||||
void scheduleConstraintsUpdate(Plasma::Constraints c);
|
||||
|
Loading…
Reference in New Issue
Block a user