Possible drag and drop actions for KURLDrag

David Faure faure at kde.org
Fri Oct 15 23:29:51 BST 2004

On Saturday 16 October 2004 00:16, Wilco Greven wrote:
> Op vrijdag 15 oktober 2004 22:40, schreef David Faure:
> > On Friday 15 October 2004 21:59, Wilco Greven wrote:
> > > Hello,
> > >
> > > I've implemented dragging covers from amarok's cover manager. I'm using
> > > KURLDrag (and also QImageDrag) so it's possible to drag the file
> > > containing the cover image to Konqueror. But the file should be
> > > considered as a kind of private data. So while it's ok to copy the file,
> > > it shouldn't be possible to move it.
> > >
> > > I couldn't find a way to specify this in the KURLDrag. Is there a way to
> > > do this? Or is there another solution? The only thing I can think of is
> > > to make a copy of the orginal file and offer that in the dragobject.
> >
> > Tried QDragObject::dragCopy() ?
> Yes, I tried reimplementing QIconView::startDrag() and starting the drag with 
> dragCopy(). But Konqueror still provides the move option, and it will move 
> the file when the option is chosen.

Hmm, indeed konqueror doesn't check this. It sounds like a missing QDropEvent
(or XDND) feature. If we check QDropEvent::action() then we would never offer
copy/move/link, since action() is always one of those, never "unknown, let the user choose".
QDropEvent seems to think that the source always decides on the action, never
the destination, and konqueror wants to do exactly the opposite.

It sounds to me like you shouldn't use KURLDrag at all. We support drops
of "any kind of data" on konqueror and kdesktop. You should see a "File name for
dropped contents" dialog asking you for the filename.

If your problem is that you don't want to see this dialog, then we could add support
for a "suggested filename" in the dragobject, as a separate kde-specific mimetype
(like we do for x-kde-cutselection in konq_drag.cc).

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list