diff --git a/src/libtomahawk/ContextMenu.cpp b/src/libtomahawk/ContextMenu.cpp index 4fef0daa6..0ed97ebd0 100644 --- a/src/libtomahawk/ContextMenu.cpp +++ b/src/libtomahawk/ContextMenu.cpp @@ -104,14 +104,20 @@ ContextMenu::setQueries( const QList& queries ) onSocialActionsLoaded(); } - if ( m_supportedActions & ActionCopyLink && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink ); + addSeparator(); if ( m_supportedActions & ActionPage && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "&Show Track Page" ) ), ActionPage ); + { + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->track() ) ), ActionTrackPage ); + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->album() ) ), ActionAlbumPage ); + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->artist() ) ), ActionArtistPage ); + } addSeparator(); + if ( m_supportedActions & ActionCopyLink && itemCount() == 1 ) + m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink ); + if ( m_supportedActions & ActionEditMetadata && itemCount() == 1 ) m_sigmap->setMapping( addAction( tr( "Properties..." ) ), ActionEditMetadata ); @@ -149,14 +155,16 @@ 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 & ActionQueue ) m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); + addSeparator(); + if ( m_supportedActions & ActionPage && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "&Show Album Page" ) ), ActionPage ); + { + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_albums.first()->name() ) ), ActionAlbumPage ); + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_albums.first()->artist()->name() ) ), ActionArtistPage ); + } //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); @@ -197,8 +205,10 @@ ContextMenu::setArtists( const QList& artists ) if ( m_supportedActions & ActionQueue ) m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); + addSeparator(); + if ( m_supportedActions & ActionPage && itemCount() == 1 ) - m_sigmap->setMapping( addAction( tr( "&Show Artist Page" ) ), ActionPage ); + m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_artists.first()->name() ) ), ActionArtistPage ); //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); @@ -236,8 +246,10 @@ ContextMenu::onTriggered( int action ) copyLink(); break; - case ActionPage: - openPage(); + case ActionTrackPage: + case ActionArtistPage: + case ActionAlbumPage: + openPage( (MenuActions)action ); break; case ActionLove: @@ -304,20 +316,42 @@ ContextMenu::copyLink() void -ContextMenu::openPage() +ContextMenu::openPage( MenuActions action ) { if ( m_queries.count() ) { - ViewManager::instance()->show( m_queries.first() ); + if ( action == ActionTrackPage ) + { + ViewManager::instance()->show( m_queries.first() ); + } + else + { + const Tomahawk::artist_ptr artist = Artist::get( m_queries.first()->artist(), false ); + if ( action == ActionArtistPage ) + { + ViewManager::instance()->show( artist ); + } + else if ( action == ActionAlbumPage ) + { + ViewManager::instance()->show( Album::get( artist, m_queries.first()->album(), false ) ); + } + } + } + else if ( m_albums.count() ) + { + if ( action == ActionArtistPage ) + { + ViewManager::instance()->show( m_albums.first()->artist() ); + } + else + { + ViewManager::instance()->show( m_albums.first() ); + } } else if ( m_artists.count() ) { ViewManager::instance()->show( m_artists.first() ); } - else if ( m_albums.count() ) - { - ViewManager::instance()->show( m_albums.first() ); - } } diff --git a/src/libtomahawk/ContextMenu.h b/src/libtomahawk/ContextMenu.h index 3e59ee908..f12fef5b3 100644 --- a/src/libtomahawk/ContextMenu.h +++ b/src/libtomahawk/ContextMenu.h @@ -43,6 +43,9 @@ public: ActionLove = 16, ActionStopAfter = 32, ActionPage = 64, + ActionTrackPage = 65, + ActionArtistPage = 66, + ActionAlbumPage = 67, ActionEditMetadata = 128 }; @@ -73,7 +76,7 @@ signals: private slots: void onTriggered( int action ); void copyLink(); - void openPage(); + void openPage( MenuActions action ); void addToQueue(); void onSocialActionsLoaded();