6603:77189681b787 | 6646:51eefa621de4 |
---|---|
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 | 2 |
3 # Copyright (c) 2002 - 2018 Detlev Offenbach <detlev@die-offenbachs.de> | 3 # Copyright (c) 2002 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
4 # | 4 # |
5 | 5 |
6 """ | 6 """ |
7 Module implementing the web browser main window. | 7 Module implementing the web browser main window. |
8 """ | 8 """ |
16 import os | 16 import os |
17 import shutil | 17 import shutil |
18 import sys | 18 import sys |
19 | 19 |
20 from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, \ | 20 from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, \ |
21 QUrl, QTextCodec, QProcess, QEvent | 21 QUrl, QTextCodec, QProcess, QEvent, QFileInfo |
22 from PyQt5.QtGui import QDesktopServices, QKeySequence, QFont, QFontMetrics | 22 from PyQt5.QtGui import QDesktopServices, QKeySequence, QFont, QFontMetrics |
23 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \ | 23 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \ |
24 QComboBox, QLabel, QMenu, QLineEdit, QApplication, \ | 24 QComboBox, QLabel, QMenu, QLineEdit, QApplication, \ |
25 QWhatsThis, QDialog, QHBoxLayout, QProgressBar, QInputDialog, QAction | 25 QWhatsThis, QDialog, QHBoxLayout, QProgressBar, QInputDialog, QAction |
26 from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEnginePage, \ | 26 from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEnginePage, \ |
57 | 57 |
58 from .Tools import Scripts, WebBrowserTools, WebIconProvider | 58 from .Tools import Scripts, WebBrowserTools, WebIconProvider |
59 | 59 |
60 from .ZoomManager import ZoomManager | 60 from .ZoomManager import ZoomManager |
61 | 61 |
62 from .WebBrowserSingleApplication import WebBrowserSingleApplicationServer | |
63 | |
62 from eric6config import getConfig | 64 from eric6config import getConfig |
63 | 65 |
64 | 66 |
65 class WebBrowserWindow(E5MainWindow): | 67 class WebBrowserWindow(E5MainWindow): |
66 """ | 68 """ |
80 webBrowserOpened = pyqtSignal(QWidget) | 82 webBrowserOpened = pyqtSignal(QWidget) |
81 webBrowserClosed = pyqtSignal(QWidget) | 83 webBrowserClosed = pyqtSignal(QWidget) |
82 | 84 |
83 BrowserWindows = [] | 85 BrowserWindows = [] |
84 | 86 |
85 _fromEric = False | |
86 _useQtHelp = QTHELP_AVAILABLE | 87 _useQtHelp = QTHELP_AVAILABLE |
87 _isPrivate = False | 88 _isPrivate = False |
88 | 89 |
89 _webProfile = None | 90 _webProfile = None |
90 _networkManager = None | 91 _networkManager = None |
112 | 113 |
113 _performingStartup = True | 114 _performingStartup = True |
114 _performingShutdown = False | 115 _performingShutdown = False |
115 _lastActiveWindow = None | 116 _lastActiveWindow = None |
116 | 117 |
117 def __init__(self, home, path, parent, name, fromEric=False, | 118 def __init__(self, home, path, parent, name, |
118 initShortcutsOnly=False, searchWord=None, | 119 searchWord=None, private=False, qthelp=False, settingsDir="", |
119 private=False, qthelp=False, settingsDir="", | 120 restoreSession=False, single=False, saname=""): |
120 restoreSession=False): | |
121 """ | 121 """ |
122 Constructor | 122 Constructor |
123 | 123 |
124 @param home the URL to be shown | 124 @param home the URL to be shown |
125 @type str | 125 @type str |
127 @type str | 127 @type str |
128 @param parent parent widget of this window | 128 @param parent parent widget of this window |
129 @type QWidget | 129 @type QWidget |
130 @param name name of this window | 130 @param name name of this window |
131 @type str | 131 @type str |
132 @param fromEric flag indicating whether it was called from within | 132 @param searchWord word to search for |
133 eric6 | 133 @type str |
134 @param private flag indicating a private browsing window | |
134 @type bool | 135 @type bool |
135 @keyparam initShortcutsOnly flag indicating to just initialize the | 136 @param qthelp flag indicating to enable the QtHelp support |
136 keyboard shortcuts | |
137 @type bool | 137 @type bool |
138 @keyparam searchWord word to search for | 138 @param settingsDir directory to be used for the settings files |
139 @type str | 139 @type str |
140 @keyparam private flag indicating a private browsing window | 140 @param restoreSession flag indicating a restore session action |
141 @type bool | 141 @type bool |
142 @keyparam qthelp flag indicating to enable the QtHelp support | 142 @param single flag indicating to start in single application mode |
143 @type bool | 143 @type bool |
144 @keyparam settingsDir directory to be used for the settings files | 144 @param saname name to be used for the single application server |
145 @type str | 145 @type str |
146 @keyparam restoreSession flag indicating a restore session action | |
147 @type bool | |
148 """ | 146 """ |
149 self.__hideNavigationTimer = None | 147 self.__hideNavigationTimer = None |
150 | 148 |
151 super(WebBrowserWindow, self).__init__(parent) | 149 super(WebBrowserWindow, self).__init__(parent) |
152 self.setObjectName(name) | 150 self.setObjectName(name) |
154 self.setWindowTitle(self.tr("eric6 Web Browser (Private Mode)")) | 152 self.setWindowTitle(self.tr("eric6 Web Browser (Private Mode)")) |
155 else: | 153 else: |
156 self.setWindowTitle(self.tr("eric6 Web Browser")) | 154 self.setWindowTitle(self.tr("eric6 Web Browser")) |
157 | 155 |
158 self.__settingsDir = settingsDir | 156 self.__settingsDir = settingsDir |
159 self.__fromEric = fromEric | |
160 WebBrowserWindow._fromEric = fromEric | |
161 self.__initShortcutsOnly = initShortcutsOnly | |
162 self.setWindowIcon(UI.PixmapCache.getIcon("ericWeb.png")) | 157 self.setWindowIcon(UI.PixmapCache.getIcon("ericWeb.png")) |
163 | 158 |
164 self.__mHistory = [] | 159 self.__mHistory = [] |
165 self.__lastConfigurationPageName = "" | 160 self.__lastConfigurationPageName = "" |
166 | 161 |
167 WebBrowserWindow._isPrivate = private | 162 WebBrowserWindow._isPrivate = private |
168 | 163 |
164 self.__shortcutsDialog = None | |
165 | |
169 self.__eventMouseButtons = Qt.NoButton | 166 self.__eventMouseButtons = Qt.NoButton |
170 self.__eventKeyboardModifiers = Qt.NoModifier | 167 self.__eventKeyboardModifiers = Qt.NoModifier |
171 | 168 |
172 if self.__initShortcutsOnly: | 169 if qVersionTuple() < (5, 11, 0) and \ |
173 WebBrowserWindow.setUseQtHelp( | 170 Preferences.getWebBrowser("WebInspectorEnabled"): |
174 self.__fromEric or qthelp or bool(searchWord)) | 171 os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = \ |
175 self.__initActions() | 172 str(Preferences.getWebBrowser("WebInspectorPort")) |
173 | |
174 WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord)) | |
175 | |
176 self.webProfile(private) | |
177 self.networkManager() | |
178 | |
179 self.__htmlFullScreen = False | |
180 self.__windowStates = Qt.WindowNoState | |
181 self.__isClosing = False | |
182 | |
183 from .SearchWidget import SearchWidget | |
184 from .QtHelp.HelpTocWidget import HelpTocWidget | |
185 from .QtHelp.HelpIndexWidget import HelpIndexWidget | |
186 from .QtHelp.HelpSearchWidget import HelpSearchWidget | |
187 from .WebBrowserView import WebBrowserView | |
188 from .WebBrowserTabWidget import WebBrowserTabWidget | |
189 from .AdBlock.AdBlockIcon import AdBlockIcon | |
190 from .StatusBar.JavaScriptIcon import JavaScriptIcon | |
191 from .StatusBar.ImagesIcon import ImagesIcon | |
192 from .VirusTotal.VirusTotalApi import VirusTotalAPI | |
193 from .Navigation.NavigationBar import NavigationBar | |
194 from .Navigation.NavigationContainer import NavigationContainer | |
195 from .Bookmarks.BookmarksToolBar import BookmarksToolBar | |
196 | |
197 self.setStyle(Preferences.getUI("Style"), | |
198 Preferences.getUI("StyleSheet")) | |
199 | |
200 # initialize some SSL stuff | |
201 from E5Network.E5SslUtilities import initSSL | |
202 initSSL() | |
203 | |
204 if WebBrowserWindow._useQtHelp: | |
205 self.__helpEngine = QHelpEngine( | |
206 WebBrowserWindow.getQtHelpCollectionFileName(), | |
207 self) | |
208 self.__removeOldDocumentation() | |
209 self.__helpEngine.warning.connect(self.__warning) | |
176 else: | 210 else: |
177 if qVersionTuple() < (5, 11, 0) and \ | 211 self.__helpEngine = None |
178 Preferences.getWebBrowser("WebInspectorEnabled"): | 212 self.__helpInstaller = None |
179 os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = \ | 213 |
180 str(Preferences.getWebBrowser("WebInspectorPort")) | 214 self.__zoomWidget = E5ZoomWidget( |
215 UI.PixmapCache.getPixmap("zoomOut.png"), | |
216 UI.PixmapCache.getPixmap("zoomIn.png"), | |
217 UI.PixmapCache.getPixmap("zoomReset.png"), self) | |
218 self.statusBar().addPermanentWidget(self.__zoomWidget) | |
219 self.__zoomWidget.setMapping( | |
220 WebBrowserView.ZoomLevels, WebBrowserView.ZoomLevelDefault) | |
221 self.__zoomWidget.valueChanged.connect(self.__zoomValueChanged) | |
222 | |
223 self.__tabWidget = WebBrowserTabWidget(self) | |
224 self.__tabWidget.currentChanged[int].connect(self.__currentChanged) | |
225 self.__tabWidget.titleChanged.connect(self.__titleChanged) | |
226 self.__tabWidget.showMessage.connect(self.statusBar().showMessage) | |
227 self.__tabWidget.browserZoomValueChanged.connect( | |
228 self.__zoomWidget.setValue) | |
229 self.__tabWidget.browserClosed.connect(self.webBrowserClosed) | |
230 self.__tabWidget.browserOpened.connect(self.webBrowserOpened) | |
231 | |
232 self.__searchWidget = SearchWidget(self, self) | |
233 | |
234 self.__setIconDatabasePath() | |
235 | |
236 bookmarksModel = self.bookmarksManager().bookmarksModel() | |
237 self.__bookmarksToolBar = BookmarksToolBar(self, bookmarksModel, | |
238 self) | |
239 self.__bookmarksToolBar.setIconSize(UI.Config.ToolBarIconSize) | |
240 self.__bookmarksToolBar.openUrl.connect(self.openUrl) | |
241 self.__bookmarksToolBar.newTab.connect(self.openUrlNewTab) | |
242 self.__bookmarksToolBar.newWindow.connect(self.openUrlNewWindow) | |
243 | |
244 self.__navigationBar = NavigationBar(self) | |
245 | |
246 self.__navigationContainer = NavigationContainer(self) | |
247 self.__navigationContainer.addWidget(self.__navigationBar) | |
248 self.__navigationContainer.addWidget(self.__bookmarksToolBar) | |
249 | |
250 centralWidget = QWidget() | |
251 layout = QVBoxLayout() | |
252 layout.setContentsMargins(1, 1, 1, 1) | |
253 layout.setSpacing(0) | |
254 layout.addWidget(self.__navigationContainer) | |
255 layout.addWidget(self.__tabWidget) | |
256 layout.addWidget(self.__searchWidget) | |
257 self.__tabWidget.setSizePolicy( | |
258 QSizePolicy.Preferred, QSizePolicy.Expanding) | |
259 centralWidget.setLayout(layout) | |
260 self.setCentralWidget(centralWidget) | |
261 self.__searchWidget.hide() | |
262 | |
263 if WebBrowserWindow._useQtHelp: | |
264 # setup the TOC widget | |
265 self.__tocWindow = HelpTocWidget(self.__helpEngine) | |
266 self.__tocDock = QDockWidget(self.tr("Contents"), self) | |
267 self.__tocDock.setObjectName("TocWindow") | |
268 self.__tocDock.setWidget(self.__tocWindow) | |
269 self.addDockWidget(Qt.LeftDockWidgetArea, self.__tocDock) | |
181 | 270 |
182 WebBrowserWindow.setUseQtHelp( | 271 # setup the index widget |
183 self.__fromEric or qthelp or bool(searchWord)) | 272 self.__indexWindow = HelpIndexWidget(self.__helpEngine) |
273 self.__indexDock = QDockWidget(self.tr("Index"), self) | |
274 self.__indexDock.setObjectName("IndexWindow") | |
275 self.__indexDock.setWidget(self.__indexWindow) | |
276 self.addDockWidget(Qt.LeftDockWidgetArea, self.__indexDock) | |
184 | 277 |
185 self.webProfile(private) | 278 # setup the search widget |
186 self.networkManager() | 279 self.__searchWord = searchWord |
280 self.__indexing = False | |
281 self.__indexingProgress = None | |
282 self.__searchEngine = self.__helpEngine.searchEngine() | |
283 self.__searchEngine.indexingStarted.connect( | |
284 self.__indexingStarted) | |
285 self.__searchEngine.indexingFinished.connect( | |
286 self.__indexingFinished) | |
287 self.__searchWindow = HelpSearchWidget(self.__searchEngine) | |
288 self.__searchDock = QDockWidget(self.tr("Search"), self) | |
289 self.__searchDock.setObjectName("SearchWindow") | |
290 self.__searchDock.setWidget(self.__searchWindow) | |
291 self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock) | |
292 | |
293 # JavaScript Console window | |
294 from .WebBrowserJavaScriptConsole import \ | |
295 WebBrowserJavaScriptConsole | |
296 self.__javascriptConsole = WebBrowserJavaScriptConsole(self) | |
297 self.__javascriptConsoleDock = QDockWidget( | |
298 self.tr("JavaScript Console")) | |
299 self.__javascriptConsoleDock.setObjectName("JavascriptConsole") | |
300 self.__javascriptConsoleDock.setAllowedAreas( | |
301 Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea) | |
302 self.__javascriptConsoleDock.setWidget(self.__javascriptConsole) | |
303 self.addDockWidget(Qt.BottomDockWidgetArea, | |
304 self.__javascriptConsoleDock) | |
305 | |
306 if Preferences.getWebBrowser("SaveGeometry"): | |
307 g = Preferences.getGeometry("WebBrowserGeometry") | |
308 else: | |
309 g = QByteArray() | |
310 if g.isEmpty(): | |
311 s = QSize(800, 800) | |
312 self.resize(s) | |
313 else: | |
314 self.restoreGeometry(g) | |
315 | |
316 WebBrowserWindow.BrowserWindows.append(self) | |
317 | |
318 self.__initWebEngineSettings() | |
319 | |
320 # initialize some of our class objects | |
321 self.passwordManager() | |
322 self.historyManager() | |
323 self.greaseMonkeyManager() | |
324 | |
325 # initialize the actions | |
326 self.__initActions() | |
327 | |
328 # initialize the menus | |
329 self.__initMenus() | |
330 self.__initSuperMenu() | |
331 if Preferences.getWebBrowser("MenuBarVisible"): | |
332 self.__navigationBar.superMenuButton().hide() | |
333 else: | |
334 self.menuBar().hide() | |
335 | |
336 # save references to toolbars in order to hide them | |
337 # when going full screen | |
338 self.__toolbars = {} | |
339 # initialize toolbars | |
340 if Preferences.getWebBrowser("ShowToolbars"): | |
341 self.__initToolbars() | |
342 self.__bookmarksToolBar.setVisible( | |
343 Preferences.getWebBrowser("BookmarksToolBarVisible")) | |
344 | |
345 syncMgr = self.syncManager() | |
346 syncMgr.syncMessage.connect(self.statusBar().showMessage) | |
347 syncMgr.syncError.connect(self.statusBar().showMessage) | |
348 | |
349 restoreSessionData = {} | |
350 if WebBrowserWindow._performingStartup and not home and \ | |
351 not WebBrowserWindow.isPrivate(): | |
352 startupBehavior = Preferences.getWebBrowser("StartupBehavior") | |
353 if not private and startupBehavior in [3, 4]: | |
354 if startupBehavior == 3: | |
355 # restore last session | |
356 restoreSessionFile = \ | |
357 self.sessionManager().lastActiveSessionFile() | |
358 elif startupBehavior == 4: | |
359 # select session | |
360 restoreSessionFile = \ | |
361 self.sessionManager().selectSession() | |
362 sessionData = \ | |
363 self.sessionManager().readSessionFromFile( | |
364 restoreSessionFile) | |
365 if self.sessionManager().isValidSession(sessionData): | |
366 restoreSessionData = sessionData | |
367 restoreSession = True | |
368 else: | |
369 if Preferences.getWebBrowser("StartupBehavior") == 0: | |
370 home = "about:blank" | |
371 elif Preferences.getWebBrowser("StartupBehavior") == 1: | |
372 home = Preferences.getWebBrowser("HomePage") | |
373 elif Preferences.getWebBrowser("StartupBehavior") == 2: | |
374 home = "eric:speeddial" | |
375 | |
376 if not restoreSession: | |
377 self.__tabWidget.newBrowser(QUrl.fromUserInput(home)) | |
378 self.__tabWidget.currentBrowser().setFocus() | |
379 WebBrowserWindow._performingStartup = False | |
380 | |
381 self.__imagesIcon = ImagesIcon(self) | |
382 self.statusBar().addPermanentWidget(self.__imagesIcon) | |
383 self.__javaScriptIcon = JavaScriptIcon(self) | |
384 self.statusBar().addPermanentWidget(self.__javaScriptIcon) | |
385 | |
386 self.__adBlockIcon = AdBlockIcon(self) | |
387 self.statusBar().addPermanentWidget(self.__adBlockIcon) | |
388 self.__adBlockIcon.setEnabled( | |
389 Preferences.getWebBrowser("AdBlockEnabled")) | |
390 self.__tabWidget.currentChanged[int].connect( | |
391 self.__adBlockIcon.currentChanged) | |
392 self.__tabWidget.sourceChanged.connect( | |
393 self.__adBlockIcon.sourceChanged) | |
394 | |
395 self.__tabManagerIcon = self.tabManager().createStatusBarIcon() | |
396 self.statusBar().addPermanentWidget(self.__tabManagerIcon) | |
397 | |
398 self.networkIcon = E5NetworkIcon(self) | |
399 self.statusBar().addPermanentWidget(self.networkIcon) | |
400 | |
401 if not Preferences.getWebBrowser("StatusBarVisible"): | |
402 self.statusBar().hide() | |
403 | |
404 if len(WebBrowserWindow.BrowserWindows): | |
405 QDesktopServices.setUrlHandler( | |
406 "http", WebBrowserWindow.BrowserWindows[0].urlHandler) | |
407 QDesktopServices.setUrlHandler( | |
408 "https", WebBrowserWindow.BrowserWindows[0].urlHandler) | |
409 | |
410 # setup connections | |
411 self.__activating = False | |
412 if WebBrowserWindow._useQtHelp: | |
413 # TOC window | |
414 self.__tocWindow.escapePressed.connect( | |
415 self.__activateCurrentBrowser) | |
416 self.__tocWindow.openUrl.connect(self.openUrl) | |
417 self.__tocWindow.newTab.connect(self.openUrlNewTab) | |
418 self.__tocWindow.newBackgroundTab.connect( | |
419 self.openUrlNewBackgroundTab) | |
420 self.__tocWindow.newWindow.connect(self.openUrlNewWindow) | |
187 | 421 |
188 self.__htmlFullScreen = False | 422 # index window |
189 self.__windowStates = Qt.WindowNoState | 423 self.__indexWindow.escapePressed.connect( |
190 self.__isClosing = False | 424 self.__activateCurrentBrowser) |
425 self.__indexWindow.openUrl.connect(self.openUrl) | |
426 self.__indexWindow.newTab.connect(self.openUrlNewTab) | |
427 self.__indexWindow.newBackgroundTab.connect( | |
428 self.openUrlNewBackgroundTab) | |
429 self.__indexWindow.newWindow.connect(self.openUrlNewWindow) | |
191 | 430 |
192 from .SearchWidget import SearchWidget | 431 # search window |
193 from .QtHelp.HelpTocWidget import HelpTocWidget | 432 self.__searchWindow.escapePressed.connect( |
194 from .QtHelp.HelpIndexWidget import HelpIndexWidget | 433 self.__activateCurrentBrowser) |
195 from .QtHelp.HelpSearchWidget import HelpSearchWidget | 434 self.__searchWindow.openUrl.connect(self.openUrl) |
196 from .WebBrowserView import WebBrowserView | 435 self.__searchWindow.newTab.connect(self.openUrlNewTab) |
197 from .WebBrowserTabWidget import WebBrowserTabWidget | 436 self.__searchWindow.newBackgroundTab.connect( |
198 from .AdBlock.AdBlockIcon import AdBlockIcon | 437 self.openUrlNewBackgroundTab) |
199 from .StatusBar.JavaScriptIcon import JavaScriptIcon | 438 self.__searchWindow.newWindow.connect(self.openUrlNewWindow) |
200 from .StatusBar.ImagesIcon import ImagesIcon | 439 |
201 from .VirusTotal.VirusTotalApi import VirusTotalAPI | 440 state = Preferences.getWebBrowser("WebBrowserState") |
202 from .Navigation.NavigationBar import NavigationBar | 441 self.restoreState(state) |
203 from .Navigation.NavigationContainer import NavigationContainer | 442 |
204 from .Bookmarks.BookmarksToolBar import BookmarksToolBar | 443 self.__initHelpDb() |
205 | 444 |
206 if not self.__fromEric: | 445 self.__virusTotal = VirusTotalAPI(self) |
207 self.setStyle(Preferences.getUI("Style"), | 446 self.__virusTotal.submitUrlError.connect( |
208 Preferences.getUI("StyleSheet")) | 447 self.__virusTotalSubmitUrlError) |
209 | 448 self.__virusTotal.urlScanReport.connect( |
210 # initialize some SSL stuff | 449 self.__virusTotalUrlScanReport) |
211 from E5Network.E5SslUtilities import initSSL | 450 self.__virusTotal.fileScanReport.connect( |
212 initSSL() | 451 self.__virusTotalFileScanReport) |
213 | 452 |
214 if WebBrowserWindow._useQtHelp: | 453 self.flashCookieManager() |
215 self.__helpEngine = QHelpEngine( | 454 |
216 WebBrowserWindow.getQtHelpCollectionFileName(), | 455 e5App().focusChanged.connect(self.__appFocusChanged) |
217 self) | 456 |
218 self.__removeOldDocumentation() | 457 self.__toolbarStates = self.saveState() |
219 self.__helpEngine.warning.connect(self.__warning) | 458 |
220 else: | 459 if single: |
221 self.__helpEngine = None | 460 self.SAServer = WebBrowserSingleApplicationServer(saname) |
222 self.__helpInstaller = None | 461 self.SAServer.loadUrl.connect(self.__saLoadUrl) |
223 | 462 self.SAServer.newTab.connect(self.__saNewTab) |
224 self.__zoomWidget = E5ZoomWidget( | 463 self.SAServer.search.connect(self.__saSearchWord) |
225 UI.PixmapCache.getPixmap("zoomOut.png"), | 464 self.SAServer.shutdown.connect(self.shutdown) |
226 UI.PixmapCache.getPixmap("zoomIn.png"), | 465 else: |
227 UI.PixmapCache.getPixmap("zoomReset.png"), self) | 466 self.SAServer = None |
228 self.statusBar().addPermanentWidget(self.__zoomWidget) | 467 |
229 self.__zoomWidget.setMapping( | 468 self.__hideNavigationTimer = QTimer(self) |
230 WebBrowserView.ZoomLevels, WebBrowserView.ZoomLevelDefault) | 469 self.__hideNavigationTimer.setInterval(1000) |
231 self.__zoomWidget.valueChanged.connect(self.__zoomValueChanged) | 470 self.__hideNavigationTimer.setSingleShot(True) |
232 | 471 self.__hideNavigationTimer.timeout.connect(self.__hideNavigation) |
233 self.__tabWidget = WebBrowserTabWidget(self) | 472 |
234 self.__tabWidget.currentChanged[int].connect(self.__currentChanged) | 473 self.__forcedClose = False |
235 self.__tabWidget.titleChanged.connect(self.__titleChanged) | 474 |
236 self.__tabWidget.showMessage.connect(self.statusBar().showMessage) | 475 if restoreSessionData and not WebBrowserWindow.isPrivate(): |
237 self.__tabWidget.browserZoomValueChanged.connect( | 476 self.sessionManager().restoreSessionFromData( |
238 self.__zoomWidget.setValue) | 477 self, restoreSessionData) |
239 self.__tabWidget.browserClosed.connect(self.webBrowserClosed) | 478 |
240 self.__tabWidget.browserOpened.connect(self.webBrowserOpened) | 479 if not WebBrowserWindow.isPrivate(): |
241 | |
242 self.__searchWidget = SearchWidget(self, self) | |
243 | |
244 self.__setIconDatabasePath() | |
245 | |
246 bookmarksModel = self.bookmarksManager().bookmarksModel() | |
247 self.__bookmarksToolBar = BookmarksToolBar(self, bookmarksModel, | |
248 self) | |
249 self.__bookmarksToolBar.setIconSize(UI.Config.ToolBarIconSize) | |
250 self.__bookmarksToolBar.openUrl.connect(self.openUrl) | |
251 self.__bookmarksToolBar.newTab.connect(self.openUrlNewTab) | |
252 self.__bookmarksToolBar.newWindow.connect(self.openUrlNewWindow) | |
253 | |
254 self.__navigationBar = NavigationBar(self) | |
255 | |
256 self.__navigationContainer = NavigationContainer(self) | |
257 self.__navigationContainer.addWidget(self.__navigationBar) | |
258 self.__navigationContainer.addWidget(self.__bookmarksToolBar) | |
259 | |
260 centralWidget = QWidget() | |
261 layout = QVBoxLayout() | |
262 layout.setContentsMargins(1, 1, 1, 1) | |
263 layout.setSpacing(0) | |
264 layout.addWidget(self.__navigationContainer) | |
265 layout.addWidget(self.__tabWidget) | |
266 layout.addWidget(self.__searchWidget) | |
267 self.__tabWidget.setSizePolicy( | |
268 QSizePolicy.Preferred, QSizePolicy.Expanding) | |
269 centralWidget.setLayout(layout) | |
270 self.setCentralWidget(centralWidget) | |
271 self.__searchWidget.hide() | |
272 | |
273 if WebBrowserWindow._useQtHelp: | |
274 # setup the TOC widget | |
275 self.__tocWindow = HelpTocWidget(self.__helpEngine) | |
276 self.__tocDock = QDockWidget(self.tr("Contents"), self) | |
277 self.__tocDock.setObjectName("TocWindow") | |
278 self.__tocDock.setWidget(self.__tocWindow) | |
279 self.addDockWidget(Qt.LeftDockWidgetArea, self.__tocDock) | |
280 | |
281 # setup the index widget | |
282 self.__indexWindow = HelpIndexWidget(self.__helpEngine) | |
283 self.__indexDock = QDockWidget(self.tr("Index"), self) | |
284 self.__indexDock.setObjectName("IndexWindow") | |
285 self.__indexDock.setWidget(self.__indexWindow) | |
286 self.addDockWidget(Qt.LeftDockWidgetArea, self.__indexDock) | |
287 | |
288 # setup the search widget | |
289 self.__searchWord = searchWord | |
290 self.__indexing = False | |
291 self.__indexingProgress = None | |
292 self.__searchEngine = self.__helpEngine.searchEngine() | |
293 self.__searchEngine.indexingStarted.connect( | |
294 self.__indexingStarted) | |
295 self.__searchEngine.indexingFinished.connect( | |
296 self.__indexingFinished) | |
297 self.__searchWindow = HelpSearchWidget(self.__searchEngine) | |
298 self.__searchDock = QDockWidget(self.tr("Search"), self) | |
299 self.__searchDock.setObjectName("SearchWindow") | |
300 self.__searchDock.setWidget(self.__searchWindow) | |
301 self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock) | |
302 | |
303 # JavaScript Console window | |
304 from .WebBrowserJavaScriptConsole import \ | |
305 WebBrowserJavaScriptConsole | |
306 self.__javascriptConsole = WebBrowserJavaScriptConsole(self) | |
307 self.__javascriptConsoleDock = QDockWidget( | |
308 self.tr("JavaScript Console")) | |
309 self.__javascriptConsoleDock.setObjectName("JavascriptConsole") | |
310 self.__javascriptConsoleDock.setAllowedAreas( | |
311 Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea) | |
312 self.__javascriptConsoleDock.setWidget(self.__javascriptConsole) | |
313 self.addDockWidget(Qt.BottomDockWidgetArea, | |
314 self.__javascriptConsoleDock) | |
315 | |
316 if Preferences.getWebBrowser("SaveGeometry"): | |
317 g = Preferences.getGeometry("WebBrowserGeometry") | |
318 else: | |
319 g = QByteArray() | |
320 if g.isEmpty(): | |
321 s = QSize(800, 800) | |
322 self.resize(s) | |
323 else: | |
324 self.restoreGeometry(g) | |
325 | |
326 WebBrowserWindow.BrowserWindows.append(self) | |
327 | |
328 self.__initWebEngineSettings() | |
329 | |
330 # initialize some of our class objects | |
331 self.passwordManager() | |
332 self.historyManager() | |
333 self.greaseMonkeyManager() | |
334 | |
335 # initialize the actions | |
336 self.__initActions() | |
337 | |
338 # initialize the menus | |
339 self.__initMenus() | |
340 self.__initSuperMenu() | |
341 if Preferences.getWebBrowser("MenuBarVisible"): | |
342 self.__navigationBar.superMenuButton().hide() | |
343 else: | |
344 self.menuBar().hide() | |
345 | |
346 # save references to toolbars in order to hide them | |
347 # when going full screen | |
348 self.__toolbars = {} | |
349 # initialize toolbars | |
350 if Preferences.getWebBrowser("ShowToolbars"): | |
351 self.__initToolbars() | |
352 self.__bookmarksToolBar.setVisible( | |
353 Preferences.getWebBrowser("BookmarksToolBarVisible")) | |
354 | |
355 syncMgr = self.syncManager() | |
356 syncMgr.syncMessage.connect(self.statusBar().showMessage) | |
357 syncMgr.syncError.connect(self.statusBar().showMessage) | |
358 | |
359 restoreSessionData = {} | |
360 if WebBrowserWindow._performingStartup and not home: | |
361 startupBehavior = Preferences.getWebBrowser("StartupBehavior") | |
362 if not private and startupBehavior in [3, 4]: | |
363 if startupBehavior == 3: | |
364 # restore last session | |
365 restoreSessionFile = \ | |
366 self.sessionManager().lastActiveSessionFile() | |
367 elif startupBehavior == 4: | |
368 # select session | |
369 restoreSessionFile = \ | |
370 self.sessionManager().selectSession() | |
371 sessionData = \ | |
372 self.sessionManager().readSessionFromFile( | |
373 restoreSessionFile) | |
374 if self.sessionManager().isValidSession(sessionData): | |
375 restoreSessionData = sessionData | |
376 restoreSession = True | |
377 else: | |
378 if Preferences.getWebBrowser("StartupBehavior") == 0: | |
379 home = "about:blank" | |
380 elif Preferences.getWebBrowser("StartupBehavior") == 1: | |
381 home = Preferences.getWebBrowser("HomePage") | |
382 elif Preferences.getWebBrowser("StartupBehavior") == 2: | |
383 home = "eric:speeddial" | |
384 | |
385 if not restoreSession: | |
386 self.__tabWidget.newBrowser(home) | |
387 self.__tabWidget.currentBrowser().setFocus() | |
388 WebBrowserWindow._performingStartup = False | |
389 | |
390 self.__imagesIcon = ImagesIcon(self) | |
391 self.statusBar().addPermanentWidget(self.__imagesIcon) | |
392 self.__javaScriptIcon = JavaScriptIcon(self) | |
393 self.statusBar().addPermanentWidget(self.__javaScriptIcon) | |
394 | |
395 self.__adBlockIcon = AdBlockIcon(self) | |
396 self.statusBar().addPermanentWidget(self.__adBlockIcon) | |
397 self.__adBlockIcon.setEnabled( | |
398 Preferences.getWebBrowser("AdBlockEnabled")) | |
399 self.__tabWidget.currentChanged[int].connect( | |
400 self.__adBlockIcon.currentChanged) | |
401 self.__tabWidget.sourceChanged.connect( | |
402 self.__adBlockIcon.sourceChanged) | |
403 | |
404 self.__tabManagerIcon = self.tabManager().createStatusBarIcon() | |
405 self.statusBar().addPermanentWidget(self.__tabManagerIcon) | |
406 | |
407 self.networkIcon = E5NetworkIcon(self) | |
408 self.statusBar().addPermanentWidget(self.networkIcon) | |
409 | |
410 if not Preferences.getWebBrowser("StatusBarVisible"): | |
411 self.statusBar().hide() | |
412 | |
413 if not self.__fromEric and len(WebBrowserWindow.BrowserWindows): | |
414 QDesktopServices.setUrlHandler( | |
415 "http", WebBrowserWindow.BrowserWindows[0].urlHandler) | |
416 QDesktopServices.setUrlHandler( | |
417 "https", WebBrowserWindow.BrowserWindows[0].urlHandler) | |
418 | |
419 # setup connections | |
420 self.__activating = False | |
421 if WebBrowserWindow._useQtHelp: | |
422 # TOC window | |
423 self.__tocWindow.escapePressed.connect( | |
424 self.__activateCurrentBrowser) | |
425 self.__tocWindow.openUrl.connect(self.openUrl) | |
426 self.__tocWindow.newTab.connect(self.openUrlNewTab) | |
427 self.__tocWindow.newBackgroundTab.connect( | |
428 self.openUrlNewBackgroundTab) | |
429 self.__tocWindow.newWindow.connect(self.openUrlNewWindow) | |
430 | |
431 # index window | |
432 self.__indexWindow.escapePressed.connect( | |
433 self.__activateCurrentBrowser) | |
434 self.__indexWindow.openUrl.connect(self.openUrl) | |
435 self.__indexWindow.newTab.connect(self.openUrlNewTab) | |
436 self.__indexWindow.newBackgroundTab.connect( | |
437 self.openUrlNewBackgroundTab) | |
438 self.__indexWindow.newWindow.connect(self.openUrlNewWindow) | |
439 | |
440 # search window | |
441 self.__searchWindow.escapePressed.connect( | |
442 self.__activateCurrentBrowser) | |
443 self.__searchWindow.openUrl.connect(self.openUrl) | |
444 self.__searchWindow.newTab.connect(self.openUrlNewTab) | |
445 self.__searchWindow.newBackgroundTab.connect( | |
446 self.openUrlNewBackgroundTab) | |
447 self.__searchWindow.newWindow.connect(self.openUrlNewWindow) | |
448 | |
449 state = Preferences.getWebBrowser("WebBrowserState") | |
450 self.restoreState(state) | |
451 | |
452 self.__initHelpDb() | |
453 | |
454 self.__virusTotal = VirusTotalAPI(self) | |
455 self.__virusTotal.submitUrlError.connect( | |
456 self.__virusTotalSubmitUrlError) | |
457 self.__virusTotal.urlScanReport.connect( | |
458 self.__virusTotalUrlScanReport) | |
459 self.__virusTotal.fileScanReport.connect( | |
460 self.__virusTotalFileScanReport) | |
461 | |
462 self.flashCookieManager() | |
463 | |
464 e5App().focusChanged.connect(self.__appFocusChanged) | |
465 | |
466 self.__toolbarStates = self.saveState() | |
467 | |
468 self.__hideNavigationTimer = QTimer(self) | |
469 self.__hideNavigationTimer.setInterval(1000) | |
470 self.__hideNavigationTimer.setSingleShot(True) | |
471 self.__hideNavigationTimer.timeout.connect(self.__hideNavigation) | |
472 | |
473 self.__forcedClose = False | |
474 | |
475 if restoreSessionData: | |
476 self.sessionManager().restoreSessionFromData( | |
477 self, restoreSessionData) | |
478 | |
479 self.sessionManager().activateTimer() | 480 self.sessionManager().activateTimer() |
480 | 481 |
481 QTimer.singleShot(0, syncMgr.loadSettings) | 482 QTimer.singleShot(0, syncMgr.loadSettings) |
482 | 483 |
483 if WebBrowserWindow._useQtHelp: | 484 if WebBrowserWindow._useQtHelp: |
484 QTimer.singleShot(50, self.__lookForNewDocumentation) | 485 QTimer.singleShot(50, self.__lookForNewDocumentation) |
485 if self.__searchWord is not None: | 486 if self.__searchWord is not None: |
486 QTimer.singleShot(0, self.__searchForWord) | 487 QTimer.singleShot(0, self.__searchForWord) |
487 | 488 |
488 def __del__(self): | 489 def __del__(self): |
489 """ | 490 """ |
490 Special method called during object destruction. | 491 Special method called during object destruction. |
491 | 492 |
501 | 502 |
502 @return reference to the tab widget | 503 @return reference to the tab widget |
503 @rtype WebBrowserTabWidget | 504 @rtype WebBrowserTabWidget |
504 """ | 505 """ |
505 return self.__tabWidget | 506 return self.__tabWidget |
506 | |
507 def fromEric(self): | |
508 """ | |
509 Public method to check, if the web browser was called from within the | |
510 eric IDE. | |
511 | |
512 @return flag indicating that the browserw as opened from within eric | |
513 @rtype bool | |
514 """ | |
515 return self.__fromEric | |
516 | 507 |
517 def __setIconDatabasePath(self, enable=True): | 508 def __setIconDatabasePath(self, enable=True): |
518 """ | 509 """ |
519 Private method to set the favicons path. | 510 Private method to set the favicons path. |
520 | 511 |
701 self.newTabAct.setStatusTip(self.tr('Open a new web browser tab')) | 692 self.newTabAct.setStatusTip(self.tr('Open a new web browser tab')) |
702 self.newTabAct.setWhatsThis(self.tr( | 693 self.newTabAct.setWhatsThis(self.tr( |
703 """<b>New Tab</b>""" | 694 """<b>New Tab</b>""" |
704 """<p>This opens a new web browser tab.</p>""" | 695 """<p>This opens a new web browser tab.</p>""" |
705 )) | 696 )) |
706 if not self.__initShortcutsOnly: | 697 self.newTabAct.triggered.connect(self.newTab) |
707 self.newTabAct.triggered.connect(self.newTab) | |
708 self.__actions.append(self.newTabAct) | 698 self.__actions.append(self.newTabAct) |
709 | 699 |
710 self.newAct = E5Action( | 700 self.newAct = E5Action( |
711 self.tr('New Window'), | 701 self.tr('New Window'), |
712 UI.PixmapCache.getIcon("newWindow.png"), | 702 UI.PixmapCache.getIcon("newWindow.png"), |
717 self.newAct.setWhatsThis(self.tr( | 707 self.newAct.setWhatsThis(self.tr( |
718 """<b>New Window</b>""" | 708 """<b>New Window</b>""" |
719 """<p>This opens a new web browser window in the current""" | 709 """<p>This opens a new web browser window in the current""" |
720 """ privacy mode.</p>""" | 710 """ privacy mode.</p>""" |
721 )) | 711 )) |
722 if not self.__initShortcutsOnly: | 712 self.newAct.triggered.connect(self.newWindow) |
723 self.newAct.triggered.connect(self.newWindow) | |
724 self.__actions.append(self.newAct) | 713 self.__actions.append(self.newAct) |
725 | 714 |
726 self.newPrivateAct = E5Action( | 715 self.newPrivateAct = E5Action( |
727 self.tr('New Private Window'), | 716 self.tr('New Private Window'), |
728 UI.PixmapCache.getIcon("privateMode.png"), | 717 UI.PixmapCache.getIcon("privateMode.png"), |
734 self.newPrivateAct.setWhatsThis(self.tr( | 723 self.newPrivateAct.setWhatsThis(self.tr( |
735 """<b>New Private Window</b>""" | 724 """<b>New Private Window</b>""" |
736 """<p>This opens a new private web browser window by starting""" | 725 """<p>This opens a new private web browser window by starting""" |
737 """ a new web browser instance in private mode.</p>""" | 726 """ a new web browser instance in private mode.</p>""" |
738 )) | 727 )) |
739 if not self.__initShortcutsOnly: | 728 self.newPrivateAct.triggered.connect(self.newPrivateWindow) |
740 self.newPrivateAct.triggered.connect(self.newPrivateWindow) | |
741 self.__actions.append(self.newPrivateAct) | 729 self.__actions.append(self.newPrivateAct) |
742 | 730 |
743 self.openAct = E5Action( | 731 self.openAct = E5Action( |
744 self.tr('Open File'), | 732 self.tr('Open File'), |
745 UI.PixmapCache.getIcon("open.png"), | 733 UI.PixmapCache.getIcon("open.png"), |
750 self.openAct.setWhatsThis(self.tr( | 738 self.openAct.setWhatsThis(self.tr( |
751 """<b>Open File</b>""" | 739 """<b>Open File</b>""" |
752 """<p>This opens a new file for display.""" | 740 """<p>This opens a new file for display.""" |
753 """ It pops up a file selection dialog.</p>""" | 741 """ It pops up a file selection dialog.</p>""" |
754 )) | 742 )) |
755 if not self.__initShortcutsOnly: | 743 self.openAct.triggered.connect(self.__openFile) |
756 self.openAct.triggered.connect(self.__openFile) | |
757 self.__actions.append(self.openAct) | 744 self.__actions.append(self.openAct) |
758 | 745 |
759 self.openTabAct = E5Action( | 746 self.openTabAct = E5Action( |
760 self.tr('Open File in New Tab'), | 747 self.tr('Open File in New Tab'), |
761 UI.PixmapCache.getIcon("openNewTab.png"), | 748 UI.PixmapCache.getIcon("openNewTab.png"), |
767 self.openTabAct.setWhatsThis(self.tr( | 754 self.openTabAct.setWhatsThis(self.tr( |
768 """<b>Open File in New Tab</b>""" | 755 """<b>Open File in New Tab</b>""" |
769 """<p>This opens a new file for display in a new tab.""" | 756 """<p>This opens a new file for display in a new tab.""" |
770 """ It pops up a file selection dialog.</p>""" | 757 """ It pops up a file selection dialog.</p>""" |
771 )) | 758 )) |
772 if not self.__initShortcutsOnly: | 759 self.openTabAct.triggered.connect(self.__openFileNewTab) |
773 self.openTabAct.triggered.connect(self.__openFileNewTab) | |
774 self.__actions.append(self.openTabAct) | 760 self.__actions.append(self.openTabAct) |
775 | 761 |
776 if hasattr(QWebEnginePage, "SavePage"): | 762 if hasattr(QWebEnginePage, "SavePage"): |
777 self.saveAsAct = E5Action( | 763 self.saveAsAct = E5Action( |
778 self.tr('Save As'), | 764 self.tr('Save As'), |
784 self.tr('Save the current page to disk')) | 770 self.tr('Save the current page to disk')) |
785 self.saveAsAct.setWhatsThis(self.tr( | 771 self.saveAsAct.setWhatsThis(self.tr( |
786 """<b>Save As...</b>""" | 772 """<b>Save As...</b>""" |
787 """<p>Saves the current page to disk.</p>""" | 773 """<p>Saves the current page to disk.</p>""" |
788 )) | 774 )) |
789 if not self.__initShortcutsOnly: | 775 self.saveAsAct.triggered.connect(self.__savePageAs) |
790 self.saveAsAct.triggered.connect(self.__savePageAs) | |
791 self.__actions.append(self.saveAsAct) | 776 self.__actions.append(self.saveAsAct) |
792 else: | 777 else: |
793 self.saveAsAct = None | 778 self.saveAsAct = None |
794 | 779 |
795 self.saveVisiblePageScreenAct = E5Action( | 780 self.saveVisiblePageScreenAct = E5Action( |
803 self.saveVisiblePageScreenAct.setWhatsThis(self.tr( | 788 self.saveVisiblePageScreenAct.setWhatsThis(self.tr( |
804 """<b>Save Page Screen...</b>""" | 789 """<b>Save Page Screen...</b>""" |
805 """<p>Saves the visible part of the current page as a""" | 790 """<p>Saves the visible part of the current page as a""" |
806 """ screen shot.</p>""" | 791 """ screen shot.</p>""" |
807 )) | 792 )) |
808 if not self.__initShortcutsOnly: | 793 self.saveVisiblePageScreenAct.triggered.connect( |
809 self.saveVisiblePageScreenAct.triggered.connect( | 794 self.__saveVisiblePageScreen) |
810 self.__saveVisiblePageScreen) | |
811 self.__actions.append(self.saveVisiblePageScreenAct) | 795 self.__actions.append(self.saveVisiblePageScreenAct) |
812 | 796 |
813 bookmarksManager = self.bookmarksManager() | 797 bookmarksManager = self.bookmarksManager() |
814 self.importBookmarksAct = E5Action( | 798 self.importBookmarksAct = E5Action( |
815 self.tr('Import Bookmarks'), | 799 self.tr('Import Bookmarks'), |
819 self.tr('Import bookmarks from other browsers')) | 803 self.tr('Import bookmarks from other browsers')) |
820 self.importBookmarksAct.setWhatsThis(self.tr( | 804 self.importBookmarksAct.setWhatsThis(self.tr( |
821 """<b>Import Bookmarks</b>""" | 805 """<b>Import Bookmarks</b>""" |
822 """<p>Import bookmarks from other browsers.</p>""" | 806 """<p>Import bookmarks from other browsers.</p>""" |
823 )) | 807 )) |
824 if not self.__initShortcutsOnly: | 808 self.importBookmarksAct.triggered.connect( |
825 self.importBookmarksAct.triggered.connect( | 809 bookmarksManager.importBookmarks) |
826 bookmarksManager.importBookmarks) | |
827 self.__actions.append(self.importBookmarksAct) | 810 self.__actions.append(self.importBookmarksAct) |
828 | 811 |
829 self.exportBookmarksAct = E5Action( | 812 self.exportBookmarksAct = E5Action( |
830 self.tr('Export Bookmarks'), | 813 self.tr('Export Bookmarks'), |
831 self.tr('&Export Bookmarks...'), | 814 self.tr('&Export Bookmarks...'), |
834 self.tr('Export the bookmarks into a file')) | 817 self.tr('Export the bookmarks into a file')) |
835 self.exportBookmarksAct.setWhatsThis(self.tr( | 818 self.exportBookmarksAct.setWhatsThis(self.tr( |
836 """<b>Export Bookmarks</b>""" | 819 """<b>Export Bookmarks</b>""" |
837 """<p>Export the bookmarks into a file.</p>""" | 820 """<p>Export the bookmarks into a file.</p>""" |
838 )) | 821 )) |
839 if not self.__initShortcutsOnly: | 822 self.exportBookmarksAct.triggered.connect( |
840 self.exportBookmarksAct.triggered.connect( | 823 bookmarksManager.exportBookmarks) |
841 bookmarksManager.exportBookmarks) | |
842 self.__actions.append(self.exportBookmarksAct) | 824 self.__actions.append(self.exportBookmarksAct) |
843 | 825 |
844 if qVersionTuple() >= (5, 8, 0) or ( | 826 if qVersionTuple() >= (5, 8, 0) or ( |
845 not Globals.isWindowsPlatform() or qVersionTuple() >= (5, 7, 0)): | 827 not Globals.isWindowsPlatform() or qVersionTuple() >= (5, 7, 0)): |
846 self.printAct = E5Action( | 828 self.printAct = E5Action( |
852 self.printAct.setStatusTip(self.tr('Print the displayed help')) | 834 self.printAct.setStatusTip(self.tr('Print the displayed help')) |
853 self.printAct.setWhatsThis(self.tr( | 835 self.printAct.setWhatsThis(self.tr( |
854 """<b>Print</b>""" | 836 """<b>Print</b>""" |
855 """<p>Print the displayed help text.</p>""" | 837 """<p>Print the displayed help text.</p>""" |
856 )) | 838 )) |
857 if not self.__initShortcutsOnly: | 839 self.printAct.triggered.connect(self.__tabWidget.printBrowser) |
858 self.printAct.triggered.connect(self.__tabWidget.printBrowser) | |
859 self.__actions.append(self.printAct) | 840 self.__actions.append(self.printAct) |
860 else: | 841 else: |
861 self.printAct = None | 842 self.printAct = None |
862 | 843 |
863 if Globals.isLinuxPlatform() or qVersionTuple() >= (5, 7, 0): | 844 if Globals.isLinuxPlatform() or qVersionTuple() >= (5, 7, 0): |
870 'Print the displayed help as PDF')) | 851 'Print the displayed help as PDF')) |
871 self.printPdfAct.setWhatsThis(self.tr( | 852 self.printPdfAct.setWhatsThis(self.tr( |
872 """<b>Print as PDF</b>""" | 853 """<b>Print as PDF</b>""" |
873 """<p>Print the displayed help text as a PDF file.</p>""" | 854 """<p>Print the displayed help text as a PDF file.</p>""" |
874 )) | 855 )) |
875 if not self.__initShortcutsOnly: | 856 self.printPdfAct.triggered.connect( |
876 self.printPdfAct.triggered.connect( | 857 self.__tabWidget.printBrowserPdf) |
877 self.__tabWidget.printBrowserPdf) | |
878 self.__actions.append(self.printPdfAct) | 858 self.__actions.append(self.printPdfAct) |
879 else: | 859 else: |
880 self.printPdfAct = None | 860 self.printPdfAct = None |
881 | 861 |
882 if qVersionTuple() >= (5, 8, 0) or ( | 862 if qVersionTuple() >= (5, 8, 0) or ( |
890 'Print preview of the displayed help')) | 870 'Print preview of the displayed help')) |
891 self.printPreviewAct.setWhatsThis(self.tr( | 871 self.printPreviewAct.setWhatsThis(self.tr( |
892 """<b>Print Preview</b>""" | 872 """<b>Print Preview</b>""" |
893 """<p>Print preview of the displayed help text.</p>""" | 873 """<p>Print preview of the displayed help text.</p>""" |
894 )) | 874 )) |
895 if not self.__initShortcutsOnly: | 875 self.printPreviewAct.triggered.connect( |
896 self.printPreviewAct.triggered.connect( | 876 self.__tabWidget.printPreviewBrowser) |
897 self.__tabWidget.printPreviewBrowser) | |
898 self.__actions.append(self.printPreviewAct) | 877 self.__actions.append(self.printPreviewAct) |
899 else: | 878 else: |
900 self.printPreviewAct = None | 879 self.printPreviewAct = None |
901 | 880 |
902 self.sendPageLinkAct = E5Action( | 881 self.sendPageLinkAct = E5Action( |
908 'Send the link of the current page via email')) | 887 'Send the link of the current page via email')) |
909 self.sendPageLinkAct.setWhatsThis(self.tr( | 888 self.sendPageLinkAct.setWhatsThis(self.tr( |
910 """<b>Send Page Link</b>""" | 889 """<b>Send Page Link</b>""" |
911 """<p>Send the link of the current page via email.</p>""" | 890 """<p>Send the link of the current page via email.</p>""" |
912 )) | 891 )) |
913 if not self.__initShortcutsOnly: | 892 self.sendPageLinkAct.triggered.connect(self.__sendPageLink) |
914 self.sendPageLinkAct.triggered.connect(self.__sendPageLink) | |
915 self.__actions.append(self.sendPageLinkAct) | 893 self.__actions.append(self.sendPageLinkAct) |
916 | 894 |
917 self.closeAct = E5Action( | 895 self.closeAct = E5Action( |
918 self.tr('Close'), | 896 self.tr('Close'), |
919 UI.PixmapCache.getIcon("close.png"), | 897 UI.PixmapCache.getIcon("close.png"), |
924 'Close the current help window')) | 902 'Close the current help window')) |
925 self.closeAct.setWhatsThis(self.tr( | 903 self.closeAct.setWhatsThis(self.tr( |
926 """<b>Close</b>""" | 904 """<b>Close</b>""" |
927 """<p>Closes the current web browser window.</p>""" | 905 """<p>Closes the current web browser window.</p>""" |
928 )) | 906 )) |
929 if not self.__initShortcutsOnly: | 907 self.closeAct.triggered.connect(self.__tabWidget.closeBrowser) |
930 self.closeAct.triggered.connect(self.__tabWidget.closeBrowser) | |
931 self.__actions.append(self.closeAct) | 908 self.__actions.append(self.closeAct) |
932 | 909 |
933 self.closeAllAct = E5Action( | 910 self.closeAllAct = E5Action( |
934 self.tr('Close All'), | 911 self.tr('Close All'), |
935 self.tr('Close &All'), | 912 self.tr('Close &All'), |
937 self.closeAllAct.setStatusTip(self.tr('Close all help windows')) | 914 self.closeAllAct.setStatusTip(self.tr('Close all help windows')) |
938 self.closeAllAct.setWhatsThis(self.tr( | 915 self.closeAllAct.setWhatsThis(self.tr( |
939 """<b>Close All</b>""" | 916 """<b>Close All</b>""" |
940 """<p>Closes all web browser windows except the first one.</p>""" | 917 """<p>Closes all web browser windows except the first one.</p>""" |
941 )) | 918 )) |
942 if not self.__initShortcutsOnly: | 919 self.closeAllAct.triggered.connect( |
943 self.closeAllAct.triggered.connect( | 920 self.__tabWidget.closeAllBrowsers) |
944 self.__tabWidget.closeAllBrowsers) | |
945 self.__actions.append(self.closeAllAct) | 921 self.__actions.append(self.closeAllAct) |
946 | 922 |
947 self.exitAct = E5Action( | 923 self.exitAct = E5Action( |
948 self.tr('Quit'), | 924 self.tr('Quit'), |
949 UI.PixmapCache.getIcon("exit.png"), | 925 UI.PixmapCache.getIcon("exit.png"), |
953 self.exitAct.setStatusTip(self.tr('Quit the eric6 Web Browser')) | 929 self.exitAct.setStatusTip(self.tr('Quit the eric6 Web Browser')) |
954 self.exitAct.setWhatsThis(self.tr( | 930 self.exitAct.setWhatsThis(self.tr( |
955 """<b>Quit</b>""" | 931 """<b>Quit</b>""" |
956 """<p>Quit the eric6 Web Browser.</p>""" | 932 """<p>Quit the eric6 Web Browser.</p>""" |
957 )) | 933 )) |
958 if not self.__initShortcutsOnly: | 934 self.exitAct.triggered.connect(self.shutdown) |
959 if self.__fromEric: | |
960 self.exitAct.triggered.connect(self.close) | |
961 else: | |
962 self.exitAct.triggered.connect(self.shutdown) | |
963 self.__actions.append(self.exitAct) | 935 self.__actions.append(self.exitAct) |
964 | 936 |
965 self.backAct = E5Action( | 937 self.backAct = E5Action( |
966 self.tr('Backward'), | 938 self.tr('Backward'), |
967 UI.PixmapCache.getIcon("back.png"), | 939 UI.PixmapCache.getIcon("back.png"), |
972 self.backAct.setWhatsThis(self.tr( | 944 self.backAct.setWhatsThis(self.tr( |
973 """<b>Backward</b>""" | 945 """<b>Backward</b>""" |
974 """<p>Moves one screen backward. If none is""" | 946 """<p>Moves one screen backward. If none is""" |
975 """ available, this action is disabled.</p>""" | 947 """ available, this action is disabled.</p>""" |
976 )) | 948 )) |
977 if not self.__initShortcutsOnly: | 949 self.backAct.triggered.connect(self.__backward) |
978 self.backAct.triggered.connect(self.__backward) | |
979 self.__actions.append(self.backAct) | 950 self.__actions.append(self.backAct) |
980 | 951 |
981 self.forwardAct = E5Action( | 952 self.forwardAct = E5Action( |
982 self.tr('Forward'), | 953 self.tr('Forward'), |
983 UI.PixmapCache.getIcon("forward.png"), | 954 UI.PixmapCache.getIcon("forward.png"), |
989 self.forwardAct.setWhatsThis(self.tr( | 960 self.forwardAct.setWhatsThis(self.tr( |
990 """<b>Forward</b>""" | 961 """<b>Forward</b>""" |
991 """<p>Moves one screen forward. If none is""" | 962 """<p>Moves one screen forward. If none is""" |
992 """ available, this action is disabled.</p>""" | 963 """ available, this action is disabled.</p>""" |
993 )) | 964 )) |
994 if not self.__initShortcutsOnly: | 965 self.forwardAct.triggered.connect(self.__forward) |
995 self.forwardAct.triggered.connect(self.__forward) | |
996 self.__actions.append(self.forwardAct) | 966 self.__actions.append(self.forwardAct) |
997 | 967 |
998 self.homeAct = E5Action( | 968 self.homeAct = E5Action( |
999 self.tr('Home'), | 969 self.tr('Home'), |
1000 UI.PixmapCache.getIcon("home.png"), | 970 UI.PixmapCache.getIcon("home.png"), |
1005 'Move to the initial screen')) | 975 'Move to the initial screen')) |
1006 self.homeAct.setWhatsThis(self.tr( | 976 self.homeAct.setWhatsThis(self.tr( |
1007 """<b>Home</b>""" | 977 """<b>Home</b>""" |
1008 """<p>Moves to the initial screen.</p>""" | 978 """<p>Moves to the initial screen.</p>""" |
1009 )) | 979 )) |
1010 if not self.__initShortcutsOnly: | 980 self.homeAct.triggered.connect(self.__home) |
1011 self.homeAct.triggered.connect(self.__home) | |
1012 self.__actions.append(self.homeAct) | 981 self.__actions.append(self.homeAct) |
1013 | 982 |
1014 self.reloadAct = E5Action( | 983 self.reloadAct = E5Action( |
1015 self.tr('Reload'), | 984 self.tr('Reload'), |
1016 UI.PixmapCache.getIcon("reload.png"), | 985 UI.PixmapCache.getIcon("reload.png"), |
1022 'Reload the current screen')) | 991 'Reload the current screen')) |
1023 self.reloadAct.setWhatsThis(self.tr( | 992 self.reloadAct.setWhatsThis(self.tr( |
1024 """<b>Reload</b>""" | 993 """<b>Reload</b>""" |
1025 """<p>Reloads the current screen.</p>""" | 994 """<p>Reloads the current screen.</p>""" |
1026 )) | 995 )) |
1027 if not self.__initShortcutsOnly: | 996 self.reloadAct.triggered.connect(self.__reload) |
1028 self.reloadAct.triggered.connect(self.__reload) | |
1029 self.__actions.append(self.reloadAct) | 997 self.__actions.append(self.reloadAct) |
1030 | 998 |
1031 self.stopAct = E5Action( | 999 self.stopAct = E5Action( |
1032 self.tr('Stop'), | 1000 self.tr('Stop'), |
1033 UI.PixmapCache.getIcon("stopLoading.png"), | 1001 UI.PixmapCache.getIcon("stopLoading.png"), |
1038 self.stopAct.setStatusTip(self.tr('Stop loading')) | 1006 self.stopAct.setStatusTip(self.tr('Stop loading')) |
1039 self.stopAct.setWhatsThis(self.tr( | 1007 self.stopAct.setWhatsThis(self.tr( |
1040 """<b>Stop</b>""" | 1008 """<b>Stop</b>""" |
1041 """<p>Stops loading of the current tab.</p>""" | 1009 """<p>Stops loading of the current tab.</p>""" |
1042 )) | 1010 )) |
1043 if not self.__initShortcutsOnly: | 1011 self.stopAct.triggered.connect(self.__stopLoading) |
1044 self.stopAct.triggered.connect(self.__stopLoading) | |
1045 self.__actions.append(self.stopAct) | 1012 self.__actions.append(self.stopAct) |
1046 | 1013 |
1047 self.copyAct = E5Action( | 1014 self.copyAct = E5Action( |
1048 self.tr('Copy'), | 1015 self.tr('Copy'), |
1049 UI.PixmapCache.getIcon("editCopy.png"), | 1016 UI.PixmapCache.getIcon("editCopy.png"), |
1053 self.copyAct.setStatusTip(self.tr('Copy the selected text')) | 1020 self.copyAct.setStatusTip(self.tr('Copy the selected text')) |
1054 self.copyAct.setWhatsThis(self.tr( | 1021 self.copyAct.setWhatsThis(self.tr( |
1055 """<b>Copy</b>""" | 1022 """<b>Copy</b>""" |
1056 """<p>Copy the selected text to the clipboard.</p>""" | 1023 """<p>Copy the selected text to the clipboard.</p>""" |
1057 )) | 1024 )) |
1058 if not self.__initShortcutsOnly: | 1025 self.copyAct.triggered.connect(self.__copy) |
1059 self.copyAct.triggered.connect(self.__copy) | |
1060 self.__actions.append(self.copyAct) | 1026 self.__actions.append(self.copyAct) |
1061 | 1027 |
1062 self.cutAct = E5Action( | 1028 self.cutAct = E5Action( |
1063 self.tr('Cut'), | 1029 self.tr('Cut'), |
1064 UI.PixmapCache.getIcon("editCut.png"), | 1030 UI.PixmapCache.getIcon("editCut.png"), |
1068 self.cutAct.setStatusTip(self.tr('Cut the selected text')) | 1034 self.cutAct.setStatusTip(self.tr('Cut the selected text')) |
1069 self.cutAct.setWhatsThis(self.tr( | 1035 self.cutAct.setWhatsThis(self.tr( |
1070 """<b>Cut</b>""" | 1036 """<b>Cut</b>""" |
1071 """<p>Cut the selected text to the clipboard.</p>""" | 1037 """<p>Cut the selected text to the clipboard.</p>""" |
1072 )) | 1038 )) |
1073 if not self.__initShortcutsOnly: | 1039 self.cutAct.triggered.connect(self.__cut) |
1074 self.cutAct.triggered.connect(self.__cut) | |
1075 self.__actions.append(self.cutAct) | 1040 self.__actions.append(self.cutAct) |
1076 | 1041 |
1077 self.pasteAct = E5Action( | 1042 self.pasteAct = E5Action( |
1078 self.tr('Paste'), | 1043 self.tr('Paste'), |
1079 UI.PixmapCache.getIcon("editPaste.png"), | 1044 UI.PixmapCache.getIcon("editPaste.png"), |
1083 self.pasteAct.setStatusTip(self.tr('Paste text from the clipboard')) | 1048 self.pasteAct.setStatusTip(self.tr('Paste text from the clipboard')) |
1084 self.pasteAct.setWhatsThis(self.tr( | 1049 self.pasteAct.setWhatsThis(self.tr( |
1085 """<b>Paste</b>""" | 1050 """<b>Paste</b>""" |
1086 """<p>Paste some text from the clipboard.</p>""" | 1051 """<p>Paste some text from the clipboard.</p>""" |
1087 )) | 1052 )) |
1088 if not self.__initShortcutsOnly: | 1053 self.pasteAct.triggered.connect(self.__paste) |
1089 self.pasteAct.triggered.connect(self.__paste) | |
1090 self.__actions.append(self.pasteAct) | 1054 self.__actions.append(self.pasteAct) |
1091 | 1055 |
1092 self.undoAct = E5Action( | 1056 self.undoAct = E5Action( |
1093 self.tr('Undo'), | 1057 self.tr('Undo'), |
1094 UI.PixmapCache.getIcon("editUndo.png"), | 1058 UI.PixmapCache.getIcon("editUndo.png"), |
1098 self.undoAct.setStatusTip(self.tr('Undo the last edit action')) | 1062 self.undoAct.setStatusTip(self.tr('Undo the last edit action')) |
1099 self.undoAct.setWhatsThis(self.tr( | 1063 self.undoAct.setWhatsThis(self.tr( |
1100 """<b>Undo</b>""" | 1064 """<b>Undo</b>""" |
1101 """<p>Undo the last edit action.</p>""" | 1065 """<p>Undo the last edit action.</p>""" |
1102 )) | 1066 )) |
1103 if not self.__initShortcutsOnly: | 1067 self.undoAct.triggered.connect(self.__undo) |
1104 self.undoAct.triggered.connect(self.__undo) | |
1105 self.__actions.append(self.undoAct) | 1068 self.__actions.append(self.undoAct) |
1106 | 1069 |
1107 self.redoAct = E5Action( | 1070 self.redoAct = E5Action( |
1108 self.tr('Redo'), | 1071 self.tr('Redo'), |
1109 UI.PixmapCache.getIcon("editRedo.png"), | 1072 UI.PixmapCache.getIcon("editRedo.png"), |
1113 self.redoAct.setStatusTip(self.tr('Redo the last edit action')) | 1076 self.redoAct.setStatusTip(self.tr('Redo the last edit action')) |
1114 self.redoAct.setWhatsThis(self.tr( | 1077 self.redoAct.setWhatsThis(self.tr( |
1115 """<b>Redo</b>""" | 1078 """<b>Redo</b>""" |
1116 """<p>Redo the last edit action.</p>""" | 1079 """<p>Redo the last edit action.</p>""" |
1117 )) | 1080 )) |
1118 if not self.__initShortcutsOnly: | 1081 self.redoAct.triggered.connect(self.__redo) |
1119 self.redoAct.triggered.connect(self.__redo) | |
1120 self.__actions.append(self.redoAct) | 1082 self.__actions.append(self.redoAct) |
1121 | 1083 |
1122 self.selectAllAct = E5Action( | 1084 self.selectAllAct = E5Action( |
1123 self.tr('Select All'), | 1085 self.tr('Select All'), |
1124 UI.PixmapCache.getIcon("editSelectAll.png"), | 1086 UI.PixmapCache.getIcon("editSelectAll.png"), |
1128 self.selectAllAct.setStatusTip(self.tr('Select all text')) | 1090 self.selectAllAct.setStatusTip(self.tr('Select all text')) |
1129 self.selectAllAct.setWhatsThis(self.tr( | 1091 self.selectAllAct.setWhatsThis(self.tr( |
1130 """<b>Select All</b>""" | 1092 """<b>Select All</b>""" |
1131 """<p>Select all text of the current browser.</p>""" | 1093 """<p>Select all text of the current browser.</p>""" |
1132 )) | 1094 )) |
1133 if not self.__initShortcutsOnly: | 1095 self.selectAllAct.triggered.connect(self.__selectAll) |
1134 self.selectAllAct.triggered.connect(self.__selectAll) | |
1135 self.__actions.append(self.selectAllAct) | 1096 self.__actions.append(self.selectAllAct) |
1136 | 1097 |
1137 self.unselectAct = E5Action( | 1098 self.unselectAct = E5Action( |
1138 self.tr('Unselect'), | 1099 self.tr('Unselect'), |
1139 self.tr('Unselect'), | 1100 self.tr('Unselect'), |
1142 self.unselectAct.setStatusTip(self.tr('Clear current selection')) | 1103 self.unselectAct.setStatusTip(self.tr('Clear current selection')) |
1143 self.unselectAct.setWhatsThis(self.tr( | 1104 self.unselectAct.setWhatsThis(self.tr( |
1144 """<b>Unselect</b>""" | 1105 """<b>Unselect</b>""" |
1145 """<p>Clear the selection of the current browser.</p>""" | 1106 """<p>Clear the selection of the current browser.</p>""" |
1146 )) | 1107 )) |
1147 if not self.__initShortcutsOnly: | 1108 self.unselectAct.triggered.connect(self.__unselect) |
1148 self.unselectAct.triggered.connect(self.__unselect) | |
1149 self.__actions.append(self.unselectAct) | 1109 self.__actions.append(self.unselectAct) |
1150 | 1110 |
1151 self.findAct = E5Action( | 1111 self.findAct = E5Action( |
1152 self.tr('Find...'), | 1112 self.tr('Find...'), |
1153 UI.PixmapCache.getIcon("find.png"), | 1113 UI.PixmapCache.getIcon("find.png"), |
1157 self.findAct.setStatusTip(self.tr('Find text in page')) | 1117 self.findAct.setStatusTip(self.tr('Find text in page')) |
1158 self.findAct.setWhatsThis(self.tr( | 1118 self.findAct.setWhatsThis(self.tr( |
1159 """<b>Find</b>""" | 1119 """<b>Find</b>""" |
1160 """<p>Find text in the current page.</p>""" | 1120 """<p>Find text in the current page.</p>""" |
1161 )) | 1121 )) |
1162 if not self.__initShortcutsOnly: | 1122 self.findAct.triggered.connect(self.__find) |
1163 self.findAct.triggered.connect(self.__find) | |
1164 self.__actions.append(self.findAct) | 1123 self.__actions.append(self.findAct) |
1165 | 1124 |
1166 self.findNextAct = E5Action( | 1125 self.findNextAct = E5Action( |
1167 self.tr('Find next'), | 1126 self.tr('Find next'), |
1168 UI.PixmapCache.getIcon("findNext.png"), | 1127 UI.PixmapCache.getIcon("findNext.png"), |
1173 'Find next occurrence of text in page')) | 1132 'Find next occurrence of text in page')) |
1174 self.findNextAct.setWhatsThis(self.tr( | 1133 self.findNextAct.setWhatsThis(self.tr( |
1175 """<b>Find next</b>""" | 1134 """<b>Find next</b>""" |
1176 """<p>Find the next occurrence of text in the current page.</p>""" | 1135 """<p>Find the next occurrence of text in the current page.</p>""" |
1177 )) | 1136 )) |
1178 if not self.__initShortcutsOnly: | 1137 self.findNextAct.triggered.connect(self.__searchWidget.findNext) |
1179 self.findNextAct.triggered.connect(self.__searchWidget.findNext) | |
1180 self.__actions.append(self.findNextAct) | 1138 self.__actions.append(self.findNextAct) |
1181 | 1139 |
1182 self.findPrevAct = E5Action( | 1140 self.findPrevAct = E5Action( |
1183 self.tr('Find previous'), | 1141 self.tr('Find previous'), |
1184 UI.PixmapCache.getIcon("findPrev.png"), | 1142 UI.PixmapCache.getIcon("findPrev.png"), |
1190 self.findPrevAct.setWhatsThis(self.tr( | 1148 self.findPrevAct.setWhatsThis(self.tr( |
1191 """<b>Find previous</b>""" | 1149 """<b>Find previous</b>""" |
1192 """<p>Find the previous occurrence of text in the current""" | 1150 """<p>Find the previous occurrence of text in the current""" |
1193 """ page.</p>""" | 1151 """ page.</p>""" |
1194 )) | 1152 )) |
1195 if not self.__initShortcutsOnly: | 1153 self.findPrevAct.triggered.connect( |
1196 self.findPrevAct.triggered.connect( | 1154 self.__searchWidget.findPrevious) |
1197 self.__searchWidget.findPrevious) | |
1198 self.__actions.append(self.findPrevAct) | 1155 self.__actions.append(self.findPrevAct) |
1199 | 1156 |
1200 self.bookmarksManageAct = E5Action( | 1157 self.bookmarksManageAct = E5Action( |
1201 self.tr('Manage Bookmarks'), | 1158 self.tr('Manage Bookmarks'), |
1202 self.tr('&Manage Bookmarks...'), | 1159 self.tr('&Manage Bookmarks...'), |
1206 'Open a dialog to manage the bookmarks.')) | 1163 'Open a dialog to manage the bookmarks.')) |
1207 self.bookmarksManageAct.setWhatsThis(self.tr( | 1164 self.bookmarksManageAct.setWhatsThis(self.tr( |
1208 """<b>Manage Bookmarks...</b>""" | 1165 """<b>Manage Bookmarks...</b>""" |
1209 """<p>Open a dialog to manage the bookmarks.</p>""" | 1166 """<p>Open a dialog to manage the bookmarks.</p>""" |
1210 )) | 1167 )) |
1211 if not self.__initShortcutsOnly: | 1168 self.bookmarksManageAct.triggered.connect( |
1212 self.bookmarksManageAct.triggered.connect( | 1169 self.__showBookmarksDialog) |
1213 self.__showBookmarksDialog) | |
1214 self.__actions.append(self.bookmarksManageAct) | 1170 self.__actions.append(self.bookmarksManageAct) |
1215 | 1171 |
1216 self.bookmarksAddAct = E5Action( | 1172 self.bookmarksAddAct = E5Action( |
1217 self.tr('Add Bookmark'), | 1173 self.tr('Add Bookmark'), |
1218 UI.PixmapCache.getIcon("addBookmark.png"), | 1174 UI.PixmapCache.getIcon("addBookmark.png"), |
1224 'Open a dialog to add a bookmark.')) | 1180 'Open a dialog to add a bookmark.')) |
1225 self.bookmarksAddAct.setWhatsThis(self.tr( | 1181 self.bookmarksAddAct.setWhatsThis(self.tr( |
1226 """<b>Add Bookmark</b>""" | 1182 """<b>Add Bookmark</b>""" |
1227 """<p>Open a dialog to add the current URL as a bookmark.</p>""" | 1183 """<p>Open a dialog to add the current URL as a bookmark.</p>""" |
1228 )) | 1184 )) |
1229 if not self.__initShortcutsOnly: | 1185 self.bookmarksAddAct.triggered.connect(self.__addBookmark) |
1230 self.bookmarksAddAct.triggered.connect(self.__addBookmark) | |
1231 self.__actions.append(self.bookmarksAddAct) | 1186 self.__actions.append(self.bookmarksAddAct) |
1232 | 1187 |
1233 self.bookmarksAddFolderAct = E5Action( | 1188 self.bookmarksAddFolderAct = E5Action( |
1234 self.tr('Add Folder'), | 1189 self.tr('Add Folder'), |
1235 self.tr('Add &Folder...'), | 1190 self.tr('Add &Folder...'), |
1238 'Open a dialog to add a new bookmarks folder.')) | 1193 'Open a dialog to add a new bookmarks folder.')) |
1239 self.bookmarksAddFolderAct.setWhatsThis(self.tr( | 1194 self.bookmarksAddFolderAct.setWhatsThis(self.tr( |
1240 """<b>Add Folder...</b>""" | 1195 """<b>Add Folder...</b>""" |
1241 """<p>Open a dialog to add a new bookmarks folder.</p>""" | 1196 """<p>Open a dialog to add a new bookmarks folder.</p>""" |
1242 )) | 1197 )) |
1243 if not self.__initShortcutsOnly: | 1198 self.bookmarksAddFolderAct.triggered.connect( |
1244 self.bookmarksAddFolderAct.triggered.connect( | 1199 self.__addBookmarkFolder) |
1245 self.__addBookmarkFolder) | |
1246 self.__actions.append(self.bookmarksAddFolderAct) | 1200 self.__actions.append(self.bookmarksAddFolderAct) |
1247 | 1201 |
1248 self.bookmarksAllTabsAct = E5Action( | 1202 self.bookmarksAllTabsAct = E5Action( |
1249 self.tr('Bookmark All Tabs'), | 1203 self.tr('Bookmark All Tabs'), |
1250 self.tr('Bookmark All Tabs...'), | 1204 self.tr('Bookmark All Tabs...'), |
1254 self.bookmarksAllTabsAct.setWhatsThis(self.tr( | 1208 self.bookmarksAllTabsAct.setWhatsThis(self.tr( |
1255 """<b>Bookmark All Tabs...</b>""" | 1209 """<b>Bookmark All Tabs...</b>""" |
1256 """<p>Open a dialog to add a new bookmarks folder for""" | 1210 """<p>Open a dialog to add a new bookmarks folder for""" |
1257 """ all open tabs.</p>""" | 1211 """ all open tabs.</p>""" |
1258 )) | 1212 )) |
1259 if not self.__initShortcutsOnly: | 1213 self.bookmarksAllTabsAct.triggered.connect(self.bookmarkAll) |
1260 self.bookmarksAllTabsAct.triggered.connect(self.bookmarkAll) | |
1261 self.__actions.append(self.bookmarksAllTabsAct) | 1214 self.__actions.append(self.bookmarksAllTabsAct) |
1262 | 1215 |
1263 self.whatsThisAct = E5Action( | 1216 self.whatsThisAct = E5Action( |
1264 self.tr('What\'s This?'), | 1217 self.tr('What\'s This?'), |
1265 UI.PixmapCache.getIcon("whatsThis.png"), | 1218 UI.PixmapCache.getIcon("whatsThis.png"), |
1273 """ with a question mark, and you can click on the interface""" | 1226 """ with a question mark, and you can click on the interface""" |
1274 """ elements to get a short description of what they do and how""" | 1227 """ elements to get a short description of what they do and how""" |
1275 """ to use them. In dialogs, this feature can be accessed using""" | 1228 """ to use them. In dialogs, this feature can be accessed using""" |
1276 """ the context help button in the titlebar.</p>""" | 1229 """ the context help button in the titlebar.</p>""" |
1277 )) | 1230 )) |
1278 if not self.__initShortcutsOnly: | 1231 self.whatsThisAct.triggered.connect(self.__whatsThis) |
1279 self.whatsThisAct.triggered.connect(self.__whatsThis) | |
1280 self.__actions.append(self.whatsThisAct) | 1232 self.__actions.append(self.whatsThisAct) |
1281 | 1233 |
1282 self.aboutAct = E5Action( | 1234 self.aboutAct = E5Action( |
1283 self.tr('About'), | 1235 self.tr('About'), |
1284 self.tr('&About'), | 1236 self.tr('&About'), |
1287 'Display information about this software')) | 1239 'Display information about this software')) |
1288 self.aboutAct.setWhatsThis(self.tr( | 1240 self.aboutAct.setWhatsThis(self.tr( |
1289 """<b>About</b>""" | 1241 """<b>About</b>""" |
1290 """<p>Display some information about this software.</p>""" | 1242 """<p>Display some information about this software.</p>""" |
1291 )) | 1243 )) |
1292 if not self.__initShortcutsOnly: | 1244 self.aboutAct.triggered.connect(self.__about) |
1293 self.aboutAct.triggered.connect(self.__about) | |
1294 self.__actions.append(self.aboutAct) | 1245 self.__actions.append(self.aboutAct) |
1295 | 1246 |
1296 self.aboutQtAct = E5Action( | 1247 self.aboutQtAct = E5Action( |
1297 self.tr('About Qt'), | 1248 self.tr('About Qt'), |
1298 self.tr('About &Qt'), | 1249 self.tr('About &Qt'), |
1301 self.tr('Display information about the Qt toolkit')) | 1252 self.tr('Display information about the Qt toolkit')) |
1302 self.aboutQtAct.setWhatsThis(self.tr( | 1253 self.aboutQtAct.setWhatsThis(self.tr( |
1303 """<b>About Qt</b>""" | 1254 """<b>About Qt</b>""" |
1304 """<p>Display some information about the Qt toolkit.</p>""" | 1255 """<p>Display some information about the Qt toolkit.</p>""" |
1305 )) | 1256 )) |
1306 if not self.__initShortcutsOnly: | 1257 self.aboutQtAct.triggered.connect(self.__aboutQt) |
1307 self.aboutQtAct.triggered.connect(self.__aboutQt) | |
1308 self.__actions.append(self.aboutQtAct) | 1258 self.__actions.append(self.aboutQtAct) |
1309 | 1259 |
1310 self.zoomInAct = E5Action( | 1260 self.zoomInAct = E5Action( |
1311 self.tr('Zoom in'), | 1261 self.tr('Zoom in'), |
1312 UI.PixmapCache.getIcon("zoomIn.png"), | 1262 UI.PixmapCache.getIcon("zoomIn.png"), |
1318 self.zoomInAct.setWhatsThis(self.tr( | 1268 self.zoomInAct.setWhatsThis(self.tr( |
1319 """<b>Zoom in</b>""" | 1269 """<b>Zoom in</b>""" |
1320 """<p>Zoom in on the web page.""" | 1270 """<p>Zoom in on the web page.""" |
1321 """ This makes the web page bigger.</p>""" | 1271 """ This makes the web page bigger.</p>""" |
1322 )) | 1272 )) |
1323 if not self.__initShortcutsOnly: | 1273 self.zoomInAct.triggered.connect(self.__zoomIn) |
1324 self.zoomInAct.triggered.connect(self.__zoomIn) | |
1325 self.__actions.append(self.zoomInAct) | 1274 self.__actions.append(self.zoomInAct) |
1326 | 1275 |
1327 self.zoomOutAct = E5Action( | 1276 self.zoomOutAct = E5Action( |
1328 self.tr('Zoom out'), | 1277 self.tr('Zoom out'), |
1329 UI.PixmapCache.getIcon("zoomOut.png"), | 1278 UI.PixmapCache.getIcon("zoomOut.png"), |
1335 self.zoomOutAct.setWhatsThis(self.tr( | 1284 self.zoomOutAct.setWhatsThis(self.tr( |
1336 """<b>Zoom out</b>""" | 1285 """<b>Zoom out</b>""" |
1337 """<p>Zoom out on the web page.""" | 1286 """<p>Zoom out on the web page.""" |
1338 """ This makes the web page smaller.</p>""" | 1287 """ This makes the web page smaller.</p>""" |
1339 )) | 1288 )) |
1340 if not self.__initShortcutsOnly: | 1289 self.zoomOutAct.triggered.connect(self.__zoomOut) |
1341 self.zoomOutAct.triggered.connect(self.__zoomOut) | |
1342 self.__actions.append(self.zoomOutAct) | 1290 self.__actions.append(self.zoomOutAct) |
1343 | 1291 |
1344 self.zoomResetAct = E5Action( | 1292 self.zoomResetAct = E5Action( |
1345 self.tr('Zoom reset'), | 1293 self.tr('Zoom reset'), |
1346 UI.PixmapCache.getIcon("zoomReset.png"), | 1294 UI.PixmapCache.getIcon("zoomReset.png"), |
1352 self.zoomResetAct.setWhatsThis(self.tr( | 1300 self.zoomResetAct.setWhatsThis(self.tr( |
1353 """<b>Zoom reset</b>""" | 1301 """<b>Zoom reset</b>""" |
1354 """<p>Reset the zoom of the web page. """ | 1302 """<p>Reset the zoom of the web page. """ |
1355 """This sets the zoom factor to 100%.</p>""" | 1303 """This sets the zoom factor to 100%.</p>""" |
1356 )) | 1304 )) |
1357 if not self.__initShortcutsOnly: | 1305 self.zoomResetAct.triggered.connect(self.__zoomReset) |
1358 self.zoomResetAct.triggered.connect(self.__zoomReset) | |
1359 self.__actions.append(self.zoomResetAct) | 1306 self.__actions.append(self.zoomResetAct) |
1360 | 1307 |
1361 self.pageSourceAct = E5Action( | 1308 self.pageSourceAct = E5Action( |
1362 self.tr('Show page source'), | 1309 self.tr('Show page source'), |
1363 self.tr('Show page source'), | 1310 self.tr('Show page source'), |
1367 'Show the page source in an editor')) | 1314 'Show the page source in an editor')) |
1368 self.pageSourceAct.setWhatsThis(self.tr( | 1315 self.pageSourceAct.setWhatsThis(self.tr( |
1369 """<b>Show page source</b>""" | 1316 """<b>Show page source</b>""" |
1370 """<p>Show the page source in an editor.</p>""" | 1317 """<p>Show the page source in an editor.</p>""" |
1371 )) | 1318 )) |
1372 if not self.__initShortcutsOnly: | 1319 self.pageSourceAct.triggered.connect(self.__showPageSource) |
1373 self.pageSourceAct.triggered.connect(self.__showPageSource) | |
1374 self.__actions.append(self.pageSourceAct) | 1320 self.__actions.append(self.pageSourceAct) |
1375 self.addAction(self.pageSourceAct) | 1321 self.addAction(self.pageSourceAct) |
1376 | 1322 |
1377 self.fullScreenAct = E5Action( | 1323 self.fullScreenAct = E5Action( |
1378 self.tr('Full Screen'), | 1324 self.tr('Full Screen'), |
1383 if Globals.isMacPlatform(): | 1329 if Globals.isMacPlatform(): |
1384 self.fullScreenAct.setShortcut( | 1330 self.fullScreenAct.setShortcut( |
1385 QKeySequence(self.tr("Meta+Ctrl+F"))) | 1331 QKeySequence(self.tr("Meta+Ctrl+F"))) |
1386 else: | 1332 else: |
1387 self.fullScreenAct.setShortcut(QKeySequence(self.tr('F11'))) | 1333 self.fullScreenAct.setShortcut(QKeySequence(self.tr('F11'))) |
1388 if not self.__initShortcutsOnly: | 1334 self.fullScreenAct.triggered.connect(self.toggleFullScreen) |
1389 self.fullScreenAct.triggered.connect(self.toggleFullScreen) | |
1390 self.__actions.append(self.fullScreenAct) | 1335 self.__actions.append(self.fullScreenAct) |
1391 self.addAction(self.fullScreenAct) | 1336 self.addAction(self.fullScreenAct) |
1392 | 1337 |
1393 self.nextTabAct = E5Action( | 1338 self.nextTabAct = E5Action( |
1394 self.tr('Show next tab'), | 1339 self.tr('Show next tab'), |
1395 self.tr('Show next tab'), | 1340 self.tr('Show next tab'), |
1396 QKeySequence(self.tr('Ctrl+Alt+Tab')), 0, | 1341 QKeySequence(self.tr('Ctrl+Alt+Tab')), 0, |
1397 self, 'webbrowser_view_next_tab') | 1342 self, 'webbrowser_view_next_tab') |
1398 if not self.__initShortcutsOnly: | 1343 self.nextTabAct.triggered.connect(self.__nextTab) |
1399 self.nextTabAct.triggered.connect(self.__nextTab) | |
1400 self.__actions.append(self.nextTabAct) | 1344 self.__actions.append(self.nextTabAct) |
1401 self.addAction(self.nextTabAct) | 1345 self.addAction(self.nextTabAct) |
1402 | 1346 |
1403 self.prevTabAct = E5Action( | 1347 self.prevTabAct = E5Action( |
1404 self.tr('Show previous tab'), | 1348 self.tr('Show previous tab'), |
1405 self.tr('Show previous tab'), | 1349 self.tr('Show previous tab'), |
1406 QKeySequence(self.tr('Shift+Ctrl+Alt+Tab')), 0, | 1350 QKeySequence(self.tr('Shift+Ctrl+Alt+Tab')), 0, |
1407 self, 'webbrowser_view_previous_tab') | 1351 self, 'webbrowser_view_previous_tab') |
1408 if not self.__initShortcutsOnly: | 1352 self.prevTabAct.triggered.connect(self.__prevTab) |
1409 self.prevTabAct.triggered.connect(self.__prevTab) | |
1410 self.__actions.append(self.prevTabAct) | 1353 self.__actions.append(self.prevTabAct) |
1411 self.addAction(self.prevTabAct) | 1354 self.addAction(self.prevTabAct) |
1412 | 1355 |
1413 self.switchTabAct = E5Action( | 1356 self.switchTabAct = E5Action( |
1414 self.tr('Switch between tabs'), | 1357 self.tr('Switch between tabs'), |
1415 self.tr('Switch between tabs'), | 1358 self.tr('Switch between tabs'), |
1416 QKeySequence(self.tr('Ctrl+1')), 0, | 1359 QKeySequence(self.tr('Ctrl+1')), 0, |
1417 self, 'webbrowser_switch_tabs') | 1360 self, 'webbrowser_switch_tabs') |
1418 if not self.__initShortcutsOnly: | 1361 self.switchTabAct.triggered.connect(self.__switchTab) |
1419 self.switchTabAct.triggered.connect(self.__switchTab) | |
1420 self.__actions.append(self.switchTabAct) | 1362 self.__actions.append(self.switchTabAct) |
1421 self.addAction(self.switchTabAct) | 1363 self.addAction(self.switchTabAct) |
1422 | 1364 |
1423 self.prefAct = E5Action( | 1365 self.prefAct = E5Action( |
1424 self.tr('Preferences'), | 1366 self.tr('Preferences'), |
1429 self.prefAct.setWhatsThis(self.tr( | 1371 self.prefAct.setWhatsThis(self.tr( |
1430 """<b>Preferences</b>""" | 1372 """<b>Preferences</b>""" |
1431 """<p>Set the configuration items of the application""" | 1373 """<p>Set the configuration items of the application""" |
1432 """ with your prefered values.</p>""" | 1374 """ with your prefered values.</p>""" |
1433 )) | 1375 )) |
1434 if not self.__initShortcutsOnly: | 1376 self.prefAct.triggered.connect(self.__showPreferences) |
1435 self.prefAct.triggered.connect(self.__showPreferences) | |
1436 self.__actions.append(self.prefAct) | 1377 self.__actions.append(self.prefAct) |
1437 | 1378 |
1438 self.acceptedLanguagesAct = E5Action( | 1379 self.acceptedLanguagesAct = E5Action( |
1439 self.tr('Languages'), | 1380 self.tr('Languages'), |
1440 UI.PixmapCache.getIcon("flag.png"), | 1381 UI.PixmapCache.getIcon("flag.png"), |
1444 'Configure the accepted languages for web pages')) | 1385 'Configure the accepted languages for web pages')) |
1445 self.acceptedLanguagesAct.setWhatsThis(self.tr( | 1386 self.acceptedLanguagesAct.setWhatsThis(self.tr( |
1446 """<b>Languages</b>""" | 1387 """<b>Languages</b>""" |
1447 """<p>Configure the accepted languages for web pages.</p>""" | 1388 """<p>Configure the accepted languages for web pages.</p>""" |
1448 )) | 1389 )) |
1449 if not self.__initShortcutsOnly: | 1390 self.acceptedLanguagesAct.triggered.connect( |
1450 self.acceptedLanguagesAct.triggered.connect( | 1391 self.__showAcceptedLanguages) |
1451 self.__showAcceptedLanguages) | |
1452 self.__actions.append(self.acceptedLanguagesAct) | 1392 self.__actions.append(self.acceptedLanguagesAct) |
1453 | 1393 |
1454 self.cookiesAct = E5Action( | 1394 self.cookiesAct = E5Action( |
1455 self.tr('Cookies'), | 1395 self.tr('Cookies'), |
1456 UI.PixmapCache.getIcon("cookie.png"), | 1396 UI.PixmapCache.getIcon("cookie.png"), |
1459 'Configure cookies handling')) | 1399 'Configure cookies handling')) |
1460 self.cookiesAct.setWhatsThis(self.tr( | 1400 self.cookiesAct.setWhatsThis(self.tr( |
1461 """<b>Cookies</b>""" | 1401 """<b>Cookies</b>""" |
1462 """<p>Configure cookies handling.</p>""" | 1402 """<p>Configure cookies handling.</p>""" |
1463 )) | 1403 )) |
1464 if not self.__initShortcutsOnly: | 1404 self.cookiesAct.triggered.connect( |
1465 self.cookiesAct.triggered.connect( | 1405 self.__showCookiesConfiguration) |
1466 self.__showCookiesConfiguration) | |
1467 self.__actions.append(self.cookiesAct) | 1406 self.__actions.append(self.cookiesAct) |
1468 | 1407 |
1469 self.flashCookiesAct = E5Action( | 1408 self.flashCookiesAct = E5Action( |
1470 self.tr('Flash Cookies'), | 1409 self.tr('Flash Cookies'), |
1471 UI.PixmapCache.getIcon("flashCookie.png"), | 1410 UI.PixmapCache.getIcon("flashCookie.png"), |
1475 'Manage flash cookies')) | 1414 'Manage flash cookies')) |
1476 self.flashCookiesAct.setWhatsThis(self.tr( | 1415 self.flashCookiesAct.setWhatsThis(self.tr( |
1477 """<b>Flash Cookies</b>""" | 1416 """<b>Flash Cookies</b>""" |
1478 """<p>Show a dialog to manage the flash cookies.</p>""" | 1417 """<p>Show a dialog to manage the flash cookies.</p>""" |
1479 )) | 1418 )) |
1480 if not self.__initShortcutsOnly: | 1419 self.flashCookiesAct.triggered.connect( |
1481 self.flashCookiesAct.triggered.connect( | 1420 self.__showFlashCookiesManagement) |
1482 self.__showFlashCookiesManagement) | |
1483 self.__actions.append(self.flashCookiesAct) | 1421 self.__actions.append(self.flashCookiesAct) |
1484 | 1422 |
1485 self.personalDataAct = E5Action( | 1423 self.personalDataAct = E5Action( |
1486 self.tr('Personal Information'), | 1424 self.tr('Personal Information'), |
1487 UI.PixmapCache.getIcon("pim.png"), | 1425 UI.PixmapCache.getIcon("pim.png"), |
1493 self.personalDataAct.setWhatsThis(self.tr( | 1431 self.personalDataAct.setWhatsThis(self.tr( |
1494 """<b>Personal Information...</b>""" | 1432 """<b>Personal Information...</b>""" |
1495 """<p>Opens a dialog to configure the personal information""" | 1433 """<p>Opens a dialog to configure the personal information""" |
1496 """ used for completing form fields.</p>""" | 1434 """ used for completing form fields.</p>""" |
1497 )) | 1435 )) |
1498 if not self.__initShortcutsOnly: | 1436 self.personalDataAct.triggered.connect( |
1499 self.personalDataAct.triggered.connect( | 1437 self.__showPersonalInformationDialog) |
1500 self.__showPersonalInformationDialog) | |
1501 self.__actions.append(self.personalDataAct) | 1438 self.__actions.append(self.personalDataAct) |
1502 | 1439 |
1503 self.greaseMonkeyAct = E5Action( | 1440 self.greaseMonkeyAct = E5Action( |
1504 self.tr('GreaseMonkey Scripts'), | 1441 self.tr('GreaseMonkey Scripts'), |
1505 UI.PixmapCache.getIcon("greaseMonkey.png"), | 1442 UI.PixmapCache.getIcon("greaseMonkey.png"), |
1511 self.greaseMonkeyAct.setWhatsThis(self.tr( | 1448 self.greaseMonkeyAct.setWhatsThis(self.tr( |
1512 """<b>GreaseMonkey Scripts...</b>""" | 1449 """<b>GreaseMonkey Scripts...</b>""" |
1513 """<p>Opens a dialog to configure the available GreaseMonkey""" | 1450 """<p>Opens a dialog to configure the available GreaseMonkey""" |
1514 """ Scripts.</p>""" | 1451 """ Scripts.</p>""" |
1515 )) | 1452 )) |
1516 if not self.__initShortcutsOnly: | 1453 self.greaseMonkeyAct.triggered.connect( |
1517 self.greaseMonkeyAct.triggered.connect( | 1454 self.__showGreaseMonkeyConfigDialog) |
1518 self.__showGreaseMonkeyConfigDialog) | |
1519 self.__actions.append(self.greaseMonkeyAct) | 1455 self.__actions.append(self.greaseMonkeyAct) |
1520 | 1456 |
1521 self.editMessageFilterAct = E5Action( | 1457 self.editMessageFilterAct = E5Action( |
1522 self.tr('Edit Message Filters'), | 1458 self.tr('Edit Message Filters'), |
1523 UI.PixmapCache.getIcon("warning.png"), | 1459 UI.PixmapCache.getIcon("warning.png"), |
1529 """<b>Edit Message Filters</b>""" | 1465 """<b>Edit Message Filters</b>""" |
1530 """<p>Opens a dialog to edit the message filters used to""" | 1466 """<p>Opens a dialog to edit the message filters used to""" |
1531 """ suppress unwanted messages been shown in an error""" | 1467 """ suppress unwanted messages been shown in an error""" |
1532 """ window.</p>""" | 1468 """ window.</p>""" |
1533 )) | 1469 )) |
1534 if not self.__initShortcutsOnly: | 1470 self.editMessageFilterAct.triggered.connect( |
1535 self.editMessageFilterAct.triggered.connect( | 1471 E5ErrorMessage.editMessageFilters) |
1536 E5ErrorMessage.editMessageFilters) | |
1537 self.__actions.append(self.editMessageFilterAct) | 1472 self.__actions.append(self.editMessageFilterAct) |
1538 | 1473 |
1539 self.featurePermissionAct = E5Action( | 1474 self.featurePermissionAct = E5Action( |
1540 self.tr('Edit HTML5 Feature Permissions'), | 1475 self.tr('Edit HTML5 Feature Permissions'), |
1541 UI.PixmapCache.getIcon("featurePermission.png"), | 1476 UI.PixmapCache.getIcon("featurePermission.png"), |
1546 self.featurePermissionAct.setWhatsThis(self.tr( | 1481 self.featurePermissionAct.setWhatsThis(self.tr( |
1547 """<b>Edit HTML5 Feature Permissions</b>""" | 1482 """<b>Edit HTML5 Feature Permissions</b>""" |
1548 """<p>Opens a dialog to edit the remembered HTML5""" | 1483 """<p>Opens a dialog to edit the remembered HTML5""" |
1549 """ feature permissions.</p>""" | 1484 """ feature permissions.</p>""" |
1550 )) | 1485 )) |
1551 if not self.__initShortcutsOnly: | 1486 self.featurePermissionAct.triggered.connect( |
1552 self.featurePermissionAct.triggered.connect( | 1487 self.__showFeaturePermissionDialog) |
1553 self.__showFeaturePermissionDialog) | |
1554 self.__actions.append(self.featurePermissionAct) | 1488 self.__actions.append(self.featurePermissionAct) |
1555 | 1489 |
1556 if WebBrowserWindow._useQtHelp or self.__initShortcutsOnly: | 1490 if WebBrowserWindow._useQtHelp: |
1557 self.syncTocAct = E5Action( | 1491 self.syncTocAct = E5Action( |
1558 self.tr('Sync with Table of Contents'), | 1492 self.tr('Sync with Table of Contents'), |
1559 UI.PixmapCache.getIcon("syncToc.png"), | 1493 UI.PixmapCache.getIcon("syncToc.png"), |
1560 self.tr('Sync with Table of Contents'), | 1494 self.tr('Sync with Table of Contents'), |
1561 0, 0, self, 'webbrowser_sync_toc') | 1495 0, 0, self, 'webbrowser_sync_toc') |
1564 self.syncTocAct.setWhatsThis(self.tr( | 1498 self.syncTocAct.setWhatsThis(self.tr( |
1565 """<b>Sync with Table of Contents</b>""" | 1499 """<b>Sync with Table of Contents</b>""" |
1566 """<p>Synchronizes the table of contents with current""" | 1500 """<p>Synchronizes the table of contents with current""" |
1567 """ page.</p>""" | 1501 """ page.</p>""" |
1568 )) | 1502 )) |
1569 if not self.__initShortcutsOnly: | 1503 self.syncTocAct.triggered.connect(self.__syncTOC) |
1570 self.syncTocAct.triggered.connect(self.__syncTOC) | |
1571 self.__actions.append(self.syncTocAct) | 1504 self.__actions.append(self.syncTocAct) |
1572 | 1505 |
1573 self.showTocAct = E5Action( | 1506 self.showTocAct = E5Action( |
1574 self.tr('Table of Contents'), | 1507 self.tr('Table of Contents'), |
1575 self.tr('Table of Contents'), | 1508 self.tr('Table of Contents'), |
1578 'Shows the table of contents window')) | 1511 'Shows the table of contents window')) |
1579 self.showTocAct.setWhatsThis(self.tr( | 1512 self.showTocAct.setWhatsThis(self.tr( |
1580 """<b>Table of Contents</b>""" | 1513 """<b>Table of Contents</b>""" |
1581 """<p>Shows the table of contents window.</p>""" | 1514 """<p>Shows the table of contents window.</p>""" |
1582 )) | 1515 )) |
1583 if not self.__initShortcutsOnly: | 1516 self.showTocAct.triggered.connect(self.__showTocWindow) |
1584 self.showTocAct.triggered.connect(self.__showTocWindow) | |
1585 self.__actions.append(self.showTocAct) | 1517 self.__actions.append(self.showTocAct) |
1586 | 1518 |
1587 self.showIndexAct = E5Action( | 1519 self.showIndexAct = E5Action( |
1588 self.tr('Index'), | 1520 self.tr('Index'), |
1589 self.tr('Index'), | 1521 self.tr('Index'), |
1592 'Shows the index window')) | 1524 'Shows the index window')) |
1593 self.showIndexAct.setWhatsThis(self.tr( | 1525 self.showIndexAct.setWhatsThis(self.tr( |
1594 """<b>Index</b>""" | 1526 """<b>Index</b>""" |
1595 """<p>Shows the index window.</p>""" | 1527 """<p>Shows the index window.</p>""" |
1596 )) | 1528 )) |
1597 if not self.__initShortcutsOnly: | 1529 self.showIndexAct.triggered.connect(self.__showIndexWindow) |
1598 self.showIndexAct.triggered.connect(self.__showIndexWindow) | |
1599 self.__actions.append(self.showIndexAct) | 1530 self.__actions.append(self.showIndexAct) |
1600 | 1531 |
1601 self.showSearchAct = E5Action( | 1532 self.showSearchAct = E5Action( |
1602 self.tr('Search'), | 1533 self.tr('Search'), |
1603 self.tr('Search'), | 1534 self.tr('Search'), |
1606 'Shows the search window')) | 1537 'Shows the search window')) |
1607 self.showSearchAct.setWhatsThis(self.tr( | 1538 self.showSearchAct.setWhatsThis(self.tr( |
1608 """<b>Search</b>""" | 1539 """<b>Search</b>""" |
1609 """<p>Shows the search window.</p>""" | 1540 """<p>Shows the search window.</p>""" |
1610 )) | 1541 )) |
1611 if not self.__initShortcutsOnly: | 1542 self.showSearchAct.triggered.connect( |
1612 self.showSearchAct.triggered.connect( | 1543 self.__showSearchWindow) |
1613 self.__showSearchWindow) | |
1614 self.__actions.append(self.showSearchAct) | 1544 self.__actions.append(self.showSearchAct) |
1615 | 1545 |
1616 self.manageQtHelpDocsAct = E5Action( | 1546 self.manageQtHelpDocsAct = E5Action( |
1617 self.tr('Manage QtHelp Documents'), | 1547 self.tr('Manage QtHelp Documents'), |
1618 self.tr('Manage QtHelp &Documents'), | 1548 self.tr('Manage QtHelp &Documents'), |
1622 self.manageQtHelpDocsAct.setWhatsThis(self.tr( | 1552 self.manageQtHelpDocsAct.setWhatsThis(self.tr( |
1623 """<b>Manage QtHelp Documents</b>""" | 1553 """<b>Manage QtHelp Documents</b>""" |
1624 """<p>Shows a dialog to manage the QtHelp documentation""" | 1554 """<p>Shows a dialog to manage the QtHelp documentation""" |
1625 """ set.</p>""" | 1555 """ set.</p>""" |
1626 )) | 1556 )) |
1627 if not self.__initShortcutsOnly: | 1557 self.manageQtHelpDocsAct.triggered.connect( |
1628 self.manageQtHelpDocsAct.triggered.connect( | 1558 self.__manageQtHelpDocumentation) |
1629 self.__manageQtHelpDocumentation) | |
1630 self.__actions.append(self.manageQtHelpDocsAct) | 1559 self.__actions.append(self.manageQtHelpDocsAct) |
1631 | 1560 |
1632 self.manageQtHelpFiltersAct = E5Action( | 1561 self.manageQtHelpFiltersAct = E5Action( |
1633 self.tr('Manage QtHelp Filters'), | 1562 self.tr('Manage QtHelp Filters'), |
1634 self.tr('Manage QtHelp &Filters'), | 1563 self.tr('Manage QtHelp &Filters'), |
1637 'Shows a dialog to manage the QtHelp filters')) | 1566 'Shows a dialog to manage the QtHelp filters')) |
1638 self.manageQtHelpFiltersAct.setWhatsThis(self.tr( | 1567 self.manageQtHelpFiltersAct.setWhatsThis(self.tr( |
1639 """<b>Manage QtHelp Filters</b>""" | 1568 """<b>Manage QtHelp Filters</b>""" |
1640 """<p>Shows a dialog to manage the QtHelp filters.</p>""" | 1569 """<p>Shows a dialog to manage the QtHelp filters.</p>""" |
1641 )) | 1570 )) |
1642 if not self.__initShortcutsOnly: | 1571 self.manageQtHelpFiltersAct.triggered.connect( |
1643 self.manageQtHelpFiltersAct.triggered.connect( | 1572 self.__manageQtHelpFilters) |
1644 self.__manageQtHelpFilters) | |
1645 self.__actions.append(self.manageQtHelpFiltersAct) | 1573 self.__actions.append(self.manageQtHelpFiltersAct) |
1646 | 1574 |
1647 self.reindexDocumentationAct = E5Action( | 1575 self.reindexDocumentationAct = E5Action( |
1648 self.tr('Reindex Documentation'), | 1576 self.tr('Reindex Documentation'), |
1649 self.tr('&Reindex Documentation'), | 1577 self.tr('&Reindex Documentation'), |
1652 'Reindexes the documentation set')) | 1580 'Reindexes the documentation set')) |
1653 self.reindexDocumentationAct.setWhatsThis(self.tr( | 1581 self.reindexDocumentationAct.setWhatsThis(self.tr( |
1654 """<b>Reindex Documentation</b>""" | 1582 """<b>Reindex Documentation</b>""" |
1655 """<p>Reindexes the documentation set.</p>""" | 1583 """<p>Reindexes the documentation set.</p>""" |
1656 )) | 1584 )) |
1657 if not self.__initShortcutsOnly: | 1585 self.reindexDocumentationAct.triggered.connect( |
1658 self.reindexDocumentationAct.triggered.connect( | 1586 self.__searchEngine.reindexDocumentation) |
1659 self.__searchEngine.reindexDocumentation) | |
1660 self.__actions.append(self.reindexDocumentationAct) | 1587 self.__actions.append(self.reindexDocumentationAct) |
1661 | 1588 |
1662 self.clearPrivateDataAct = E5Action( | 1589 self.clearPrivateDataAct = E5Action( |
1663 self.tr('Clear private data'), | 1590 self.tr('Clear private data'), |
1664 UI.PixmapCache.getIcon("clearPrivateData.png"), | 1591 UI.PixmapCache.getIcon("clearPrivateData.png"), |
1670 self.clearPrivateDataAct.setWhatsThis(self.tr( | 1597 self.clearPrivateDataAct.setWhatsThis(self.tr( |
1671 """<b>Clear private data</b>""" | 1598 """<b>Clear private data</b>""" |
1672 """<p>Clears the private data like browsing history, search""" | 1599 """<p>Clears the private data like browsing history, search""" |
1673 """ history or the favicons database.</p>""" | 1600 """ history or the favicons database.</p>""" |
1674 )) | 1601 )) |
1675 if not self.__initShortcutsOnly: | 1602 self.clearPrivateDataAct.triggered.connect( |
1676 self.clearPrivateDataAct.triggered.connect( | 1603 self.__clearPrivateData) |
1677 self.__clearPrivateData) | |
1678 self.__actions.append(self.clearPrivateDataAct) | 1604 self.__actions.append(self.clearPrivateDataAct) |
1679 | 1605 |
1680 self.clearIconsAct = E5Action( | 1606 self.clearIconsAct = E5Action( |
1681 self.tr('Clear icons database'), | 1607 self.tr('Clear icons database'), |
1682 self.tr('Clear &icons database'), | 1608 self.tr('Clear &icons database'), |
1687 self.clearIconsAct.setWhatsThis(self.tr( | 1613 self.clearIconsAct.setWhatsThis(self.tr( |
1688 """<b>Clear icons database</b>""" | 1614 """<b>Clear icons database</b>""" |
1689 """<p>Clears the database of favicons of previously visited""" | 1615 """<p>Clears the database of favicons of previously visited""" |
1690 """ URLs.</p>""" | 1616 """ URLs.</p>""" |
1691 )) | 1617 )) |
1692 if not self.__initShortcutsOnly: | 1618 self.clearIconsAct.triggered.connect(self.__clearIconsDatabase) |
1693 self.clearIconsAct.triggered.connect(self.__clearIconsDatabase) | |
1694 self.__actions.append(self.clearIconsAct) | 1619 self.__actions.append(self.clearIconsAct) |
1695 | 1620 |
1696 self.manageIconsAct = E5Action( | 1621 self.manageIconsAct = E5Action( |
1697 self.tr('Manage saved Favicons'), | 1622 self.tr('Manage saved Favicons'), |
1698 UI.PixmapCache.getIcon("icons.png"), | 1623 UI.PixmapCache.getIcon("icons.png"), |
1704 self.manageIconsAct.setWhatsThis(self.tr( | 1629 self.manageIconsAct.setWhatsThis(self.tr( |
1705 """<b>Manage saved Favicons</b>""" | 1630 """<b>Manage saved Favicons</b>""" |
1706 """<p>This shows a dialog to manage the saved favicons of""" | 1631 """<p>This shows a dialog to manage the saved favicons of""" |
1707 """ previously visited URLs.</p>""" | 1632 """ previously visited URLs.</p>""" |
1708 )) | 1633 )) |
1709 if not self.__initShortcutsOnly: | 1634 self.manageIconsAct.triggered.connect(self.__showWebIconsDialog) |
1710 self.manageIconsAct.triggered.connect(self.__showWebIconsDialog) | |
1711 self.__actions.append(self.manageIconsAct) | 1635 self.__actions.append(self.manageIconsAct) |
1712 | 1636 |
1713 self.searchEnginesAct = E5Action( | 1637 self.searchEnginesAct = E5Action( |
1714 self.tr('Configure Search Engines'), | 1638 self.tr('Configure Search Engines'), |
1715 self.tr('Configure Search &Engines...'), | 1639 self.tr('Configure Search &Engines...'), |
1720 self.searchEnginesAct.setWhatsThis(self.tr( | 1644 self.searchEnginesAct.setWhatsThis(self.tr( |
1721 """<b>Configure Search Engines...</b>""" | 1645 """<b>Configure Search Engines...</b>""" |
1722 """<p>Opens a dialog to configure the available search""" | 1646 """<p>Opens a dialog to configure the available search""" |
1723 """ engines.</p>""" | 1647 """ engines.</p>""" |
1724 )) | 1648 )) |
1725 if not self.__initShortcutsOnly: | 1649 self.searchEnginesAct.triggered.connect( |
1726 self.searchEnginesAct.triggered.connect( | 1650 self.__showEnginesConfigurationDialog) |
1727 self.__showEnginesConfigurationDialog) | |
1728 self.__actions.append(self.searchEnginesAct) | 1651 self.__actions.append(self.searchEnginesAct) |
1729 | 1652 |
1730 self.passwordsAct = E5Action( | 1653 self.passwordsAct = E5Action( |
1731 self.tr('Manage Saved Passwords'), | 1654 self.tr('Manage Saved Passwords'), |
1732 UI.PixmapCache.getIcon("passwords.png"), | 1655 UI.PixmapCache.getIcon("passwords.png"), |
1737 'Manage the saved passwords')) | 1660 'Manage the saved passwords')) |
1738 self.passwordsAct.setWhatsThis(self.tr( | 1661 self.passwordsAct.setWhatsThis(self.tr( |
1739 """<b>Manage Saved Passwords...</b>""" | 1662 """<b>Manage Saved Passwords...</b>""" |
1740 """<p>Opens a dialog to manage the saved passwords.</p>""" | 1663 """<p>Opens a dialog to manage the saved passwords.</p>""" |
1741 )) | 1664 )) |
1742 if not self.__initShortcutsOnly: | 1665 self.passwordsAct.triggered.connect(self.__showPasswordsDialog) |
1743 self.passwordsAct.triggered.connect(self.__showPasswordsDialog) | |
1744 self.__actions.append(self.passwordsAct) | 1666 self.__actions.append(self.passwordsAct) |
1745 | 1667 |
1746 self.adblockAct = E5Action( | 1668 self.adblockAct = E5Action( |
1747 self.tr('Ad Block'), | 1669 self.tr('Ad Block'), |
1748 UI.PixmapCache.getIcon("adBlockPlus.png"), | 1670 UI.PixmapCache.getIcon("adBlockPlus.png"), |
1754 self.adblockAct.setWhatsThis(self.tr( | 1676 self.adblockAct.setWhatsThis(self.tr( |
1755 """<b>Ad Block...</b>""" | 1677 """<b>Ad Block...</b>""" |
1756 """<p>Opens a dialog to configure AdBlock subscriptions and""" | 1678 """<p>Opens a dialog to configure AdBlock subscriptions and""" |
1757 """ rules.</p>""" | 1679 """ rules.</p>""" |
1758 )) | 1680 )) |
1759 if not self.__initShortcutsOnly: | 1681 self.adblockAct.triggered.connect(self.__showAdBlockDialog) |
1760 self.adblockAct.triggered.connect(self.__showAdBlockDialog) | |
1761 self.__actions.append(self.adblockAct) | 1682 self.__actions.append(self.adblockAct) |
1762 | 1683 |
1763 self.certificateErrorsAct = E5Action( | 1684 self.certificateErrorsAct = E5Action( |
1764 self.tr('Manage SSL Certificate Errors'), | 1685 self.tr('Manage SSL Certificate Errors'), |
1765 UI.PixmapCache.getIcon("certificates.png"), | 1686 UI.PixmapCache.getIcon("certificates.png"), |
1771 self.certificateErrorsAct.setWhatsThis(self.tr( | 1692 self.certificateErrorsAct.setWhatsThis(self.tr( |
1772 """<b>Manage SSL Certificate Errors...</b>""" | 1693 """<b>Manage SSL Certificate Errors...</b>""" |
1773 """<p>Opens a dialog to manage the accepted SSL""" | 1694 """<p>Opens a dialog to manage the accepted SSL""" |
1774 """ certificate errors.</p>""" | 1695 """ certificate errors.</p>""" |
1775 )) | 1696 )) |
1776 if not self.__initShortcutsOnly: | 1697 self.certificateErrorsAct.triggered.connect( |
1777 self.certificateErrorsAct.triggered.connect( | 1698 self.__showCertificateErrorsDialog) |
1778 self.__showCertificateErrorsDialog) | |
1779 self.__actions.append(self.certificateErrorsAct) | 1699 self.__actions.append(self.certificateErrorsAct) |
1780 | 1700 |
1781 self.safeBrowsingAct = E5Action( | 1701 self.safeBrowsingAct = E5Action( |
1782 self.tr('Manage Safe Browsing'), | 1702 self.tr('Manage Safe Browsing'), |
1783 UI.PixmapCache.getIcon("safeBrowsing.png"), | 1703 UI.PixmapCache.getIcon("safeBrowsing.png"), |
1788 self.safeBrowsingAct.setWhatsThis(self.tr( | 1708 self.safeBrowsingAct.setWhatsThis(self.tr( |
1789 """<b>Manage Safe Browsing</b>""" | 1709 """<b>Manage Safe Browsing</b>""" |
1790 """<p>This opens a dialog to configure Safe Browsing and""" | 1710 """<p>This opens a dialog to configure Safe Browsing and""" |
1791 """ to manage the local cache.</p>""" | 1711 """ to manage the local cache.</p>""" |
1792 )) | 1712 )) |
1793 if not self.__initShortcutsOnly: | 1713 self.safeBrowsingAct.triggered.connect( |
1794 self.safeBrowsingAct.triggered.connect( | 1714 self.__showSafeBrowsingDialog) |
1795 self.__showSafeBrowsingDialog) | |
1796 self.__actions.append(self.safeBrowsingAct) | 1715 self.__actions.append(self.safeBrowsingAct) |
1797 | 1716 |
1798 self.showDownloadManagerAct = E5Action( | 1717 self.showDownloadManagerAct = E5Action( |
1799 self.tr('Downloads'), | 1718 self.tr('Downloads'), |
1800 self.tr('Downloads'), | 1719 self.tr('Downloads'), |
1803 'Shows the downloads window')) | 1722 'Shows the downloads window')) |
1804 self.showDownloadManagerAct.setWhatsThis(self.tr( | 1723 self.showDownloadManagerAct.setWhatsThis(self.tr( |
1805 """<b>Downloads</b>""" | 1724 """<b>Downloads</b>""" |
1806 """<p>Shows the downloads window.</p>""" | 1725 """<p>Shows the downloads window.</p>""" |
1807 )) | 1726 )) |
1808 if not self.__initShortcutsOnly: | 1727 self.showDownloadManagerAct.triggered.connect( |
1809 self.showDownloadManagerAct.triggered.connect( | 1728 self.__showDownloadsWindow) |
1810 self.__showDownloadsWindow) | |
1811 self.__actions.append(self.showDownloadManagerAct) | 1729 self.__actions.append(self.showDownloadManagerAct) |
1812 | 1730 |
1813 self.feedsManagerAct = E5Action( | 1731 self.feedsManagerAct = E5Action( |
1814 self.tr('RSS Feeds Dialog'), | 1732 self.tr('RSS Feeds Dialog'), |
1815 UI.PixmapCache.getIcon("rss22.png"), | 1733 UI.PixmapCache.getIcon("rss22.png"), |
1822 """<b>RSS Feeds Dialog...</b>""" | 1740 """<b>RSS Feeds Dialog...</b>""" |
1823 """<p>Open a dialog to show the configured RSS feeds.""" | 1741 """<p>Open a dialog to show the configured RSS feeds.""" |
1824 """ It can be used to mange the feeds and to show their""" | 1742 """ It can be used to mange the feeds and to show their""" |
1825 """ contents.</p>""" | 1743 """ contents.</p>""" |
1826 )) | 1744 )) |
1827 if not self.__initShortcutsOnly: | 1745 self.feedsManagerAct.triggered.connect(self.__showFeedsManager) |
1828 self.feedsManagerAct.triggered.connect(self.__showFeedsManager) | |
1829 self.__actions.append(self.feedsManagerAct) | 1746 self.__actions.append(self.feedsManagerAct) |
1830 | 1747 |
1831 self.siteInfoAct = E5Action( | 1748 self.siteInfoAct = E5Action( |
1832 self.tr('Siteinfo Dialog'), | 1749 self.tr('Siteinfo Dialog'), |
1833 UI.PixmapCache.getIcon("helpAbout.png"), | 1750 UI.PixmapCache.getIcon("helpAbout.png"), |
1839 self.siteInfoAct.setWhatsThis(self.tr( | 1756 self.siteInfoAct.setWhatsThis(self.tr( |
1840 """<b>Siteinfo Dialog...</b>""" | 1757 """<b>Siteinfo Dialog...</b>""" |
1841 """<p>Opens a dialog showing some information about the current""" | 1758 """<p>Opens a dialog showing some information about the current""" |
1842 """ site.</p>""" | 1759 """ site.</p>""" |
1843 )) | 1760 )) |
1844 if not self.__initShortcutsOnly: | 1761 self.siteInfoAct.triggered.connect(self.__showSiteinfoDialog) |
1845 self.siteInfoAct.triggered.connect(self.__showSiteinfoDialog) | |
1846 self.__actions.append(self.siteInfoAct) | 1762 self.__actions.append(self.siteInfoAct) |
1847 | 1763 |
1848 self.userAgentManagerAct = E5Action( | 1764 self.userAgentManagerAct = E5Action( |
1849 self.tr('Manage User Agent Settings'), | 1765 self.tr('Manage User Agent Settings'), |
1850 self.tr('Manage &User Agent Settings'), | 1766 self.tr('Manage &User Agent Settings'), |
1853 'Shows a dialog to manage the User Agent settings')) | 1769 'Shows a dialog to manage the User Agent settings')) |
1854 self.userAgentManagerAct.setWhatsThis(self.tr( | 1770 self.userAgentManagerAct.setWhatsThis(self.tr( |
1855 """<b>Manage User Agent Settings</b>""" | 1771 """<b>Manage User Agent Settings</b>""" |
1856 """<p>Shows a dialog to manage the User Agent settings.</p>""" | 1772 """<p>Shows a dialog to manage the User Agent settings.</p>""" |
1857 )) | 1773 )) |
1858 if not self.__initShortcutsOnly: | 1774 self.userAgentManagerAct.triggered.connect( |
1859 self.userAgentManagerAct.triggered.connect( | 1775 self.__showUserAgentsDialog) |
1860 self.__showUserAgentsDialog) | |
1861 self.__actions.append(self.userAgentManagerAct) | 1776 self.__actions.append(self.userAgentManagerAct) |
1862 | 1777 |
1863 self.synchronizationAct = E5Action( | 1778 self.synchronizationAct = E5Action( |
1864 self.tr('Synchronize data'), | 1779 self.tr('Synchronize data'), |
1865 UI.PixmapCache.getIcon("sync.png"), | 1780 UI.PixmapCache.getIcon("sync.png"), |
1870 self.synchronizationAct.setWhatsThis(self.tr( | 1785 self.synchronizationAct.setWhatsThis(self.tr( |
1871 """<b>Synchronize Data...</b>""" | 1786 """<b>Synchronize Data...</b>""" |
1872 """<p>This shows a dialog to synchronize data via the""" | 1787 """<p>This shows a dialog to synchronize data via the""" |
1873 """ network.</p>""" | 1788 """ network.</p>""" |
1874 )) | 1789 )) |
1875 if not self.__initShortcutsOnly: | 1790 self.synchronizationAct.triggered.connect( |
1876 self.synchronizationAct.triggered.connect( | 1791 self.__showSyncDialog) |
1877 self.__showSyncDialog) | |
1878 self.__actions.append(self.synchronizationAct) | 1792 self.__actions.append(self.synchronizationAct) |
1879 | 1793 |
1880 self.zoomValuesAct = E5Action( | 1794 self.zoomValuesAct = E5Action( |
1881 self.tr('Manage Saved Zoom Values'), | 1795 self.tr('Manage Saved Zoom Values'), |
1882 UI.PixmapCache.getIcon("zoomReset.png"), | 1796 UI.PixmapCache.getIcon("zoomReset.png"), |
1887 'Manage the saved zoom values')) | 1801 'Manage the saved zoom values')) |
1888 self.zoomValuesAct.setWhatsThis(self.tr( | 1802 self.zoomValuesAct.setWhatsThis(self.tr( |
1889 """<b>Manage Saved Zoom Values...</b>""" | 1803 """<b>Manage Saved Zoom Values...</b>""" |
1890 """<p>Opens a dialog to manage the saved zoom values.</p>""" | 1804 """<p>Opens a dialog to manage the saved zoom values.</p>""" |
1891 )) | 1805 )) |
1892 if not self.__initShortcutsOnly: | 1806 self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog) |
1893 self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog) | |
1894 self.__actions.append(self.zoomValuesAct) | 1807 self.__actions.append(self.zoomValuesAct) |
1895 | 1808 |
1896 self.showJavaScriptConsoleAct = E5Action( | 1809 self.showJavaScriptConsoleAct = E5Action( |
1897 self.tr('JavaScript Console'), | 1810 self.tr('JavaScript Console'), |
1898 self.tr('JavaScript Console'), | 1811 self.tr('JavaScript Console'), |
1901 'Toggle the JavaScript console window')) | 1814 'Toggle the JavaScript console window')) |
1902 self.showJavaScriptConsoleAct.setWhatsThis(self.tr( | 1815 self.showJavaScriptConsoleAct.setWhatsThis(self.tr( |
1903 """<b>JavaScript Console</b>""" | 1816 """<b>JavaScript Console</b>""" |
1904 """<p>This toggles the JavaScript console window.</p>""" | 1817 """<p>This toggles the JavaScript console window.</p>""" |
1905 )) | 1818 )) |
1906 if not self.__initShortcutsOnly: | 1819 self.showJavaScriptConsoleAct.triggered.connect( |
1907 self.showJavaScriptConsoleAct.triggered.connect( | 1820 self.__toggleJavaScriptConsole) |
1908 self.__toggleJavaScriptConsole) | |
1909 self.__actions.append(self.showJavaScriptConsoleAct) | 1821 self.__actions.append(self.showJavaScriptConsoleAct) |
1910 | 1822 |
1911 self.showTabManagerAct = E5Action( | 1823 self.showTabManagerAct = E5Action( |
1912 self.tr('Tab Manager'), | 1824 self.tr('Tab Manager'), |
1913 self.tr('Tab Manager'), | 1825 self.tr('Tab Manager'), |
1916 'Shows the tab manager window')) | 1828 'Shows the tab manager window')) |
1917 self.showTabManagerAct.setWhatsThis(self.tr( | 1829 self.showTabManagerAct.setWhatsThis(self.tr( |
1918 """<b>Tab Manager</b>""" | 1830 """<b>Tab Manager</b>""" |
1919 """<p>Shows the tab manager window.</p>""" | 1831 """<p>Shows the tab manager window.</p>""" |
1920 )) | 1832 )) |
1921 if not self.__initShortcutsOnly: | 1833 self.showTabManagerAct.triggered.connect( |
1922 self.showTabManagerAct.triggered.connect( | 1834 lambda: self.__showTabManager(self.showTabManagerAct)) |
1923 lambda: self.__showTabManager(self.showTabManagerAct)) | |
1924 self.__actions.append(self.showTabManagerAct) | 1835 self.__actions.append(self.showTabManagerAct) |
1925 | 1836 |
1926 self.showSessionsManagerAct = E5Action( | 1837 self.showSessionsManagerAct = E5Action( |
1927 self.tr('Session Manager'), | 1838 self.tr('Session Manager'), |
1928 self.tr('Session Manager...'), | 1839 self.tr('Session Manager...'), |
1931 'Shows the session manager window')) | 1842 'Shows the session manager window')) |
1932 self.showSessionsManagerAct.setWhatsThis(self.tr( | 1843 self.showSessionsManagerAct.setWhatsThis(self.tr( |
1933 """<b>Session Manager</b>""" | 1844 """<b>Session Manager</b>""" |
1934 """<p>Shows the session manager window.</p>""" | 1845 """<p>Shows the session manager window.</p>""" |
1935 )) | 1846 )) |
1936 if not self.__initShortcutsOnly: | 1847 self.showSessionsManagerAct.triggered.connect( |
1937 self.showSessionsManagerAct.triggered.connect( | 1848 self.__showSessionManagerDialog) |
1938 self.__showSessionManagerDialog) | |
1939 self.__actions.append(self.showSessionsManagerAct) | 1849 self.__actions.append(self.showSessionsManagerAct) |
1940 | 1850 |
1941 self.virustotalScanCurrentAct = E5Action( | 1851 self.virustotalScanCurrentAct = E5Action( |
1942 self.tr("Scan current site"), | 1852 self.tr("Scan current site"), |
1943 UI.PixmapCache.getIcon("virustotal.png"), | 1853 UI.PixmapCache.getIcon("virustotal.png"), |
1944 self.tr("Scan current site"), | 1854 self.tr("Scan current site"), |
1945 0, 0, | 1855 0, 0, |
1946 self, 'webbrowser_virustotal_scan_site') | 1856 self, 'webbrowser_virustotal_scan_site') |
1947 if not self.__initShortcutsOnly: | 1857 self.virustotalScanCurrentAct.triggered.connect( |
1948 self.virustotalScanCurrentAct.triggered.connect( | 1858 self.__virusTotalScanCurrentSite) |
1949 self.__virusTotalScanCurrentSite) | |
1950 self.__actions.append(self.virustotalScanCurrentAct) | 1859 self.__actions.append(self.virustotalScanCurrentAct) |
1951 | 1860 |
1952 self.virustotalIpReportAct = E5Action( | 1861 self.virustotalIpReportAct = E5Action( |
1953 self.tr("IP Address Report"), | 1862 self.tr("IP Address Report"), |
1954 UI.PixmapCache.getIcon("virustotal.png"), | 1863 UI.PixmapCache.getIcon("virustotal.png"), |
1955 self.tr("IP Address Report"), | 1864 self.tr("IP Address Report"), |
1956 0, 0, | 1865 0, 0, |
1957 self, 'webbrowser_virustotal_ip_report') | 1866 self, 'webbrowser_virustotal_ip_report') |
1958 if not self.__initShortcutsOnly: | 1867 self.virustotalIpReportAct.triggered.connect( |
1959 self.virustotalIpReportAct.triggered.connect( | 1868 self.__virusTotalIpAddressReport) |
1960 self.__virusTotalIpAddressReport) | |
1961 self.__actions.append(self.virustotalIpReportAct) | 1869 self.__actions.append(self.virustotalIpReportAct) |
1962 | 1870 |
1963 self.virustotalDomainReportAct = E5Action( | 1871 self.virustotalDomainReportAct = E5Action( |
1964 self.tr("Domain Report"), | 1872 self.tr("Domain Report"), |
1965 UI.PixmapCache.getIcon("virustotal.png"), | 1873 UI.PixmapCache.getIcon("virustotal.png"), |
1966 self.tr("Domain Report"), | 1874 self.tr("Domain Report"), |
1967 0, 0, | 1875 0, 0, |
1968 self, 'webbrowser_virustotal_domain_report') | 1876 self, 'webbrowser_virustotal_domain_report') |
1969 if not self.__initShortcutsOnly: | 1877 self.virustotalDomainReportAct.triggered.connect( |
1970 self.virustotalDomainReportAct.triggered.connect( | 1878 self.__virusTotalDomainReport) |
1971 self.__virusTotalDomainReport) | |
1972 self.__actions.append(self.virustotalDomainReportAct) | 1879 self.__actions.append(self.virustotalDomainReportAct) |
1973 | 1880 |
1974 if not Preferences.getWebBrowser("VirusTotalEnabled") or \ | 1881 if not Preferences.getWebBrowser("VirusTotalEnabled") or \ |
1975 Preferences.getWebBrowser("VirusTotalServiceKey") == "": | 1882 Preferences.getWebBrowser("VirusTotalServiceKey") == "": |
1976 self.virustotalScanCurrentAct.setEnabled(False) | 1883 self.virustotalScanCurrentAct.setEnabled(False) |
1977 self.virustotalIpReportAct.setEnabled(False) | 1884 self.virustotalIpReportAct.setEnabled(False) |
1978 self.virustotalDomainReportAct.setEnabled(False) | 1885 self.virustotalDomainReportAct.setEnabled(False) |
1886 | |
1887 self.shortcutsAct = E5Action( | |
1888 self.tr('Keyboard Shortcuts'), | |
1889 UI.PixmapCache.getIcon("configureShortcuts.png"), | |
1890 self.tr('Keyboard &Shortcuts...'), | |
1891 0, 0, | |
1892 self, 'webbrowser_keyboard_shortcuts') | |
1893 self.shortcutsAct.setStatusTip(self.tr( | |
1894 'Set the keyboard shortcuts')) | |
1895 self.shortcutsAct.setWhatsThis(self.tr( | |
1896 """<b>Keyboard Shortcuts</b>""" | |
1897 """<p>Set the keyboard shortcuts of the application""" | |
1898 """ with your prefered values.</p>""" | |
1899 )) | |
1900 self.shortcutsAct.triggered.connect(self.__configShortcuts) | |
1901 self.__actions.append(self.shortcutsAct) | |
1902 | |
1903 self.exportShortcutsAct = E5Action( | |
1904 self.tr('Export Keyboard Shortcuts'), | |
1905 UI.PixmapCache.getIcon("exportShortcuts.png"), | |
1906 self.tr('&Export Keyboard Shortcuts...'), | |
1907 0, 0, self, 'export_keyboard_shortcuts') | |
1908 self.exportShortcutsAct.setStatusTip(self.tr( | |
1909 'Export the keyboard shortcuts')) | |
1910 self.exportShortcutsAct.setWhatsThis(self.tr( | |
1911 """<b>Export Keyboard Shortcuts</b>""" | |
1912 """<p>Export the keyboard shortcuts of the application.</p>""" | |
1913 )) | |
1914 self.exportShortcutsAct.triggered.connect(self.__exportShortcuts) | |
1915 self.__actions.append(self.exportShortcutsAct) | |
1916 | |
1917 self.importShortcutsAct = E5Action( | |
1918 self.tr('Import Keyboard Shortcuts'), | |
1919 UI.PixmapCache.getIcon("importShortcuts.png"), | |
1920 self.tr('&Import Keyboard Shortcuts...'), | |
1921 0, 0, self, 'import_keyboard_shortcuts') | |
1922 self.importShortcutsAct.setStatusTip(self.tr( | |
1923 'Import the keyboard shortcuts')) | |
1924 self.importShortcutsAct.setWhatsThis(self.tr( | |
1925 """<b>Import Keyboard Shortcuts</b>""" | |
1926 """<p>Import the keyboard shortcuts of the application.</p>""" | |
1927 )) | |
1928 self.importShortcutsAct.triggered.connect(self.__importShortcuts) | |
1929 self.__actions.append(self.importShortcutsAct) | |
1979 | 1930 |
1980 self.backAct.setEnabled(False) | 1931 self.backAct.setEnabled(False) |
1981 self.forwardAct.setEnabled(False) | 1932 self.forwardAct.setEnabled(False) |
1982 | 1933 |
1983 # now read the keyboard shortcuts for the actions | 1934 # now read the keyboard shortcuts for the actions |
1984 Shortcuts.readShortcuts( | 1935 Shortcuts.readShortcuts(helpViewer=self) |
1985 helpViewer=self, helpViewerCategory="webBrowser") | |
1986 | 1936 |
1987 def getActions(self): | 1937 def getActions(self): |
1988 """ | 1938 """ |
1989 Public method to get a list of all actions. | 1939 Public method to get a list of all actions. |
1990 | 1940 |
1991 @return list of all actions (list of E5Action) | 1941 @return list of all actions (list of E5Action) |
1992 """ | 1942 """ |
1993 return self.__actions[:] | 1943 return self.__actions[:] |
1994 | 1944 |
1945 def getActionsCategory(self): | |
1946 """ | |
1947 Public method to get the category of the defined actions. | |
1948 | |
1949 @return category of the actions | |
1950 @rtype str | |
1951 """ | |
1952 return "WebBrowser" | |
1953 | |
1995 def __initMenus(self): | 1954 def __initMenus(self): |
1996 """ | 1955 """ |
1997 Private method to create the menus. | 1956 Private method to create the menus. |
1998 """ | 1957 """ |
1999 mb = self.menuBar() | 1958 mb = self.menuBar() |
2102 bookmarksActions.append(self.exportBookmarksAct) | 2061 bookmarksActions.append(self.exportBookmarksAct) |
2103 self.bookmarksMenu.setInitialActions(bookmarksActions) | 2062 self.bookmarksMenu.setInitialActions(bookmarksActions) |
2104 | 2063 |
2105 menu = mb.addMenu(self.tr('&Settings')) | 2064 menu = mb.addMenu(self.tr('&Settings')) |
2106 menu.addAction(self.prefAct) | 2065 menu.addAction(self.prefAct) |
2066 menu.addSeparator() | |
2067 menu.addAction(self.shortcutsAct) | |
2068 menu.addAction(self.exportShortcutsAct) | |
2069 menu.addAction(self.importShortcutsAct) | |
2070 menu.addSeparator() | |
2107 menu.addAction(self.acceptedLanguagesAct) | 2071 menu.addAction(self.acceptedLanguagesAct) |
2108 menu.addAction(self.cookiesAct) | 2072 menu.addAction(self.cookiesAct) |
2109 menu.addAction(self.flashCookiesAct) | 2073 menu.addAction(self.flashCookiesAct) |
2110 menu.addAction(self.personalDataAct) | 2074 menu.addAction(self.personalDataAct) |
2111 menu.addAction(self.greaseMonkeyAct) | 2075 menu.addAction(self.greaseMonkeyAct) |
2225 self.__superMenu.addAction(self.bookmarksManageAct) | 2189 self.__superMenu.addAction(self.bookmarksManageAct) |
2226 self.__superMenu.addSeparator() | 2190 self.__superMenu.addSeparator() |
2227 self.__superMenu.addAction(self.prefAct) | 2191 self.__superMenu.addAction(self.prefAct) |
2228 | 2192 |
2229 menu = self.__superMenu.addMenu(self.tr('Settings')) | 2193 menu = self.__superMenu.addMenu(self.tr('Settings')) |
2194 menu.addAction(self.shortcutsAct) | |
2195 menu.addAction(self.exportShortcutsAct) | |
2196 menu.addAction(self.importShortcutsAct) | |
2197 menu.addSeparator() | |
2230 menu.addAction(self.acceptedLanguagesAct) | 2198 menu.addAction(self.acceptedLanguagesAct) |
2231 menu.addAction(self.cookiesAct) | 2199 menu.addAction(self.cookiesAct) |
2232 menu.addAction(self.flashCookiesAct) | 2200 menu.addAction(self.flashCookiesAct) |
2233 menu.addAction(self.personalDataAct) | 2201 menu.addAction(self.personalDataAct) |
2234 menu.addAction(self.greaseMonkeyAct) | 2202 menu.addAction(self.greaseMonkeyAct) |
2389 | 2357 |
2390 settingstb = self.addToolBar(self.tr("Settings")) | 2358 settingstb = self.addToolBar(self.tr("Settings")) |
2391 settingstb.setObjectName("SettingsToolBar") | 2359 settingstb.setObjectName("SettingsToolBar") |
2392 settingstb.setIconSize(UI.Config.ToolBarIconSize) | 2360 settingstb.setIconSize(UI.Config.ToolBarIconSize) |
2393 settingstb.addAction(self.prefAct) | 2361 settingstb.addAction(self.prefAct) |
2362 settingstb.addAction(self.shortcutsAct) | |
2394 settingstb.addAction(self.acceptedLanguagesAct) | 2363 settingstb.addAction(self.acceptedLanguagesAct) |
2395 settingstb.addAction(self.cookiesAct) | 2364 settingstb.addAction(self.cookiesAct) |
2396 settingstb.addAction(self.flashCookiesAct) | 2365 settingstb.addAction(self.flashCookiesAct) |
2397 settingstb.addAction(self.personalDataAct) | 2366 settingstb.addAction(self.personalDataAct) |
2398 settingstb.addAction(self.greaseMonkeyAct) | 2367 settingstb.addAction(self.greaseMonkeyAct) |
2507 elif isinstance(link, QUrl): | 2476 elif isinstance(link, QUrl): |
2508 linkName = link.toString() | 2477 linkName = link.toString() |
2509 else: | 2478 else: |
2510 linkName = link | 2479 linkName = link |
2511 h = WebBrowserWindow(linkName, ".", self.parent(), "webbrowser", | 2480 h = WebBrowserWindow(linkName, ".", self.parent(), "webbrowser", |
2512 self.__fromEric, private=self.isPrivate(), | 2481 private=self.isPrivate(), |
2513 restoreSession=restoreSession) | 2482 restoreSession=restoreSession) |
2514 h.show() | 2483 h.show() |
2515 | 2484 |
2516 self.webBrowserWindowOpened.emit(h) | 2485 self.webBrowserWindowOpened.emit(h) |
2517 | 2486 |
2835 if not self.__tabWidget.shallShutDown(): | 2804 if not self.__tabWidget.shallShutDown(): |
2836 return False | 2805 return False |
2837 | 2806 |
2838 self.__isClosing = True | 2807 self.__isClosing = True |
2839 | 2808 |
2840 if not self.__fromEric: | 2809 if not WebBrowserWindow._performingShutdown and \ |
2841 if not WebBrowserWindow._performingShutdown and \ | 2810 len(WebBrowserWindow.BrowserWindows) == 1 and \ |
2842 len(WebBrowserWindow.BrowserWindows) == 1: | 2811 not WebBrowserWindow.isPrivate(): |
2843 # shut down the session manager in case the last window is | 2812 # shut down the session manager in case the last window is |
2844 # about to be closed | 2813 # about to be closed |
2845 self.sessionManager().shutdown() | 2814 self.sessionManager().shutdown() |
2846 | 2815 |
2847 self.__bookmarksToolBar.setModel(None) | 2816 self.__bookmarksToolBar.setModel(None) |
2848 | 2817 |
2849 self.__virusTotal.close() | 2818 self.__virusTotal.close() |
2850 | 2819 |
2871 else: | 2840 else: |
2872 Preferences.setGeometry("WebBrowserGeometry", QByteArray()) | 2841 Preferences.setGeometry("WebBrowserGeometry", QByteArray()) |
2873 | 2842 |
2874 try: | 2843 try: |
2875 browserIndex = WebBrowserWindow.BrowserWindows.index(self) | 2844 browserIndex = WebBrowserWindow.BrowserWindows.index(self) |
2876 if not self.__fromEric and len(WebBrowserWindow.BrowserWindows): | 2845 if len(WebBrowserWindow.BrowserWindows): |
2877 if browserIndex == 0: | 2846 if browserIndex == 0: |
2878 if len(WebBrowserWindow.BrowserWindows) > 1: | 2847 if len(WebBrowserWindow.BrowserWindows) > 1: |
2879 # first window will be deleted | 2848 # first window will be deleted |
2880 QDesktopServices.setUrlHandler( | 2849 QDesktopServices.setUrlHandler( |
2881 "http", | 2850 "http", |
2884 "https", | 2853 "https", |
2885 WebBrowserWindow.BrowserWindows[1].urlHandler) | 2854 WebBrowserWindow.BrowserWindows[1].urlHandler) |
2886 else: | 2855 else: |
2887 QDesktopServices.unsetUrlHandler("http") | 2856 QDesktopServices.unsetUrlHandler("http") |
2888 QDesktopServices.unsetUrlHandler("https") | 2857 QDesktopServices.unsetUrlHandler("https") |
2889 if self.__fromEric or len(WebBrowserWindow.BrowserWindows) > 0: | 2858 if len(WebBrowserWindow.BrowserWindows) > 0: |
2890 del WebBrowserWindow.BrowserWindows[browserIndex] | 2859 del WebBrowserWindow.BrowserWindows[browserIndex] |
2891 except ValueError: | 2860 except ValueError: |
2892 pass | 2861 pass |
2893 | 2862 |
2894 if not self.__fromEric: | 2863 Preferences.syncPreferences() |
2895 Preferences.syncPreferences() | 2864 if not WebBrowserWindow._performingShutdown and \ |
2896 if not WebBrowserWindow._performingShutdown and \ | 2865 len(WebBrowserWindow.BrowserWindows) == 0: |
2897 len(WebBrowserWindow.BrowserWindows) == 0: | 2866 # shut down the browser in case the last window was |
2898 # shut down the browser in case the last window was | 2867 # simply closed |
2899 # simply closed | 2868 self.shutdown() |
2900 self.shutdown() | |
2901 | 2869 |
2902 return True | 2870 return True |
2903 | 2871 |
2904 def __shallShutDown(self): | 2872 def __shallShutDown(self): |
2905 """ | 2873 """ |
2922 """ browser?\n""" | 2890 """ browser?\n""" |
2923 """You have {0} windows with {1} tabs open.""") | 2891 """You have {0} windows with {1} tabs open.""") |
2924 .format(windowCount, tabCount), | 2892 .format(windowCount, tabCount), |
2925 modal=True, | 2893 modal=True, |
2926 parent=self) | 2894 parent=self) |
2927 if self.fromEric: | 2895 quitButton = mb.addButton( |
2928 quitButton = mb.addButton( | 2896 self.tr("&Quit"), E5MessageBox.AcceptRole) |
2929 self.tr("&Close"), E5MessageBox.AcceptRole) | 2897 quitButton.setIcon(UI.PixmapCache.getIcon("exit.png")) |
2930 quitButton.setIcon(UI.PixmapCache.getIcon("close.png")) | |
2931 else: | |
2932 quitButton = mb.addButton( | |
2933 self.tr("&Quit"), E5MessageBox.AcceptRole) | |
2934 quitButton.setIcon(UI.PixmapCache.getIcon("exit.png")) | |
2935 mb.addButton(E5MessageBox.Cancel) | 2898 mb.addButton(E5MessageBox.Cancel) |
2936 mb.exec_() | 2899 mb.exec_() |
2937 return mb.clickedButton() == quitButton | 2900 return mb.clickedButton() == quitButton |
2938 | 2901 |
2939 return True | 2902 return True |
2951 not self.downloadManager().allowQuit(): | 2914 not self.downloadManager().allowQuit(): |
2952 return False | 2915 return False |
2953 | 2916 |
2954 WebBrowserWindow._performingShutdown = True | 2917 WebBrowserWindow._performingShutdown = True |
2955 | 2918 |
2956 self.sessionManager().shutdown() | 2919 if not WebBrowserWindow.isPrivate(): |
2920 self.sessionManager().shutdown() | |
2957 | 2921 |
2958 if WebBrowserWindow._downloadManager is not None: | 2922 if WebBrowserWindow._downloadManager is not None: |
2959 self.downloadManager().shutdown() | 2923 self.downloadManager().shutdown() |
2960 | 2924 |
2961 self.cookieJar().close() | 2925 self.cookieJar().close() |
3233 """ | 3197 """ |
3234 Private slot to set the preferences. | 3198 Private slot to set the preferences. |
3235 """ | 3199 """ |
3236 from Preferences.ConfigurationDialog import ConfigurationDialog | 3200 from Preferences.ConfigurationDialog import ConfigurationDialog |
3237 dlg = ConfigurationDialog( | 3201 dlg = ConfigurationDialog( |
3238 self, 'Configuration', True, fromEric=self.__fromEric, | 3202 self, 'Configuration', True, fromEric=False, |
3239 displayMode=ConfigurationDialog.WebBrowserMode) | 3203 displayMode=ConfigurationDialog.WebBrowserMode) |
3240 dlg.preferencesChanged.connect(self.preferencesChanged) | 3204 dlg.preferencesChanged.connect(self.preferencesChanged) |
3241 dlg.masterPasswordChanged.connect( | 3205 dlg.masterPasswordChanged.connect( |
3242 lambda old, new: self.masterPasswordChanged(old, new, local=True)) | 3206 lambda old, new: self.masterPasswordChanged(old, new, local=True)) |
3243 dlg.show() | 3207 dlg.show() |
3255 | 3219 |
3256 def preferencesChanged(self): | 3220 def preferencesChanged(self): |
3257 """ | 3221 """ |
3258 Public slot to handle a change of preferences. | 3222 Public slot to handle a change of preferences. |
3259 """ | 3223 """ |
3260 if not self.__fromEric: | 3224 self.setStyle(Preferences.getUI("Style"), |
3261 self.setStyle(Preferences.getUI("Style"), | 3225 Preferences.getUI("StyleSheet")) |
3262 Preferences.getUI("StyleSheet")) | |
3263 | 3226 |
3264 self.__initWebEngineSettings() | 3227 self.__initWebEngineSettings() |
3265 | 3228 |
3266 self.networkManager().preferencesChanged() | 3229 self.networkManager().preferencesChanged() |
3267 | 3230 |
3303 self.virustotalIpReportAct.setEnabled(True) | 3266 self.virustotalIpReportAct.setEnabled(True) |
3304 self.virustotalDomainReportAct.setEnabled(True) | 3267 self.virustotalDomainReportAct.setEnabled(True) |
3305 | 3268 |
3306 self.__javaScriptIcon.preferencesChanged() | 3269 self.__javaScriptIcon.preferencesChanged() |
3307 | 3270 |
3308 self.sessionManager().preferencesChanged() | 3271 if not WebBrowserWindow.isPrivate(): |
3272 self.sessionManager().preferencesChanged() | |
3309 | 3273 |
3310 def masterPasswordChanged(self, oldPassword, newPassword, local=False): | 3274 def masterPasswordChanged(self, oldPassword, newPassword, local=False): |
3311 """ | 3275 """ |
3312 Public slot to handle the change of the master password. | 3276 Public slot to handle the change of the master password. |
3313 | 3277 |
3318 @param local flag indicating being called from the local configuration | 3282 @param local flag indicating being called from the local configuration |
3319 dialog | 3283 dialog |
3320 @type bool | 3284 @type bool |
3321 """ | 3285 """ |
3322 self.passwordManager().masterPasswordChanged(oldPassword, newPassword) | 3286 self.passwordManager().masterPasswordChanged(oldPassword, newPassword) |
3323 if self.__fromEric and local: | 3287 if local: |
3324 # we were called from our local configuration dialog | 3288 # we were called from our local configuration dialog |
3325 Preferences.convertPasswords(oldPassword, newPassword) | 3289 Preferences.convertPasswords(oldPassword, newPassword) |
3326 Utilities.crypto.changeRememberedMaster(newPassword) | 3290 Utilities.crypto.changeRememberedMaster(newPassword) |
3327 | 3291 |
3328 def __showAcceptedLanguages(self): | 3292 def __showAcceptedLanguages(self): |
3621 | 3585 |
3622 def __removeOldDocumentation(self): | 3586 def __removeOldDocumentation(self): |
3623 """ | 3587 """ |
3624 Private slot to remove non-existing documentation from the help engine. | 3588 Private slot to remove non-existing documentation from the help engine. |
3625 """ | 3589 """ |
3626 for namespace in self.__helpEngine.registeredDocumentations(): | 3590 if WebBrowserWindow._useQtHelp: |
3627 docFile = self.__helpEngine.documentationFileName(namespace) | 3591 for namespace in self.__helpEngine.registeredDocumentations(): |
3628 if not os.path.exists(docFile): | 3592 docFile = self.__helpEngine.documentationFileName(namespace) |
3629 self.__helpEngine.unregisterDocumentation(namespace) | 3593 if not os.path.exists(docFile): |
3594 self.__helpEngine.unregisterDocumentation(namespace) | |
3630 | 3595 |
3631 def __lookForNewDocumentation(self): | 3596 def __lookForNewDocumentation(self): |
3632 """ | 3597 """ |
3633 Private slot to look for new documentation to be loaded into the | 3598 Private slot to look for new documentation to be loaded into the |
3634 help database. | 3599 help database. |
4780 @type str | 4745 @type str |
4781 @param timeout time in seconds the notification should be shown | 4746 @param timeout time in seconds the notification should be shown |
4782 (None = use configured timeout, 0 = indefinitely) | 4747 (None = use configured timeout, 0 = indefinitely) |
4783 @type int | 4748 @type int |
4784 """ | 4749 """ |
4785 if cls._fromEric: | 4750 if Preferences.getUI("NotificationsEnabled"): |
4786 e5App().getObject("UserInterface").showNotification( | 4751 if cls._notification is None: |
4787 icon, heading, text, timeout) | 4752 from UI.NotificationWidget import NotificationWidget |
4788 else: | 4753 cls._notification = NotificationWidget() |
4789 if Preferences.getUI("NotificationsEnabled"): | 4754 cls._notification.setPixmap(icon) |
4790 if cls._notification is None: | 4755 cls._notification.setHeading(heading) |
4791 from UI.NotificationWidget import NotificationWidget | 4756 cls._notification.setText(text) |
4792 cls._notification = NotificationWidget() | 4757 if timeout is None: |
4793 cls._notification.setPixmap(icon) | 4758 timeout = Preferences.getUI("NotificationTimeout") |
4794 cls._notification.setHeading(heading) | 4759 cls._notification.setTimeout(timeout) |
4795 cls._notification.setText(text) | 4760 cls._notification.move( |
4796 if timeout is None: | 4761 Preferences.getUI("NotificationPosition")) |
4797 timeout = Preferences.getUI("NotificationTimeout") | 4762 cls._notification.show() |
4798 cls._notification.setTimeout(timeout) | |
4799 cls._notification.move( | |
4800 Preferences.getUI("NotificationPosition")) | |
4801 cls._notification.show() | |
4802 | 4763 |
4803 @classmethod | 4764 @classmethod |
4804 def notificationsEnabled(cls): | 4765 def notificationsEnabled(cls): |
4805 """ | 4766 """ |
4806 Class method to check, if notifications are enabled. | 4767 Class method to check, if notifications are enabled. |
4807 | 4768 |
4808 @return flag indicating, if notifications are enabled (boolean) | 4769 @return flag indicating, if notifications are enabled (boolean) |
4809 """ | 4770 """ |
4810 if cls._fromEric: | 4771 return Preferences.getUI("NotificationsEnabled") |
4811 return e5App().getObject("UserInterface").notificationsEnabled() | |
4812 else: | |
4813 return Preferences.getUI("NotificationsEnabled") | |
4814 | 4772 |
4815 ###################################### | 4773 ###################################### |
4816 ## Support for global status bar below | 4774 ## Support for global status bar below |
4817 ###################################### | 4775 ###################################### |
4818 | 4776 |
4828 @return reference to the global status bar | 4786 @return reference to the global status bar |
4829 @rtype QStatusBar | 4787 @rtype QStatusBar |
4830 """ | 4788 """ |
4831 if cls.BrowserWindows: | 4789 if cls.BrowserWindows: |
4832 return cls.BrowserWindows[0].statusBar() | 4790 return cls.BrowserWindows[0].statusBar() |
4833 elif cls._fromEric: | |
4834 return e5App().getObject("UserInterface").statusBar() | |
4835 else: | 4791 else: |
4836 return None | 4792 return None |
4837 | 4793 |
4838 ################################### | 4794 ################################### |
4839 ## Support for download files below | 4795 ## Support for download files below |
4990 def __showSafeBrowsingDialog(self): | 4946 def __showSafeBrowsingDialog(self): |
4991 """ | 4947 """ |
4992 Private slot to show the safe browsing management dialog. | 4948 Private slot to show the safe browsing management dialog. |
4993 """ | 4949 """ |
4994 self.safeBrowsingManager().showSafeBrowsingDialog() | 4950 self.safeBrowsingManager().showSafeBrowsingDialog() |
4951 | |
4952 ############################################################### | |
4953 ## Methods below implement single application related functions | |
4954 ############################################################### | |
4955 | |
4956 @pyqtSlot(str) | |
4957 def __saLoadUrl(self, urlStr): | |
4958 """ | |
4959 Private slot to load an URL received via the single application | |
4960 protocol. | |
4961 | |
4962 @param urlStr URL to be loaded | |
4963 @type str | |
4964 """ | |
4965 url = QUrl.fromUserInput(urlStr) | |
4966 self.__linkActivated(url) | |
4967 | |
4968 self.raise_() | |
4969 self.activateWindow() | |
4970 | |
4971 @pyqtSlot(str) | |
4972 def __saNewTab(self, urlStr): | |
4973 """ | |
4974 Private slot to load an URL received via the single application | |
4975 protocol in a new tab. | |
4976 | |
4977 @param urlStr URL to be loaded | |
4978 @type str | |
4979 """ | |
4980 url = QUrl.fromUserInput(urlStr) | |
4981 self.newTab(url) | |
4982 | |
4983 self.raise_() | |
4984 self.activateWindow() | |
4985 | |
4986 @pyqtSlot(str) | |
4987 def __saSearchWord(self, word): | |
4988 """ | |
4989 Private slot to search for the given word. | |
4990 | |
4991 @param word word to be searched for | |
4992 @type str | |
4993 """ | |
4994 if WebBrowserWindow._useQtHelp: | |
4995 self.__searchWord = word | |
4996 self.__searchForWord() | |
4997 | |
4998 self.raise_() | |
4999 self.activateWindow() | |
5000 | |
5001 ###################################################### | |
5002 ## Methods below implement shortcuts related functions | |
5003 ###################################################### | |
5004 | |
5005 def __configShortcuts(self): | |
5006 """ | |
5007 Private slot to configure the keyboard shortcuts. | |
5008 """ | |
5009 if self.__shortcutsDialog is None: | |
5010 from Preferences.ShortcutsDialog import ShortcutsDialog | |
5011 self.__shortcutsDialog = ShortcutsDialog(self) | |
5012 self.__shortcutsDialog.populate(helpViewer=self) | |
5013 self.__shortcutsDialog.show() | |
5014 | |
5015 def __exportShortcuts(self): | |
5016 """ | |
5017 Private slot to export the keyboard shortcuts. | |
5018 """ | |
5019 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( | |
5020 None, | |
5021 self.tr("Export Keyboard Shortcuts"), | |
5022 "", | |
5023 self.tr("Keyboard shortcut file (*.e4k)"), | |
5024 "", | |
5025 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) | |
5026 | |
5027 if not fn: | |
5028 return | |
5029 | |
5030 ext = QFileInfo(fn).suffix() | |
5031 if not ext: | |
5032 ex = selectedFilter.split("(*")[1].split(")")[0] | |
5033 if ex: | |
5034 fn += ex | |
5035 | |
5036 from Preferences import Shortcuts | |
5037 Shortcuts.exportShortcuts(fn, helpViewer=self) | |
5038 | |
5039 def __importShortcuts(self): | |
5040 """ | |
5041 Private slot to import the keyboard shortcuts. | |
5042 """ | |
5043 fn = E5FileDialog.getOpenFileName( | |
5044 None, | |
5045 self.tr("Import Keyboard Shortcuts"), | |
5046 "", | |
5047 self.tr("Keyboard shortcut file (*.e4k)")) | |
5048 | |
5049 if fn: | |
5050 from Preferences import Shortcuts | |
5051 Shortcuts.importShortcuts(fn, helpViewer=self) |