1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-22 00:42:04 +02:00

Add ampersand escaping for Albums and Artists

This commit is contained in:
Uwe L. Korn 2013-03-24 03:23:28 +01:00
parent 031597f9e1
commit 6c08a27b3a

@ -110,15 +110,15 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
if ( m_supportedActions & ActionPage && itemCount() == 1 )
{
// Ampersands need to be escaped as they indicate a keyboard shortcut
QString track = m_queries.first()->track().replace( QString( "&" ), QString( "&&" ) );
const QString track = m_queries.first()->track().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/track-icon.svg" ),
tr( "&Go to \"%1\"" ).arg( track ) ), ActionTrackPage );
if ( !m_queries.first()->album().isEmpty() ) {
QString album = m_queries.first()->album().replace( QString( "&" ), QString( "&&" ) );
const QString album = m_queries.first()->album().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/album-icon.svg" ),
tr( "Go to \"%1\"" ).arg( album ) ), ActionAlbumPage );
}
QString artist = m_queries.first()->artist().replace( QString( "&" ), QString( "&&" ) );
const QString artist = m_queries.first()->artist().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/artist-icon.svg" ),
tr( "Go to \"%1\"" ).arg( artist ) ), ActionArtistPage );
}
@ -172,10 +172,12 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
if ( m_supportedActions & ActionPage && itemCount() == 1 )
{
const QString album = m_albums.first()->name().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/album-icon.svg" ),
tr( "&Go to \"%1\"" ).arg( m_albums.first()->name() ) ), ActionAlbumPage );
tr( "&Go to \"%1\"" ).arg( album ) ), ActionAlbumPage );
const QString artist = m_albums.first()->artist()->name().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/artist-icon.svg" ),
tr( "Go to \"%1\"" ).arg( m_albums.first()->artist()->name() ) ), ActionArtistPage );
tr( "Go to \"%1\"" ).arg( artist ) ), ActionArtistPage );
}
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
@ -219,9 +221,11 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
addSeparator();
if ( m_supportedActions & ActionPage && itemCount() == 1 )
if ( m_supportedActions & ActionPage && itemCount() == 1 ) {
const QString artist = m_artists.first()->name().replace( QString( "&" ), QString( "&&" ) );
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/artist-icon.svg" ),
tr( "&Go to \"%1\"" ).arg( m_artists.first()->name() ) ), ActionArtistPage );
tr( "&Go to \"%1\"" ).arg( artist ) ), ActionArtistPage );
}
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );