diff --git a/manual/gui.rst b/manual/gui.rst index 6d75f65542..f973008ffd 100755 --- a/manual/gui.rst +++ b/manual/gui.rst @@ -586,6 +586,8 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes - Focus the book list * - :kbd:`Ctrl+Esc` - Clear the virtual library + * - :kbd:`Alt+Esc` + - Clear the additional restriction * - :kbd:`N or F3` - Find the next book that matches the current search (only works if the highlight checkbox next to the search bar is checked) * - :kbd:`Shift+N or Shift+F3` diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py index 1a9ea621a9..c6965aaa6c 100644 --- a/src/calibre/gui2/search_restriction_mixin.py +++ b/src/calibre/gui2/search_restriction_mixin.py @@ -549,6 +549,9 @@ class SearchRestrictionMixin(object): restriction = '' self._apply_search_restriction(restriction, r) + def clear_additional_restriction(self): + self._apply_search_restriction('', '') + def _apply_search_restriction(self, restriction, name): self.saved_search.clear() # The order below is important. Set the restriction, force a '' search diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 8a5f1ffbb5..aafea4ef2b 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -279,6 +279,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ action=self.ctrl_esc_action) self.ctrl_esc_action.triggered.connect(self.ctrl_esc) + self.alt_esc_action = QAction(self) + self.addAction(self.alt_esc_action) + self.keyboard.register_shortcut('clear additional restriction', + _('Clear the additional restriction'), default_keys=('Alt+Esc',), + action=self.alt_esc_action) + self.alt_esc_action.triggered.connect(self.clear_additional_restriction) + ####################### Start spare job server ######################## QTimer.singleShot(1000, self.add_spare_server)