From 2035c3e7f52e4003e9707889330d4d3af1349f4a Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 15 Jul 2012 12:51:19 +0100 Subject: [PATCH] Fix a bug where dragging songs to the bottom of the playlist would actually move them back to the top. --- src/playlist/playlist.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 4f07472b7..b092de62c 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -707,9 +707,9 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action, int ro stream.readRawData(reinterpret_cast(&source_playlist), sizeof(source_playlist)); stream >> source_rows; if (!stream.atEnd()) { - stream.readRawData((char*)&pid, sizeof(pid)); + stream.readRawData((char*)&pid, sizeof(pid)); } else { - pid = ! own_pid; + pid = ! own_pid; } qStableSort(source_rows); // Make sure we take them in order @@ -791,6 +791,10 @@ void Playlist::MoveItemsWithoutUndo(const QList& source_rows, int pos) { layoutAboutToBeChanged(); PlaylistItemList moved_items; + if (pos < 0) { + pos = items_.count(); + } + // Take the items out of the list first, keeping track of whether the // insertion point changes int offset = 0; @@ -802,10 +806,6 @@ void Playlist::MoveItemsWithoutUndo(const QList& source_rows, int pos) { } offset++; } - - if (pos < 0) { - pos = items_.count(); - } // Put the items back in for (int i=start ; i