Fix #2821 (Non user-friendly error message when attempting to save metadata of open file)

This commit is contained in:
Kovid Goyal 2009-07-11 11:03:35 -06:00
parent 86abc60efe
commit a8294ae4b8

View File

@ -485,9 +485,17 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
def accept(self):
if self.formats_changed:
self.sync_formats()
title = qstring_to_unicode(self.title.text())
try:
if self.formats_changed:
self.sync_formats()
title = unicode(self.title.text())
except IOError, err:
if err.errno == 13: # Permission denied
fname = err.filename if err.filename else 'file'
return error_dialog(self, _('Permission denied'),
_('Could not open %s. Is it being used by another'
' program?')%fname, show=True)
raise
self.db.set_title(self.id, title, notify=False)
au = unicode(self.authors.text())
if au: