Commit 75ef8af9 authored by Michael Pyne's avatar Michael Pyne

Move the cover drop functionality to a more appropriate spot, and correct the

handling of dropped covers.  Now you can drop a cover onto an item that isn't
selected and JuK will behave correctly.  Dropping a cover onto a selected
item will still apply the cover to all selected items in the playlist.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=433502
parent 9d9cda29
......@@ -1050,20 +1050,6 @@ bool Playlist::canDecode(QMimeSource *s)
void Playlist::decode(QMimeSource *s, PlaylistItem *item)
{
KURL::List urls;
coverKey id;
if(CoverDrag::decode(s, id)) {
// Apply cover to selected items.
PlaylistItemList selItems = selectedItems();
for(PlaylistItemList::Iterator it = selItems.begin(); it != selItems.end(); ++it) {
(*it)->file().coverInfo()->setCoverId(id);
(*it)->refresh();
}
return;
}
if(!KURLDrag::decode(s, urls) || urls.isEmpty())
return;
......@@ -1156,6 +1142,30 @@ void Playlist::contentsDropEvent(QDropEvent *e)
QPoint vp = contentsToViewport(e->pos());
PlaylistItem *item = static_cast<PlaylistItem *>(itemAt(vp));
// First see if we're dropping a cover, if so we can get it out of the
// way early.
if(item && CoverDrag::canDecode(e)) {
coverKey id;
CoverDrag::decode(e, id);
// If the item we dropped on is selected, apply cover to all selected
// items, otherwise just apply to the dropped item.
if(item->isSelected()) {
PlaylistItemList selItems = selectedItems();
for(PlaylistItemList::Iterator it = selItems.begin(); it != selItems.end(); ++it) {
(*it)->file().coverInfo()->setCoverId(id);
(*it)->refresh();
}
}
else {
item->file().coverInfo()->setCoverId(id);
item->refresh();
}
return;
}
// When dropping on the upper half of an item, insert before this item.
// This is what the user expects, and also allows the insertion at
// top of the list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment