Edit Book: Fix open OPF file not being refreshed when deleting items from the file browser. Fixes #1445634 [Wrong .opf syncing when deleting xptg template (and others?)](https://bugs.launchpad.net/calibre/+bug/1445634)

This commit is contained in:
Kovid Goyal 2015-04-18 08:35:55 +05:30
parent 8e85a16e4c
commit a3a7b20f07

View File

@ -360,6 +360,7 @@ class Boss(QObject):
@in_thread_job @in_thread_job
def delete_requested(self, spine_items, other_items): def delete_requested(self, spine_items, other_items):
self.add_savepoint(_('Before: Delete files')) self.add_savepoint(_('Before: Delete files'))
self.commit_dirty_opf()
c = current_container() c = current_container()
c.remove_from_spine(spine_items) c.remove_from_spine(spine_items)
for name in other_items: for name in other_items:
@ -379,6 +380,8 @@ class Boss(QObject):
toc = find_existing_toc(current_container()) toc = find_existing_toc(current_container())
if toc and toc in editors: if toc and toc in editors:
editors[toc].replace_data(c.raw_data(toc)) editors[toc].replace_data(c.raw_data(toc))
if c.opf_name in editors:
editors[c.opf_name].replace_data(c.raw_data(c.opf_name))
def commit_dirty_opf(self): def commit_dirty_opf(self):
c = current_container() c = current_container()