Playlist reordering works only if you press-n-hold, drag and drop a media item downwards. If you do so upwards, the order remains the same.
Steps to Reproduce:
1. Add more than 2 songs to playlist
2. Drag song1 below song2
song1 remains in its original position
song1 should go below song2 and the order should become
Created attachment 82410 [details]
this is a patch to the /plasma-media-center/libs/mediacenter/playlistmodel.cpp
the drag and drop feature worked only in one direction. I fixed the bug.
now the drag and drop feature is complete.
Thanks for the patch. However, in the following code-
void PlaylistModel::moveItem(int firstIndex, int secondIndex)
emit dataChanged(createIndex(firstIndex, 0), createIndex(secondIndex, 0));
the call to d->musicList.move is there to avoid calling beginResetModel() and endResetModel(). This is because reset'ing a model is expensive, and instead we should only call move.
My guess is that during upwards, the move() method works fine, but dataChanged() is somehow not working. Try to figure out why (maybe look at the values passed to dataChanged and whats the difference between upwards and downwards).
Created attachment 82411 [details]
in case my patch dosnt work, replace the /plasma-media-center/libs/mediacenter/playlistmodel.cpp file with this.
PS: as i said i am very new to open source so please excuse my amature behavior.
So as I mentioned, don't use reset and instead use dataChanged (as its already there). I think the problem is that lets say you pass firstIndex, secondIndex to dataChanged, it works only if firstIndex < secondIndex. I suspect that when reordering upwards, firstIndex becomes greater than secondIndex and hence the problem. Try putting a if condition when this happens and in that case reverse the order of firstIndex and secondIndex when calling dataChanged.
If it works, instead of adding a patch here, create a new review request at http://git.reviewboard.kde.org/ and upload your patch there. Add "plasma" in the group and publish your review. Then we can take a look at your patch :)
Git commit 86f20ec9a746efb0add1de56e44bc5064de45a53 by Shantanu Tushar.
Committed on 06/03/2014 at 14:18.
Pushed by shantanu into branch 'master'.
Make playlist reordering work both the ways.
Patch by Ashish Madeti <firstname.lastname@example.org>
Welcome to KDE :)
M +5 -1 libs/mediacenter/playlistmodel.cpp