diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index bf66ea7235..40abb05f89 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -9,7 +9,7 @@ import sys from functools import partial from PyQt4.Qt import QComboBox, QLabel, QSpinBox, QDoubleSpinBox, QDateEdit, \ - QDate, QGroupBox, QVBoxLayout, QPlainTextEdit, QSizePolicy, \ + QDate, QGroupBox, QVBoxLayout, QSizePolicy, \ QSpacerItem, QIcon, QCheckBox, QWidget, QHBoxLayout, SIGNAL, \ QPushButton diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 957828f93c..fef1542737 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -301,9 +301,13 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{ self.document = QTextDocument() def paint(self, painter, option, index): + style = self.parent().style() self.document.setHtml(index.data(Qt.DisplayRole).toString()) painter.save() - if option.state & QStyle.State_Selected: + if hasattr(QStyle, 'CE_ItemViewItem'): + style.drawControl(QStyle.CE_ItemViewItem, option, + painter, self._parent) + elif option.state & QStyle.State_Selected: painter.fillRect(option.rect, option.palette.highlight()) painter.setClipRect(option.rect) painter.translate(option.rect.topLeft()) diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index b1c4a4c2f9..afc20ba21c 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -556,18 +556,19 @@ class BrowseServer(object): ids = self.search_cache('search:"%s"'%which) except: raise cherrypy.HTTPError(404, 'Search: %r not understood'%which) - all_ids = self.search_cache('') - if category == 'newest': - ids = all_ids - hide_sort = 'true' - elif category == 'allbooks': - ids = all_ids else: - q = category - if q == 'news': - q = 'tags' - ids = self.db.get_books_for_category(q, cid) - ids = [x for x in ids if x in all_ids] + all_ids = self.search_cache('') + if category == 'newest': + ids = all_ids + hide_sort = 'true' + elif category == 'allbooks': + ids = all_ids + else: + q = category + if q == 'news': + q = 'tags' + ids = self.db.get_books_for_category(q, cid) + ids = [x for x in ids if x in all_ids] items = [self.db.data._data[x] for x in ids] if category == 'newest':