eric7/HelpViewer/HelpViewerImplQTB.py

branch
eric7
changeset 8900
9c153ce17d74
parent 8881
54e42bc2437a
child 9172
4bac907a4c74
--- a/eric7/HelpViewer/HelpViewerImplQTB.py	Tue Jan 04 15:52:14 2022 +0100
+++ b/eric7/HelpViewer/HelpViewerImplQTB.py	Tue Jan 04 17:13:35 2022 +0100
@@ -487,6 +487,16 @@
         act.triggered.connect(
             functools.partial(self.__copyLink, act))
         
+        act = self.__menu.addAction(
+            UI.PixmapCache.getIcon("bookmark22"),
+            self.tr("Bookmark Page"))
+        act.setData({
+            "title": self.pageTitle(),
+            "url": self.link()
+        })
+        act.triggered.connect(
+            functools.partial(self.__bookmarkPage, act))
+        
         self.__menu.addSeparator()
         
         act = self.__menu.addAction(
@@ -596,6 +606,21 @@
         
         self.__helpViewerWidget.openUrlNewBackgroundPage(url)
     
+    def __bookmarkPage(self, act):
+        """
+        Private method called by the context menu to bookmark the page.
+        
+        @param act reference to the action that triggered
+        @type QAction
+        """
+        data = act.data()
+        if data:
+            with contextlib.suppress(KeyError):
+                url = data["url"]
+                title = data["title"]
+                
+                self.__helpViewerWidget.bookmarkPage(title, url)
+    
     def __copyLink(self, act):
         """
         Private method called by the context menu to copy a link to the

eric ide

mercurial