mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Hide edit_collections on context menu when device does not support collections
This commit is contained in:
parent
46a9d48b1d
commit
a7e20ef517
@ -396,7 +396,8 @@ class BooksView(QTableView): # {{{
|
||||
self.context_menu.addAction(add_to_library[0], func)
|
||||
if edit_device_collections is not None:
|
||||
func = partial(edit_device_collections[1], view=self)
|
||||
self.context_menu.addAction(edit_device_collections[0], func)
|
||||
self.edit_collections_menu = \
|
||||
self.context_menu.addAction(edit_device_collections[0], func)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
self.context_menu.popup(event.globalPos())
|
||||
@ -498,6 +499,11 @@ class DeviceBooksView(BooksView): # {{{
|
||||
self.setDragDropMode(self.NoDragDrop)
|
||||
self.setAcceptDrops(False)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
self.edit_collections_menu.setVisible(self._model.db.supports_collections())
|
||||
self.context_menu.popup(event.globalPos())
|
||||
event.accept()
|
||||
|
||||
def set_database(self, db):
|
||||
self._model.set_database(db)
|
||||
self.restore_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user