Summary: | Playlist reordering works only in one direction | ||
---|---|---|---|
Product: | [Plasma] plasma-mediacenter | Reporter: | Shantanu Tushar <shantanu> |
Component: | Playlist | Assignee: | Sinny Kumari <ksinny> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | NOR | ||
Version: | 1.1.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/plasma-mediacenter/86f20ec9a746efb0add1de56e44bc5064de45a53 | Version Fixed In: | |
Attachments: |
this is a patch to the /plasma-media-center/libs/mediacenter/playlistmodel.cpp
playlistmodel.cpp |
Description
Shantanu Tushar
2013-09-17 17:38:17 UTC
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) { + beginResetModel(); d->musicList.move(firstIndex,secondIndex); + endResetModel(); 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]
playlistmodel.cpp
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.
Hey kaushik, 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 <ashishmadeti@gmail.com> Welcome to KDE :) REVIEW: 116626 M +5 -1 libs/mediacenter/playlistmodel.cpp http://commits.kde.org/plasma-mediacenter/86f20ec9a746efb0add1de56e44bc5064de45a53 |