2nd fixed regression! You can now again drop into extenders when hovering over popupapplets.

svn path=/trunk/KDE/kdelibs/; revision=924031
This commit is contained in:
Rob Scheepmaker 2009-02-09 22:10:35 +00:00
parent 6ce839cc08
commit 5105554bc1
2 changed files with 23 additions and 5 deletions

View File

@ -225,6 +225,11 @@ void Extender::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
if (mimeData) {
itemHoverEnterEvent(mimeData->extenderItem());
PopupApplet *popupApplet = qobject_cast<PopupApplet*>(d->applet);
if (popupApplet) {
popupApplet->showPopup();
}
}
}
}
@ -250,9 +255,20 @@ void Extender::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
if (mimeData) {
itemHoverLeaveEvent(mimeData->extenderItem());
//Hide popups when we drag the last item away.
//Some logic to conveniently show/hide popups or applets when logical.
Extender *sourceExtender = mimeData->extenderItem()->d->extender;
//Hide popups when they're not the extender where we started, and we're leaving the
//extender. Use a small timeout here, to avoid accidental hides of extenders we're
//targetting.
PopupApplet *popupApplet = qobject_cast<PopupApplet*>(d->applet);
if (popupApplet && attachedItems().count() < 2) {
if (popupApplet && sourceExtender != this) {
kDebug() << "leaving another extender then the extender we started, so hide the popup.";
popupApplet->showPopup(250);
}
//Hide popups when we drag the last item away.
if (popupApplet && sourceExtender == this && attachedItems().count() < 2) {
kDebug() << "leaving the extender, and there are no more attached items so hide the popup.";
popupApplet->hidePopup();
}
@ -260,7 +276,7 @@ void Extender::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
//Hide empty internal extender containers when we drag the last item away. Avoids having
//an ugly empty applet on the desktop temporarily.
ExtenderApplet *extenderApplet = qobject_cast<ExtenderApplet*>(d->applet);
if (extenderApplet && attachedItems().count() < 2) {
if (extenderApplet && sourceExtender == this && (attachedItems().count() < 2)) {
kDebug() << "leaving the internal extender container, so hide the applet and it's handle.";
extenderApplet->hide();
AppletHandle *handle = qgraphicsitem_cast<AppletHandle*>(extenderApplet->parentItem());

View File

@ -386,8 +386,10 @@ void PopupApplet::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
//we started.
if (d->dialog && !d->dialog->geometry().contains(event->screenPos()) &&
mimeData->extenderItem()->extender() != qobject_cast<Extender*>(graphicsWidget())) {
kDebug() << "leaving the popupApplet, and it's not our starting popupApplet, hiding.";
hidePopup();
//We actually try to hide the popup, with a call to showPopup, with a smal timeout,
//so if the user moves into the popup fast enough, it remains open (the extender
//will call showPopup which will cancel the timeout.
showPopup(250);
}
}
}