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:
Kovid Goyal 2014-05-06 18:51:44 +05:30
parent 76ba5f06e2
commit 5b009747b7

View File

@ -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