--- a/Preferences/__init__.py Thu Aug 03 14:50:59 2017 +0200 +++ b/Preferences/__init__.py Fri Sep 01 12:08:17 2017 +0200 @@ -29,7 +29,7 @@ import sys from PyQt5.QtCore import QDir, QPoint, QLocale, QSettings, QFileInfo, \ - QCoreApplication, QByteArray, QSize, QUrl, Qt, QLibraryInfo + QCoreApplication, QByteArray, QSize, QUrl, Qt, QLibraryInfo, QDateTime from PyQt5.QtGui import QColor, QFont, QPalette from PyQt5.QtWidgets import QInputDialog, QApplication from PyQt5.QtNetwork import QNetworkRequest @@ -470,6 +470,9 @@ "PreviewRestFileNameExtensions": ["rst"], "PreviewQssFileNameExtensions": ["qss"], "PreviewRestUseSphinx": False, + "PreviewMarkdownNLtoBR": True, + "PreviewMarkdownHTMLFormat": "XHTML1", # XHTML1, HTML4, HTML5 + "PreviewRestDocutilsHTMLFormat": "HTML5", # HTML4, HTML5 "VirtualSpaceOptions": QsciScintilla.SCVS_NONE, @@ -1119,6 +1122,12 @@ "SessionAutoSave": True, "SessionAutoSaveInterval": 15, # interval in seconds "SessionLastActivePath": "", + # Google Safe Browsing + "SafeBrowsingEnabled": True, + "SafeBrowsingApiKey": "", # API key + "SafeBrowsingFilterPlatform": True, + "SafeBrowsingAutoUpdate": False, + "SafeBrowsingUpdateDateTime": QDateTime(), } if QWebEngineSettings: webBrowserDefaults["HelpViewerType"] = 1 # eric browser @@ -2044,7 +2053,8 @@ """ if key in ["DefaultEncoding", "DefaultOpenFilter", "DefaultSaveFilter", "SpellCheckingDefaultLanguage", "SpellCheckingPersonalWordList", - "SpellCheckingPersonalExcludeList"]: + "SpellCheckingPersonalExcludeList", + "PreviewMarkdownHTMLFormat", "PreviewRestDocutilsHTMLFormat"]: return prefClass.settings.value( "Editor/" + key, prefClass.editorDefaults[key]) elif key in ["AutosaveInterval", "TabWidth", "IndentWidth", @@ -2919,6 +2929,8 @@ "SpellCheckEnabled", "ShowToolbars", "MenuBarVisible", "BookmarksToolBarVisible", "StatusBarVisible", "SessionAutoSave", "LoadTabOnActivation", + "SafeBrowsingEnabled", "SafeBrowsingFilterPlatform", + "SafeBrowsingAutoUpdate", ]: return toBool(prefClass.settings.value( "WebBrowser/" + key, prefClass.webBrowserDefaults[key])) @@ -2931,6 +2943,12 @@ elif key in ["AutoScrollDivider"]: return float(prefClass.settings.value( "WebBrowser/" + key, prefClass.webBrowserDefaults[key])) + elif key in ["SafeBrowsingUpdateDateTime"]: + dateTimeStr = prefClass.settings.value("WebBrowser/" + key) + if dateTimeStr is not None: + return QDateTime.fromString(dateTimeStr, Qt.ISODate) + else: + return prefClass.webBrowserDefaults[key] else: return prefClass.settings.value("WebBrowser/" + key, prefClass.webBrowserDefaults[key]) @@ -2993,6 +3011,10 @@ from Utilities.crypto import pwConvert prefClass.settings.setValue( "WebBrowser/" + key, pwConvert(value, encode=True)) + elif key in ["SafeBrowsingUpdateDateTime"]: + # value is a QDateTime + prefClass.settings.setValue("WebBrowser/" + key, + value.toString(Qt.ISODate)) else: prefClass.settings.setValue("WebBrowser/" + key, value)