From 363becf9b9e67156b86fe22d45c64ecaae754f8b Mon Sep 17 00:00:00 2001
From: Christian Muehlhaeuser <muesli@gmail.com>
Date: Thu, 28 Jun 2012 20:14:11 +0200
Subject: [PATCH] * Show correct context menus for album / artist QueryLabels.

---
 src/libtomahawk/widgets/QueryLabel.cpp | 29 ++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/libtomahawk/widgets/QueryLabel.cpp b/src/libtomahawk/widgets/QueryLabel.cpp
index 7671ab87a..dd353c824 100644
--- a/src/libtomahawk/widgets/QueryLabel.cpp
+++ b/src/libtomahawk/widgets/QueryLabel.cpp
@@ -92,7 +92,7 @@ QueryLabel::init()
     m_useCustomFont = false;
     m_align = Qt::AlignLeft | Qt::AlignVCenter;
     m_mode = Qt::ElideMiddle;
-    
+
     m_jumpLinkVisible = false;
     m_jumpPixmap = QPixmap( RESPATH "images/jump-link.png" ).scaled( QSize( fontMetrics().height(), fontMetrics().height() ), Qt::KeepAspectRatio, Qt::SmoothTransformation );
 }
@@ -508,7 +508,25 @@ void
 QueryLabel::contextMenuEvent( QContextMenuEvent* event )
 {
     m_contextMenu->clear();
-    m_contextMenu->setQuery( m_query );
+
+    if ( m_result )
+    {
+        switch( m_hoverType )
+        {
+            case Artist:
+                m_contextMenu->setArtist( m_result->artist() );
+                break;
+            case Album:
+                m_contextMenu->setAlbum( m_result->album() );
+                break;
+
+            default:
+                m_contextMenu->setQuery( m_query );
+        }
+    }
+    else
+        m_contextMenu->setQuery( m_query );
+
     m_contextMenu->exec( event->globalPos() );
 }
 
@@ -528,7 +546,6 @@ QueryLabel::mouseReleaseEvent( QMouseEvent* event )
     QFrame::mouseReleaseEvent( event );
 
     m_dragPos = QPoint();
-    qDebug() << "ELAPSED TIME" << m_time.elapsed() << "limit:" << qApp->doubleClickInterval();
     if ( m_time.elapsed() < qApp->doubleClickInterval() )
     {
         switch( m_hoverType )
@@ -542,7 +559,7 @@ QueryLabel::mouseReleaseEvent( QMouseEvent* event )
             case Track:
                 emit clickedTrack();
                 break;
-                
+
             case Complete:
                 ViewManager::instance()->showCurrentTrack();
                 break;
@@ -634,7 +651,7 @@ QueryLabel::mouseMoveEvent( QMouseEvent* event )
     {
         hoverArea.setLeft( 0 );
         hoverArea.setRight( width() - 1 );
-        
+
         if ( m_type & Artist )
             m_hoverType = Artist;
         else if ( m_type & Album )
@@ -648,7 +665,7 @@ QueryLabel::mouseMoveEvent( QMouseEvent* event )
         hoverArea.setY( 1 );
         hoverArea.setHeight( height() - 2 );
     }
-    
+
     if ( m_hoverType != None )
         setCursor( Qt::PointingHandCursor );
     else