mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #8018 (Search fires twice in certain circumstance)
This commit is contained in:
parent
6e4be52e94
commit
77bdeedbeb
@ -206,17 +206,23 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.line_edit.blockSignals(yes)
|
self.line_edit.blockSignals(yes)
|
||||||
|
|
||||||
def set_search_string(self, txt, store_in_history=False, emit_changed=True):
|
def set_search_string(self, txt, store_in_history=False, emit_changed=True):
|
||||||
self.setFocus(Qt.OtherFocusReason)
|
if not store_in_history:
|
||||||
if not txt:
|
self.activated.disconnect()
|
||||||
self.clear()
|
try:
|
||||||
else:
|
self.setFocus(Qt.OtherFocusReason)
|
||||||
self.normalize_state()
|
if not txt:
|
||||||
self.setEditText(txt)
|
self.clear()
|
||||||
self.line_edit.end(False)
|
else:
|
||||||
if emit_changed:
|
self.normalize_state()
|
||||||
self.changed.emit()
|
self.setEditText(txt)
|
||||||
self._do_search(store_in_history=store_in_history)
|
self.line_edit.end(False)
|
||||||
self.focus_to_library.emit()
|
if emit_changed:
|
||||||
|
self.changed.emit()
|
||||||
|
self._do_search(store_in_history=store_in_history)
|
||||||
|
self.focus_to_library.emit()
|
||||||
|
finally:
|
||||||
|
if not store_in_history:
|
||||||
|
self.activated.connect(self.history_selected)
|
||||||
|
|
||||||
def search_as_you_type(self, enabled):
|
def search_as_you_type(self, enabled):
|
||||||
self.as_you_type = enabled
|
self.as_you_type = enabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user