diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 676f95dba..a79e8bf12 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -592,12 +592,15 @@ void CollectionView::FilterReturnPressed() { } void CollectionView::ShowInBrowser() { + + SongList songs = GetSelectedSongs(); QList urls; - for (const Song &song : GetSelectedSongs()) { + for (const Song &song : songs) { urls << song.url(); } Utilities::OpenInFileBrowser(urls); + } int CollectionView::TotalSongs() { diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index b9009b212..bf82b642a 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -2118,6 +2118,7 @@ void MainWindow::PlaylistOpenInBrowser() { } Utilities::OpenInFileBrowser(urls); + } void MainWindow::PlaylistQueue() { diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 9f0a8f9b5..8a8cfea14 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #ifdef HAVE_TRANSLATIONS # include @@ -356,6 +357,25 @@ void ShowFileInExplorer(QString const &path) { void OpenInFileBrowser(const QList &urls) { + if (urls.count() > 50) { + QMessageBox messagebox(QMessageBox::Critical, tr("Error"), tr("Too many songs selected.")); + messagebox.exec(); + return; + } + + if (urls.count() > 5) { + QMessageBox messagebox(QMessageBox::Information, tr("Show in file browser"), tr("%1 songs selected, are you sure you want to open them all?").arg(urls.count()), QMessageBox::Open|QMessageBox::Cancel); + messagebox.setTextFormat(Qt::RichText); + int result = messagebox.exec(); + switch (result) { + case QMessageBox::Open: + break; + case QMessageBox::Cancel: + default: + return; + } + } + QSet dirs; for (const QUrl &url : urls) {