1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 13:01:53 +02:00

Set collection on (non-collection) search/resolve results if collectionId is set in script response

This commit is contained in:
Dominik Schmidt 2014-12-06 15:11:57 +01:00
parent 62731c7907
commit b59c272819

View File

@ -590,6 +590,28 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
}
rp->setResolvedBy( this );
// find collection
const QString collectionId = m.value( "collectionId" ).toString();
if ( !collectionId.isEmpty() )
{
Tomahawk::collection_ptr collection = Tomahawk::collection_ptr();
foreach ( const Tomahawk::collection_ptr& coll, collections() )
{
Tomahawk::ScriptCollection* scriptCollection = qobject_cast<Tomahawk::ScriptCollection*>( coll.data() );
Q_ASSERT( scriptCollection );
if ( scriptCollection->id() == collectionId )
{
collection = coll;
}
}
if ( !collection.isNull() )
{
rp->setCollection( collection );
}
}
results << rp;
}