mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 23:23:43 +02:00
Edit Book: Nicer error message when user tries to rename files in a format that does not support it, such as AZW3
This commit is contained in:
parent
312696dbf1
commit
6daf4d61b9
1 changed files with 12 additions and 0 deletions
|
|
@ -478,6 +478,12 @@ def start_merge(self, category, names):
|
|||
self.merge_requested.emit(category, names, d.ans)
|
||||
|
||||
def edit_current_item(self):
|
||||
if not current_container().SUPPORTS_FILENAMES:
|
||||
error_dialog(self, _('Cannot rename'), _(
|
||||
'%s books do not support file renaming as they do not use file names'
|
||||
' internally. The filenames you see are automatically generated from the'
|
||||
' internal structures of the original file.') % current_container().book_type.upper(), show=True)
|
||||
return
|
||||
if self.currentItem() is not None:
|
||||
self.editItem(self.currentItem())
|
||||
|
||||
|
|
@ -502,6 +508,12 @@ def keyPressEvent(self, ev):
|
|||
return QTreeWidget.keyPressEvent(self, ev)
|
||||
|
||||
def request_bulk_rename(self):
|
||||
if not current_container().SUPPORTS_FILENAMES:
|
||||
error_dialog(self, _('Cannot rename'), _(
|
||||
'%s books do not support file renaming as they do not use file names'
|
||||
' internally. The filenames you see are automatically generated from the'
|
||||
' internal structures of the original file.') % current_container().book_type.upper(), show=True)
|
||||
return
|
||||
names = {unicode(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()}
|
||||
bad = names & current_container().names_that_must_not_be_changed
|
||||
if bad:
|
||||
|
|
|
|||
Loading…
Reference in a new issue