24 from PyQt5.QtWebEngineWidgets import QWebEnginePage |
24 from PyQt5.QtWebEngineWidgets import QWebEnginePage |
25 |
25 |
26 from E5Gui.E5LineEdit import E5LineEdit |
26 from E5Gui.E5LineEdit import E5LineEdit |
27 from E5Gui.E5LineEditButton import E5LineEditButton |
27 from E5Gui.E5LineEditButton import E5LineEditButton |
28 |
28 |
29 import WebBrowser.WebBrowserWindow |
29 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
30 |
30 |
31 from .FavIconLabel import FavIconLabel |
31 from .FavIconLabel import FavIconLabel |
32 ##from .SslLabel import SslLabel |
32 ##from .SslLabel import SslLabel |
33 ## |
33 ## |
34 import UI.PixmapCache |
34 import UI.PixmapCache |
51 self.setInactiveText(self.tr("Enter the URL here.")) |
51 self.setInactiveText(self.tr("Enter the URL here.")) |
52 self.setWhatsThis(self.tr("Enter the URL here.")) |
52 self.setWhatsThis(self.tr("Enter the URL here.")) |
53 |
53 |
54 self.__mw = mainWindow |
54 self.__mw = mainWindow |
55 self.__browser = None |
55 self.__browser = None |
56 ## self.__privateMode = QWebSettings.globalSettings().testAttribute( |
56 self.__privateMode = WebBrowserWindow.isPrivate() |
57 ## QWebSettings.PrivateBrowsingEnabled) |
|
58 |
57 |
59 self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16.png") |
58 self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16.png") |
60 self.__bmInactiveIcon = QIcon( |
59 self.__bmInactiveIcon = QIcon( |
61 self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) |
60 self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) |
62 |
61 |
66 # TODO: SSL |
65 # TODO: SSL |
67 ## self.__sslLabel = SslLabel(self) |
66 ## self.__sslLabel = SslLabel(self) |
68 ## self.addWidget(self.__sslLabel, E5LineEdit.LeftSide) |
67 ## self.addWidget(self.__sslLabel, E5LineEdit.LeftSide) |
69 ## self.__sslLabel.setVisible(False) |
68 ## self.__sslLabel.setVisible(False) |
70 |
69 |
71 # TODO: Privacy |
|
72 ## self.__privacyButton = E5LineEditButton(self) |
|
73 ## self.__privacyButton.setIcon( |
|
74 ## UI.PixmapCache.getIcon("privateBrowsing.png")) |
|
75 ## self.addWidget(self.__privacyButton, E5LineEdit.RightSide) |
|
76 ## self.__privacyButton.setVisible(self.__privateMode) |
|
77 |
|
78 self.__rssButton = E5LineEditButton(self) |
70 self.__rssButton = E5LineEditButton(self) |
79 self.__rssButton.setIcon(UI.PixmapCache.getIcon("rss16.png")) |
71 self.__rssButton.setIcon(UI.PixmapCache.getIcon("rss16.png")) |
80 self.addWidget(self.__rssButton, E5LineEdit.RightSide) |
72 self.addWidget(self.__rssButton, E5LineEdit.RightSide) |
81 self.__rssButton.setVisible(False) |
73 self.__rssButton.setVisible(False) |
82 |
74 |
89 self.addWidget(self.__clearButton, E5LineEdit.RightSide) |
81 self.addWidget(self.__clearButton, E5LineEdit.RightSide) |
90 self.__clearButton.setVisible(False) |
82 self.__clearButton.setVisible(False) |
91 |
83 |
92 self.__bookmarkButton.clicked.connect(self.__showBookmarkInfo) |
84 self.__bookmarkButton.clicked.connect(self.__showBookmarkInfo) |
93 self.__rssButton.clicked.connect(self.__rssClicked) |
85 self.__rssButton.clicked.connect(self.__rssClicked) |
94 # TODO: Privacy |
|
95 ## self.__privacyButton.clicked.connect(self.__privacyClicked) |
|
96 self.__clearButton.clicked.connect(self.clear) |
86 self.__clearButton.clicked.connect(self.clear) |
97 ## self.__mw.privacyChanged.connect(self.__privacyButton.setVisible) |
|
98 self.textChanged.connect(self.__textChanged) |
87 self.textChanged.connect(self.__textChanged) |
99 |
88 |
100 self.__mw.bookmarksManager().entryChanged.connect( |
89 self.__mw.bookmarksManager().entryChanged.connect( |
101 self.__bookmarkChanged) |
90 self.__bookmarkChanged) |
102 self.__mw.bookmarksManager().entryAdded.connect( |
91 self.__mw.bookmarksManager().entryAdded.connect( |
220 ## |
209 ## |
221 ## self.__sslLabel.setVisible(False) |
210 ## self.__sslLabel.setVisible(False) |
222 ## except RuntimeError: |
211 ## except RuntimeError: |
223 ## pass |
212 ## pass |
224 |
213 |
225 # TODO: Privacy |
|
226 ## def setPrivateMode(self, on): |
|
227 ## """ |
|
228 ## Public method to set the private mode. |
|
229 ## |
|
230 ## @param on flag indicating the privacy state (boolean) |
|
231 ## """ |
|
232 ## self.__privateMode = on |
|
233 ## self.__privacyButton.setVisible(on) |
|
234 ## |
|
235 ## def __privacyClicked(self): |
|
236 ## """ |
|
237 ## Private slot to handle the click of the private mode button. |
|
238 ## """ |
|
239 ## self.__mw.setPrivateMode(False) |
|
240 ## |
|
241 def __textChanged(self, txt): |
214 def __textChanged(self, txt): |
242 """ |
215 """ |
243 Private slot to handle changes of the text. |
216 Private slot to handle changes of the text. |
244 |
217 |
245 @param txt current text (string) |
218 @param txt current text (string) |
288 """ |
261 """ |
289 Protected method handling a paint event. |
262 Protected method handling a paint event. |
290 |
263 |
291 @param evt reference to the paint event (QPaintEvent) |
264 @param evt reference to the paint event (QPaintEvent) |
292 """ |
265 """ |
293 # TODO: Privacy |
266 if self.__privateMode: |
294 ## if self.__privateMode: |
267 backgroundColor = QColor(220, 220, 220) # light gray |
295 ## backgroundColor = QColor(220, 220, 220) # light gray |
268 foregroundColor = Qt.black |
296 ## foregroundColor = Qt.black |
269 else: |
297 ## else: |
270 backgroundColor = QApplication.palette().color(QPalette.Base) |
298 backgroundColor = QApplication.palette().color(QPalette.Base) |
271 foregroundColor = QApplication.palette().color(QPalette.Text) |
299 foregroundColor = QApplication.palette().color(QPalette.Text) |
|
300 |
272 |
301 if self.__browser is not None: |
273 if self.__browser is not None: |
302 p = self.palette() |
274 p = self.palette() |
303 progress = self.__browser.progress() |
275 progress = self.__browser.progress() |
304 if progress == 0 or progress == 100: |
276 if progress == 0 or progress == 100: |