1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

TWK-968: Fix PlayableModel/DropJob for mixed mimetype

This commit is contained in:
Leo Franchi
2012-07-13 13:07:32 -04:00
committed by Christian Muehlhaeuser
parent e19423e08f
commit 67d75543e6
2 changed files with 12 additions and 5 deletions

View File

@@ -425,12 +425,18 @@ DropJob::tracksFromMixedData( const QMimeData *data )
QDataStream singleStream( &singleData, QIODevice::WriteOnly );
QMimeData singleMimeData;
if ( mimeType == "application/tomahawk.query.list" || mimeType == "application/tomahawk.result.list" )
if ( mimeType == "application/tomahawk.query.list" )
{
qlonglong query;
stream >> query;
singleStream << query;
}
else if ( mimeType == "application/tomahawk.result.list" )
{
qlonglong result;
stream >> result;
singleStream << result;
}
else if ( mimeType == "application/tomahawk.metadata.album" )
{
QString artist;

View File

@@ -508,6 +508,7 @@ PlayableModel::mimeData( const QModelIndexList &indexes ) const
// Ok... we have to use mixed
resultData.clear();
QDataStream mixedStream( &resultData, QIODevice::WriteOnly );
foreach ( const QModelIndex& i, indexes )
{
if ( i.column() > 0 || indexes.contains( i.parent() ) )
@@ -520,22 +521,22 @@ PlayableModel::mimeData( const QModelIndexList &indexes ) const
if ( !item->artist().isNull() )
{
const artist_ptr& artist = item->artist();
resultStream << QString( "application/tomahawk.metadata.artist" ) << artist->name();
mixedStream << QString( "application/tomahawk.metadata.artist" ) << artist->name();
}
else if ( !item->album().isNull() )
{
const album_ptr& album = item->album();
resultStream << QString( "application/tomahawk.metadata.album" ) << album->artist()->name() << album->name();
mixedStream << QString( "application/tomahawk.metadata.album" ) << album->artist()->name() << album->name();
}
else if ( !item->result().isNull() )
{
const result_ptr& result = item->result();
resultStream << QString( "application/tomahawk.result.list" ) << qlonglong( &result );
mixedStream << QString( "application/tomahawk.result.list" ) << qlonglong( &result );
}
else if ( !item->query().isNull() )
{
const query_ptr& query = item->query();
resultStream << QString( "application/tomahawk.query.list" ) << qlonglong( &query );
mixedStream << QString( "application/tomahawk.query.list" ) << qlonglong( &query );
}
}