MainWindow: Add error dialog when file deletion fails

Fixes #1384
This commit is contained in:
Jonas Kvinge 2024-04-03 21:37:20 +02:00
parent 4c1a5168f0
commit 70809e0647
2 changed files with 15 additions and 1 deletions

View File

@ -204,6 +204,8 @@
#include "smartplaylists/smartplaylistsviewcontainer.h"
#include "organize/organizeerrordialog.h"
#ifdef Q_OS_WIN
# include "windows7thumbbar.h"
#endif
@ -3239,11 +3241,21 @@ void MainWindow::PlaylistDelete() {
SharedPtr<MusicStorage> storage = make_shared<FilesystemMusicStorage>(Song::Source::LocalFile, "/");
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
//QObject::connect(delete_files, &DeleteFiles::Finished, this, &MainWindow::DeleteFinished);
QObject::connect(delete_files, &DeleteFiles::Finished, this, &MainWindow::DeleteFilesFinished);
delete_files->Start(selected_songs);
}
void MainWindow::DeleteFilesFinished(const SongList &songs_with_errors) {
if (songs_with_errors.isEmpty()) return;
OrganizeErrorDialog *dialog = new OrganizeErrorDialog(this);
dialog->Show(OrganizeErrorDialog::OperationType::Delete, songs_with_errors);
// It deletes itself when the user closes it
}
void MainWindow::FocusSearchField() {
if (ui_->tabs->currentIndex() == ui_->tabs->IndexOfTab(collection_view_) && !collection_view_->filter_widget()->SearchFieldHasFocus()) {

View File

@ -270,6 +270,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void FocusSearchField();
void DeleteFilesFinished(const SongList &songs_with_errors);
public slots:
void CommandlineOptionsReceived(const QByteArray &string_options);
void Raise();