diff --git a/src/libtomahawk/ContextMenu.cpp b/src/libtomahawk/ContextMenu.cpp index c5716bdb6..4c13a7b6c 100644 --- a/src/libtomahawk/ContextMenu.cpp +++ b/src/libtomahawk/ContextMenu.cpp @@ -38,7 +38,7 @@ ContextMenu::ContextMenu( QWidget* parent ) m_sigmap = new QSignalMapper( this ); connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) ); - m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove | ActionStopAfter; + m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove | ActionStopAfter | ActionPage; } @@ -104,6 +104,9 @@ ContextMenu::setQueries( const QList& queries ) if ( m_supportedActions & ActionCopyLink && itemCount() == 1 ) m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink ); + if ( m_supportedActions & ActionPage && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "&Show Track Page" ) ), ActionPage ); + addSeparator(); if ( m_supportedActions & ActionDelete ) @@ -135,12 +138,15 @@ ContextMenu::setAlbums( const QList& albums ) m_albums.clear(); m_albums << albums; - if ( m_supportedActions & ActionPlay && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "Show &Album page" ) ), ActionPlay ); +/* if ( m_supportedActions & ActionPlay && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "Show &Album Page" ) ), ActionPlay );*/ if ( m_supportedActions & ActionQueue ) m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); + if ( m_supportedActions & ActionPage && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "&Show Album Page" ) ), ActionPage ); + //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); addSeparator(); @@ -174,12 +180,15 @@ ContextMenu::setArtists( const QList& artists ) m_artists.clear(); m_artists << artists; - if ( m_supportedActions & ActionPlay && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "Show &Artist page" ) ), ActionPlay ); +/* if ( m_supportedActions & ActionPlay && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "Show &Artist Page" ) ), ActionPlay );*/ if ( m_supportedActions & ActionQueue ) m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); + if ( m_supportedActions & ActionPage && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "&Show Artist Page" ) ), ActionPage ); + //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); addSeparator(); @@ -215,6 +224,10 @@ ContextMenu::onTriggered( int action ) case ActionCopyLink: copyLink(); break; + + case ActionPage: + openPage(); + break; case ActionLove: m_queries.first()->setLoved( !m_queries.first()->loved() ); @@ -264,6 +277,24 @@ ContextMenu::copyLink() } +void +ContextMenu::openPage() +{ + if ( m_queries.count() ) + { + ViewManager::instance()->show( m_queries.first() ); + } + else if ( m_artists.count() ) + { + ViewManager::instance()->show( m_artists.first() ); + } + else if ( m_albums.count() ) + { + ViewManager::instance()->show( m_albums.first() ); + } +} + + void ContextMenu::onSocialActionsLoaded() { diff --git a/src/libtomahawk/ContextMenu.h b/src/libtomahawk/ContextMenu.h index 2e695a675..9f1e28def 100644 --- a/src/libtomahawk/ContextMenu.h +++ b/src/libtomahawk/ContextMenu.h @@ -41,7 +41,8 @@ public: ActionDelete = 4, ActionCopyLink = 8, ActionLove = 16, - ActionStopAfter = 32 + ActionStopAfter = 32, + ActionPage = 64 }; explicit ContextMenu( QWidget* parent = 0 ); @@ -69,6 +70,7 @@ signals: private slots: void onTriggered( int action ); void copyLink(); + void openPage(); void addToQueue(); void onSocialActionsLoaded();