351 |
352 |
352 def fromEric(self): |
353 def fromEric(self): |
353 """ |
354 """ |
354 Public method to check, if the web browser was called from within the |
355 Public method to check, if the web browser was called from within the |
355 eric IDE. |
356 eric IDE. |
|
357 |
|
358 @return flag indicating that the browserw as opened from within eric |
|
359 @rtype bool |
356 """ |
360 """ |
357 return self.__fromEric |
361 return self.__fromEric |
358 |
362 |
359 ## def __setIconDatabasePath(self, enable=True): |
363 def __setIconDatabasePath(self, enable=True): |
360 ## """ |
364 """ |
361 ## Private method to set the favicons path. |
365 Private method to set the favicons path. |
362 ## |
366 |
363 ## @param enable flag indicating to enabled icon storage (boolean) |
367 @param enable flag indicating to enabled icon storage (boolean) |
364 ## """ |
368 """ |
365 ## if enable: |
369 if enable: |
366 ## iconDatabasePath = os.path.join(Utilities.getConfigDir(), |
370 iconDatabasePath = os.path.join(Utilities.getConfigDir(), |
367 ## "browser", "favicons") |
371 "web_browser", "favicons") |
368 ## if not os.path.exists(iconDatabasePath): |
372 if not os.path.exists(iconDatabasePath): |
369 ## os.makedirs(iconDatabasePath) |
373 os.makedirs(iconDatabasePath) |
370 ## else: |
374 else: |
371 ## iconDatabasePath = "" # setting an empty path disables it |
375 iconDatabasePath = "" # setting an empty path disables it |
372 ## QWebSettings.setIconDatabasePath(iconDatabasePath) |
376 |
373 ## |
377 WebIconProvider.instance().setIconDatabasePath(iconDatabasePath) |
|
378 |
374 def __initWebEngineSettings(self): |
379 def __initWebEngineSettings(self): |
375 """ |
380 """ |
376 Private method to set the global web settings. |
381 Private method to set the global web settings. |
377 """ |
382 """ |
378 standardFont = Preferences.getWebBrowser("StandardFont") |
383 standardFont = Preferences.getWebBrowser("StandardFont") |
394 Preferences.getWebBrowser("MinimumFontSize")) |
399 Preferences.getWebBrowser("MinimumFontSize")) |
395 settings.setFontSize( |
400 settings.setFontSize( |
396 QWebEngineSettings.MinimumLogicalFontSize, |
401 QWebEngineSettings.MinimumLogicalFontSize, |
397 Preferences.getWebBrowser("MinimumLogicalFontSize")) |
402 Preferences.getWebBrowser("MinimumLogicalFontSize")) |
398 |
403 |
399 styleSheet = Preferences.getHelp("UserStyleSheet") |
404 styleSheet = Preferences.getWebBrowser("UserStyleSheet") |
400 self.__setUserStyleSheet(styleSheet) |
405 self.__setUserStyleSheet(styleSheet) |
401 |
406 |
402 settings.setAttribute( |
407 settings.setAttribute( |
403 QWebEngineSettings.AutoLoadImages, |
408 QWebEngineSettings.AutoLoadImages, |
404 Preferences.getWebBrowser("AutoLoadImages")) |
409 Preferences.getWebBrowser("AutoLoadImages")) |
405 ## settings.setAttribute( |
410 ## settings.setAttribute( |
406 ## QWebSettings.JavaEnabled, |
411 ## QWebSettings.JavaEnabled, |
407 ## Preferences.getHelp("JavaEnabled")) |
412 ## Preferences.getWebBrowser("JavaEnabled")) |
408 settings.setAttribute( |
413 settings.setAttribute( |
409 QWebEngineSettings.JavascriptEnabled, |
414 QWebEngineSettings.JavascriptEnabled, |
410 Preferences.getWebBrowser("JavaScriptEnabled")) |
415 Preferences.getWebBrowser("JavaScriptEnabled")) |
411 settings.setAttribute( |
416 settings.setAttribute( |
412 QWebEngineSettings.JavascriptCanOpenWindows, |
417 QWebEngineSettings.JavascriptCanOpenWindows, |
414 settings.setAttribute( |
419 settings.setAttribute( |
415 QWebEngineSettings.JavascriptCanAccessClipboard, |
420 QWebEngineSettings.JavascriptCanAccessClipboard, |
416 Preferences.getWebBrowser("JavaScriptCanAccessClipboard")) |
421 Preferences.getWebBrowser("JavaScriptCanAccessClipboard")) |
417 ## settings.setAttribute( |
422 ## settings.setAttribute( |
418 ## QWebSettings.PluginsEnabled, |
423 ## QWebSettings.PluginsEnabled, |
419 ## Preferences.getHelp("PluginsEnabled")) |
424 ## Preferences.getWebBrowser("PluginsEnabled")) |
420 |
425 |
421 ## if hasattr(QWebSettings, "PrintElementBackgrounds"): |
426 ## if hasattr(QWebSettings, "PrintElementBackgrounds"): |
422 ## settings.setAttribute( |
427 ## settings.setAttribute( |
423 ## QWebSettings.PrintElementBackgrounds, |
428 ## QWebSettings.PrintElementBackgrounds, |
424 ## Preferences.getHelp("PrintBackgrounds")) |
429 ## Preferences.getWebBrowser("PrintBackgrounds")) |
425 ## |
430 ## |
426 ## if hasattr(QWebSettings, "setOfflineStoragePath"): |
431 ## if hasattr(QWebSettings, "setOfflineStoragePath"): |
427 ## settings.setAttribute( |
432 ## settings.setAttribute( |
428 ## QWebSettings.OfflineStorageDatabaseEnabled, |
433 ## QWebSettings.OfflineStorageDatabaseEnabled, |
429 ## Preferences.getHelp("OfflineStorageDatabaseEnabled")) |
434 ## Preferences.getWebBrowser("OfflineStorageDatabaseEnabled")) |
430 ## webDatabaseDir = os.path.join( |
435 ## webDatabaseDir = os.path.join( |
431 ## Utilities.getConfigDir(), "browser", "webdatabases") |
436 ## Utilities.getConfigDir(), "web_browser", "webdatabases") |
432 ## if not os.path.exists(webDatabaseDir): |
437 ## if not os.path.exists(webDatabaseDir): |
433 ## os.makedirs(webDatabaseDir) |
438 ## os.makedirs(webDatabaseDir) |
434 ## settings.setOfflineStoragePath(webDatabaseDir) |
439 ## settings.setOfflineStoragePath(webDatabaseDir) |
435 ## settings.setOfflineStorageDefaultQuota( |
440 ## settings.setOfflineStorageDefaultQuota( |
436 ## Preferences.getHelp("OfflineStorageDatabaseQuota") * |
441 ## Preferences.getWebBrowser("OfflineStorageDatabaseQuota") * |
437 ## 1024 * 1024) |
442 ## 1024 * 1024) |
438 ## |
443 ## |
439 ## if hasattr(QWebSettings, "OfflineWebApplicationCacheEnabled"): |
444 ## if hasattr(QWebSettings, "OfflineWebApplicationCacheEnabled"): |
440 ## settings.setAttribute( |
445 ## settings.setAttribute( |
441 ## QWebSettings.OfflineWebApplicationCacheEnabled, |
446 ## QWebSettings.OfflineWebApplicationCacheEnabled, |
442 ## Preferences.getHelp("OfflineWebApplicationCacheEnabled")) |
447 ## Preferences.getWebBrowser("OfflineWebApplicationCacheEnabled")) |
443 ## appCacheDir = os.path.join( |
448 ## appCacheDir = os.path.join( |
444 ## Utilities.getConfigDir(), "browser", "webappcaches") |
449 ## Utilities.getConfigDir(), "web_browser", "webappcaches") |
445 ## if not os.path.exists(appCacheDir): |
450 ## if not os.path.exists(appCacheDir): |
446 ## os.makedirs(appCacheDir) |
451 ## os.makedirs(appCacheDir) |
447 ## settings.setOfflineWebApplicationCachePath(appCacheDir) |
452 ## settings.setOfflineWebApplicationCachePath(appCacheDir) |
448 ## settings.setOfflineWebApplicationCacheQuota( |
453 ## settings.setOfflineWebApplicationCacheQuota( |
449 ## Preferences.getHelp("OfflineWebApplicationCacheQuota") * |
454 ## Preferences.getWebBrowser("OfflineWebApplicationCacheQuota") * |
450 ## 1024 * 1024) |
455 ## 1024 * 1024) |
451 ## |
456 ## |
452 if self.isPrivate(): |
457 if self.isPrivate(): |
453 settings.setAttribute( |
458 settings.setAttribute( |
454 QWebEngineSettings.LocalStorageEnabled, False) |
459 QWebEngineSettings.LocalStorageEnabled, False) |
455 else: |
460 else: |
456 settings.setAttribute( |
461 settings.setAttribute( |
457 QWebEngineSettings.LocalStorageEnabled, |
462 QWebEngineSettings.LocalStorageEnabled, |
458 Preferences.getWebBrowser("LocalStorageEnabled")) |
463 Preferences.getWebBrowser("LocalStorageEnabled")) |
459 ## localStorageDir = os.path.join( |
464 ## localStorageDir = os.path.join( |
460 ## Utilities.getConfigDir(), "browser", "weblocalstorage") |
465 ## Utilities.getConfigDir(), "web_browser", "weblocalstorage") |
461 ## if not os.path.exists(localStorageDir): |
466 ## if not os.path.exists(localStorageDir): |
462 ## os.makedirs(localStorageDir) |
467 ## os.makedirs(localStorageDir) |
463 ## settings.setLocalStoragePath(localStorageDir) |
468 ## settings.setLocalStoragePath(localStorageDir) |
464 ## |
469 ## |
465 ## if hasattr(QWebSettings, "DnsPrefetchEnabled"): |
470 ## if hasattr(QWebSettings, "DnsPrefetchEnabled"): |
466 ## settings.setAttribute( |
471 ## settings.setAttribute( |
467 ## QWebSettings.DnsPrefetchEnabled, |
472 ## QWebSettings.DnsPrefetchEnabled, |
468 ## Preferences.getHelp("DnsPrefetchEnabled")) |
473 ## Preferences.getWebBrowser("DnsPrefetchEnabled")) |
469 ## |
474 ## |
470 settings.setDefaultTextEncoding( |
475 settings.setDefaultTextEncoding( |
471 Preferences.getWebBrowser("DefaultTextEncoding")) |
476 Preferences.getWebBrowser("DefaultTextEncoding")) |
472 |
477 |
473 settings.setAttribute( |
478 settings.setAttribute( |
486 QWebEngineSettings.XSSAuditingEnabled, |
491 QWebEngineSettings.XSSAuditingEnabled, |
487 Preferences.getWebBrowser("XSSAuditingEnabled")) |
492 Preferences.getWebBrowser("XSSAuditingEnabled")) |
488 ## if hasattr(QWebSettings, "SiteSpecificQuirksEnabled"): |
493 ## if hasattr(QWebSettings, "SiteSpecificQuirksEnabled"): |
489 ## settings.setAttribute( |
494 ## settings.setAttribute( |
490 ## QWebSettings.SiteSpecificQuirksEnabled, |
495 ## QWebSettings.SiteSpecificQuirksEnabled, |
491 ## Preferences.getHelp("SiteSpecificQuirksEnabled")) |
496 ## Preferences.getWebBrowser("SiteSpecificQuirksEnabled")) |
492 ## |
497 ## |
493 ## QWebSecurityOrigin.addLocalScheme("eric") |
498 ## QWebSecurityOrigin.addLocalScheme("eric") |
494 settings.setAttribute( |
499 settings.setAttribute( |
495 QWebEngineSettings.ScrollAnimatorEnabled, |
500 QWebEngineSettings.ScrollAnimatorEnabled, |
496 Preferences.getWebBrowser("ScrollAnimatorEnabled")) |
501 Preferences.getWebBrowser("ScrollAnimatorEnabled")) |
1637 ## if not self.__initShortcutsOnly: |
1642 ## if not self.__initShortcutsOnly: |
1638 ## self.synchronizationAct.triggered.connect( |
1643 ## self.synchronizationAct.triggered.connect( |
1639 ## self.__showSyncDialog) |
1644 ## self.__showSyncDialog) |
1640 ## self.__actions.append(self.synchronizationAct) |
1645 ## self.__actions.append(self.synchronizationAct) |
1641 |
1646 |
1642 # TODO: Zoom Manager |
1647 self.zoomValuesAct = E5Action( |
1643 ## self.zoomValuesAct = E5Action( |
1648 self.tr('Manage Saved Zoom Values'), |
1644 ## self.tr('Manage Saved Zoom Values'), |
1649 UI.PixmapCache.getIcon("zoomReset.png"), |
1645 ## UI.PixmapCache.getIcon("zoomReset.png"), |
1650 self.tr('Manage Saved Zoom Values...'), |
1646 ## self.tr('Manage Saved Zoom Values...'), |
1651 0, 0, |
1647 ## 0, 0, |
1652 self, 'webbrowser_manage_zoom_values') |
1648 ## self, 'webbrowser_manage_zoom_values') |
1653 self.zoomValuesAct.setStatusTip(self.tr( |
1649 ## self.zoomValuesAct.setStatusTip(self.tr( |
1654 'Manage the saved zoom values')) |
1650 ## 'Manage the saved zoom values')) |
1655 self.zoomValuesAct.setWhatsThis(self.tr( |
1651 ## self.zoomValuesAct.setWhatsThis(self.tr( |
1656 """<b>Manage Saved Zoom Values...</b>""" |
1652 ## """<b>Manage Saved Zoom Values...</b>""" |
1657 """<p>Opens a dialog to manage the saved zoom values.</p>""" |
1653 ## """<p>Opens a dialog to manage the saved zoom values.</p>""" |
1658 )) |
1654 ## )) |
1659 if not self.__initShortcutsOnly: |
1655 ## if not self.__initShortcutsOnly: |
1660 self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog) |
1656 ## self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog) |
1661 self.__actions.append(self.zoomValuesAct) |
1657 ## self.__actions.append(self.zoomValuesAct) |
|
1658 |
1662 |
1659 self.backAct.setEnabled(False) |
1663 self.backAct.setEnabled(False) |
1660 self.forwardAct.setEnabled(False) |
1664 self.forwardAct.setEnabled(False) |
1661 |
1665 |
1662 # now read the keyboard shortcuts for the actions |
1666 # now read the keyboard shortcuts for the actions |
|
1667 # TODO: change this to webBrowser |
1663 Shortcuts.readShortcuts(helpViewer=self) |
1668 Shortcuts.readShortcuts(helpViewer=self) |
1664 |
1669 |
1665 def getActions(self): |
1670 def getActions(self): |
1666 """ |
1671 """ |
1667 Public method to get a list of all actions. |
1672 Public method to get a list of all actions. |
1989 ## self.__virusTotalIpAddressReport) |
1994 ## self.__virusTotalIpAddressReport) |
1990 ## self.virustotalDomainReportAct = vttb.addAction( |
1995 ## self.virustotalDomainReportAct = vttb.addAction( |
1991 ## UI.PixmapCache.getIcon("virustotal.png"), |
1996 ## UI.PixmapCache.getIcon("virustotal.png"), |
1992 ## self.tr("Domain Report"), |
1997 ## self.tr("Domain Report"), |
1993 ## self.__virusTotalDomainReport) |
1998 ## self.__virusTotalDomainReport) |
1994 ## if not Preferences.getHelp("VirusTotalEnabled") or \ |
1999 ## if not Preferences.getWebBrowser("VirusTotalEnabled") or \ |
1995 ## Preferences.getHelp("VirusTotalServiceKey") == "": |
2000 ## Preferences.getWebBrowser("VirusTotalServiceKey") == "": |
1996 ## self.virustotalScanCurrentAct.setEnabled(False) |
2001 ## self.virustotalScanCurrentAct.setEnabled(False) |
1997 ## self.virustotalIpReportAct.setEnabled(False) |
2002 ## self.virustotalIpReportAct.setEnabled(False) |
1998 ## self.virustotalDomainReportAct.setEnabled(False) |
2003 ## self.virustotalDomainReportAct.setEnabled(False) |
1999 |
2004 |
2000 def __nextTab(self): |
2005 def __nextTab(self): |