mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2106093 [[Enhancement] Add 'Remove format' action to context menu](https://bugs.launchpad.net/calibre/+bug/2106093)
This commit is contained in:
parent
d8ac21b896
commit
024a60ef20
@ -890,6 +890,9 @@ class FormatList(_FormatList):
|
|||||||
action = EditAction(item, cm)
|
action = EditAction(item, cm)
|
||||||
action.edit_fmt.connect(self.edit_fmt, type=Qt.ConnectionType.QueuedConnection)
|
action.edit_fmt.connect(self.edit_fmt, type=Qt.ConnectionType.QueuedConnection)
|
||||||
cm.addAction(action)
|
cm.addAction(action)
|
||||||
|
ac = cm.addAction(QIcon.ic('trash.png'), _('&Remove {} format').format(item.ext.upper()))
|
||||||
|
ac.setObjectName(item.ext)
|
||||||
|
ac.triggered.connect(self.remove_cm_fmt)
|
||||||
|
|
||||||
if item and originals:
|
if item and originals:
|
||||||
cm.addSeparator()
|
cm.addSeparator()
|
||||||
@ -904,6 +907,9 @@ class FormatList(_FormatList):
|
|||||||
cm.popup(event.globalPos())
|
cm.popup(event.globalPos())
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
|
def remove_cm_fmt(self):
|
||||||
|
self.remove_format(self.sender().objectName())
|
||||||
|
|
||||||
def remove_format(self, fmt):
|
def remove_format(self, fmt):
|
||||||
for i in range(self.count()):
|
for i in range(self.count()):
|
||||||
f = self.item(i)
|
f = self.item(i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user