Version: (using KDE KDE 3.2.2) Installed from: Unlisted Binary Package OS: Linux Try to drag a shortcut from the Kmenu to the desktop and that Kmenu wont go down automatically. You have to do it manually afterwards :(
This same behavior occurs for me in KDE 3.3alpha1. I'm not sure this is necessarily the wrong behavior, though.
*** Bug 83318 has been marked as a duplicate of this bug. ***
*** Bug 85382 has been marked as a duplicate of this bug. ***
Created attachment 9044 [details] kmenu-close-after-drop.patch
Created attachment 9072 [details] kmenu-close-after-drop.patch Improved patch. Respects accidental drags. Also solves http://bugs.kde.org/show_bug.cgi?id=88940.
Okay, I've polished the patch respecting the coding style. Instead of creating a new attachment and mess this report up you can mail me if you're interested.
CVS commit by aseigo: close menus after dragging items out of them patch graciously contributed by Stefan Nikolaus BUG:81438 BUG:88940 CCMAIL: stefan.nikolaus@stuco.uni-oldenburg.de M +9 -0 browser_mnu.cpp 1.67 M +1 -0 browser_mnu.h 1.17 M +31 -2 service_mnu.cpp 1.90 M +3 -0 service_mnu.h 1.36 --- kdebase/kicker/ui/browser_mnu.cpp #1.66:1.67 @@ -399,8 +399,17 @@ void PanelBrowserMenu::mouseMoveEvent(QM KURL::List files(url); KURLDrag *d = new KURLDrag(files, this); + connect(d, SIGNAL(destroyed()), this, SLOT(slotDragObjectDestroyed())); d->setPixmap(iconSet(id)->pixmap()); d->drag(); } +void PanelBrowserMenu::slotDragObjectDestroyed() +{ + if (KURLDrag::target() != this) + { + close(); + } +} + void PanelBrowserMenu::dragEnterEvent( QDragEnterEvent *ev ) { --- kdebase/kicker/ui/browser_mnu.h #1.16:1.17 @@ -51,4 +51,5 @@ protected slots: void slotClearIfNeeded(const QString&); void slotClear(); + void slotDragObjectDestroyed(); protected: --- kdebase/kicker/ui/service_mnu.cpp #1.89:1.90 @@ -693,8 +693,7 @@ void PanelServiceMenu::mouseMoveEvent(QM KURLDrag *d = new KURLDrag(KURL::List(url), this); - + connect(d, SIGNAL(destroyed()), this, SLOT(slotDragObjectDestroyed())); d->setPixmap(icon); d->dragCopy(); - //close(); // Set the startposition outside the panel, so there is no drag initiated @@ -704,4 +703,34 @@ void PanelServiceMenu::mouseMoveEvent(QM } +void PanelServiceMenu::dragEnterEvent(QDragEnterEvent *event) +{ + // Set the DragObject's target to this widget. This is needed because the + // widget doesn't accept drops, but we want to determine if the drag object + // is dropped on it. This avoids closing on accidental drags. If this + // widget accepts drops in the future, these lines can be removed. + if (event->source() == this) + { + KURLDrag::setTarget(this); + } + event->ignore(); +} + +void PanelServiceMenu::dragLeaveEvent(QDragLeaveEvent */*event*/) +{ + // see PanelServiceMenu::dragEnterEvent why this is nescessary + if (!frameGeometry().contains(QCursor::pos())) + { + KURLDrag::setTarget(0); + } +} + +void PanelServiceMenu::slotDragObjectDestroyed() +{ + if (KURLDrag::target() != this) + { + close(); + } +} + PanelServiceMenu *PanelServiceMenu::newSubMenu(const QString & label, const QString & relPath, QWidget * parent, const char * name) --- kdebase/kicker/ui/service_mnu.h #1.35:1.36 @@ -76,4 +76,5 @@ protected slots: virtual void configChanged(); virtual void slotClose(); + void slotDragObjectDestroyed(); protected: @@ -84,4 +85,6 @@ protected: virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseMoveEvent(QMouseEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); void activateParent(const QString &child);