Merge from trunk

This commit is contained in:
Charles Haley 2011-05-31 07:48:31 +01:00
commit 1682265621
2 changed files with 9 additions and 5 deletions

View File

@ -152,7 +152,8 @@ class DeleteAction(InterfaceAction):
if not ids:
return
fmts = self._get_selected_formats(
'<p>'+_('Choose formats <b>not</b> to be deleted'), ids)
'<p>'+_('Choose formats <b>not</b> to be deleted.<p>Note that '
'this will never remove all formats from a book.'), ids)
if fmts is None:
return
for id in ids:
@ -161,9 +162,12 @@ class DeleteAction(InterfaceAction):
continue
bfmts = set([x.lower() for x in bfmts.split(',')])
rfmts = bfmts - set(fmts)
for fmt in rfmts:
self.gui.library_view.model().db.remove_format(id, fmt,
index_is_id=True, notify=False)
if bfmts - rfmts:
# Do not delete if it will leave the book with no
# formats
for fmt in rfmts:
self.gui.library_view.model().db.remove_format(id, fmt,
index_is_id=True, notify=False)
self.gui.library_view.model().refresh_ids(ids)
self.gui.library_view.model().current_changed(self.gui.library_view.currentIndex(),
self.gui.library_view.currentIndex())

View File

@ -44,7 +44,7 @@ class SelectFormats(QDialog):
self.setLayout(self._l)
self.setWindowTitle(_('Choose formats'))
self._m = QLabel(msg)
self._m.setWordWrap = True
self._m.setWordWrap(True)
self._l.addWidget(self._m)
self.formats = Formats(fmt_list)
self.fview = QListView(self)