diff --git a/resources/js/_contentManager.js b/resources/js/_contentManager.js index 9606f4d..6a08fee 100644 --- a/resources/js/_contentManager.js +++ b/resources/js/_contentManager.js @@ -100,10 +100,13 @@ function init() { } }, cancelBook : function(book) { + contentManager.pauseBook(book.id); if (confirm("Are you sure you want to abort the download of '" + book.title + "' ?")) { contentManager.cancelBook(book.id); clearInterval(downloadUpdaters[book.id]); Vue.delete(app.downloads, book.id); + } else { + contentManager.resumeBook(book.id); } }, displayedBooks : function(books, nb) { diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index e95702e..c8a4c8f 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -237,7 +237,9 @@ void ContentManager::cancelBook(const QString& id) { auto& b = mp_library->getBookById(id); auto download = mp_downloader->getDownload(b.getDownloadId()); - download->cancelDownload(); + if (download->getStatus() != kiwix::Download::K_COMPLETE) { + download->cancelDownload(); + } QString fileToRemove = QString::fromUtf8(getLastPathElement(download->getPath()).c_str()) + "*"; eraseBookFilesFromComputer(fileToRemove); mp_library->removeBookFromLibraryById(id);