don't use Applet::extender(); we're friends, after all

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=862087
This commit is contained in:
Aaron J. Seigo 2008-09-18 02:44:08 +00:00
parent c5fe5cb285
commit 0ae78795da
2 changed files with 13 additions and 10 deletions

View File

@ -79,11 +79,12 @@ QList<ExtenderItem*> Extender::items() const
{
QList<ExtenderItem*> result;
//FIXME: a triple nested loop ... ew. there should be a more efficient way to do this
//iterate through all extenders we can find and check each extenders source applet.
foreach (Containment *c, d->applet->containment()->corona()->containments()) {
foreach (Applet *applet, c->applets()) {
if (applet->extender()) {
foreach (ExtenderItem *item, applet->extender()->attachedItems()) {
if (applet->d->extender) {
foreach (ExtenderItem *item, applet->d->extender->attachedItems()) {
if (item->sourceAppletId() == d->applet->id()) {
result.append(item);
}

View File

@ -358,7 +358,7 @@ ExtenderItem::~ExtenderItem()
KConfigGroup ExtenderItem::config() const
{
KConfigGroup cg = extender()->d->applet->config("ExtenderItems");
KConfigGroup cg = d->extender->d->applet->config("ExtenderItems");
return KConfigGroup(&cg, QString::number(d->extenderItemId));
}
@ -787,9 +787,10 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Extender *targetExtender = 0;
foreach (Containment *containment, corona->containments()) {
foreach (Applet *applet, containment->applets()) {
if (applet->extender() && (applet->sceneBoundingRect().contains(mousePos)
|| applet->extender()->sceneBoundingRect().contains(mousePos))) {
targetExtender = applet->extender();
if (applet->d->extender &&
(applet->sceneBoundingRect().contains(mousePos) ||
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
targetExtender = applet->d->extender;
//check if we're hovering over an popupapplet, and open it up in case it does.
PopupApplet *popupApplet = qobject_cast<PopupApplet*>(applet);
@ -870,9 +871,10 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
foreach (Containment *containment, corona->containments()) {
foreach (Applet *applet, containment->applets()) {
if (applet->extender() && (applet->sceneBoundingRect().contains(mousePos)
|| applet->extender()->sceneBoundingRect().contains(mousePos))) {
targetExtender = applet->extender();
if (applet->d->extender &&
(applet->sceneBoundingRect().contains(mousePos) ||
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
targetExtender = applet->d->extender;
}
}
}
@ -894,7 +896,7 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Applet *applet = containment->addApplet("internal:extender",
QVariantList(),
QRectF(mousePos, size()));
setExtender(applet->extender());
setExtender(applet->d->extender);
}
}
}