mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
47b1bcb4d9
commit
85ba1a3cc1
@ -716,6 +716,8 @@ calibre has several keyboard shortcuts to save you time and mouse movement. Thes
|
|||||||
- Edit book
|
- Edit book
|
||||||
* - :kbd:`V`
|
* - :kbd:`V`
|
||||||
- View
|
- View
|
||||||
|
* - :kbd:`Shift+V`
|
||||||
|
- View last read book
|
||||||
* - :kbd:`Alt+V/Cmd+V in macOS`
|
* - :kbd:`Alt+V/Cmd+V in macOS`
|
||||||
- View specific format
|
- View specific format
|
||||||
* - :kbd:`Alt+Shift+J`
|
* - :kbd:`Alt+Shift+J`
|
||||||
|
@ -63,6 +63,10 @@ class ViewAction(InterfaceAction):
|
|||||||
self.clear_history_action = cm('clear history',
|
self.clear_history_action = cm('clear history',
|
||||||
_('Clear recently viewed list'), triggered=self.clear_history)
|
_('Clear recently viewed list'), triggered=self.clear_history)
|
||||||
self.history_actions = [self.clear_sep1]
|
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):
|
def initialization_complete(self):
|
||||||
self.build_menus(self.gui.current_db)
|
self.build_menus(self.gui.current_db)
|
||||||
@ -82,6 +86,12 @@ class ViewAction(InterfaceAction):
|
|||||||
ac.view_historical.connect(self.view_historical)
|
ac.view_historical.connect(self.view_historical)
|
||||||
self.history_actions.append(ac)
|
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):
|
def browse_annots(self):
|
||||||
self.gui.iactions['Browse Annotations'].show_browser()
|
self.gui.iactions['Browse Annotations'].show_browser()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user