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();
|
QModelIndex mi = i.previous();
|
||||||
currentComicPath = i2.previous();
|
currentComicPath = i2.previous();
|
||||||
if(QFile::remove(currentComicPath))
|
if(QFile::remove(currentComicPath))
|
||||||
{
|
|
||||||
emit remove(mi.row());
|
emit remove(mi.row());
|
||||||
}
|
else
|
||||||
|
emit removeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit finished();
|
emit finished();
|
||||||
|
@ -14,6 +14,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void remove(int);
|
void remove(int);
|
||||||
|
void removeError();
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LibraryWindow::LibraryWindow()
|
LibraryWindow::LibraryWindow()
|
||||||
:QMainWindow(),fullscreen(false),fetching(false),previousFilter("")
|
:QMainWindow(),fullscreen(false),fetching(false),previousFilter(""),removeError(false)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
loadLibraries();
|
loadLibraries();
|
||||||
@ -1433,6 +1433,20 @@ void LibraryWindow::showComicVineScraper()
|
|||||||
comicVineDialog->show();
|
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()
|
void LibraryWindow::asignNumbers()
|
||||||
{
|
{
|
||||||
QModelIndexList indexList = getSelectedComics();
|
QModelIndexList indexList = getSelectedComics();
|
||||||
@ -1640,9 +1654,11 @@ void LibraryWindow::deleteComics()
|
|||||||
|
|
||||||
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
||||||
connect(remover, SIGNAL(remove(int)), comicFlow, 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()), dmCV, SLOT(finishTransaction()));
|
||||||
//connect(remover, SIGNAL(finished()), comicView, SLOT(hideDeleteProgress()));
|
//connect(remover, SIGNAL(finished()), comicView, SLOT(hideDeleteProgress()));
|
||||||
connect(remover, SIGNAL(finished()),this,SLOT(checkEmptyFolder()));
|
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()), remover, SLOT(deleteLater()));
|
||||||
//connect(remover, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
//connect(remover, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
@ -205,6 +205,8 @@ private:
|
|||||||
int currentFolderNavigation;
|
int currentFolderNavigation;
|
||||||
QList<QModelIndex> history;
|
QList<QModelIndex> history;
|
||||||
|
|
||||||
|
bool removeError;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent ( QCloseEvent * event );
|
virtual void closeEvent ( QCloseEvent * event );
|
||||||
public:
|
public:
|
||||||
@ -270,6 +272,8 @@ public:
|
|||||||
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
||||||
void setCurrentComicOpened();
|
void setCurrentComicOpened();
|
||||||
void showComicVineScraper();
|
void showComicVineScraper();
|
||||||
|
void setRemoveError();
|
||||||
|
void checkRemoveError();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user