From 00ccf29b50440c89b853ef4c5b64bd15748cc99d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Oct 2014 23:01:15 +0530 Subject: [PATCH] E-book viewer: Add a keyboard shortcut to toggle the Table of Contents [Ctrl+T] --- src/calibre/gui2/viewer/keys.py | 3 +++ src/calibre/gui2/viewer/main.py | 1 + src/calibre/gui2/viewer/ui.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer/keys.py b/src/calibre/gui2/viewer/keys.py index 02a3646c51..f5d60af260 100644 --- a/src/calibre/gui2/viewer/keys.py +++ b/src/calibre/gui2/viewer/keys.py @@ -78,6 +78,9 @@ SHORTCUTS = { 'Search online': (['Ctrl+E'], _('Search online for word')), + 'Table of Contents': (['Ctrl+T'], + _('Show/hide the Table of Contents')), + 'Lookup word': (['Ctrl+L'], _('Lookup word in dictionary')), diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index d636eff0c6..c5f28ddcab 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -933,6 +933,7 @@ class EbookViewer(MainWindow): 'Next occurrence': self.view.search_action, 'Bookmark': bac, 'Reload': self.action_reload, + 'Table of Contents': self.action_table_of_contents, }.get(key, None) if action is not None: event.accept() diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 2c82de61c4..704a1f7b70 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -348,7 +348,7 @@ class Main(MainWindow): a('copy', _('Copy to clipboard'), 'edit-copy.png').setDisabled(True) a('font_size_larger', _('Increase font size'), 'font_size_larger.png') a('font_size_smaller', _('Decrease font size'), 'font_size_smaller.png') - a('table_of_contents', self.toc_dock, 'highlight_only_on.png') + a('table_of_contents', self.toc_dock, 'highlight_only_on.png', sc_name='Table of Contents') a('full_screen', _('Toggle full screen'), 'page.png', sc_name='Fullscreen').setCheckable(True) self.tool_bar.addSeparator()