14 except NameError: |
14 except NameError: |
15 pass |
15 pass |
16 |
16 |
17 import os |
17 import os |
18 |
18 |
19 from PyQt5.QtCore import pyqtSignal, PYQT_VERSION, Qt, QUrl, QFileInfo, \ |
19 from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QUrl, \ |
20 QTimer, QEvent, QPoint, QPointF, QDateTime, QStandardPaths, QByteArray, \ |
20 QFileInfo, QTimer, QEvent, QPoint, QPointF, QDateTime, QStandardPaths, \ |
21 QIODevice, QDataStream |
21 QByteArray, QIODevice, QDataStream |
22 from PyQt5.QtGui import QDesktopServices, QClipboard, QIcon, \ |
22 from PyQt5.QtGui import QDesktopServices, QClipboard, QIcon, \ |
23 QContextMenuEvent, QPixmap |
23 QContextMenuEvent, QPixmap |
24 from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication |
24 from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication |
25 from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, \ |
25 from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, \ |
26 QWebEngineDownloadItem |
26 QWebEngineDownloadItem |
612 @type WebHitTestResult |
618 @type WebHitTestResult |
613 """ |
619 """ |
614 if not menu.isEmpty(): |
620 if not menu.isEmpty(): |
615 menu.addSeparator() |
621 menu.addSeparator() |
616 |
622 |
617 menu.addAction( |
623 act = menu.addAction( |
618 UI.PixmapCache.getIcon("openNewTab.png"), |
624 UI.PixmapCache.getIcon("openNewTab.png"), |
619 self.tr("Open Link in New Tab\tCtrl+LMB"), |
625 self.tr("Open Link in New Tab\tCtrl+LMB")) |
620 self.__openLinkInNewTab).setData(hitTest.linkUrl()) |
626 act.setData(hitTest.linkUrl()) |
621 menu.addAction( |
627 act.triggered.connect( |
|
628 lambda: self.__openLinkInNewTab(act)) |
|
629 act = menu.addAction( |
622 UI.PixmapCache.getIcon("newWindow.png"), |
630 UI.PixmapCache.getIcon("newWindow.png"), |
623 self.tr("Open Link in New Window"), |
631 self.tr("Open Link in New Window")) |
624 self.__openLinkInNewWindow).setData(hitTest.linkUrl()) |
632 act.setData(hitTest.linkUrl()) |
625 menu.addAction( |
633 act.triggered.connect( |
|
634 lambda: self.__openLinkInNewWindow(act)) |
|
635 act = menu.addAction( |
626 UI.PixmapCache.getIcon("privateMode.png"), |
636 UI.PixmapCache.getIcon("privateMode.png"), |
627 self.tr("Open Link in New Private Window"), |
637 self.tr("Open Link in New Private Window")) |
628 self.__openLinkInNewPrivateWindow).setData(hitTest.linkUrl()) |
638 act.setData(hitTest.linkUrl()) |
|
639 act.triggered.connect( |
|
640 lambda: self.__openLinkInNewPrivateWindow(act)) |
629 menu.addSeparator() |
641 menu.addSeparator() |
630 menu.addAction( |
642 menu.addAction( |
631 UI.PixmapCache.getIcon("download.png"), |
643 UI.PixmapCache.getIcon("download.png"), |
632 self.tr("Save Lin&k"), self.__downloadLink) |
644 self.tr("Save Lin&k"), self.__downloadLink) |
633 menu.addAction( |
645 act = menu.addAction( |
634 UI.PixmapCache.getIcon("bookmark22.png"), |
646 UI.PixmapCache.getIcon("bookmark22.png"), |
635 self.tr("Bookmark this Link"), self.__bookmarkLink)\ |
647 self.tr("Bookmark this Link")) |
636 .setData(hitTest.linkUrl()) |
648 act.setData(hitTest.linkUrl()) |
|
649 act.triggered.connect( |
|
650 lambda: self.__bookmarkLink(act)) |
637 menu.addSeparator() |
651 menu.addSeparator() |
638 menu.addAction( |
652 act = menu.addAction( |
639 UI.PixmapCache.getIcon("editCopy.png"), |
653 UI.PixmapCache.getIcon("editCopy.png"), |
640 self.tr("Copy Link to Clipboard"), self.__copyLink)\ |
654 self.tr("Copy Link to Clipboard")) |
641 .setData(hitTest.linkUrl()) |
655 act.setData(hitTest.linkUrl()) |
642 menu.addAction( |
656 act.triggered.connect( |
|
657 lambda: self.__copyLink(act)) |
|
658 act = menu.addAction( |
643 UI.PixmapCache.getIcon("mailSend.png"), |
659 UI.PixmapCache.getIcon("mailSend.png"), |
644 self.tr("Send Link"), |
660 self.tr("Send Link")) |
645 self.__sendLink).setData(hitTest.linkUrl()) |
661 act.setData(hitTest.linkUrl()) |
|
662 act.triggered.connect( |
|
663 lambda: self.__sendLink(act)) |
646 if Preferences.getWebBrowser("VirusTotalEnabled") and \ |
664 if Preferences.getWebBrowser("VirusTotalEnabled") and \ |
647 Preferences.getWebBrowser("VirusTotalServiceKey") != "": |
665 Preferences.getWebBrowser("VirusTotalServiceKey") != "": |
648 menu.addAction( |
666 act = menu.addAction( |
649 UI.PixmapCache.getIcon("virustotal.png"), |
667 UI.PixmapCache.getIcon("virustotal.png"), |
650 self.tr("Scan Link with VirusTotal"), |
668 self.tr("Scan Link with VirusTotal")) |
651 self.__virusTotal).setData(hitTest.linkUrl()) |
669 act.setData(hitTest.linkUrl()) |
|
670 act.triggered.connect( |
|
671 lambda: self.__virusTotal(act)) |
652 |
672 |
653 def __createImageContextMenu(self, menu, hitTest): |
673 def __createImageContextMenu(self, menu, hitTest): |
654 """ |
674 """ |
655 Private method to populate the context menu for images. |
675 Private method to populate the context menu for images. |
656 |
676 |
660 @type WebHitTestResult |
680 @type WebHitTestResult |
661 """ |
681 """ |
662 if not menu.isEmpty(): |
682 if not menu.isEmpty(): |
663 menu.addSeparator() |
683 menu.addSeparator() |
664 |
684 |
665 menu.addAction( |
685 act = menu.addAction( |
666 UI.PixmapCache.getIcon("openNewTab.png"), |
686 UI.PixmapCache.getIcon("openNewTab.png"), |
667 self.tr("Open Image in New Tab"), |
687 self.tr("Open Image in New Tab")) |
668 self.__openLinkInNewTab).setData(hitTest.imageUrl()) |
688 act.setData(hitTest.imageUrl()) |
|
689 act.triggered.connect( |
|
690 lambda: self.__openLinkInNewTab(act)) |
669 menu.addSeparator() |
691 menu.addSeparator() |
670 menu.addAction( |
692 menu.addAction( |
671 UI.PixmapCache.getIcon("download.png"), |
693 UI.PixmapCache.getIcon("download.png"), |
672 self.tr("Save Image"), self.__downloadImage) |
694 self.tr("Save Image"), self.__downloadImage) |
673 menu.addAction( |
695 menu.addAction( |
674 self.tr("Copy Image to Clipboard"), self.__copyImage) |
696 self.tr("Copy Image to Clipboard"), self.__copyImage) |
675 menu.addAction( |
697 act = menu.addAction( |
676 UI.PixmapCache.getIcon("editCopy.png"), |
698 UI.PixmapCache.getIcon("editCopy.png"), |
677 self.tr("Copy Image Location to Clipboard"), |
699 self.tr("Copy Image Location to Clipboard")) |
678 self.__copyLink).setData(hitTest.imageUrl()) |
700 act.setData(hitTest.imageUrl()) |
679 menu.addAction( |
701 act.triggered.connect( |
|
702 lambda: self.__copyLink(act)) |
|
703 act = menu.addAction( |
680 UI.PixmapCache.getIcon("mailSend.png"), |
704 UI.PixmapCache.getIcon("mailSend.png"), |
681 self.tr("Send Image Link"), |
705 self.tr("Send Image Link")) |
682 self.__sendLink).setData(hitTest.imageUrl()) |
706 act.setData(hitTest.imageUrl()) |
|
707 act.triggered.connect( |
|
708 lambda: self.__sendLink(act)) |
683 |
709 |
684 if hitTest.imageUrl().scheme() in ["http", "https"]: |
710 if hitTest.imageUrl().scheme() in ["http", "https"]: |
685 menu.addSeparator() |
711 menu.addSeparator() |
686 engine = WebBrowserWindow.imageSearchEngine() |
712 engine = WebBrowserWindow.imageSearchEngine() |
687 searchEngineName = engine.searchEngine() |
713 searchEngineName = engine.searchEngine() |
688 menu.addAction( |
714 act = menu.addAction( |
689 UI.PixmapCache.getIcon("{0}.png".format( |
715 UI.PixmapCache.getIcon("{0}.png".format( |
690 searchEngineName.lower())), |
716 searchEngineName.lower())), |
691 self.tr("Search image in {0}").format(searchEngineName), |
717 self.tr("Search image in {0}").format(searchEngineName)) |
692 self.__searchImage).setData( |
718 act.setData(engine.getSearchQuery(hitTest.imageUrl())) |
693 engine.getSearchQuery(hitTest.imageUrl())) |
719 act.triggered.connect( |
|
720 lambda: self.__searchImage(act)) |
694 self.__imageSearchMenu = menu.addMenu( |
721 self.__imageSearchMenu = menu.addMenu( |
695 self.tr("Search image with...")) |
722 self.tr("Search image with...")) |
696 for searchEngineName in engine.searchEngineNames(): |
723 for searchEngineName in engine.searchEngineNames(): |
697 self.__imageSearchMenu.addAction( |
724 act = self.__imageSearchMenu.addAction( |
698 UI.PixmapCache.getIcon("{0}.png".format( |
725 UI.PixmapCache.getIcon("{0}.png".format( |
699 searchEngineName.lower())), |
726 searchEngineName.lower())), |
700 self.tr("Search image in {0}").format(searchEngineName), |
727 self.tr("Search image in {0}").format(searchEngineName)) |
701 self.__searchImage).setData( |
728 act.setData(engine.getSearchQuery( |
702 engine.getSearchQuery( |
729 hitTest.imageUrl(), searchEngineName)) |
703 hitTest.imageUrl(), searchEngineName)) |
730 act.triggered.connect( |
|
731 lambda: self.__searchImage(act)) |
704 |
732 |
705 menu.addSeparator() |
733 menu.addSeparator() |
706 menu.addAction( |
734 act = menu.addAction( |
707 UI.PixmapCache.getIcon("adBlockPlus.png"), |
735 UI.PixmapCache.getIcon("adBlockPlus.png"), |
708 self.tr("Block Image"), self.__blockImage)\ |
736 self.tr("Block Image")) |
709 .setData(hitTest.imageUrl().toString()) |
737 act.setData(hitTest.imageUrl().toString()) |
|
738 act.triggered.connect( |
|
739 lambda: self.__blockImage(act)) |
710 if Preferences.getWebBrowser("VirusTotalEnabled") and \ |
740 if Preferences.getWebBrowser("VirusTotalEnabled") and \ |
711 Preferences.getWebBrowser("VirusTotalServiceKey") != "": |
741 Preferences.getWebBrowser("VirusTotalServiceKey") != "": |
712 menu.addAction( |
742 act = menu.addAction( |
713 UI.PixmapCache.getIcon("virustotal.png"), |
743 UI.PixmapCache.getIcon("virustotal.png"), |
714 self.tr("Scan Image with VirusTotal"), |
744 self.tr("Scan Image with VirusTotal")) |
715 self.__virusTotal).setData(hitTest.imageUrl()) |
745 act.setData(hitTest.imageUrl()) |
|
746 act.triggered.connect( |
|
747 lambda: self.__virusTotal(act)) |
716 |
748 |
717 def __createMediaContextMenu(self, menu, hitTest): |
749 def __createMediaContextMenu(self, menu, hitTest): |
718 """ |
750 """ |
719 Private method to populate the context menu for media elements. |
751 Private method to populate the context menu for media elements. |
720 |
752 |
741 else: |
773 else: |
742 menu.addAction( |
774 menu.addAction( |
743 UI.PixmapCache.getIcon("audioVolumeMuted.png"), |
775 UI.PixmapCache.getIcon("audioVolumeMuted.png"), |
744 self.tr("Mute"), self.__muteMedia) |
776 self.tr("Mute"), self.__muteMedia) |
745 menu.addSeparator() |
777 menu.addSeparator() |
746 menu.addAction( |
778 act = menu.addAction( |
747 UI.PixmapCache.getIcon("editCopy.png"), |
779 UI.PixmapCache.getIcon("editCopy.png"), |
748 self.tr("Copy Media Address to Clipboard"), |
780 self.tr("Copy Media Address to Clipboard")) |
749 self.__copyLink).setData(hitTest.mediaUrl()) |
781 act.setData(hitTest.mediaUrl()) |
750 menu.addAction( |
782 act.triggered.connect( |
|
783 lambda: self.__copyLink(act)) |
|
784 act = menu.addAction( |
751 UI.PixmapCache.getIcon("mailSend.png"), |
785 UI.PixmapCache.getIcon("mailSend.png"), |
752 self.tr("Send Media Address"), self.__sendLink)\ |
786 self.tr("Send Media Address")) |
753 .setData(hitTest.mediaUrl()) |
787 act.setData(hitTest.mediaUrl()) |
|
788 act.triggered.connect( |
|
789 lambda: self.__sendLink(act)) |
754 menu.addAction( |
790 menu.addAction( |
755 UI.PixmapCache.getIcon("download.png"), |
791 UI.PixmapCache.getIcon("download.png"), |
756 self.tr("Save Media"), self.__downloadMedia) |
792 self.tr("Save Media"), self.__downloadMedia) |
757 |
793 |
758 def __createSelectedTextContextMenu(self, menu, hitTest): |
794 def __createSelectedTextContextMenu(self, menu, hitTest): |
802 language = languages[0] |
840 language = languages[0] |
803 langCode = language.split("[")[1][:2] |
841 langCode = language.split("[")[1][:2] |
804 googleTranslatorUrl = QUrl( |
842 googleTranslatorUrl = QUrl( |
805 "http://translate.google.com/#auto/{0}/{1}".format( |
843 "http://translate.google.com/#auto/{0}/{1}".format( |
806 langCode, self.selectedText())) |
844 langCode, self.selectedText())) |
807 menu.addAction( |
845 act = menu.addAction( |
808 UI.PixmapCache.getIcon("translate.png"), |
846 UI.PixmapCache.getIcon("translate.png"), |
809 self.tr("Google Translate"), self.__openLinkInNewTab)\ |
847 self.tr("Google Translate")) |
810 .setData(googleTranslatorUrl) |
848 act.setData(googleTranslatorUrl) |
|
849 act.triggered.connect( |
|
850 lambda: self.__openLinkInNewTab(act)) |
811 wiktionaryUrl = QUrl( |
851 wiktionaryUrl = QUrl( |
812 "http://{0}.wiktionary.org/wiki/Special:Search?search={1}" |
852 "http://{0}.wiktionary.org/wiki/Special:Search?search={1}" |
813 .format(langCode, self.selectedText())) |
853 .format(langCode, self.selectedText())) |
814 menu.addAction( |
854 act = menu.addAction( |
815 UI.PixmapCache.getIcon("wikipedia.png"), |
855 UI.PixmapCache.getIcon("wikipedia.png"), |
816 self.tr("Dictionary"), self.__openLinkInNewTab)\ |
856 self.tr("Dictionary")) |
817 .setData(wiktionaryUrl) |
857 act.setData(wiktionaryUrl) |
|
858 act.triggered.connect( |
|
859 lambda: self.__openLinkInNewTab(act)) |
818 menu.addSeparator() |
860 menu.addSeparator() |
819 |
861 |
820 guessedUrl = QUrl.fromUserInput(self.selectedText().strip()) |
862 guessedUrl = QUrl.fromUserInput(self.selectedText().strip()) |
821 if self.__isUrlValid(guessedUrl): |
863 if self.__isUrlValid(guessedUrl): |
822 menu.addAction( |
864 act = menu.addAction(self.tr("Go to web address")) |
823 self.tr("Go to web address"), |
865 act.setData(guessedUrl) |
824 self.__openLinkInNewTab).setData(guessedUrl) |
866 act.triggered.connect( |
|
867 lambda: self.__openLinkInNewTab(act)) |
825 |
868 |
826 def __createPageContextMenu(self, menu): |
869 def __createPageContextMenu(self, menu): |
827 """ |
870 """ |
828 Private method to populate the basic context menu. |
871 Private method to populate the basic context menu. |
829 |
872 |
858 return |
902 return |
859 |
903 |
860 menu.addAction( |
904 menu.addAction( |
861 UI.PixmapCache.getIcon("bookmark22.png"), |
905 UI.PixmapCache.getIcon("bookmark22.png"), |
862 self.tr("Bookmark this Page"), self.addBookmark) |
906 self.tr("Bookmark this Page"), self.addBookmark) |
863 menu.addAction( |
907 act = menu.addAction( |
864 UI.PixmapCache.getIcon("editCopy.png"), |
908 UI.PixmapCache.getIcon("editCopy.png"), |
865 self.tr("Copy Page Link"), self.__copyLink).setData(self.url()) |
909 self.tr("Copy Page Link")) |
866 menu.addAction( |
910 act.setData(self.url()) |
|
911 act.triggered.connect( |
|
912 lambda: self.__copyLink(act)) |
|
913 act = menu.addAction( |
867 UI.PixmapCache.getIcon("mailSend.png"), |
914 UI.PixmapCache.getIcon("mailSend.png"), |
868 self.tr("Send Page Link"), self.__sendLink).setData(self.url()) |
915 self.tr("Send Page Link")) |
|
916 act.setData(self.url()) |
|
917 act.triggered.connect( |
|
918 lambda: self.__sendLink(act)) |
869 menu.addSeparator() |
919 menu.addSeparator() |
870 |
920 |
871 from .UserAgent.UserAgentMenu import UserAgentMenu |
921 from .UserAgent.UserAgentMenu import UserAgentMenu |
872 self.__userAgentMenu = UserAgentMenu(self.tr("User Agent"), |
922 self.__userAgentMenu = UserAgentMenu(self.tr("User Agent"), |
873 url=self.url()) |
923 url=self.url()) |
913 b"http://translate.google.com/translate?sl=auto&tl=" + |
965 b"http://translate.google.com/translate?sl=auto&tl=" + |
914 langCode.encode() + |
966 langCode.encode() + |
915 b"&u=" + |
967 b"&u=" + |
916 QUrl.toPercentEncoding( |
968 QUrl.toPercentEncoding( |
917 bytes(self.url().toEncoded()).decode())) |
969 bytes(self.url().toEncoded()).decode())) |
918 menu.addAction( |
970 act = menu.addAction( |
919 UI.PixmapCache.getIcon("translate.png"), |
971 UI.PixmapCache.getIcon("translate.png"), |
920 self.tr("Google Translate"), self.__openLinkInNewTab)\ |
972 self.tr("Google Translate")) |
921 .setData(googleTranslatorUrl) |
973 act.setData(googleTranslatorUrl) |
922 |
974 act.triggered.connect( |
|
975 lambda: self.__openLinkInNewTab(act)) |
|
976 |
923 def __checkForForm(self, act, pos): |
977 def __checkForForm(self, act, pos): |
924 """ |
978 """ |
925 Private method to check the given position for an open search form. |
979 Private method to check the given position for an open search form. |
926 |
980 |
927 @param act reference to the action to be populated upon success |
981 @param act reference to the action to be populated upon success |
968 return url.isValid() and \ |
1022 return url.isValid() and \ |
969 bool(url.host()) and \ |
1023 bool(url.host()) and \ |
970 bool(url.scheme()) and \ |
1024 bool(url.scheme()) and \ |
971 "." in url.host() |
1025 "." in url.host() |
972 |
1026 |
973 def __replaceMisspelledWord(self): |
1027 def __replaceMisspelledWord(self, act): |
974 """ |
1028 """ |
975 Private slot to replace a misspelled word under the context menu. |
1029 Private slot to replace a misspelled word under the context menu. |
976 """ |
1030 |
977 act = self.sender() |
1031 @param act reference to the action that triggered |
|
1032 @type QAction |
|
1033 """ |
978 suggestion = act.text() |
1034 suggestion = act.text() |
979 self.page().replaceMisspelledWord(suggestion) |
1035 self.page().replaceMisspelledWord(suggestion) |
980 |
1036 |
981 def __openLinkInNewTab(self): |
1037 def __openLinkInNewTab(self, act): |
982 """ |
1038 """ |
983 Private method called by the context menu to open a link in a new |
1039 Private method called by the context menu to open a link in a new |
984 tab. |
1040 tab. |
985 """ |
1041 |
986 act = self.sender() |
1042 @param act reference to the action that triggered |
|
1043 @type QAction |
|
1044 """ |
987 url = act.data() |
1045 url = act.data() |
988 if url.isEmpty(): |
1046 if url.isEmpty(): |
989 return |
1047 return |
990 |
1048 |
991 self.setSource(url, newTab=True) |
1049 self.setSource(url, newTab=True) |
992 |
1050 |
993 def __openLinkInNewWindow(self): |
1051 def __openLinkInNewWindow(self, act): |
994 """ |
1052 """ |
995 Private slot called by the context menu to open a link in a new |
1053 Private slot called by the context menu to open a link in a new |
996 window. |
1054 window. |
997 """ |
1055 |
998 act = self.sender() |
1056 @param act reference to the action that triggered |
|
1057 @type QAction |
|
1058 """ |
999 url = act.data() |
1059 url = act.data() |
1000 if url.isEmpty(): |
1060 if url.isEmpty(): |
1001 return |
1061 return |
1002 |
1062 |
1003 self.__mw.newWindow(url) |
1063 self.__mw.newWindow(url) |
1004 |
1064 |
1005 def __openLinkInNewPrivateWindow(self): |
1065 def __openLinkInNewPrivateWindow(self, act): |
1006 """ |
1066 """ |
1007 Private slot called by the context menu to open a link in a new |
1067 Private slot called by the context menu to open a link in a new |
1008 private window. |
1068 private window. |
1009 """ |
1069 |
1010 act = self.sender() |
1070 @param act reference to the action that triggered |
|
1071 @type QAction |
|
1072 """ |
1011 url = act.data() |
1073 url = act.data() |
1012 if url.isEmpty(): |
1074 if url.isEmpty(): |
1013 return |
1075 return |
1014 |
1076 |
1015 self.__mw.newPrivateWindow(url) |
1077 self.__mw.newPrivateWindow(url) |
1016 |
1078 |
1017 def __bookmarkLink(self): |
1079 def __bookmarkLink(self, act): |
1018 """ |
1080 """ |
1019 Private slot to bookmark a link via the context menu. |
1081 Private slot to bookmark a link via the context menu. |
1020 """ |
1082 |
1021 act = self.sender() |
1083 @param act reference to the action that triggered |
|
1084 @type QAction |
|
1085 """ |
1022 url = act.data() |
1086 url = act.data() |
1023 if url.isEmpty(): |
1087 if url.isEmpty(): |
1024 return |
1088 return |
1025 |
1089 |
1026 from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog |
1090 from .Bookmarks.AddBookmarkDialog import AddBookmarkDialog |
1027 dlg = AddBookmarkDialog() |
1091 dlg = AddBookmarkDialog() |
1028 dlg.setUrl(bytes(url.toEncoded()).decode()) |
1092 dlg.setUrl(bytes(url.toEncoded()).decode()) |
1029 dlg.exec_() |
1093 dlg.exec_() |
1030 |
1094 |
1031 def __sendLink(self): |
1095 def __sendLink(self, act): |
1032 """ |
1096 """ |
1033 Private slot to send a link via email. |
1097 Private slot to send a link via email. |
1034 """ |
1098 |
1035 act = self.sender() |
1099 @param act reference to the action that triggered |
|
1100 @type QAction |
|
1101 """ |
1036 data = act.data() |
1102 data = act.data() |
1037 if isinstance(data, QUrl) and data.isEmpty(): |
1103 if isinstance(data, QUrl) and data.isEmpty(): |
1038 return |
1104 return |
1039 |
1105 |
1040 if isinstance(data, QUrl): |
1106 if isinstance(data, QUrl): |
1041 data = data.toString() |
1107 data = data.toString() |
1042 QDesktopServices.openUrl(QUrl("mailto:?body=" + data)) |
1108 QDesktopServices.openUrl(QUrl("mailto:?body=" + data)) |
1043 |
1109 |
1044 def __copyLink(self): |
1110 def __copyLink(self, act): |
1045 """ |
1111 """ |
1046 Private slot to copy a link to the clipboard. |
1112 Private slot to copy a link to the clipboard. |
1047 """ |
1113 |
1048 act = self.sender() |
1114 @param act reference to the action that triggered |
|
1115 @type QAction |
|
1116 """ |
1049 data = act.data() |
1117 data = act.data() |
1050 if isinstance(data, QUrl) and data.isEmpty(): |
1118 if isinstance(data, QUrl) and data.isEmpty(): |
1051 return |
1119 return |
1052 |
1120 |
1053 if isinstance(data, QUrl): |
1121 if isinstance(data, QUrl): |