mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 08:19:42 +01:00
* Fixed showing 'playlist' in a station's or automatic playlist's context menu. (TWK-171)
This commit is contained in:
parent
9bac08deda
commit
c2982e7312
@ -61,6 +61,29 @@ SourcesModel::~SourcesModel()
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
SourcesModel::rowTypeToString( RowType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case Collection:
|
||||
return tr( "Collection" );
|
||||
|
||||
case StaticPlaylist:
|
||||
return tr( "Playlist" );
|
||||
|
||||
case AutomaticPlaylist:
|
||||
return tr( "Automatic Playlist" );
|
||||
|
||||
case Station:
|
||||
return tr( "Station" );
|
||||
|
||||
default:
|
||||
return QString( "Unknown" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
SourcesModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
|
@ -64,10 +64,11 @@ public:
|
||||
SortRole = Qt::UserRole + 12
|
||||
};
|
||||
|
||||
|
||||
SourcesModel( QObject* parent = 0 );
|
||||
virtual ~SourcesModel();
|
||||
|
||||
static QString rowTypeToString( RowType type );
|
||||
|
||||
// reimplemented from QAIM
|
||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
|
@ -120,11 +120,6 @@ SourceTreeView::setupMenus()
|
||||
{
|
||||
m_playlistMenu.clear();
|
||||
|
||||
m_loadPlaylistAction = m_playlistMenu.addAction( tr( "&Load Playlist" ) );
|
||||
m_renamePlaylistAction = m_playlistMenu.addAction( tr( "&Rename Playlist" ) );
|
||||
m_playlistMenu.addSeparator();
|
||||
m_deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete Playlist" ) );
|
||||
|
||||
bool readonly = true;
|
||||
SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
|
||||
if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
|
||||
@ -138,6 +133,11 @@ SourceTreeView::setupMenus()
|
||||
}
|
||||
}
|
||||
|
||||
m_loadPlaylistAction = m_playlistMenu.addAction( tr( "&Load Playlist" ) );
|
||||
m_renamePlaylistAction = m_playlistMenu.addAction( tr( "&Rename Playlist" ) );
|
||||
m_playlistMenu.addSeparator();
|
||||
m_deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) );
|
||||
|
||||
m_deletePlaylistAction->setEnabled( !readonly );
|
||||
m_renamePlaylistAction->setEnabled( !readonly );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user