mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Confirm format override when add files to book
When adding formats to an existing book, ask for confirmation if some formats will be overwritten.
This commit is contained in:
parent
03041f925e
commit
dca69aa470
@ -110,6 +110,19 @@ class AddAction(InterfaceAction):
|
||||
return
|
||||
|
||||
db = view.model().db
|
||||
if len(ids) == 1:
|
||||
formats = db.formats(ids[0], index_is_id=True)
|
||||
if formats:
|
||||
formats = {x.upper() for x in formats.split(',')}
|
||||
nformats = {f.rpartition('.')[-1].upper() for f in books}
|
||||
override = formats.intersection(nformats)
|
||||
if override:
|
||||
title = db.title(ids[0], index_is_id=True)
|
||||
msg = _('The {0} format(s) will be replaced in the book {1}. Are you sure?').format(
|
||||
', '.join(override), title)
|
||||
if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure'), parent=self.gui):
|
||||
return
|
||||
|
||||
for id_ in ids:
|
||||
for fpath in books:
|
||||
fmt = os.path.splitext(fpath)[1][1:].upper()
|
||||
|
Loading…
x
Reference in New Issue
Block a user