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:
parent
7b8860b462
commit
df1ba079e8
42
applet.cpp
42
applet.cpp
@ -117,7 +117,7 @@ public:
|
||||
immutability(NotImmutable),
|
||||
hasConfigurationInterface(false),
|
||||
failed(false),
|
||||
actAsContainment(false),
|
||||
isContainment(false),
|
||||
square(false),
|
||||
transient(false)
|
||||
{
|
||||
@ -254,7 +254,7 @@ public:
|
||||
return mainConfig;
|
||||
}
|
||||
|
||||
if (actAsContainment) {
|
||||
if (isContainment) {
|
||||
const Containment *asContainment = qobject_cast<Containment*>(const_cast<Applet*>(q));
|
||||
Q_ASSERT(asContainment);
|
||||
|
||||
@ -337,7 +337,7 @@ public:
|
||||
ImmutabilityType immutability;
|
||||
bool hasConfigurationInterface : 1;
|
||||
bool failed : 1;
|
||||
bool actAsContainment : 1;
|
||||
bool isContainment : 1;
|
||||
bool square : 1;
|
||||
bool transient : 1;
|
||||
};
|
||||
@ -511,7 +511,7 @@ KConfigGroup Applet::config(const QString &group) const
|
||||
|
||||
KConfigGroup Applet::config() const
|
||||
{
|
||||
if (d->actAsContainment) {
|
||||
if (d->isContainment) {
|
||||
return *(d->mainConfigGroup(this));
|
||||
}
|
||||
|
||||
@ -521,8 +521,8 @@ KConfigGroup Applet::config() const
|
||||
KConfigGroup Applet::globalConfig() const
|
||||
{
|
||||
KConfigGroup globalAppletConfig;
|
||||
const Containment *c = actAsContainment() ? dynamic_cast<const Containment*>(this) : containment();
|
||||
QString group = actAsContainment() ? "ContainmentGlobals" : "AppletGlobals";
|
||||
const Containment *c = isContainment() ? dynamic_cast<const Containment*>(this) : containment();
|
||||
QString group = isContainment() ? "ContainmentGlobals" : "AppletGlobals";
|
||||
|
||||
if (c && c->corona()) {
|
||||
KSharedConfig::Ptr coronaConfig = c->corona()->config();
|
||||
@ -932,7 +932,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
setBackgroundHints(d->backgroundHints^ShadowedBackground);
|
||||
}
|
||||
|
||||
if (!actAsContainment() && f != Vertical && f != Horizontal) {
|
||||
if (!isContainment() && f != Vertical && f != Horizontal) {
|
||||
setBackgroundHints(d->backgroundHints|StandardBackground);
|
||||
} else {
|
||||
setBackgroundHints(d->backgroundHints^StandardBackground);
|
||||
@ -968,7 +968,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
}
|
||||
|
||||
Containment* containment = qobject_cast<Plasma::Containment*>(this);
|
||||
if (actAsContainment() && containment) {
|
||||
if (isContainment() && containment) {
|
||||
containment->d->containmentConstraintsEvent(c);
|
||||
}
|
||||
|
||||
@ -986,7 +986,7 @@ int Applet::type() const
|
||||
|
||||
QPainterPath Applet::shape() const
|
||||
{
|
||||
if (actAsContainment()) {
|
||||
if (isContainment()) {
|
||||
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));
|
||||
}
|
||||
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
|
||||
View* v = qobject_cast<Plasma::View*>(widget->parent());
|
||||
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
|
||||
* returns zero in the case that this is a containment itself.
|
||||
* if (actAsContainment()) {
|
||||
* if (isContainment()) {
|
||||
return dynamic_cast<Containment*>(const_cast<Applet*>(this));
|
||||
}
|
||||
*/
|
||||
@ -1070,7 +1070,7 @@ Containment* Applet::containment() const
|
||||
|
||||
while (parent) {
|
||||
Containment *possibleC = dynamic_cast<Containment*>(parent);
|
||||
if (possibleC && possibleC->actAsContainment()) {
|
||||
if (possibleC && possibleC->isContainment()) {
|
||||
c = possibleC;
|
||||
break;
|
||||
}
|
||||
@ -1182,7 +1182,7 @@ void Applet::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
QGraphicsItem *parent = parentItem();
|
||||
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.
|
||||
QPointF curPos = event->pos();
|
||||
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);
|
||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
|
||||
|
||||
bool actAsContainment = false;
|
||||
bool isContainment = false;
|
||||
if (offers.isEmpty()) {
|
||||
//TODO: what would be -really- cool is offer to try and download the applet
|
||||
// from the network at this point
|
||||
offers = KServiceTypeTrader::self()->query("Plasma/Containment", constraint);
|
||||
actAsContainment = true;
|
||||
isContainment = true;
|
||||
if (offers.isEmpty()) {
|
||||
kDebug() << "offers is empty for " << appletName;
|
||||
return 0;
|
||||
@ -1377,7 +1377,7 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
|
||||
|
||||
if (!offer->property("X-Plasma-Language").toString().isEmpty()) {
|
||||
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 Applet(0, offer->storageId(), appletId);
|
||||
@ -1472,13 +1472,13 @@ void Applet::lower()
|
||||
setZValue(--Private::s_minZValue);
|
||||
}
|
||||
|
||||
void Applet::setActAsContainment(bool actAsContainment)
|
||||
void Applet::setIsContainment(bool isContainment)
|
||||
{
|
||||
if (d->actAsContainment == actAsContainment) {
|
||||
if (d->isContainment == isContainment) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->actAsContainment = actAsContainment;
|
||||
d->isContainment = isContainment;
|
||||
|
||||
Containment *c = qobject_cast<Containment*>(this);
|
||||
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()
|
||||
|
4
applet.h
4
applet.h
@ -436,7 +436,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
/**
|
||||
* @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
|
||||
@ -625,7 +625,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
/**
|
||||
* 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.
|
||||
|
@ -196,7 +196,7 @@ void Containment::setContainmentType(Containment::Type type)
|
||||
{
|
||||
d->type = type;
|
||||
|
||||
if (actAsContainment() && type == DesktopContainment) {
|
||||
if (isContainment() && type == DesktopContainment) {
|
||||
if (!d->toolBox) {
|
||||
QGraphicsWidget *addWidgetTool = addToolBoxTool("addwidgets", "list-add", i18n("Add Widgets"));
|
||||
connect(addWidgetTool, SIGNAL(clicked()), this, SLOT(triggerShowAddWidgets()));
|
||||
@ -218,7 +218,7 @@ void Containment::setContainmentType(Containment::Type type)
|
||||
connect(activityTool, SIGNAL(clicked()), this, SLOT(addSiblingContainment()));
|
||||
}
|
||||
|
||||
} else if (actAsContainment() && type == PanelContainment) {
|
||||
} else if (isContainment() && type == PanelContainment) {
|
||||
if (!d->toolBox) {
|
||||
d->createToolBox();
|
||||
d->toolBox->setSize(22);
|
||||
@ -238,7 +238,7 @@ Corona* Containment::corona() const
|
||||
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
{
|
||||
//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);
|
||||
return;
|
||||
}
|
||||
@ -253,7 +253,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
|
||||
while (item) {
|
||||
applet = qgraphicsitem_cast<Applet*>(item);
|
||||
if (applet && !applet->actAsContainment()) {
|
||||
if (applet && !applet->isContainment()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ void Containment::setFormFactor(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
|
||||
d->positionPanel(true);
|
||||
}
|
||||
@ -434,7 +434,7 @@ void Containment::createLayout(FormFactor formFactor)
|
||||
|
||||
FormFactor Containment::formFactor() const
|
||||
{
|
||||
if (actAsContainment()) {
|
||||
if (isContainment()) {
|
||||
return d->formFactor;
|
||||
}
|
||||
|
||||
@ -800,7 +800,7 @@ QVariant Containment::itemChange(GraphicsItemChange change, const QVariant &valu
|
||||
{
|
||||
Q_UNUSED(value)
|
||||
|
||||
if (actAsContainment() &&
|
||||
if (isContainment() &&
|
||||
(change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemPositionHasChanged) &&
|
||||
!d->positioning) {
|
||||
switch (containmentType()) {
|
||||
@ -970,7 +970,7 @@ void Containment::Private::setLockToolText()
|
||||
|
||||
void Containment::Private::containmentConstraintsEvent(Plasma::Constraints constraints)
|
||||
{
|
||||
if (!q->actAsContainment()) {
|
||||
if (!q->isContainment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -120,12 +120,12 @@ public:
|
||||
containments.removeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void syncConfig()
|
||||
{
|
||||
q->config()->sync();
|
||||
}
|
||||
|
||||
|
||||
Containment* addContainment(const QString& name, const QVariantList& args, uint id, bool delayedInit)
|
||||
{
|
||||
QString pluginName = name;
|
||||
@ -154,7 +154,7 @@ public:
|
||||
containment->setFormFactor(Plasma::Planar);
|
||||
}
|
||||
|
||||
containment->setActAsContainment(true);
|
||||
containment->setIsContainment(true);
|
||||
|
||||
if (!delayedInit) {
|
||||
q->addItem(containment);
|
||||
|
Loading…
Reference in New Issue
Block a user