go back is isContainment. ActAs is just ugly ugly. i don't think anyone really gets confused over isContainment (e.g. confusing it with IsA ;)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=801792
This commit is contained in:
Aaron J. Seigo 2008-04-27 19:05:06 +00:00
parent 7b8860b462
commit df1ba079e8
4 changed files with 34 additions and 34 deletions

View File

@ -117,7 +117,7 @@ public:
immutability(NotImmutable), immutability(NotImmutable),
hasConfigurationInterface(false), hasConfigurationInterface(false),
failed(false), failed(false),
actAsContainment(false), isContainment(false),
square(false), square(false),
transient(false) transient(false)
{ {
@ -254,7 +254,7 @@ public:
return mainConfig; return mainConfig;
} }
if (actAsContainment) { if (isContainment) {
const Containment *asContainment = qobject_cast<Containment*>(const_cast<Applet*>(q)); const Containment *asContainment = qobject_cast<Containment*>(const_cast<Applet*>(q));
Q_ASSERT(asContainment); Q_ASSERT(asContainment);
@ -337,7 +337,7 @@ public:
ImmutabilityType immutability; ImmutabilityType immutability;
bool hasConfigurationInterface : 1; bool hasConfigurationInterface : 1;
bool failed : 1; bool failed : 1;
bool actAsContainment : 1; bool isContainment : 1;
bool square : 1; bool square : 1;
bool transient : 1; bool transient : 1;
}; };
@ -511,7 +511,7 @@ KConfigGroup Applet::config(const QString &group) const
KConfigGroup Applet::config() const KConfigGroup Applet::config() const
{ {
if (d->actAsContainment) { if (d->isContainment) {
return *(d->mainConfigGroup(this)); return *(d->mainConfigGroup(this));
} }
@ -521,8 +521,8 @@ KConfigGroup Applet::config() const
KConfigGroup Applet::globalConfig() const KConfigGroup Applet::globalConfig() const
{ {
KConfigGroup globalAppletConfig; KConfigGroup globalAppletConfig;
const Containment *c = actAsContainment() ? dynamic_cast<const Containment*>(this) : containment(); const Containment *c = isContainment() ? dynamic_cast<const Containment*>(this) : containment();
QString group = actAsContainment() ? "ContainmentGlobals" : "AppletGlobals"; QString group = isContainment() ? "ContainmentGlobals" : "AppletGlobals";
if (c && c->corona()) { if (c && c->corona()) {
KSharedConfig::Ptr coronaConfig = c->corona()->config(); KSharedConfig::Ptr coronaConfig = c->corona()->config();
@ -932,7 +932,7 @@ void Applet::flushPendingConstraintsEvents()
setBackgroundHints(d->backgroundHints^ShadowedBackground); setBackgroundHints(d->backgroundHints^ShadowedBackground);
} }
if (!actAsContainment() && f != Vertical && f != Horizontal) { if (!isContainment() && f != Vertical && f != Horizontal) {
setBackgroundHints(d->backgroundHints|StandardBackground); setBackgroundHints(d->backgroundHints|StandardBackground);
} else { } else {
setBackgroundHints(d->backgroundHints^StandardBackground); setBackgroundHints(d->backgroundHints^StandardBackground);
@ -968,7 +968,7 @@ void Applet::flushPendingConstraintsEvents()
} }
Containment* containment = qobject_cast<Plasma::Containment*>(this); Containment* containment = qobject_cast<Plasma::Containment*>(this);
if (actAsContainment() && containment) { if (isContainment() && containment) {
containment->d->containmentConstraintsEvent(c); containment->d->containmentConstraintsEvent(c);
} }
@ -986,7 +986,7 @@ int Applet::type() const
QPainterPath Applet::shape() const QPainterPath Applet::shape() const
{ {
if (actAsContainment()) { if (isContainment()) {
return QGraphicsWidget::shape(); return QGraphicsWidget::shape();
} }
@ -1019,7 +1019,7 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
d->background->paintPanel(painter, option->rect, QPointF(0,0)); d->background->paintPanel(painter, option->rect, QPointF(0,0));
} }
if (!d->failed) { if (!d->failed) {
if (widget && actAsContainment()) { if (widget && isContainment()) {
// note that the widget we get is actually the viewport of the view, not the view itself // note that the widget we get is actually the viewport of the view, not the view itself
View* v = qobject_cast<Plasma::View*>(widget->parent()); View* v = qobject_cast<Plasma::View*>(widget->parent());
if (!v || v->isWallpaperEnabled()) { if (!v || v->isWallpaperEnabled()) {
@ -1060,7 +1060,7 @@ Containment* Applet::containment() const
/* /*
* while this is probably "more correct", much of the code in applet assumes containment * while this is probably "more correct", much of the code in applet assumes containment
* returns zero in the case that this is a containment itself. * returns zero in the case that this is a containment itself.
* if (actAsContainment()) { * if (isContainment()) {
return dynamic_cast<Containment*>(const_cast<Applet*>(this)); return dynamic_cast<Containment*>(const_cast<Applet*>(this));
} }
*/ */
@ -1070,7 +1070,7 @@ Containment* Applet::containment() const
while (parent) { while (parent) {
Containment *possibleC = dynamic_cast<Containment*>(parent); Containment *possibleC = dynamic_cast<Containment*>(parent);
if (possibleC && possibleC->actAsContainment()) { if (possibleC && possibleC->isContainment()) {
c = possibleC; c = possibleC;
break; break;
} }
@ -1182,7 +1182,7 @@ void Applet::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem *parent = parentItem(); QGraphicsItem *parent = parentItem();
Plasma::Applet *applet = qgraphicsitem_cast<Plasma::Applet*>(parent); Plasma::Applet *applet = qgraphicsitem_cast<Plasma::Applet*>(parent);
if (applet && applet->actAsContainment()) { if (applet && applet->isContainment()) {
// our direct parent is a containment. just move ourselves. // our direct parent is a containment. just move ourselves.
QPointF curPos = event->pos(); QPointF curPos = event->pos();
QPointF lastPos = event->lastPos(); QPointF lastPos = event->lastPos();
@ -1355,12 +1355,12 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName); QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint); KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
bool actAsContainment = false; bool isContainment = false;
if (offers.isEmpty()) { if (offers.isEmpty()) {
//TODO: what would be -really- cool is offer to try and download the applet //TODO: what would be -really- cool is offer to try and download the applet
// from the network at this point // from the network at this point
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint); offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
actAsContainment = true; isContainment = true;
if (offers.isEmpty()) { if (offers.isEmpty()) {
kDebug() << "offers is empty for " << appletName; kDebug() << "offers is empty for " << appletName;
return 0; return 0;
@ -1377,7 +1377,7 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
if (!offer->property("X-Plasma-Language").toString().isEmpty()) { if (!offer->property("X-Plasma-Language").toString().isEmpty()) {
kDebug() << "we have a script in the language of" << offer->property("X-Plasma-Language").toString(); kDebug() << "we have a script in the language of" << offer->property("X-Plasma-Language").toString();
if (actAsContainment) { if (isContainment) {
return new Containment(0, offer->storageId(), appletId); return new Containment(0, offer->storageId(), appletId);
} }
return new Applet(0, offer->storageId(), appletId); return new Applet(0, offer->storageId(), appletId);
@ -1472,13 +1472,13 @@ void Applet::lower()
setZValue(--Private::s_minZValue); setZValue(--Private::s_minZValue);
} }
void Applet::setActAsContainment(bool actAsContainment) void Applet::setIsContainment(bool isContainment)
{ {
if (d->actAsContainment == actAsContainment) { if (d->isContainment == isContainment) {
return; return;
} }
d->actAsContainment = actAsContainment; d->isContainment = isContainment;
Containment *c = qobject_cast<Containment*>(this); Containment *c = qobject_cast<Containment*>(this);
if (c) { if (c) {
@ -1487,9 +1487,9 @@ void Applet::setActAsContainment(bool actAsContainment)
} }
} }
bool Applet::actAsContainment() const bool Applet::isContainment() const
{ {
return d->actAsContainment; return d->isContainment;
} }
void Applet::themeChanged() void Applet::themeChanged()

View File

@ -436,7 +436,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* @return true if this Applet is currently being used as a Containment, false otherwise * @return true if this Applet is currently being used as a Containment, false otherwise
*/ */
bool actAsContainment() const; bool isContainment() const;
/** /**
* Sets the geometry of this Plasma::Applet. Should not be used directly by * Sets the geometry of this Plasma::Applet. Should not be used directly by
@ -625,7 +625,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* Sets whether or not this Applet is acting as a Containment * Sets whether or not this Applet is acting as a Containment
*/ */
void setActAsContainment(bool actAsContainment); void setIsContainment(bool isContainment);
/** /**
* Called when any of the geometry constraints have been updated. * Called when any of the geometry constraints have been updated.

View File

@ -196,7 +196,7 @@ void Containment::setContainmentType(Containment::Type type)
{ {
d->type = type; d->type = type;
if (actAsContainment() && type == DesktopContainment) { if (isContainment() && type == DesktopContainment) {
if (!d->toolBox) { if (!d->toolBox) {
QGraphicsWidget *addWidgetTool = addToolBoxTool("addwidgets", "list-add", i18n("Add Widgets")); QGraphicsWidget *addWidgetTool = addToolBoxTool("addwidgets", "list-add", i18n("Add Widgets"));
connect(addWidgetTool, SIGNAL(clicked()), this, SLOT(triggerShowAddWidgets())); connect(addWidgetTool, SIGNAL(clicked()), this, SLOT(triggerShowAddWidgets()));
@ -218,7 +218,7 @@ void Containment::setContainmentType(Containment::Type type)
connect(activityTool, SIGNAL(clicked()), this, SLOT(addSiblingContainment())); connect(activityTool, SIGNAL(clicked()), this, SLOT(addSiblingContainment()));
} }
} else if (actAsContainment() && type == PanelContainment) { } else if (isContainment() && type == PanelContainment) {
if (!d->toolBox) { if (!d->toolBox) {
d->createToolBox(); d->createToolBox();
d->toolBox->setSize(22); d->toolBox->setSize(22);
@ -238,7 +238,7 @@ Corona* Containment::corona() const
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
{ {
//kDebug() << "let's see if we manage to get a context menu here, huh"; //kDebug() << "let's see if we manage to get a context menu here, huh";
if (!actAsContainment() || !scene() || !KAuthorized::authorizeKAction("desktop_contextmenu")) { if (!isContainment() || !scene() || !KAuthorized::authorizeKAction("desktop_contextmenu")) {
Applet::contextMenuEvent(event); Applet::contextMenuEvent(event);
return; return;
} }
@ -253,7 +253,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
while (item) { while (item) {
applet = qgraphicsitem_cast<Applet*>(item); applet = qgraphicsitem_cast<Applet*>(item);
if (applet && !applet->actAsContainment()) { if (applet && !applet->isContainment()) {
break; break;
} }
@ -360,7 +360,7 @@ void Containment::setFormFactor(FormFactor formFactor)
d->formFactor = formFactor; d->formFactor = formFactor;
if (actAsContainment() && containmentType() == PanelContainment && was != formFactor) { if (isContainment() && containmentType() == PanelContainment && was != formFactor) {
// we are a panel and we have chaged our orientation // we are a panel and we have chaged our orientation
d->positionPanel(true); d->positionPanel(true);
} }
@ -434,7 +434,7 @@ void Containment::createLayout(FormFactor formFactor)
FormFactor Containment::formFactor() const FormFactor Containment::formFactor() const
{ {
if (actAsContainment()) { if (isContainment()) {
return d->formFactor; return d->formFactor;
} }
@ -800,7 +800,7 @@ QVariant Containment::itemChange(GraphicsItemChange change, const QVariant &valu
{ {
Q_UNUSED(value) Q_UNUSED(value)
if (actAsContainment() && if (isContainment() &&
(change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemPositionHasChanged) && (change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemPositionHasChanged) &&
!d->positioning) { !d->positioning) {
switch (containmentType()) { switch (containmentType()) {
@ -970,7 +970,7 @@ void Containment::Private::setLockToolText()
void Containment::Private::containmentConstraintsEvent(Plasma::Constraints constraints) void Containment::Private::containmentConstraintsEvent(Plasma::Constraints constraints)
{ {
if (!q->actAsContainment()) { if (!q->isContainment()) {
return; return;
} }

View File

@ -120,12 +120,12 @@ public:
containments.removeAt(index); containments.removeAt(index);
} }
} }
void syncConfig() void syncConfig()
{ {
q->config()->sync(); q->config()->sync();
} }
Containment* addContainment(const QString& name, const QVariantList& args, uint id, bool delayedInit) Containment* addContainment(const QString& name, const QVariantList& args, uint id, bool delayedInit)
{ {
QString pluginName = name; QString pluginName = name;
@ -154,7 +154,7 @@ public:
containment->setFormFactor(Plasma::Planar); containment->setFormFactor(Plasma::Planar);
} }
containment->setActAsContainment(true); containment->setIsContainment(true);
if (!delayedInit) { if (!delayedInit) {
q->addItem(containment); q->addItem(containment);