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() {
|
void CollectionView::ShowInBrowser() {
|
||||||
|
|
||||||
|
SongList songs = GetSelectedSongs();
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
for (const Song &song : GetSelectedSongs()) {
|
for (const Song &song : songs) {
|
||||||
urls << song.url();
|
urls << song.url();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities::OpenInFileBrowser(urls);
|
Utilities::OpenInFileBrowser(urls);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CollectionView::TotalSongs() {
|
int CollectionView::TotalSongs() {
|
||||||
|
|
|
@ -2118,6 +2118,7 @@ void MainWindow::PlaylistOpenInBrowser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities::OpenInFileBrowser(urls);
|
Utilities::OpenInFileBrowser(urls);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::PlaylistQueue() {
|
void MainWindow::PlaylistQueue() {
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtEvents>
|
#include <QtEvents>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#ifdef HAVE_TRANSLATIONS
|
#ifdef HAVE_TRANSLATIONS
|
||||||
# include <QTranslator>
|
# include <QTranslator>
|
||||||
|
@ -356,6 +357,25 @@ void ShowFileInExplorer(QString const &path) {
|
||||||
|
|
||||||
void OpenInFileBrowser(const QList<QUrl> &urls) {
|
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;
|
QSet<QString> dirs;
|
||||||
|
|
||||||
for (const QUrl &url : urls) {
|
for (const QUrl &url : urls) {
|
||||||
|
|
Loading…
Reference in New Issue