1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

Check mimedata source on osx as Qt::DropAction is not reliable. Also, minor cleanups

This commit is contained in:
Leo Franchi
2011-10-02 13:00:50 -04:00
parent 4402bd8f03
commit acfaf3970e
2 changed files with 19 additions and 17 deletions

View File

@@ -367,8 +367,17 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
m_dropStorage.action = action; m_dropStorage.action = action;
DropJob* dj = new DropJob(); DropJob* dj = new DropJob();
// On mac, drags from outside the app are still Qt::MoveActions instead of Qt::CopyAction by default
// so check if the drag originated in this playlist to determine whether or not to copy
#ifdef Q_WS_MAC
if ( !data->hasFormat( "application/tomahawk.playlist.id" ) ||
data->data( "application/tomahawk.playlist.id" ) != m_playlist->guid() )
dj->setDropAction( DropJob::Append );
#else
if ( action & Qt::CopyAction ) if ( action & Qt::CopyAction )
dj->setDropAction( DropJob::Append ); dj->setDropAction( DropJob::Append );
#endif
connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), this, SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) ); connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), this, SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) );
dj->tracksFromMimeData( data ); dj->tracksFromMimeData( data );

View File

@@ -108,7 +108,7 @@ SpotifyParser::lookupSpotifyBrowse( const QString& link )
if ( link.contains( "spotify:track" ) ) if ( link.contains( "spotify:track" ) )
type = DropJob::Track; type = DropJob::Track;
m_browseJob = new DropJobNotifier( pixmap(), QString( "Spotify" ).arg( (int)type ), type, reply ); m_browseJob = new DropJobNotifier( pixmap(), "Spotify", type, reply );
JobStatusView::instance()->model()->addJob( m_browseJob ); JobStatusView::instance()->model()->addJob( m_browseJob );
m_queries.insert( reply ); m_queries.insert( reply );
@@ -165,19 +165,12 @@ SpotifyParser::spotifyBrowseFinished()
checkTrackFinished(); checkTrackFinished();
return; return;
} }
else if ( res.contains( "trackCount" ) && res.value( "trackCount" ).toInt() < 0 )
{
tLog() << "No tracks' item in the spotify browse result... not doing anything";
checkTrackFinished();
return;
}
QVariantMap resultResponse = res.value( res.value( "type" ).toString() ).toMap(); QVariantMap resultResponse = res.value( res.value( "type" ).toString() ).toMap();
if ( !resultResponse.isEmpty() ) if ( !resultResponse.isEmpty() )
{ {
m_title = resultResponse.value( "name" ).toString(); m_title = resultResponse.value( "name" ).toString();
m_single = false; m_single = false;