From 01f0c986074c18b16aade14104dd62a719fa25f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Oct 2014 17:49:14 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/search_box.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index 7e6b984ae5..031a3ce55c 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -429,6 +429,9 @@ class SearchBoxMixin(object): # {{{ tt = _('Enable or disable search highlighting.') + '

' 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?'),