Fix a regression in the previous release that broke Copy to library and delete after when copying a duplicated book. Fixes #1816224 [Bug when copying an existing book from one library to another](https://bugs.launchpad.net/calibre/+bug/1816224)

This commit is contained in:
Kovid Goyal 2019-03-08 08:37:09 +05:30
parent 293571cb8a
commit 7667b177d8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -499,17 +499,16 @@ class CopyToLibraryAction(InterfaceAction):
'controlled by the Auto-merge option in ' 'controlled by the Auto-merge option in '
'Preferences->Import/export->Adding books.'), det_msg=books, 'Preferences->Import/export->Adding books.'), det_msg=books,
show=True) show=True)
if delete_after and self.worker.processed: done_ids = frozenset(self.worker.processed) - frozenset(self.worker.duplicate_ids)
if delete_after and done_ids:
v = self.gui.library_view v = self.gui.library_view
ci = v.currentIndex() ci = v.currentIndex()
row = None row = None
if ci.isValid(): if ci.isValid():
row = ci.row() row = ci.row()
v.model().delete_books_by_id(self.worker.processed, v.model().delete_books_by_id(done_ids, permanent=True)
permanent=True) self.gui.iactions['Remove Books'].library_ids_deleted(done_ids, row)
self.gui.iactions['Remove Books'].library_ids_deleted(
self.worker.processed, row)
if self.worker.failed_books: if self.worker.failed_books:
def fmt_err(book_id): def fmt_err(book_id):