661 |
661 |
662 menu.addAction( |
662 menu.addAction( |
663 UI.PixmapCache.getIcon("openNewTab.png"), |
663 UI.PixmapCache.getIcon("openNewTab.png"), |
664 self.tr("Open Link in New Tab\tCtrl+LMB"), |
664 self.tr("Open Link in New Tab\tCtrl+LMB"), |
665 self.__openLinkInNewTab).setData(hitTest.linkUrl()) |
665 self.__openLinkInNewTab).setData(hitTest.linkUrl()) |
666 # TODO: context menu: Open Link in New Window |
666 menu.addAction( |
667 # TODO: context menu: Open Link in Private Window |
667 UI.PixmapCache.getIcon("newWindow.png"), |
|
668 self.tr("Open Link in New Window"), |
|
669 self.__openLinkInNewWindow).setData(hitTest.linkUrl()) |
|
670 menu.addAction( |
|
671 UI.PixmapCache.getIcon("privateMode.png"), |
|
672 self.tr("Open Link in New Private Window"), |
|
673 self.__openLinkInNewPrivateWindow).setData(hitTest.linkUrl()) |
668 menu.addSeparator() |
674 menu.addSeparator() |
669 # TODO: Qt 5.6 |
675 # TODO: Qt 5.6 |
670 ## menu.addAction( |
676 ## menu.addAction( |
671 ## UI.PixmapCache.getIcon("download.png"), |
677 ## UI.PixmapCache.getIcon("download.png"), |
672 ## self.tr("Save Lin&k"), self.__downloadLink) |
678 ## self.tr("Save Lin&k"), self.__downloadLink) |
970 "." in url.host() |
976 "." in url.host() |
971 |
977 |
972 def __openLinkInNewTab(self): |
978 def __openLinkInNewTab(self): |
973 """ |
979 """ |
974 Private method called by the context menu to open a link in a new |
980 Private method called by the context menu to open a link in a new |
975 window. |
981 tab. |
976 """ |
982 """ |
977 act = self.sender() |
983 act = self.sender() |
978 url = act.data() |
984 url = act.data() |
979 if url.isEmpty(): |
985 if url.isEmpty(): |
980 return |
986 return |
981 |
987 |
982 # TODO: check, if this can be done simpler |
988 # TODO: check, if this can be done simpler |
983 self.__ctrlPressed = True |
989 self.__ctrlPressed = True |
984 self.setSource(url) |
990 self.setSource(url) |
985 self.__ctrlPressed = False |
991 self.__ctrlPressed = False |
|
992 |
|
993 def __openLinkInNewWindow(self): |
|
994 """ |
|
995 Private slot called by the context menu to open a link in a new |
|
996 window. |
|
997 """ |
|
998 act = self.sender() |
|
999 url = act.data() |
|
1000 if url.isEmpty(): |
|
1001 return |
|
1002 |
|
1003 self.__mw.newWindow(url) |
|
1004 |
|
1005 def __openLinkInNewPrivateWindow(self): |
|
1006 """ |
|
1007 Private slot called by the context menu to open a link in a new |
|
1008 private window. |
|
1009 """ |
|
1010 act = self.sender() |
|
1011 url = act.data() |
|
1012 if url.isEmpty(): |
|
1013 return |
|
1014 |
|
1015 self.__mw.newPrivateWindow(url) |
986 |
1016 |
987 def __bookmarkLink(self): |
1017 def __bookmarkLink(self): |
988 """ |
1018 """ |
989 Private slot to bookmark a link via the context menu. |
1019 Private slot to bookmark a link via the context menu. |
990 """ |
1020 """ |