mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement: add preference (in Search) to disable QTableView keyboardSearch().
This commit is contained in:
parent
cc7e2d7662
commit
bbd11ff153
@ -398,6 +398,7 @@ def create_defs():
|
||||
# JSON dumps converts integer keys to strings, so do it explicitly
|
||||
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
|
||||
|
||||
def migrate_tweak(tweak_name, pref_name):
|
||||
# If the tweak has been changed then leave the tweak in the file so
|
||||
|
@ -756,6 +756,10 @@ class BooksView(QTableView): # {{{
|
||||
gprefs[pname] = previous
|
||||
self.sort_by_named_field(field, previous[field])
|
||||
|
||||
def keyboardSearch(self, search):
|
||||
if gprefs.get('allow_keyboard_search_in_library_views', True):
|
||||
super().keyboardSearch(search)
|
||||
|
||||
def sort_by_named_field(self, field, order, reset=True):
|
||||
if isinstance(order, Qt.SortOrder):
|
||||
order = order == Qt.SortOrder.AscendingOrder
|
||||
|
@ -33,6 +33,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('limit_search_columns', prefs)
|
||||
r('use_primary_find_in_search', prefs)
|
||||
r('search_tool_bar_shows_text', gprefs)
|
||||
r('allow_keyboard_search_in_library_views', 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)
|
||||
|
@ -160,6 +160,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="opt_allow_keyboard_search_in_library_views">
|
||||
<property name="text">
|
||||
<string>Use keyboard searching in the book list</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><p>If enabled then pressing a key in the library view
|
||||
will search for the next cell in the current column where the
|
||||
value starts with the letter pressed. If there is no such cell
|
||||
then nothing happens. If the letter is a shortcut then the
|
||||
shortcut takes precedence.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
|
Loading…
x
Reference in New Issue
Block a user