mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Fix #7726 (Search history incorrect when closing/reopening calibre)
This commit is contained in:
parent
1a0d182067
commit
769d4e9502
@ -92,7 +92,11 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
def initialize(self, opt_name, colorize=False, help_text=_('Search')):
|
def initialize(self, opt_name, colorize=False, help_text=_('Search')):
|
||||||
self.as_you_type = config['search_as_you_type']
|
self.as_you_type = config['search_as_you_type']
|
||||||
self.opt_name = opt_name
|
self.opt_name = opt_name
|
||||||
self.addItems(QStringList(list(set(config[opt_name]))))
|
items = []
|
||||||
|
for item in config[opt_name]:
|
||||||
|
if item not in items:
|
||||||
|
items.append(item)
|
||||||
|
self.addItems(QStringList(items))
|
||||||
try:
|
try:
|
||||||
self.line_edit.setPlaceholderText(help_text)
|
self.line_edit.setPlaceholderText(help_text)
|
||||||
except:
|
except:
|
||||||
@ -189,8 +193,9 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.insertItem(0, t)
|
self.insertItem(0, t)
|
||||||
self.setCurrentIndex(0)
|
self.setCurrentIndex(0)
|
||||||
self.block_signals(False)
|
self.block_signals(False)
|
||||||
config[self.opt_name] = [unicode(self.itemText(i)) for i in
|
history = [unicode(self.itemText(i)) for i in
|
||||||
range(self.count())]
|
range(self.count())]
|
||||||
|
config[self.opt_name] = history
|
||||||
|
|
||||||
def do_search(self, *args):
|
def do_search(self, *args):
|
||||||
self._do_search()
|
self._do_search()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user