1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Create a new playlist from a spotify playlist if dropped anywhere on the sourcetree

Only generate the tracks directly if dragged into a playlist contents
This commit is contained in:
Leo Franchi 2011-09-15 21:38:08 -04:00
parent bf009c8854
commit 5b48442006
4 changed files with 11 additions and 2 deletions

View File

@ -370,6 +370,9 @@ DropJob::handleXspf( const QString& fileUrl )
{
tDebug() << Q_FUNC_INFO << "Got xspf playlist!!" << fileUrl;
if ( dropAction() == Default )
setDropAction( Create );
// Doing like so on *nix, dont know really how files are
// passed on others.
// TODO look in to!
@ -395,6 +398,9 @@ DropJob::handleSpPlaylist( const QString& url )
playlistUri = "spotify:" + playlistUri;
}
if ( dropAction() == Default )
setDropAction( Create );
tDebug() << "Got a spotify playlist uri in dropjob!" << playlistUri;
SpotifyParser* spot = new SpotifyParser( playlistUri, dropAction() == Create, this );

View File

@ -56,7 +56,8 @@ public:
Q_DECLARE_FLAGS(DropTypes, DropType)
enum DropAction {
Append = 0,
Default = 0,
Append,
Create
};

View File

@ -366,6 +366,8 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
m_dropStorage.parent = QPersistentModelIndex( parent );
m_dropStorage.action = action;
DropJob *dj = new DropJob();
dj->setDropAction( DropJob::Append );
connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), this, SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) );
dj->tracksFromMimeData( data );

View File

@ -529,7 +529,7 @@ SourceTreeView::dropEvent( QDropEvent* event )
}
else
{
// In current event, parse sourceTreeView mime instead of playlistitems
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
qDebug() << Q_FUNC_INFO << "Current Event";
DropJob *dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );