mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
E-book viewer: Add a keyboard shortcut to bookmark current location. Fixes #1326198 [Enhancement to Reader– single keystroke bookmark.](https://bugs.launchpad.net/calibre/+bug/1326198)
This commit is contained in:
parent
558543b004
commit
fd9c98a233
@ -84,4 +84,7 @@ SHORTCUTS = {
|
|||||||
'Next occurrence': (['Ctrl+S'],
|
'Next occurrence': (['Ctrl+S'],
|
||||||
_('Go to next occurrence of selected word')),
|
_('Go to next occurrence of selected word')),
|
||||||
|
|
||||||
|
'Bookmark': (['Ctrl+B'],
|
||||||
|
_('Bookmark the current location')),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -972,7 +972,8 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
|
|
||||||
def set_bookmarks(self, bookmarks):
|
def set_bookmarks(self, bookmarks):
|
||||||
self.bookmarks_menu.clear()
|
self.bookmarks_menu.clear()
|
||||||
self.bookmarks_menu.addAction(_("Bookmark this location"), self.bookmark)
|
sc = _(' or ').join(self.view.shortcuts.get_shortcuts('Bookmark'))
|
||||||
|
self.bookmarks_menu.addAction(_("Bookmark this location [%s]") % sc, self.bookmark)
|
||||||
self.bookmarks_menu.addAction(_("Manage Bookmarks"), self.manage_bookmarks)
|
self.bookmarks_menu.addAction(_("Manage Bookmarks"), self.manage_bookmarks)
|
||||||
self.bookmarks_menu.addSeparator()
|
self.bookmarks_menu.addSeparator()
|
||||||
current_page = None
|
current_page = None
|
||||||
@ -1126,6 +1127,10 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
key = self.view.shortcuts.get_match(event)
|
key = self.view.shortcuts.get_match(event)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return MainWindow.keyPressEvent(self, event)
|
return MainWindow.keyPressEvent(self, event)
|
||||||
|
try:
|
||||||
|
bac = self.bookmarks_menu.actions()[0]
|
||||||
|
except (AttributeError, TypeError, IndexError, KeyError):
|
||||||
|
bac = None
|
||||||
action = {
|
action = {
|
||||||
'Quit':self.action_quit,
|
'Quit':self.action_quit,
|
||||||
'Show metadata':self.action_metadata,
|
'Show metadata':self.action_metadata,
|
||||||
@ -1138,6 +1143,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
'Search online': self.view.search_online_action,
|
'Search online': self.view.search_online_action,
|
||||||
'Lookup word': self.view.dictionary_action,
|
'Lookup word': self.view.dictionary_action,
|
||||||
'Next occurrence': self.view.search_action,
|
'Next occurrence': self.view.search_action,
|
||||||
|
'Bookmark': bac,
|
||||||
}.get(key, None)
|
}.get(key, None)
|
||||||
if action is not None:
|
if action is not None:
|
||||||
event.accept()
|
event.accept()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user