mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remember no more than 100 search expressions in the history
This commit is contained in:
parent
0301890d59
commit
16c3101490
@ -27,6 +27,8 @@ class PushButton(QPushButton):
|
||||
|
||||
class HistoryLineEdit(HistoryLineEdit2):
|
||||
|
||||
max_history_items = 100
|
||||
|
||||
def __init__(self, parent, clear_msg):
|
||||
HistoryLineEdit2.__init__(self, parent)
|
||||
self.disable_popup = tprefs['disable_completion_popup_for_search']
|
||||
|
@ -11,6 +11,8 @@ from calibre.gui2.widgets import history
|
||||
|
||||
class HistoryLineEdit2(LineEdit):
|
||||
|
||||
max_history_items = None
|
||||
|
||||
@property
|
||||
def store_name(self):
|
||||
return 'lineedit_history_'+self._name
|
||||
@ -31,6 +33,8 @@ class HistoryLineEdit2(LineEdit):
|
||||
except ValueError:
|
||||
pass
|
||||
self.history.insert(0, ct)
|
||||
if self.max_history_items is not None:
|
||||
del self.history[self.max_history_items:]
|
||||
history.set(self.store_name, self.history)
|
||||
self.update_items_cache(self.history)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user