mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 11:04:01 +02:00
TWK-968: Fix PlayableModel/DropJob for mixed mimetype
This commit is contained in:
@@ -425,12 +425,18 @@ DropJob::tracksFromMixedData( const QMimeData *data )
|
|||||||
QDataStream singleStream( &singleData, QIODevice::WriteOnly );
|
QDataStream singleStream( &singleData, QIODevice::WriteOnly );
|
||||||
|
|
||||||
QMimeData singleMimeData;
|
QMimeData singleMimeData;
|
||||||
if ( mimeType == "application/tomahawk.query.list" || mimeType == "application/tomahawk.result.list" )
|
if ( mimeType == "application/tomahawk.query.list" )
|
||||||
{
|
{
|
||||||
qlonglong query;
|
qlonglong query;
|
||||||
stream >> query;
|
stream >> query;
|
||||||
singleStream << query;
|
singleStream << query;
|
||||||
}
|
}
|
||||||
|
else if ( mimeType == "application/tomahawk.result.list" )
|
||||||
|
{
|
||||||
|
qlonglong result;
|
||||||
|
stream >> result;
|
||||||
|
singleStream << result;
|
||||||
|
}
|
||||||
else if ( mimeType == "application/tomahawk.metadata.album" )
|
else if ( mimeType == "application/tomahawk.metadata.album" )
|
||||||
{
|
{
|
||||||
QString artist;
|
QString artist;
|
||||||
|
@@ -451,6 +451,7 @@ PlayableModel::mimeData( const QModelIndexList &indexes ) const
|
|||||||
|
|
||||||
// Ok... we have to use mixed
|
// Ok... we have to use mixed
|
||||||
resultData.clear();
|
resultData.clear();
|
||||||
|
QDataStream mixedStream( &resultData, QIODevice::WriteOnly );
|
||||||
foreach ( const QModelIndex& i, indexes )
|
foreach ( const QModelIndex& i, indexes )
|
||||||
{
|
{
|
||||||
if ( i.column() > 0 || indexes.contains( i.parent() ) )
|
if ( i.column() > 0 || indexes.contains( i.parent() ) )
|
||||||
@@ -463,22 +464,22 @@ PlayableModel::mimeData( const QModelIndexList &indexes ) const
|
|||||||
if ( !item->artist().isNull() )
|
if ( !item->artist().isNull() )
|
||||||
{
|
{
|
||||||
const artist_ptr& artist = item->artist();
|
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() )
|
else if ( !item->album().isNull() )
|
||||||
{
|
{
|
||||||
const album_ptr& album = item->album();
|
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() )
|
else if ( !item->result().isNull() )
|
||||||
{
|
{
|
||||||
const result_ptr& result = item->result();
|
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() )
|
else if ( !item->query().isNull() )
|
||||||
{
|
{
|
||||||
const query_ptr& query = item->query();
|
const query_ptr& query = item->query();
|
||||||
resultStream << QString( "application/tomahawk.query.list" ) << qlonglong( &query );
|
mixedStream << QString( "application/tomahawk.query.list" ) << qlonglong( &query );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user