Allow configuring a keyboard shortcut to toggle highlighting of search results via Preferences->Keyboard (under Miscellaneous). Fixes #1380528 [[Enhancement] Keyboard Shortcut To Toggle Search Highlighting](https://bugs.launchpad.net/calibre/+bug/1380528)

This commit is contained in:
Kovid Goyal 2014-10-16 17:49:14 +05:30
parent 33d2d0e5ea
commit 01f0c98607

View File

@ -429,6 +429,9 @@ class SearchBoxMixin(object): # {{{
tt = _('Enable or disable search highlighting.') + '<br><br>'
tt += config.help('highlight_search_matches')
self.highlight_only_button.setToolTip(tt)
self.highlight_only_action = ac = QAction(self)
self.addAction(ac), ac.triggered.connect(self.highlight_only_clicked)
self.keyboard.register_shortcut('highlight search results', _('Highlight search results'), action=self.highlight_only_action)
def highlight_only_clicked(self, state):
if not config['highlight_search_matches'] and not question_dialog(self, _('Are you sure?'),