diff --git a/src/libtomahawk/globalactionmanager.cpp b/src/libtomahawk/globalactionmanager.cpp index 33723a0dd..2bd7b6a35 100644 --- a/src/libtomahawk/globalactionmanager.cpp +++ b/src/libtomahawk/globalactionmanager.cpp @@ -304,12 +304,12 @@ GlobalActionManager::handlePlaylistCommand( const QUrl& url ) tDebug() << "No xspf to load..."; return false; } - QUrl xspf = QUrl( url.queryItemValue( "xspf" ) ); + QUrl xspf = QUrl::fromUserInput( url.queryItemValue( "xspf" ) ); QString title = url.hasQueryItem( "title" ) ? url.queryItemValue( "title" ) : QString(); XSPFLoader* l= new XSPFLoader( true, this ); l->setOverrideTitle( title ); l->load( xspf ); - connect( l, SIGNAL( ok( Tomahawk::playlist_ptr ) ), ViewManager::instance(), SLOT( show( Tomahawk::playlist_ptr ) ) ); + connect( l, SIGNAL( ok( Tomahawk::playlist_ptr ) ), this, SLOT( playlistCreatedToShow( Tomahawk::playlist_ptr) ) ); } else if( parts [ 0 ] == "new" ) { if( !url.hasQueryItem( "title" ) ) { @@ -330,6 +330,22 @@ GlobalActionManager::handlePlaylistCommand( const QUrl& url ) return false; } +void +GlobalActionManager::playlistCreatedToShow( const playlist_ptr& pl ) +{ + connect( pl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistReadyToShow() ) ); + pl->setProperty( "sharedptr", QVariant::fromValue( pl ) ); +} + +void GlobalActionManager::playlistReadyToShow() +{ + playlist_ptr pl = sender()->property( "sharedptr" ).value(); + if ( !pl.isNull() ) + ViewManager::instance()->show( pl ); + + disconnect( sender(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistReadyToShow() ) ); +} + bool GlobalActionManager::handleCollectionCommand( const QUrl& url ) @@ -438,7 +454,7 @@ GlobalActionManager::doQueueAdd( const QStringList& parts, const QList< QPair< Q foreach( pair, queryItems ) { if( pair.first != "url" ) continue; - QUrl track = QUrl::fromUserInput( pair.second ); + QUrl track = QUrl::fromUserInput( pair.second ); //FIXME: isLocalFile is Qt 4.8 if( track.toString().startsWith( "file://" ) ) { // it's local, so we see if it's in the DB and load it if so // TODO diff --git a/src/libtomahawk/globalactionmanager.h b/src/libtomahawk/globalactionmanager.h index 3a0ad3685..a5ae08503 100644 --- a/src/libtomahawk/globalactionmanager.h +++ b/src/libtomahawk/globalactionmanager.h @@ -81,6 +81,8 @@ private slots: void playOrQueueNow( const Tomahawk::query_ptr& ); void playNow( const Tomahawk::query_ptr& ); + void playlistCreatedToShow( const Tomahawk::playlist_ptr& pl ); + void playlistReadyToShow(); private: explicit GlobalActionManager( QObject* parent = 0 ); void doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahawk::query_ptr& q ); diff --git a/src/libtomahawk/utils/xspfloader.cpp b/src/libtomahawk/utils/xspfloader.cpp index ec795f929..08930ac01 100644 --- a/src/libtomahawk/utils/xspfloader.cpp +++ b/src/libtomahawk/utils/xspfloader.cpp @@ -28,6 +28,7 @@ #include "sourcelist.h" #include "playlist.h" #include +#include using namespace Tomahawk; @@ -201,7 +202,7 @@ XSPFLoader::gotBody() continue; } - query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), m_autoResolve ); + query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), false ); q->setDuration( duration.toInt() / 1000 ); if ( !url.isEmpty() ) q->setResultHint( url ); @@ -209,6 +210,12 @@ XSPFLoader::gotBody() m_entries << q; } + if ( m_autoResolve ) + { + for ( int i = m_entries.size() - 1; i >= 0; i-- ) + Pipeline::instance()->resolve( m_entries[ i ] ); + } + if ( origTitle.isEmpty() && m_entries.isEmpty() ) { emit error( ParseError );