mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Fixed showing 'playlist' in a station's or automatic playlist's context menu. (TWK-171)
This commit is contained in:
@@ -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
|
QVariant
|
||||||
SourcesModel::data( const QModelIndex& index, int role ) const
|
SourcesModel::data( const QModelIndex& index, int role ) const
|
||||||
{
|
{
|
||||||
|
@@ -64,10 +64,11 @@ public:
|
|||||||
SortRole = Qt::UserRole + 12
|
SortRole = Qt::UserRole + 12
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SourcesModel( QObject* parent = 0 );
|
SourcesModel( QObject* parent = 0 );
|
||||||
virtual ~SourcesModel();
|
virtual ~SourcesModel();
|
||||||
|
|
||||||
|
static QString rowTypeToString( RowType type );
|
||||||
|
|
||||||
// reimplemented from QAIM
|
// reimplemented from QAIM
|
||||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||||
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
|
@@ -120,11 +120,6 @@ SourceTreeView::setupMenus()
|
|||||||
{
|
{
|
||||||
m_playlistMenu.clear();
|
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;
|
bool readonly = true;
|
||||||
SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
|
SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
|
||||||
if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
|
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_deletePlaylistAction->setEnabled( !readonly );
|
||||||
m_renamePlaylistAction->setEnabled( !readonly );
|
m_renamePlaylistAction->setEnabled( !readonly );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user