Edit book: Fix changing mimetypes in the opf file not being detected when closing the opf file or running any automated tool like Check Book

This commit is contained in:
Kovid Goyal 2014-01-04 10:43:51 +05:30
parent c9318785d0
commit 441709f44b
2 changed files with 9 additions and 2 deletions

View File

@ -138,6 +138,9 @@ class Container(object): # {{{
raise InvalidBook('Could not locate opf file: %r'%opfpath)
# Update mime map with data from the OPF
self.refresh_mime_map()
def refresh_mime_map(self):
for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
href = item.get('href')
name = self.href_to_name(href, self.opf_name)

View File

@ -715,8 +715,12 @@ class Boss(QObject):
ed = editors[name]
with container.open(name, 'wb') as f:
f.write(ed.data)
if container is current_container():
ed.is_synced_to_container = True
if name == container.opf_name:
container.refresh_mime_map()
if container is current_container():
ed.is_synced_to_container = True
if name == container.opf_name:
self.gui.file_list.build(container)
def commit_all_editors_to_container(self):
with BusyCursor():