mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Only accept spotify tracks by default
This commit is contained in:
@@ -726,7 +726,7 @@ GlobalActionManager::mimeTypes() const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GlobalActionManager::acceptsMimeData( const QMimeData* data )
|
GlobalActionManager::acceptsMimeData( const QMimeData* data, bool tracksOnly )
|
||||||
{
|
{
|
||||||
if ( data->hasFormat( "application/tomahawk.query.list" )
|
if ( data->hasFormat( "application/tomahawk.query.list" )
|
||||||
|| data->hasFormat( "application/tomahawk.plentry.list" )
|
|| data->hasFormat( "application/tomahawk.plentry.list" )
|
||||||
@@ -735,8 +735,9 @@ GlobalActionManager::acceptsMimeData( const QMimeData* data )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// crude check for spotify data
|
// crude check for spotify tracks
|
||||||
if ( data->hasFormat( "text/plain" ) && data->data( "text/plain" ).contains( "spotify" ) )
|
if ( data->hasFormat( "text/plain" ) && data->data( "text/plain" ).contains( "spotify" ) &&
|
||||||
|
( tracksOnly ? data->data( "text/plain" ).contains( "track" ) : true ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -754,7 +755,7 @@ GlobalActionManager::tracksFromMimeData( const QMimeData* data )
|
|||||||
{
|
{
|
||||||
QString plainData = QString::fromUtf8( data->data( "text/plain" ).constData() );
|
QString plainData = QString::fromUtf8( data->data( "text/plain" ).constData() );
|
||||||
tDebug() << "Got text/plain mime data:" << data->data( "text/plain" ) << "decoded to:" << plainData;
|
tDebug() << "Got text/plain mime data:" << data->data( "text/plain" ) << "decoded to:" << plainData;
|
||||||
if( plainData.contains( "open.spotify.com") ||
|
if( plainData.contains( "open.spotify.com/track") ||
|
||||||
plainData.contains( "spotify:track" ) )
|
plainData.contains( "spotify:track" ) )
|
||||||
{
|
{
|
||||||
QStringList tracks = plainData.split( "\n" );
|
QStringList tracks = plainData.split( "\n" );
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Connect to tracks( QList< query_ptr> ); for the extracted tracks.
|
* Connect to tracks( QList< query_ptr> ); for the extracted tracks.
|
||||||
*/
|
*/
|
||||||
bool acceptsMimeData( const QMimeData* data );
|
bool acceptsMimeData( const QMimeData* data, bool tracksOnly = true );
|
||||||
void tracksFromMimeData( const QMimeData* data );
|
void tracksFromMimeData( const QMimeData* data );
|
||||||
QStringList mimeTypes() const;
|
QStringList mimeTypes() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user