mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-19 04:50:16 +01:00
lookout for smart playlists in 'open in new playlists' functionality (Fixes issue #1465)
This commit is contained in:
parent
29056d944c
commit
fb33ba4cce
@ -374,9 +374,28 @@ void LibraryView::AddToPlaylistEnqueue() {
|
||||
|
||||
void LibraryView::OpenInNewPlaylist() {
|
||||
QMimeData* data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->name_for_new_playlist_ = LibraryView::GetNameForNewPlaylist(GetSelectedSongs());
|
||||
|
||||
// we look for the first smart playlist among selection because this
|
||||
// is the one which will get into the new playlist eventually
|
||||
QString first_smart_playlist_name;
|
||||
foreach(const QModelIndex& index, selectedIndexes()) {
|
||||
const int type = model()->data(index, LibraryModel::Role_Type).toInt();
|
||||
|
||||
if(type == LibraryItem::Type_SmartPlaylist) {
|
||||
first_smart_playlist_name = model()->data(index).toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
if(first_smart_playlist_name.isEmpty()) {
|
||||
mime_data->name_for_new_playlist_
|
||||
= LibraryView::GetNameForNewPlaylist(GetSelectedSongs());
|
||||
} else {
|
||||
mime_data->name_for_new_playlist_ = first_smart_playlist_name;
|
||||
}
|
||||
}
|
||||
|
||||
emit AddToPlaylistSignal(data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user