mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -478,6 +478,12 @@ class FileList(QTreeWidget):
|
|||||||
self.merge_requested.emit(category, names, d.ans)
|
self.merge_requested.emit(category, names, d.ans)
|
||||||
|
|
||||||
def edit_current_item(self):
|
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:
|
if self.currentItem() is not None:
|
||||||
self.editItem(self.currentItem())
|
self.editItem(self.currentItem())
|
||||||
|
|
||||||
@ -502,6 +508,12 @@ class FileList(QTreeWidget):
|
|||||||
return QTreeWidget.keyPressEvent(self, ev)
|
return QTreeWidget.keyPressEvent(self, ev)
|
||||||
|
|
||||||
def request_bulk_rename(self):
|
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()}
|
names = {unicode(item.data(0, NAME_ROLE) or '') for item in self.selectedItems()}
|
||||||
bad = names & current_container().names_that_must_not_be_changed
|
bad = names & current_container().names_that_must_not_be_changed
|
||||||
if bad:
|
if bad:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user