diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index ecd0df2b37..177a741e0d 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -427,8 +427,8 @@ class XMLCache(object): mime = MIME_MAP.get(ext, None) if mime is None: mime = guess_type('a.'+ext)[0] - if mime is not None: - record.set('mime', mime) + if mime is not None: + record.set('mime', mime) if 'sourceid' not in record.attrib: record.set('sourceid', '1') if 'id' not in record.attrib: diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index e3dc5eed48..0fc2c7f7ed 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -729,19 +729,17 @@ class BooksModel(QAbstractTableModel): # {{{ class OnDeviceSearch(SearchQueryParser): # {{{ - DEFAULT_LOCATIONS = [ + USABLE_LOCATIONS = [ 'collections', 'title', 'author', 'format', - 'search', - 'date', 'all', - ] + ] def __init__(self, model): - SearchQueryParser.__init__(self) + SearchQueryParser.__init__(self, locations=self.USABLE_LOCATIONS) self.model = model def universal_set(self): @@ -765,10 +763,10 @@ class OnDeviceSearch(SearchQueryParser): # {{{ if matchkind != REGEXP_MATCH: ### leave case in regexps because it can be significant e.g. \S \W \D query = query.lower() - if location not in self.DEFAULT_LOCATIONS: + if location not in self.USABLE_LOCATIONS: return set([]) matches = set([]) - all_locs = set(self.DEFAULT_LOCATIONS) - set(['all']) + all_locs = set(self.USABLE_LOCATIONS) - set(['all']) locations = all_locs if location == 'all' else [location] q = { 'title' : lambda x : getattr(x, 'title').lower(), @@ -1055,6 +1053,8 @@ class DeviceBooksModel(BooksModel): # {{{ return NONE def headerData(self, section, orientation, role): + if role == Qt.ToolTipRole: + return QVariant(_('The lookup/search name is "{0}"').format(self.column_map[section])) if role != Qt.DisplayRole: return NONE if orientation == Qt.Horizontal: