mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 03:27:40 +01:00
Being consistent: use already defined name_for_new_playlist_ field and GetNameForNewPlaylist function, to have the same behavior through the 'Open in a new playlist' action than with drag and drop
This commit is contained in:
parent
ec49e7a955
commit
b8bf93fc23
@ -19,6 +19,7 @@
|
||||
#include "librarybackend.h"
|
||||
#include "libraryitem.h"
|
||||
#include "librarydirectorymodel.h"
|
||||
#include "libraryview.h"
|
||||
#include "sqlrow.h"
|
||||
#include "core/albumcoverloader.h"
|
||||
#include "core/database.h"
|
||||
@ -919,15 +920,14 @@ QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if(!indexes.isEmpty()) {
|
||||
data->name_for_new_playlist_ = LibraryView::GetNameForNewPlaylist(data->songs);
|
||||
}
|
||||
|
||||
data->setUrls(urls);
|
||||
|
||||
return data;
|
||||
|
@ -208,10 +208,11 @@ void PlaylistTabBar::timerEvent(QTimerEvent* e) {
|
||||
|
||||
void PlaylistTabBar::dropEvent(QDropEvent* e) {
|
||||
if (drag_hover_tab_ == -1) {
|
||||
if(e->mimeData()->text().isEmpty()) {
|
||||
manager_->New(tr("Playlist"));
|
||||
const MimeData *mime_data = qobject_cast<const MimeData*>(e->mimeData());
|
||||
if(mime_data && !mime_data->name_for_new_playlist_.isEmpty()) {
|
||||
manager_->New(mime_data->name_for_new_playlist_);
|
||||
} else {
|
||||
manager_->New(e->mimeData()->text());
|
||||
manager_->New(tr("Playlist"));
|
||||
}
|
||||
setCurrentIndex(count() - 1);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user