Add confirmation box for opening songs in file browser
This commit is contained in:
parent
505c0eeae2
commit
647e7e708a
|
@ -592,12 +592,15 @@ void CollectionView::FilterReturnPressed() {
|
|||
}
|
||||
|
||||
void CollectionView::ShowInBrowser() {
|
||||
|
||||
SongList songs = GetSelectedSongs();
|
||||
QList<QUrl> urls;
|
||||
for (const Song &song : GetSelectedSongs()) {
|
||||
for (const Song &song : songs) {
|
||||
urls << song.url();
|
||||
}
|
||||
|
||||
Utilities::OpenInFileBrowser(urls);
|
||||
|
||||
}
|
||||
|
||||
int CollectionView::TotalSongs() {
|
||||
|
|
|
@ -2118,6 +2118,7 @@ void MainWindow::PlaylistOpenInBrowser() {
|
|||
}
|
||||
|
||||
Utilities::OpenInFileBrowser(urls);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::PlaylistQueue() {
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <QXmlStreamReader>
|
||||
#include <QSettings>
|
||||
#include <QtEvents>
|
||||
#include <QMessageBox>
|
||||
#include <QtDebug>
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
# include <QTranslator>
|
||||
|
@ -356,6 +357,25 @@ void ShowFileInExplorer(QString const &path) {
|
|||
|
||||
void OpenInFileBrowser(const QList<QUrl> &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<QString> dirs;
|
||||
|
||||
for (const QUrl &url : urls) {
|
||||
|
|
Loading…
Reference in New Issue