Fix searching in device view. Add tooltips to header of columns in device view. Fix SONY driver to set meime type in enwly created book entries.

This commit is contained in:
Kovid Goyal 2010-05-21 08:46:23 -06:00
commit 1f3c90b781
2 changed files with 9 additions and 9 deletions

View File

@ -427,8 +427,8 @@ class XMLCache(object):
mime = MIME_MAP.get(ext, None) mime = MIME_MAP.get(ext, None)
if mime is None: if mime is None:
mime = guess_type('a.'+ext)[0] mime = guess_type('a.'+ext)[0]
if mime is not None: if mime is not None:
record.set('mime', mime) record.set('mime', mime)
if 'sourceid' not in record.attrib: if 'sourceid' not in record.attrib:
record.set('sourceid', '1') record.set('sourceid', '1')
if 'id' not in record.attrib: if 'id' not in record.attrib:

View File

@ -729,19 +729,17 @@ class BooksModel(QAbstractTableModel): # {{{
class OnDeviceSearch(SearchQueryParser): # {{{ class OnDeviceSearch(SearchQueryParser): # {{{
DEFAULT_LOCATIONS = [ USABLE_LOCATIONS = [
'collections', 'collections',
'title', 'title',
'author', 'author',
'format', 'format',
'search',
'date',
'all', 'all',
] ]
def __init__(self, model): def __init__(self, model):
SearchQueryParser.__init__(self) SearchQueryParser.__init__(self, locations=self.USABLE_LOCATIONS)
self.model = model self.model = model
def universal_set(self): 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 if matchkind != REGEXP_MATCH: ### leave case in regexps because it can be significant e.g. \S \W \D
query = query.lower() query = query.lower()
if location not in self.DEFAULT_LOCATIONS: if location not in self.USABLE_LOCATIONS:
return set([]) return set([])
matches = 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] locations = all_locs if location == 'all' else [location]
q = { q = {
'title' : lambda x : getattr(x, 'title').lower(), 'title' : lambda x : getattr(x, 'title').lower(),
@ -1055,6 +1053,8 @@ class DeviceBooksModel(BooksModel): # {{{
return NONE return NONE
def headerData(self, section, orientation, role): 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: if role != Qt.DisplayRole:
return NONE return NONE
if orientation == Qt.Horizontal: if orientation == Qt.Horizontal: