mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
33d2d0e5ea
commit
01f0c98607
@ -429,6 +429,9 @@ class SearchBoxMixin(object): # {{{
|
|||||||
tt = _('Enable or disable search highlighting.') + '<br><br>'
|
tt = _('Enable or disable search highlighting.') + '<br><br>'
|
||||||
tt += config.help('highlight_search_matches')
|
tt += config.help('highlight_search_matches')
|
||||||
self.highlight_only_button.setToolTip(tt)
|
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):
|
def highlight_only_clicked(self, state):
|
||||||
if not config['highlight_search_matches'] and not question_dialog(self, _('Are you sure?'),
|
if not config['highlight_search_matches'] and not question_dialog(self, _('Are you sure?'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user