diff --git a/src/core/mimedata.h b/src/core/mimedata.h index 34eabd197..6a0fba0c8 100644 --- a/src/core/mimedata.h +++ b/src/core/mimedata.h @@ -26,20 +26,24 @@ class MimeData : public QMimeData { public: MimeData(bool clear = false, bool play_now = false, bool enqueue = false, bool open_in_new_playlist = false) - : clear_first_(clear), + : override_user_settings_(false), + clear_first_(clear), play_now_(play_now), enqueue_now_(enqueue), open_in_new_playlist_(open_in_new_playlist), name_for_new_playlist_(QString()), from_doubleclick_(false) {} + // If this is set then MainWindow will not touch any of the other flags. + bool override_user_settings_; + // If this is set then the playlist will be cleared before these songs // are inserted. bool clear_first_; // If this is set then the first item that is inserted will start playing // immediately. Note: this is always overridden with the user's preference - // if the MimeData goes via MainWindow. + // if the MimeData goes via MainWindow, unless you set override_user_settings_. bool play_now_; // If this is set then the items are added to the queue after being inserted. diff --git a/src/globalsearch/globalsearchwidget.cpp b/src/globalsearch/globalsearchwidget.cpp index ec2d0fa5d..7c1a72016 100644 --- a/src/globalsearch/globalsearchwidget.cpp +++ b/src/globalsearch/globalsearchwidget.cpp @@ -498,13 +498,15 @@ void GlobalSearchWidget::TracksLoaded(int id, MimeData* mime_data) { if (trigger == NULL) { mime_data->from_doubleclick_ = true; - } else if (trigger == add_) { - } else if (trigger == add_and_play_) { - mime_data->play_now_ = true; - } else if (trigger == add_and_queue_) { - mime_data->enqueue_now_ = true; - } else if (trigger == replace_) { - mime_data->clear_first_= true; + } else { + if (trigger == add_and_play_) { + mime_data->override_user_settings_ = true; + mime_data->play_now_ = true; + } else if (trigger == add_and_queue_) { + mime_data->enqueue_now_ = true; + } else if (trigger == replace_) { + mime_data->clear_first_= true; + } } emit AddToPlaylist(mime_data); diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index ae414b1f4..6dbedfac2 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1180,7 +1180,9 @@ void MainWindow::AddToPlaylist(QMimeData* data) { if (MimeData* mime_data = qobject_cast(data)) { // Should we replace the flags with the user's preference? - if (mime_data->from_doubleclick_) { + if (mime_data->override_user_settings_) { + // Do nothing + } else if (mime_data->from_doubleclick_) { ApplyAddBehaviour(doubleclick_addmode_, mime_data); ApplyPlayBehaviour(doubleclick_playmode_, mime_data); } else {