mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Re-organize context menu to move delete away from the top
This commit is contained in:
parent
d299c182d2
commit
beb69ea7da
@ -333,24 +333,27 @@ class FileList(QTreeWidget):
|
|||||||
sel = self.selectedItems()
|
sel = self.selectedItems()
|
||||||
num = len(sel)
|
num = len(sel)
|
||||||
container = current_container()
|
container = current_container()
|
||||||
if num > 0:
|
|
||||||
m.addAction(QIcon(I('trash.png')), _('&Delete selected files'), self.request_delete)
|
|
||||||
m.addSeparator()
|
|
||||||
ci = self.currentItem()
|
ci = self.currentItem()
|
||||||
if ci is not None:
|
if ci is not None:
|
||||||
cn = unicode(ci.data(0, NAME_ROLE).toString())
|
cn = unicode(ci.data(0, NAME_ROLE).toString())
|
||||||
mt = unicode(ci.data(0, MIME_ROLE).toString())
|
mt = unicode(ci.data(0, MIME_ROLE).toString())
|
||||||
cat = unicode(ci.data(0, CATEGORY_ROLE).toString())
|
cat = unicode(ci.data(0, CATEGORY_ROLE).toString())
|
||||||
n = elided_text(cn.rpartition('/')[-1])
|
n = elided_text(cn.rpartition('/')[-1])
|
||||||
|
m.addAction(QIcon(I('save.png')), _('Export %s') % n, partial(self.export, cn))
|
||||||
|
if cn not in container.names_that_must_not_be_changed and cn not in container.names_that_must_not_be_removed and mt not in OEB_FONTS:
|
||||||
|
m.addAction(_('Replace %s with file...') % n, partial(self.replace, cn))
|
||||||
|
m.addSeparator()
|
||||||
|
|
||||||
m.addAction(QIcon(I('modified.png')), _('&Rename %s') % n, self.edit_current_item)
|
m.addAction(QIcon(I('modified.png')), _('&Rename %s') % n, self.edit_current_item)
|
||||||
if is_raster_image(mt):
|
if is_raster_image(mt):
|
||||||
m.addAction(QIcon(I('default_cover.png')), _('Mark %s as cover image') % n, partial(self.mark_as_cover, cn))
|
m.addAction(QIcon(I('default_cover.png')), _('Mark %s as cover image') % n, partial(self.mark_as_cover, cn))
|
||||||
elif current_container().SUPPORTS_TITLEPAGES and mt in OEB_DOCS and cat == 'text':
|
elif current_container().SUPPORTS_TITLEPAGES and mt in OEB_DOCS and cat == 'text':
|
||||||
m.addAction(QIcon(I('default_cover.png')), _('Mark %s as cover page') % n, partial(self.mark_as_titlepage, cn))
|
m.addAction(QIcon(I('default_cover.png')), _('Mark %s as cover page') % n, partial(self.mark_as_titlepage, cn))
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
m.addAction(QIcon(I('save.png')), _('Export %s') % n, partial(self.export, cn))
|
|
||||||
if cn not in container.names_that_must_not_be_changed and cn not in container.names_that_must_not_be_removed and mt not in OEB_FONTS:
|
if num > 0:
|
||||||
m.addAction(_('Replace %s with file...') % n, partial(self.replace, cn))
|
m.addSeparator()
|
||||||
|
m.addAction(QIcon(I('trash.png')), _('&Delete selected files'), self.request_delete)
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
|
|
||||||
selected_map = defaultdict(list)
|
selected_map = defaultdict(list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user