mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
...
This commit is contained in:
parent
ebe4e58b8b
commit
d80786c9bb
@ -51,6 +51,9 @@ class ViewAction(InterfaceAction):
|
|||||||
ac = self.create_action(spec=(_('Read a random book'), 'catalog.png',
|
ac = self.create_action(spec=(_('Read a random book'), 'catalog.png',
|
||||||
None, None), attr='action_pick_random')
|
None, None), attr='action_pick_random')
|
||||||
ac.triggered.connect(self.view_random)
|
ac.triggered.connect(self.view_random)
|
||||||
|
ac = self.clear_history_action = QAction(
|
||||||
|
_('Clear recently viewed list'), self.gui)
|
||||||
|
ac.triggered.connect(self.clear_history)
|
||||||
|
|
||||||
def initialization_complete(self):
|
def initialization_complete(self):
|
||||||
self.build_menus(self.gui.current_db)
|
self.build_menus(self.gui.current_db)
|
||||||
@ -65,10 +68,17 @@ class ViewAction(InterfaceAction):
|
|||||||
history = db.prefs.get('gui_view_history', [])
|
history = db.prefs.get('gui_view_history', [])
|
||||||
if history:
|
if history:
|
||||||
self.view_menu.addSeparator()
|
self.view_menu.addSeparator()
|
||||||
for id_, title in history:
|
for id_, title in history:
|
||||||
ac = HistoryAction(id_, title, self.view_menu)
|
ac = HistoryAction(id_, title, self.view_menu)
|
||||||
self.view_menu.addAction(ac)
|
self.view_menu.addAction(ac)
|
||||||
ac.view_historical.connect(self.view_historical)
|
ac.view_historical.connect(self.view_historical)
|
||||||
|
self.view_menu.addSeparator()
|
||||||
|
self.view_menu.addAction(self.clear_history_action)
|
||||||
|
|
||||||
|
def clear_history(self):
|
||||||
|
db = self.gui.current_db
|
||||||
|
db.prefs['gui_view_history'] = []
|
||||||
|
self.build_menus(db)
|
||||||
|
|
||||||
def view_historical(self, id_):
|
def view_historical(self, id_):
|
||||||
self._view_calibre_books([id_])
|
self._view_calibre_books([id_])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user