mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When deleting all formats except ..., do not delete if it leaves a book with no formats
This commit is contained in:
parent
5f1b681549
commit
32bcac2147
@ -161,9 +161,12 @@ class DeleteAction(InterfaceAction):
|
|||||||
continue
|
continue
|
||||||
bfmts = set([x.lower() for x in bfmts.split(',')])
|
bfmts = set([x.lower() for x in bfmts.split(',')])
|
||||||
rfmts = bfmts - set(fmts)
|
rfmts = bfmts - set(fmts)
|
||||||
for fmt in rfmts:
|
if bfmts - rfmts:
|
||||||
self.gui.library_view.model().db.remove_format(id, fmt,
|
# Do not delete if it will leave the book with no
|
||||||
index_is_id=True, notify=False)
|
# formats
|
||||||
|
for fmt in rfmts:
|
||||||
|
self.gui.library_view.model().db.remove_format(id, fmt,
|
||||||
|
index_is_id=True, notify=False)
|
||||||
self.gui.library_view.model().refresh_ids(ids)
|
self.gui.library_view.model().refresh_ids(ids)
|
||||||
self.gui.library_view.model().current_changed(self.gui.library_view.currentIndex(),
|
self.gui.library_view.model().current_changed(self.gui.library_view.currentIndex(),
|
||||||
self.gui.library_view.currentIndex())
|
self.gui.library_view.currentIndex())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user