Using library item's name instead of generic text 'Playlist' when creating new playlist by DnD from the library, or when using 'Open in new playlist'
This commit is contained in:
parent
7221d93888
commit
4d58e75e0a
|
@ -918,6 +918,11 @@ QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const {
|
|||
QSet<int> song_ids;
|
||||
|
||||
data->backend = backend_;
|
||||
|
||||
if(!indexes.isEmpty()) {
|
||||
// Give a "name" to the mime data. Will be used for naming playlist, if needed
|
||||
data->setText(IndexToItem(indexes.first())->DisplayText());
|
||||
}
|
||||
|
||||
foreach (const QModelIndex& index, indexes) {
|
||||
GetChildSongs(IndexToItem(index), &urls, &data->songs, &song_ids);
|
||||
|
|
|
@ -208,7 +208,11 @@ void PlaylistTabBar::timerEvent(QTimerEvent* e) {
|
|||
|
||||
void PlaylistTabBar::dropEvent(QDropEvent* e) {
|
||||
if (drag_hover_tab_ == -1) {
|
||||
manager_->New(tr("Playlist"));
|
||||
if(e->mimeData()->text().isEmpty()) {
|
||||
manager_->New(tr("Playlist"));
|
||||
} else {
|
||||
manager_->New(e->mimeData()->text());
|
||||
}
|
||||
setCurrentIndex(count() - 1);
|
||||
} else {
|
||||
setCurrentIndex(drag_hover_tab_);
|
||||
|
|
Loading…
Reference in New Issue