[Patch+Problem] Enabling drag&drop from the albums applet

Andreas Mützel andreas.muetzel at gmx.net
Fri Oct 10 23:58:48 CEST 2008


Hi,

i'm trying to implement dragging functions in the albums applet so that you 
can drag albums and/or songs to the playlist from there. 

It's almost working but one issue prevents me from finishing the work: If i 
simply enable dragging in the albums applet the dragged items won't be 
recognized by the playlist because of the missing mimedata, so i wrote an 
AlbumsModel that should take care of this. 
That seems to work, but there is a strange problem with the treeview in the 
albums applet: 
If you drag something, qt/amarok/whatever seems to request the mime data of 
the parent entry. I.e. if you drag an album to the playlist nothing happens 
but if you drag a single track to the playlist the whole album is added.

My work up to this point is attached as a patch. 
The file "context/applets/albums/AlbumsModel.cpp" contains debug output that 
tells you whether mime data for a TrackItem or an AlbumItem is requested so 
you can verify that mime data for the parent entry seems to be fetched.

Has anybody already experienced a similar problem when doing drag&drop from a 
treeview?

I'm posting this because i hope that someone knows a solution for this or that 
it could be useful for someone who wants to work on the dragging stuff (to 
avoid duplicate effort etc.).

Regards,
Andreas

P.s.: This patch is not really good from a usability point of view, for 
example if it worked and you selected an album and some tracks of it the 
complete album + the selected tracks would be added to the playlist, 
resulting in duplicate entries. 
I'm not sure if my problem has an easy fix so i didn't want to waste my time 
on writing code that possibly would be useless because a completely different 
approach could be needed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: albumapplet_drag.patch
Type: text/x-diff
Size: 8457 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20081010/957858dc/attachment.bin 


More information about the Amarok-devel mailing list