mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-08 10:32:28 +00:00
A new option to keep the current search when switching Virtual libraries under Preferences->Searching. Fixes #2151262 [[Enhancement] Option for persistant Search Box Text](https://bugs.launchpad.net/calibre/+bug/2151262)
Merge branch 'copilot/add-keep-search-on-library-switch' of https://github.com/kovidgoyal/calibre
This commit is contained in:
@@ -496,6 +496,7 @@ def create_defs():
|
||||
defs['tb_search_order'] = {'0': 1, '1': 2, '2': 3, '3': 4, '4': 0}
|
||||
defs['search_tool_bar_shows_text'] = True
|
||||
defs['allow_keyboard_search_in_library_views'] = True
|
||||
defs['keep_search_when_switching_vl'] = False
|
||||
defs['show_links_in_tag_browser'] = False
|
||||
defs['show_notes_in_tag_browser'] = False
|
||||
defs['icons_on_right_in_tag_browser'] = True
|
||||
|
||||
@@ -32,6 +32,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('use_primary_find_in_search', prefs)
|
||||
r('search_tool_bar_shows_text', gprefs)
|
||||
r('allow_keyboard_search_in_library_views', gprefs)
|
||||
r('keep_search_when_switching_vl', gprefs)
|
||||
ossm = self.opt_saved_search_menu_is_hierarchical
|
||||
ossm.setChecked('search' in db.new_api.pref('categories_using_hierarchy', []))
|
||||
ossm.stateChanged.connect(self.changed_signal)
|
||||
|
||||
@@ -170,6 +170,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="opt_keep_search_when_switching_vl">
|
||||
<property name="text">
|
||||
<string>Keep current search when switching Virtual libraries</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><p>When enabled, the current search is kept and re-applied when switching Virtual libraries, instead of being cleared.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
|
||||
@@ -698,7 +698,10 @@ class SearchRestrictionMixin:
|
||||
# the book count.
|
||||
self.library_view.model().db.data.set_search_restriction(restriction)
|
||||
self.library_view.model().db.data.set_search_restriction_name(name)
|
||||
self.search.clear(emit_search=True)
|
||||
if gprefs.get('keep_search_when_switching_vl') and self.search.current_text:
|
||||
self.search.do_search()
|
||||
else:
|
||||
self.search.clear(emit_search=True)
|
||||
self.tags_view.recount()
|
||||
self.set_number_of_books_shown()
|
||||
self.focus_current_view()
|
||||
|
||||
Reference in New Issue
Block a user