Add a shirtcut (Shift+V) to open the last read book. Fixes #1897336 [[Enhancement] Add shortcut to view last viewed book](https://bugs.launchpad.net/calibre/+bug/1897336)

This commit is contained in:
Kovid Goyal 2020-10-06 09:41:20 +05:30
parent 47b1bcb4d9
commit 85ba1a3cc1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 0 deletions

View File

@ -716,6 +716,8 @@ calibre has several keyboard shortcuts to save you time and mouse movement. Thes
- Edit book
* - :kbd:`V`
- View
* - :kbd:`Shift+V`
- View last read book
* - :kbd:`Alt+V/Cmd+V in macOS`
- View specific format
* - :kbd:`Alt+Shift+J`

View File

@ -63,6 +63,10 @@ class ViewAction(InterfaceAction):
self.clear_history_action = cm('clear history',
_('Clear recently viewed list'), triggered=self.clear_history)
self.history_actions = [self.clear_sep1]
self.action_view_last_read = ac = self.create_action(
spec=(_('Continue reading previous book'), None, _('Continue reading the last opened book'), 'shift+v'), attr='action_view_last_read')
ac.triggered.connect(self.view_last_read)
self.gui.addAction(ac)
def initialization_complete(self):
self.build_menus(self.gui.current_db)
@ -82,6 +86,12 @@ class ViewAction(InterfaceAction):
ac.view_historical.connect(self.view_historical)
self.history_actions.append(ac)
def view_last_read(self):
history = self.gui.current_db.new_api.pref('gui_view_history', [])
for book_id, title in history:
self.view_historical(book_id)
break
def browse_annots(self):
self.gui.iactions['Browse Annotations'].show_browser()