Viewer: add a ashortcut (Ctrl+F11) to show/hide toolbars. Fixes #1664077 [[Enhancement request] Keyboard shortcut for "Show/hide controls"](https://bugs.launchpad.net/calibre/+bug/1664077)

This commit is contained in:
Kovid Goyal 2017-02-16 10:30:09 +05:30
parent b92e3196ad
commit 8aec078d00
2 changed files with 7 additions and 0 deletions

View File

@ -95,4 +95,7 @@ SHORTCUTS = {
'Print': (['Ctrl+P'],
_('Print the current book')),
'Show/hide controls': (['Ctrl+F11'],
_('Show/hide controls')),
}

View File

@ -248,6 +248,9 @@ class EbookViewer(MainWindow):
QTimer.singleShot(50, file_events.flush)
self.window_mode_changed = None
self.toggle_toolbar_action = QAction(_('Show/hide controls'), self)
tts = self.view.shortcuts.get_shortcuts('Show/hide controls')
if tts:
self.toggle_toolbar_action.setText(self.toggle_toolbar_action.text() + '\t' + tts[0])
self.toggle_toolbar_action.setCheckable(True)
self.toggle_toolbar_action.triggered.connect(self.toggle_toolbars)
self.toolbar_hidden = None
@ -1107,6 +1110,7 @@ class EbookViewer(MainWindow):
'Reload': self.action_reload,
'Table of Contents': self.action_table_of_contents,
'Print': self.action_print,
'Show/hide controls': self.toggle_toolbar_action,
}.get(key, None)
if action is not None:
event.accept()