mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Added error management for "delete comic"
This commit is contained in:
parent
46a9e82998
commit
40dcb461e7
@ -20,9 +20,9 @@ void ComicsRemover::run()
|
||||
QModelIndex mi = i.previous();
|
||||
currentComicPath = i2.previous();
|
||||
if(QFile::remove(currentComicPath))
|
||||
{
|
||||
emit remove(mi.row());
|
||||
}
|
||||
else
|
||||
emit removeError();
|
||||
}
|
||||
|
||||
emit finished();
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
|
||||
signals:
|
||||
void remove(int);
|
||||
void removeError();
|
||||
void finished();
|
||||
|
||||
private:
|
||||
|
@ -67,7 +67,7 @@
|
||||
#endif
|
||||
|
||||
LibraryWindow::LibraryWindow()
|
||||
:QMainWindow(),fullscreen(false),fetching(false),previousFilter("")
|
||||
:QMainWindow(),fullscreen(false),fetching(false),previousFilter(""),removeError(false)
|
||||
{
|
||||
setupUI();
|
||||
loadLibraries();
|
||||
@ -1433,6 +1433,20 @@ void LibraryWindow::showComicVineScraper()
|
||||
comicVineDialog->show();
|
||||
}
|
||||
|
||||
void LibraryWindow::setRemoveError()
|
||||
{
|
||||
removeError = true;
|
||||
}
|
||||
|
||||
void LibraryWindow::checkRemoveError()
|
||||
{
|
||||
if(removeError)
|
||||
{
|
||||
QMessageBox::critical(this,tr("Unable to delete"),tr("There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder."));
|
||||
}
|
||||
removeError = false;
|
||||
}
|
||||
|
||||
void LibraryWindow::asignNumbers()
|
||||
{
|
||||
QModelIndexList indexList = getSelectedComics();
|
||||
@ -1640,9 +1654,11 @@ void LibraryWindow::deleteComics()
|
||||
|
||||
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
||||
connect(remover, SIGNAL(remove(int)), comicFlow, SLOT(remove(int)));
|
||||
connect(remover,SIGNAL(removeError()),this,SLOT(setRemoveError()));
|
||||
connect(remover, SIGNAL(finished()), dmCV, SLOT(finishTransaction()));
|
||||
//connect(remover, SIGNAL(finished()), comicView, SLOT(hideDeleteProgress()));
|
||||
connect(remover, SIGNAL(finished()),this,SLOT(checkEmptyFolder()));
|
||||
connect(remover, SIGNAL(finished()),this,SLOT(checkRemoveError()));
|
||||
connect(remover, SIGNAL(finished()), remover, SLOT(deleteLater()));
|
||||
//connect(remover, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
|
@ -205,6 +205,8 @@ private:
|
||||
int currentFolderNavigation;
|
||||
QList<QModelIndex> history;
|
||||
|
||||
bool removeError;
|
||||
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
@ -270,6 +272,8 @@ public:
|
||||
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
||||
void setCurrentComicOpened();
|
||||
void showComicVineScraper();
|
||||
void setRemoveError();
|
||||
void checkRemoveError();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user