From e73525f18d47abbbdb37a9e14b2b818841b5f59a Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Thu, 17 Jul 2014 00:59:53 +0100 Subject: [PATCH] The result is independent from the online state of the Collection --- src/libtomahawk/Result.cpp | 9 ++++++--- src/libtomahawk/Result.h | 7 ++++++- src/libtomahawk/database/DatabaseCommand_AllTracks.cpp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/Result.cpp b/src/libtomahawk/Result.cpp index d9712d2ed..d67d53ca8 100644 --- a/src/libtomahawk/Result.cpp +++ b/src/libtomahawk/Result.cpp @@ -281,11 +281,14 @@ Result::onOffline() void -Result::setCollection( const Tomahawk::collection_ptr& collection ) +Result::setCollection( const Tomahawk::collection_ptr& collection , bool emitOnlineEvents ) { m_collection = collection; - connect( m_collection->source().data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection ); - connect( m_collection->source().data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection ); + if ( emitOnlineEvents ) + { + connect( m_collection->source().data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection ); + connect( m_collection->source().data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection ); + } } void diff --git a/src/libtomahawk/Result.h b/src/libtomahawk/Result.h index acaedbc14..61efc9c82 100644 --- a/src/libtomahawk/Result.h +++ b/src/libtomahawk/Result.h @@ -92,7 +92,12 @@ public: void setScore( float score ); void setFileId( unsigned int id ); void setRID( RID id ) { m_rid = id; } - void setCollection( const Tomahawk::collection_ptr& collection ); + /** + * Associate the used collection for this result. + * + * @param emitOnlineEvents disableing this will not emit statusChanged anymore thus the query will not update (use with care!, only when this is the sole result) + */ + void setCollection( const Tomahawk::collection_ptr& collection, bool emitOnlineEvents = true ); void setFriendlySource( const QString& s ); void setPurchaseUrl( const QString& u ); void setLinkUrl( const QString& u ); diff --git a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp index 7b0edc53c..f3f605add 100644 --- a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp +++ b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp @@ -155,7 +155,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi ) result->setModificationTime( modificationTime ); result->setMimetype( mimetype ); result->setScore( 1.0 ); - result->setCollection( s->dbCollection() ); + result->setCollection( s->dbCollection(), false ); QList results; results << result;