579 @type QMenu |
579 @type QMenu |
580 """ |
580 """ |
581 contextMenuData = self.lastContextMenuRequest() |
581 contextMenuData = self.lastContextMenuRequest() |
582 |
582 |
583 act = menu.addAction( |
583 act = menu.addAction( |
584 UI.PixmapCache.getIcon("back"), self.tr("Backward"), self.backward |
584 EricPixmapCache.getIcon("back"), self.tr("Backward"), self.backward |
585 ) |
585 ) |
586 act.setEnabled(self.isBackwardAvailable()) |
586 act.setEnabled(self.isBackwardAvailable()) |
587 |
587 |
588 act = menu.addAction( |
588 act = menu.addAction( |
589 UI.PixmapCache.getIcon("forward"), self.tr("Forward"), self.forward |
589 EricPixmapCache.getIcon("forward"), self.tr("Forward"), self.forward |
590 ) |
590 ) |
591 act.setEnabled(self.isForwardAvailable()) |
591 act.setEnabled(self.isForwardAvailable()) |
592 |
592 |
593 act = menu.addAction( |
593 act = menu.addAction( |
594 UI.PixmapCache.getIcon("reload"), self.tr("Reload"), self.reload |
594 EricPixmapCache.getIcon("reload"), self.tr("Reload"), self.reload |
595 ) |
595 ) |
596 |
596 |
597 if ( |
597 if ( |
598 not contextMenuData.linkUrl().isEmpty() |
598 not contextMenuData.linkUrl().isEmpty() |
599 and contextMenuData.linkUrl().scheme() != "javascript" |
599 and contextMenuData.linkUrl().scheme() != "javascript" |
601 self.__createLinkContextMenu(menu, contextMenuData) |
601 self.__createLinkContextMenu(menu, contextMenuData) |
602 |
602 |
603 menu.addSeparator() |
603 menu.addSeparator() |
604 |
604 |
605 act = menu.addAction( |
605 act = menu.addAction( |
606 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy Page URL to Clipboard") |
606 EricPixmapCache.getIcon("editCopy"), self.tr("Copy Page URL to Clipboard") |
607 ) |
607 ) |
608 act.setData(self.link()) |
608 act.setData(self.link()) |
609 act.triggered.connect(functools.partial(self.__copyLink, act)) |
609 act.triggered.connect(functools.partial(self.__copyLink, act)) |
610 |
610 |
611 act = menu.addAction( |
611 act = menu.addAction( |
612 UI.PixmapCache.getIcon("bookmark22"), self.tr("Bookmark Page") |
612 EricPixmapCache.getIcon("bookmark22"), self.tr("Bookmark Page") |
613 ) |
613 ) |
614 act.setData({"title": self.pageTitle(), "url": self.link()}) |
614 act.setData({"title": self.pageTitle(), "url": self.link()}) |
615 act.triggered.connect(functools.partial(self.__bookmarkPage, act)) |
615 act.triggered.connect(functools.partial(self.__bookmarkPage, act)) |
616 |
616 |
617 menu.addSeparator() |
617 menu.addSeparator() |
618 |
618 |
619 act = menu.addAction( |
619 act = menu.addAction( |
620 UI.PixmapCache.getIcon("zoomIn"), self.tr("Zoom in"), self.scaleUp |
620 EricPixmapCache.getIcon("zoomIn"), self.tr("Zoom in"), self.scaleUp |
621 ) |
621 ) |
622 act.setEnabled(self.isScaleUpAvailable()) |
622 act.setEnabled(self.isScaleUpAvailable()) |
623 |
623 |
624 act = menu.addAction( |
624 act = menu.addAction( |
625 UI.PixmapCache.getIcon("zoomOut"), self.tr("Zoom out"), self.scaleDown |
625 EricPixmapCache.getIcon("zoomOut"), self.tr("Zoom out"), self.scaleDown |
626 ) |
626 ) |
627 act.setEnabled(self.isScaleDownAvailable()) |
627 act.setEnabled(self.isScaleDownAvailable()) |
628 |
628 |
629 menu.addAction( |
629 menu.addAction( |
630 UI.PixmapCache.getIcon("zoomReset"), self.tr("Zoom reset"), self.resetScale |
630 EricPixmapCache.getIcon("zoomReset"), self.tr("Zoom reset"), self.resetScale |
631 ) |
631 ) |
632 |
632 |
633 menu.addSeparator() |
633 menu.addSeparator() |
634 |
634 |
635 act = menu.addAction( |
635 act = menu.addAction( |
636 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy"), self.__copyText |
636 EricPixmapCache.getIcon("editCopy"), self.tr("Copy"), self.__copyText |
637 ) |
637 ) |
638 act.setEnabled(bool(contextMenuData.selectedText())) |
638 act.setEnabled(bool(contextMenuData.selectedText())) |
639 |
639 |
640 menu.addAction( |
640 menu.addAction( |
641 UI.PixmapCache.getIcon("editSelectAll"), |
641 EricPixmapCache.getIcon("editSelectAll"), |
642 self.tr("Select All"), |
642 self.tr("Select All"), |
643 self.__selectAll, |
643 self.__selectAll, |
644 ) |
644 ) |
645 |
645 |
646 menu.addSeparator() |
646 menu.addSeparator() |
647 |
647 |
648 menu.addAction( |
648 menu.addAction( |
649 UI.PixmapCache.getIcon("tabClose"), self.tr("Close"), self.__closePage |
649 EricPixmapCache.getIcon("tabClose"), self.tr("Close"), self.__closePage |
650 ) |
650 ) |
651 |
651 |
652 act = menu.addAction( |
652 act = menu.addAction( |
653 UI.PixmapCache.getIcon("tabCloseOther"), |
653 EricPixmapCache.getIcon("tabCloseOther"), |
654 self.tr("Close Others"), |
654 self.tr("Close Others"), |
655 self.__closeOtherPages, |
655 self.__closeOtherPages, |
656 ) |
656 ) |
657 act.setEnabled(self.__helpViewerWidget.openPagesCount() > 1) |
657 act.setEnabled(self.__helpViewerWidget.openPagesCount() > 1) |
658 |
658 |
667 """ |
667 """ |
668 if not menu.isEmpty(): |
668 if not menu.isEmpty(): |
669 menu.addSeparator() |
669 menu.addSeparator() |
670 |
670 |
671 act = menu.addAction( |
671 act = menu.addAction( |
672 UI.PixmapCache.getIcon("openNewTab"), self.tr("Open Link in New Page") |
672 EricPixmapCache.getIcon("openNewTab"), self.tr("Open Link in New Page") |
673 ) |
673 ) |
674 act.setData(contextMenuData.linkUrl()) |
674 act.setData(contextMenuData.linkUrl()) |
675 act.triggered.connect(functools.partial(self.__openLinkInNewPage, act)) |
675 act.triggered.connect(functools.partial(self.__openLinkInNewPage, act)) |
676 |
676 |
677 act = menu.addAction( |
677 act = menu.addAction( |
678 UI.PixmapCache.getIcon("newWindow"), self.tr("Open Link in Background Page") |
678 EricPixmapCache.getIcon("newWindow"), |
|
679 self.tr("Open Link in Background Page"), |
679 ) |
680 ) |
680 act.setData(contextMenuData.linkUrl()) |
681 act.setData(contextMenuData.linkUrl()) |
681 act.triggered.connect(functools.partial(self.__openLinkInBackgroundPage, act)) |
682 act.triggered.connect(functools.partial(self.__openLinkInBackgroundPage, act)) |
682 |
683 |
683 menu.addSeparator() |
684 menu.addSeparator() |
684 |
685 |
685 act = menu.addAction( |
686 act = menu.addAction( |
686 UI.PixmapCache.getIcon("editCopy"), self.tr("Copy URL to Clipboard") |
687 EricPixmapCache.getIcon("editCopy"), self.tr("Copy URL to Clipboard") |
687 ) |
688 ) |
688 act.setData(contextMenuData.linkUrl()) |
689 act.setData(contextMenuData.linkUrl()) |
689 act.triggered.connect(functools.partial(self.__copyLink, act)) |
690 act.triggered.connect(functools.partial(self.__copyLink, act)) |
690 |
691 |
691 def __openLinkInNewPage(self, act): |
692 def __openLinkInNewPage(self, act): |