WebBrowser/WebBrowserView.py

branch
QtWebEngine
changeset 4790
deeea3d64858
parent 4783
7de17766a5df
child 4791
a1e53a9ffcf3
--- a/WebBrowser/WebBrowserView.py	Sun Feb 28 20:09:44 2016 +0100
+++ b/WebBrowser/WebBrowserView.py	Mon Feb 29 19:30:13 2016 +0100
@@ -663,8 +663,14 @@
             UI.PixmapCache.getIcon("openNewTab.png"),
             self.tr("Open Link in New Tab\tCtrl+LMB"),
             self.__openLinkInNewTab).setData(hitTest.linkUrl())
-        # TODO: context menu: Open Link in New Window
-        # TODO: context menu: Open Link in Private Window
+        menu.addAction(
+            UI.PixmapCache.getIcon("newWindow.png"),
+            self.tr("Open Link in New Window"),
+            self.__openLinkInNewWindow).setData(hitTest.linkUrl())
+        menu.addAction(
+            UI.PixmapCache.getIcon("privateMode.png"),
+            self.tr("Open Link in New Private Window"),
+            self.__openLinkInNewPrivateWindow).setData(hitTest.linkUrl())
         menu.addSeparator()
         # TODO: Qt 5.6
 ##        menu.addAction(
@@ -972,7 +978,7 @@
     def __openLinkInNewTab(self):
         """
         Private method called by the context menu to open a link in a new
-        window.
+        tab.
         """
         act = self.sender()
         url = act.data()
@@ -984,6 +990,30 @@
         self.setSource(url)
         self.__ctrlPressed = False
     
+    def __openLinkInNewWindow(self):
+        """
+        Private slot called by the context menu to open a link in a new
+        window.
+        """
+        act = self.sender()
+        url = act.data()
+        if url.isEmpty():
+            return
+        
+        self.__mw.newWindow(url)
+    
+    def __openLinkInNewPrivateWindow(self):
+        """
+        Private slot called by the context menu to open a link in a new
+        private window.
+        """
+        act = self.sender()
+        url = act.data()
+        if url.isEmpty():
+            return
+        
+        self.__mw.newPrivateWindow(url)
+    
     def __bookmarkLink(self):
         """
         Private slot to bookmark a link via the context menu.

eric ide

mercurial