485 self.tr("Copy Page URL to Clipboard")) |
485 self.tr("Copy Page URL to Clipboard")) |
486 act.setData(self.link()) |
486 act.setData(self.link()) |
487 act.triggered.connect( |
487 act.triggered.connect( |
488 functools.partial(self.__copyLink, act)) |
488 functools.partial(self.__copyLink, act)) |
489 |
489 |
|
490 act = self.__menu.addAction( |
|
491 UI.PixmapCache.getIcon("bookmark22"), |
|
492 self.tr("Bookmark Page")) |
|
493 act.setData({ |
|
494 "title": self.pageTitle(), |
|
495 "url": self.link() |
|
496 }) |
|
497 act.triggered.connect( |
|
498 functools.partial(self.__bookmarkPage, act)) |
|
499 |
490 self.__menu.addSeparator() |
500 self.__menu.addSeparator() |
491 |
501 |
492 act = self.__menu.addAction( |
502 act = self.__menu.addAction( |
493 UI.PixmapCache.getIcon("zoomIn"), |
503 UI.PixmapCache.getIcon("zoomIn"), |
494 self.tr("Zoom in"), |
504 self.tr("Zoom in"), |
594 if url.isEmpty(): |
604 if url.isEmpty(): |
595 return |
605 return |
596 |
606 |
597 self.__helpViewerWidget.openUrlNewBackgroundPage(url) |
607 self.__helpViewerWidget.openUrlNewBackgroundPage(url) |
598 |
608 |
|
609 def __bookmarkPage(self, act): |
|
610 """ |
|
611 Private method called by the context menu to bookmark the page. |
|
612 |
|
613 @param act reference to the action that triggered |
|
614 @type QAction |
|
615 """ |
|
616 data = act.data() |
|
617 if data: |
|
618 with contextlib.suppress(KeyError): |
|
619 url = data["url"] |
|
620 title = data["title"] |
|
621 |
|
622 self.__helpViewerWidget.bookmarkPage(title, url) |
|
623 |
599 def __copyLink(self, act): |
624 def __copyLink(self, act): |
600 """ |
625 """ |
601 Private method called by the context menu to copy a link to the |
626 Private method called by the context menu to copy a link to the |
602 clipboard. |
627 clipboard. |
603 |
628 |