mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book polishing: If the books being polished have an ORIGINAL_EPUB/AZW3 format, warn the user that polishing will use it as the source and ask for confirmation. See #1316158 (Repost Enhancement Request: Polish Tool)
This commit is contained in:
parent
76ba5f06e2
commit
5b009747b7
@ -432,7 +432,20 @@ class PolishAction(InterfaceAction):
|
|||||||
return None
|
return None
|
||||||
db = self.gui.library_view.model().db
|
db = self.gui.library_view.model().db
|
||||||
ans = (db.id(r) for r in rows)
|
ans = (db.id(r) for r in rows)
|
||||||
return self.get_supported_books(ans)
|
ans = self.get_supported_books(ans)
|
||||||
|
for fmts in ans.itervalues():
|
||||||
|
for x in fmts:
|
||||||
|
if x.startswith('ORIGINAL_'):
|
||||||
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
|
if not confirm(_(
|
||||||
|
'One of the books you are polishing has an {0} format.'
|
||||||
|
' Polishing will use this as the source and overwrite'
|
||||||
|
' any existing {1} format. Are you sure you want to proceed?').format(
|
||||||
|
x, x[len('ORIGINAL_'):]), 'confirm_original_polish', title=_('Are you sure?'),
|
||||||
|
confirm_msg=_('Ask for this confirmation again')):
|
||||||
|
return {}
|
||||||
|
break
|
||||||
|
return ans
|
||||||
|
|
||||||
def get_supported_books(self, book_ids):
|
def get_supported_books(self, book_ids):
|
||||||
from calibre.ebooks.oeb.polish.main import SUPPORTED
|
from calibre.ebooks.oeb.polish.main import SUPPORTED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user