From 47a403a9c88e6ad471ced285185e8bb3a5bbd7f8 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 24 Feb 2012 05:40:00 +0100 Subject: [PATCH] * Update social actions everytime you open the contextual menu of a track. --- src/audiocontrols.cpp | 10 ++++++++-- src/libtomahawk/contextmenu.cpp | 1 + src/libtomahawk/query.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/audiocontrols.cpp b/src/audiocontrols.cpp index a5baeb916..f6211ca06 100644 --- a/src/audiocontrols.cpp +++ b/src/audiocontrols.cpp @@ -277,10 +277,16 @@ void AudioControls::onSocialActionsLoaded() { Query* query = qobject_cast< Query* >( sender() ); - if ( !query || query != m_currentTrack->toQuery().data() ) + if ( !query ) return; - setSocialActions(); + query_ptr currentQuery = m_currentTrack->toQuery(); + if ( query->artist() == currentQuery->artist() && + query->track() == currentQuery->track() && + query->album() == currentQuery->album() ) + { + setSocialActions(); + } } diff --git a/src/libtomahawk/contextmenu.cpp b/src/libtomahawk/contextmenu.cpp index 558b9cb29..de5122a05 100644 --- a/src/libtomahawk/contextmenu.cpp +++ b/src/libtomahawk/contextmenu.cpp @@ -88,6 +88,7 @@ ContextMenu::setQueries( const QList& queries ) m_sigmap->setMapping( m_loveAction, ActionLove ); connect( queries.first().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) ); + m_queries.first()->loadSocialActions(); onSocialActionsLoaded(); } diff --git a/src/libtomahawk/query.cpp b/src/libtomahawk/query.cpp index 8df9cd6f7..40eb1d515 100644 --- a/src/libtomahawk/query.cpp +++ b/src/libtomahawk/query.cpp @@ -489,7 +489,7 @@ Query::loadSocialActions() query_ptr q = m_ownRef.toStrongRef(); DatabaseCommand_LoadSocialActions* cmd = new DatabaseCommand_LoadSocialActions( q ); - connect( cmd, SIGNAL( finished() ), SLOT( onSocialActionsLoaded() )); + connect( cmd, SIGNAL( finished() ), SLOT( onSocialActionsLoaded() ) ); Database::instance()->enqueue( QSharedPointer(cmd) ); }