From 5b009747b7d7c32338069ac917b844eed500b36a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 6 May 2014 18:51:44 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/actions/polish.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/polish.py b/src/calibre/gui2/actions/polish.py index 69c8d6fc23..b77849d882 100644 --- a/src/calibre/gui2/actions/polish.py +++ b/src/calibre/gui2/actions/polish.py @@ -432,7 +432,20 @@ class PolishAction(InterfaceAction): return None db = self.gui.library_view.model().db 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): from calibre.ebooks.oeb.polish.main import SUPPORTED