mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
Add ampersand escaping for Albums and Artists
This commit is contained in:
@@ -110,15 +110,15 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
|
|||||||
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
||||||
{
|
{
|
||||||
// Ampersands need to be escaped as they indicate a keyboard shortcut
|
// 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" ),
|
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/track-icon.svg" ),
|
||||||
tr( "&Go to \"%1\"" ).arg( track ) ), ActionTrackPage );
|
tr( "&Go to \"%1\"" ).arg( track ) ), ActionTrackPage );
|
||||||
if ( !m_queries.first()->album().isEmpty() ) {
|
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" ),
|
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/album-icon.svg" ),
|
||||||
tr( "Go to \"%1\"" ).arg( album ) ), ActionAlbumPage );
|
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" ),
|
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/artist-icon.svg" ),
|
||||||
tr( "Go to \"%1\"" ).arg( artist ) ), ActionArtistPage );
|
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 )
|
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" ),
|
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" ),
|
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 );
|
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
|
||||||
@@ -219,9 +221,11 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
|
|||||||
|
|
||||||
addSeparator();
|
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" ),
|
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 );
|
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user