summaryrefslogtreecommitdiff
path: root/nephilim/plugins/Playlist.py
diff options
context:
space:
mode:
Diffstat (limited to 'nephilim/plugins/Playlist.py')
-rw-r--r--nephilim/plugins/Playlist.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/nephilim/plugins/Playlist.py b/nephilim/plugins/Playlist.py
index b6266cc..72e1d8b 100644
--- a/nephilim/plugins/Playlist.py
+++ b/nephilim/plugins/Playlist.py
@@ -19,7 +19,7 @@ from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import QVariant
from ..plugin import Plugin
-from ..common import MIMETYPES
+from ..common import MIMETYPES, SongsMimeData
class Playlist(Plugin):
# public, const
@@ -82,7 +82,7 @@ class PlaylistWidget(QtGui.QWidget):
# drag&drop
self.viewport().setAcceptDrops(True)
self.setDropIndicatorShown(True)
- self.setDragDropMode(QtGui.QAbstractItemView.DropOnly)
+ self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
columns = self.plugin.settings.value(self.plugin.name + '/columns').toStringList()
self.setColumnCount(len(columns))
@@ -118,8 +118,20 @@ class PlaylistWidget(QtGui.QWidget):
else:
QtGui.QTreeWidget.keyPressEvent(self, event)
+ def mimeData(self, items):
+ data = SongsMimeData()
+ data.set_plistsongs([items[0].id])
+ return data
+
def dropMimeData(self, parent, index, data, action):
- if data.hasFormat(MIMETYPES['songs']):
+ if data.hasFormat(MIMETYPES['plistsongs']):
+ if parent:
+ index = self.indexOfTopLevelItem(parent)
+ elif index >= self.topLevelItemCount():
+ index = self.topLevelItemCount() - 1
+ self.plugin.mpclient.move(data.plistsongs()[0], index)
+ return True
+ elif data.hasFormat(MIMETYPES['songs']):
if parent:
index = self.indexOfTopLevelItem(parent)
self.plugin.mpclient.add(data.songs(), index)