mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Set collection on (non-collection) search/resolve results if collectionId is set in script response
This commit is contained in:
@@ -590,6 +590,28 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
|
|||||||
}
|
}
|
||||||
|
|
||||||
rp->setResolvedBy( this );
|
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;
|
results << rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user