Add PopupConstraintEvent, tells popupapplets (and applets with popups)

that the position has to be changed

svn path=/trunk/KDE/kdelibs/; revision=1019486
This commit is contained in:
Marco Martin 2009-09-03 18:11:49 +00:00
parent 9939b688c3
commit acfd2a83fa
4 changed files with 10 additions and 15 deletions

View File

@ -2102,19 +2102,6 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
delete old;
}
}
Plasma::PopupApplet *pa = qobject_cast<Plasma::PopupApplet *>(this);
if (pa) {
//reconnect of popupapplets with new containment geometryChanged
if (c) {
disconnect(containment(), SIGNAL(geometryChanged()), pa, SLOT(updateDialogPosition()));
}
Plasma::Containment *cont = dynamic_cast<Containment*>(value.value<QGraphicsItem *>());
if (cont) {
connect(cont, SIGNAL(geometryChanged()), pa, SLOT(updateDialogPosition()));
}
}
}
break;
case ItemPositionChange:

View File

@ -56,9 +56,11 @@ enum Constraint {
/** application startup has completed */
StartupCompletedConstraint = 32,
/** the desktop context has changed */
ContextConstraint = 64,
ContextConstraint = 64,
/** the position of the popup needs to be recalculated*/
PopupConstraint = 128,
AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint |
SizeConstraint | ImmutableConstraint | ContextConstraint
SizeConstraint | ImmutableConstraint | ContextConstraint | PopupConstraint
};
Q_DECLARE_FLAGS(Constraints, Constraint)

View File

@ -342,6 +342,11 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
q->setMinimumSize(0,0);
}
}
if (dialog && constraints & Plasma::PopupConstraint) {
updateDialogPosition();
}
emit q->sizeHintChanged(Qt::PreferredSize);
}

View File

@ -350,6 +350,7 @@ void View::configNeedsSaving() const
}
}
int View::id() const
{
return d->viewId;