mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Add cancellation to ehviewer import.
This commit is contained in:
@@ -640,7 +640,9 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
|
|||||||
if (dbFile == null || comicSrc == null) {
|
if (dbFile == null || comicSrc == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var controller = showLoadingDialog(context, allowCancel: false);
|
|
||||||
|
bool cancelled = false;
|
||||||
|
var controller = showLoadingDialog(context, onCancel: () { cancelled = true; });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var cache = FilePath.join(App.cachePath, dbFile.name);
|
var cache = FilePath.join(App.cachePath, dbFile.name);
|
||||||
@@ -649,6 +651,9 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
|
|||||||
|
|
||||||
Future<void> addTagComics(String destFolder, List<sql.Row> comics) async {
|
Future<void> addTagComics(String destFolder, List<sql.Row> comics) async {
|
||||||
for(var comic in comics) {
|
for(var comic in comics) {
|
||||||
|
if(cancelled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var comicDir = Directory(FilePath.join(comicSrc.path, comic['DIRNAME'] as String));
|
var comicDir = Directory(FilePath.join(comicSrc.path, comic['DIRNAME'] as String));
|
||||||
if(!(await comicDir.exists())) {
|
if(!(await comicDir.exists())) {
|
||||||
continue;
|
continue;
|
||||||
@@ -731,6 +736,9 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
|
|||||||
""");
|
""");
|
||||||
|
|
||||||
for (var folder in folders) {
|
for (var folder in folders) {
|
||||||
|
if(cancelled) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
var label = folder["LABEL"] as String;
|
var label = folder["LABEL"] as String;
|
||||||
var folderName = '(EhViewer)$label';
|
var folderName = '(EhViewer)$label';
|
||||||
if(!LocalFavoritesManager().existsFolder(folderName)) {
|
if(!LocalFavoritesManager().existsFolder(folderName)) {
|
||||||
|
Reference in New Issue
Block a user