diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index 016f132c57..6cae27d926 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -12,6 +12,7 @@ from calibre.gui2.dialogs.book_info_ui import Ui_BookInfo from calibre.gui2 import dynamic, open_local_file from calibre import fit_image from calibre.library.comments import comments_to_html +from calibre.utils.icu import sort_key class BookInfo(QDialog, Ui_BookInfo): @@ -130,9 +131,11 @@ class BookInfo(QDialog, Ui_BookInfo): for f in formats: f = f.strip() info[_('Formats')] += '%s, '%(f,f) - for key in info.keys(): + for key in sorted(info.keys(), key=sort_key): if key == 'id': continue txt = info[key] + if key.endswith(':html'): + key = key[:-5] if key != _('Path'): txt = u'
\n'.join(textwrap.wrap(txt, 120)) rows += u'%s:%s'%(key, txt) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 2ae6cf2936..957828f93c 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -296,19 +296,19 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{ Delegate for comments data. ''' + def __init__(self, parent): + QStyledItemDelegate.__init__(self, parent) + self.document = QTextDocument() + def paint(self, painter, option, index): - document = QTextDocument() - value = index.data(Qt.DisplayRole) -# if value.isValid() and not value.isNull(): -# QString text("This is highlighted."); - text = value.toString() - document.setHtml(text); + self.document.setHtml(index.data(Qt.DisplayRole).toString()) painter.save() + if option.state & QStyle.State_Selected: + painter.fillRect(option.rect, option.palette.highlight()) painter.setClipRect(option.rect) - painter.translate(option.rect.topLeft()); - document.drawContents(painter); + painter.translate(option.rect.topLeft()) + self.document.drawContents(painter) painter.restore() -# painter.translate(-option.rect.topLeft()); def createEditor(self, parent, option, index): m = index.model() diff --git a/src/calibre/library/server/opds.py b/src/calibre/library/server/opds.py index e447c6966c..fd8c50c594 100644 --- a/src/calibre/library/server/opds.py +++ b/src/calibre/library/server/opds.py @@ -173,6 +173,8 @@ def ACQUISITION_ENTRY(item, version, db, updated, CFM, CKEYS, prefix): extra.append('%s: %s
'%(xml(name), xml(format_tag_string(val, ',', ignore_max=True, no_tag_count=True)))) + elif datatype == 'comments': + extra.append('%s: %s
'%(xml(name), comments_to_html(unicode(val)))) else: extra.append('%s: %s
'%(xml(name), xml(unicode(val)))) comments = item[FM['comments']]