15 try: |
15 try: |
16 from PyQt6.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
16 from PyQt6.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
17 except ImportError: |
17 except ImportError: |
18 QSslCertificate = None # __IGNORE_WARNING__ |
18 QSslCertificate = None # __IGNORE_WARNING__ |
19 |
19 |
20 from EricWidgets.EricLineEdit import EricClearableLineEdit, EricLineEditSide |
20 from eric7.EricWidgets.EricLineEdit import EricClearableLineEdit, EricLineEditSide |
21 |
21 |
22 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
22 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
23 |
23 |
24 from WebBrowser.SafeBrowsing.SafeBrowsingLabel import SafeBrowsingLabel |
24 from eric7.WebBrowser.SafeBrowsing.SafeBrowsingLabel import SafeBrowsingLabel |
25 |
25 |
26 from .FavIconLabel import FavIconLabel |
26 from .FavIconLabel import FavIconLabel |
27 from .SslLabel import SslLabel |
27 from .SslLabel import SslLabel |
28 |
28 |
29 import UI.PixmapCache |
29 from eric7.EricGui import EricPixmapCache |
30 import Preferences |
30 from eric7 import Preferences, Utilities |
31 import Utilities |
|
32 |
31 |
33 |
32 |
34 class UrlBar(EricClearableLineEdit): |
33 class UrlBar(EricClearableLineEdit): |
35 """ |
34 """ |
36 Class implementing a line edit for entering URLs. |
35 Class implementing a line edit for entering URLs. |
51 |
50 |
52 self.__mw = mainWindow |
51 self.__mw = mainWindow |
53 self.__browser = None |
52 self.__browser = None |
54 self.__privateMode = WebBrowserWindow.isPrivate() |
53 self.__privateMode = WebBrowserWindow.isPrivate() |
55 |
54 |
56 self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16") |
55 self.__bmActiveIcon = EricPixmapCache.getIcon("bookmark16") |
57 self.__bmInactiveIcon = QIcon( |
56 self.__bmInactiveIcon = QIcon( |
58 self.__bmActiveIcon.pixmap(16, 16, QIcon.Mode.Disabled) |
57 self.__bmActiveIcon.pixmap(16, 16, QIcon.Mode.Disabled) |
59 ) |
58 ) |
60 |
59 |
61 self.__safeBrowsingLabel = SafeBrowsingLabel(self) |
60 self.__safeBrowsingLabel = SafeBrowsingLabel(self) |
68 self.__sslLabel = SslLabel(self) |
67 self.__sslLabel = SslLabel(self) |
69 self.addWidget(self.__sslLabel, EricLineEditSide.LEFT) |
68 self.addWidget(self.__sslLabel, EricLineEditSide.LEFT) |
70 self.__sslLabel.setVisible(False) |
69 self.__sslLabel.setVisible(False) |
71 |
70 |
72 self.__rssAction = self.addAction( |
71 self.__rssAction = self.addAction( |
73 UI.PixmapCache.getIcon("rss16"), QLineEdit.ActionPosition.TrailingPosition |
72 EricPixmapCache.getIcon("rss16"), QLineEdit.ActionPosition.TrailingPosition |
74 ) |
73 ) |
75 self.__rssAction.setVisible(False) |
74 self.__rssAction.setVisible(False) |
76 |
75 |
77 self.__bookmarkAction = self.addAction( |
76 self.__bookmarkAction = self.addAction( |
78 self.__bmInactiveIcon, QLineEdit.ActionPosition.TrailingPosition |
77 self.__bmInactiveIcon, QLineEdit.ActionPosition.TrailingPosition |
142 """ |
141 """ |
143 manager = self.__mw.bookmarksManager() |
142 manager = self.__mw.bookmarksManager() |
144 if manager.bookmarkForUrl(self.__browser.url()) is not None: |
143 if manager.bookmarkForUrl(self.__browser.url()) is not None: |
145 self.__bookmarkAction.setIcon(self.__bmActiveIcon) |
144 self.__bookmarkAction.setIcon(self.__bmActiveIcon) |
146 bookmarks = manager.bookmarksForUrl(self.__browser.url()) |
145 bookmarks = manager.bookmarksForUrl(self.__browser.url()) |
147 from WebBrowser.Bookmarks.BookmarkNode import BookmarkNode |
146 from eric7.WebBrowser.Bookmarks.BookmarkNode import BookmarkNode |
148 |
147 |
149 for bookmark in bookmarks: |
148 for bookmark in bookmarks: |
150 manager.setTimestamp( |
149 manager.setTimestamp( |
151 bookmark, BookmarkNode.TsVisited, QDateTime.currentDateTime() |
150 bookmark, BookmarkNode.TsVisited, QDateTime.currentDateTime() |
152 ) |
151 ) |
409 @pyqtSlot() |
408 @pyqtSlot() |
410 def __rssTriggered(self): |
409 def __rssTriggered(self): |
411 """ |
410 """ |
412 Private slot to handle clicking the RSS icon. |
411 Private slot to handle clicking the RSS icon. |
413 """ |
412 """ |
414 from WebBrowser.Feeds.FeedsDialog import FeedsDialog |
413 from eric7.WebBrowser.Feeds.FeedsDialog import FeedsDialog |
415 |
414 |
416 feeds = self.__browser.getRSS() |
415 feeds = self.__browser.getRSS() |
417 dlg = FeedsDialog(feeds, self.__browser) |
416 dlg = FeedsDialog(feeds, self.__browser) |
418 dlg.exec() |
417 dlg.exec() |
419 |
418 |
425 @param pos position to show the info at |
424 @param pos position to show the info at |
426 @type QPoint |
425 @type QPoint |
427 """ |
426 """ |
428 threatInfo = self.__safeBrowsingLabel.getThreatInfo() |
427 threatInfo = self.__safeBrowsingLabel.getThreatInfo() |
429 if threatInfo: |
428 if threatInfo: |
430 from WebBrowser.SafeBrowsing.SafeBrowsingInfoWidget import ( |
429 from eric7.WebBrowser.SafeBrowsing.SafeBrowsingInfoWidget import ( |
431 SafeBrowsingInfoWidget, |
430 SafeBrowsingInfoWidget, |
432 ) |
431 ) |
433 |
432 |
434 widget = SafeBrowsingInfoWidget(threatInfo, self.__browser) |
433 widget = SafeBrowsingInfoWidget(threatInfo, self.__browser) |
435 widget.showAt(pos) |
434 widget.showAt(pos) |