eric6/Preferences/__init__.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7214
f434af227a41
parent 7281
8087ef6df2e4
child 7322
cd8ee889589f
--- a/eric6/Preferences/__init__.py	Mon Sep 09 18:52:08 2019 +0200
+++ b/eric6/Preferences/__init__.py	Thu Oct 03 11:12:10 2019 +0200
@@ -16,11 +16,6 @@
 'from Preferences import *' to import it.
 """
 
-from __future__ import unicode_literals
-try:
-    basestring    # __IGNORE_WARNING__
-except NameError:
-    basestring = str
 
 import os
 import fnmatch
@@ -28,15 +23,12 @@
 import json
 import sys
 
-from PyQt5.QtCore import QDir, QPoint, QLocale, QSettings, QFileInfo, \
-    QCoreApplication, QByteArray, QSize, QUrl, Qt, QLibraryInfo, QDateTime
+from PyQt5.QtCore import (
+    QDir, QPoint, QLocale, QSettings, QFileInfo, QCoreApplication, QByteArray,
+    QSize, QUrl, Qt, QLibraryInfo, QDateTime
+)
 from PyQt5.QtGui import QColor, QFont, QPalette
 from PyQt5.QtWidgets import QApplication
-from PyQt5.QtNetwork import QNetworkRequest
-try:
-    from PyQt5.QtWebKit import QWebSettings
-except ImportError:
-    QWebSettings = None
 try:
     from PyQt5.QtWebEngineWidgets import QWebEngineSettings
 except ImportError:
@@ -49,16 +41,15 @@
 
 import Globals
 
-from Project.ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \
-    ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \
-    OthersBrowserFlag, ProtocolsBrowserFlag, AllBrowsersFlag
+from Project.ProjectBrowserFlags import (
+    SourcesBrowserFlag, FormsBrowserFlag, ResourcesBrowserFlag,
+    TranslationsBrowserFlag, InterfacesBrowserFlag, OthersBrowserFlag,
+    ProtocolsBrowserFlag, AllBrowsersFlag
+)
 
-try:
-    from Helpviewer.FlashCookieManager.FlashCookieUtilities import \
-        flashDataPathForOS
-except ImportError:
-    from WebBrowser.FlashCookieManager.FlashCookieUtilities import \
-        flashDataPathForOS
+from WebBrowser.FlashCookieManager.FlashCookieUtilities import (
+    flashDataPathForOS
+)
 
 from QScintilla.Shell import ShellHistoryStyle
 
@@ -116,18 +107,12 @@
         "MaxVariableSize": 0,     # Bytes, 0 = no limit
         "BgColorNew": QColor("#28FFEEAA"),
         "BgColorChanged": QColor("#2870FF66"),
-    }
-    debuggerDefaults["AllowedHosts"] = ["127.0.0.1", "::1%0"]
-    if sys.version_info[0] == 2:
+        "AllowedHosts": ["127.0.0.1", "::1%0"],
         # space separated list of Python2 extensions
-        debuggerDefaults["PythonExtensions"] = ".py .pyw .py2 .pyw2 .ptl"
+        "PythonExtensions": ".py2 .pyw2 .ptl",
         # space separated list of Python3 extensions
-        debuggerDefaults["Python3Extensions"] = ".py3 .pyw3"
-    else:
-        # space separated list of Python2 extensions
-        debuggerDefaults["PythonExtensions"] = ".py2 .pyw2 .ptl"
-        # space separated list of Python3 extensions
-        debuggerDefaults["Python3Extensions"] = ".py .pyw .py3 .pyw3"
+        "Python3Extensions": ".py .pyw .py3 .pyw3"
+    }
     
     # defaults for the UI settings
     uiDefaults = {
@@ -378,6 +363,7 @@
         "AutosaveInterval": 0,
         "TabWidth": 4,
         "IndentWidth": 4,
+        "TabIndentOverride": "{}",      # JSON formatted dictionary
         "IndentationGuides": True,
         "LinenoMargin": True,
         "FoldingMargin": True,
@@ -712,6 +698,17 @@
         "Ruby/InsertBlank": True,
         "Ruby/InsertHereDoc": True,
         "Ruby/InsertInlineDoc": True,
+        
+        "Yaml/EnabledTypingAids": True,
+        "Yaml/InsertClosingBrace": True,
+        "Yaml/SkipBrace": True,
+        "Yaml/InsertQuote": True,
+        "Yaml/AutoIndentation": True,
+        "Yaml/ColonDetection": True,
+        "Yaml/InsertBlankDash": True,
+        "Yaml/InsertBlankColon": True,
+        "Yaml/InsertBlankQuestion": True,
+        "Yaml/InsertBlankComma": True,
     }
     
     editorExporterDefaults = {
@@ -794,6 +791,7 @@
     
     # defaults for the project browser flags settings
     projectBrowserFlagsDefaults = {
+        # deprecated
         "Qt4": (
             SourcesBrowserFlag |
             FormsBrowserFlag |
@@ -802,6 +800,7 @@
             InterfacesBrowserFlag |
             OthersBrowserFlag |
             ProtocolsBrowserFlag),
+        # deprecated
         "Qt4C": (
             SourcesBrowserFlag |
             ResourcesBrowserFlag |
@@ -891,7 +890,6 @@
         "CustomViewer": "",
         "PythonDocDir": "",
         "Python2DocDir": "",
-        "QtDocDir": "",
         "Qt4DocDir": "",
         "Qt5DocDir": "",
         "PyQt4DocDir": "",
@@ -899,186 +897,7 @@
         "PySideDocDir": "",
         "PySide2DocDir": "",
         "EricDocDir": "",
-        "SingleHelpWindow": True,
-        "SaveGeometry": True,
-        "HelpViewerState": QByteArray(),
-        "WebSearchSuggestions": True,
-        "WebSearchEngine": "Google",
-        "WebSearchKeywords": [],    # array of two tuples (keyword,
-                                    # search engine name)
-        "DiskCacheEnabled": True,
-        "DiskCacheSize": 50,        # 50 MB
-        "CachePolicy": QNetworkRequest.PreferNetwork,
-        "AcceptCookies": 2,         # CookieJar.AcceptOnlyFromSitesNavigatedTo
-        "KeepCookiesUntil": 0,      # CookieJar.KeepUntilExpire
-        "FilterTrackingCookies": True,
-        "PrintBackgrounds": False,
-        "StartupBehavior": 1,      # show speed dial
-        "HomePage": "eric:home",
-        "HistoryLimit": 30,
-        "DefaultScheme": "https://",
-        "OfflineStorageDatabaseQuota": 50,     # 50 MB
-        "UserAgent": "",
-        "ShowPreview": True,
-        "DownloadManagerRemovePolicy": 0,      # never delete downloads
-        "DownloadManagerSize": QSize(400, 300),
-        "DownloadManagerPosition": QPoint(),
-        "DownloadManagerDownloads": [],
-        "AccessKeysEnabled": True,
-        "SearchLanguage": QLocale().language(),
-        "DoNotTrack": False,
-        "SendReferer": True,
-        "SendRefererWhitelist": ["qt-apps.org", "kde-apps.org"],
-        "NoCacheHosts": ["qt-project.org"],
-        "RssFeeds": [],
-        "WarnOnMultipleClose": True,
-        "ZoomValuesDB": "{}",       # empty JSON dictionary
-        # VirusTotal
-        "VirusTotalEnabled": False,
-        "VirusTotalServiceKey": "",
-        "VirusTotalSecure": True,
-        # AdBlock
-        "AdBlockEnabled": False,
-        "AdBlockSubscriptions": [],
-        "AdBlockUpdatePeriod": 1,
-        "AdBlockExceptions": [],
-        # Sync
-        "SyncEnabled": False,
-        "SyncBookmarks": True,
-        "SyncHistory": True,
-        "SyncPasswords": False,
-        "SyncUserAgents": True,
-        "SyncSpeedDial": True,
-        "SyncEncryptData": False,
-        "SyncEncryptionKey": "",
-        "SyncEncryptionKeyLength": 32,      # 16, 24 or 32
-        "SyncEncryptPasswordsOnly": False,
-        "SyncType": 0,
-        "SyncFtpServer": "",
-        "SyncFtpUser": "",
-        "SyncFtpPassword": "",
-        "SyncFtpPath": "",
-        "SyncFtpPort": 21,
-        "SyncFtpIdleTimeout": 30,
-        "SyncDirectoryPath": "",
-        # Click-to-Flash
-        "ClickToFlashEnabled": False,
-        "ClickToFlashWhitelist": [],
-        # PIM
-        "PimFullName": "",
-        "PimFirstName": "",
-        "PimLastName": "",
-        "PimEmail": "",
-        "PimPhone": "",
-        "PimMobile": "",
-        "PimAddress": "",
-        "PimCity": "",
-        "PimZip": "",
-        "PimState": "",
-        "PimCountry": "",
-        "PimHomePage": "",
-        "PimSpecial1": "",
-        "PimSpecial2": "",
-        "PimSpecial3": "",
-        "PimSpecial4": "",
-        # Grease Monkey
-        "GreaseMonkeyDisabledScripts": [],
-        # Flash Cookie Manager
-        "FlashCookiesDeleteOnStartExit": False,
-        "FlashCookieAutoRefresh": False,
-        "FlashCookieNotify": False,
-        "FlashCookiesWhitelist": [],
-        "FlashCookiesBlacklist": [],
-        "FlashCookiesDataPath": flashDataPathForOS(),
     }
-    if QWebSettings:
-        helpDefaults["HelpViewerType"] = 1      # eric browser
-    else:
-        helpDefaults["HelpViewerType"] = 2      # Qt Assistant
-    
-    @classmethod
-    def initWebSettingsDefaults(cls):
-        """
-        Class method to initialize the web settings related defaults.
-        """
-        if QWebSettings is None:
-            return
-        
-        websettings = QWebSettings.globalSettings()
-        fontFamily = websettings.fontFamily(QWebSettings.StandardFont)
-        fontSize = websettings.fontSize(QWebSettings.DefaultFontSize)
-        cls.helpDefaults["StandardFont"] = \
-            QFont(fontFamily, fontSize).toString()
-        fontFamily = websettings.fontFamily(QWebSettings.FixedFont)
-        fontSize = websettings.fontSize(QWebSettings.DefaultFixedFontSize)
-        cls.helpDefaults["FixedFont"] = QFont(fontFamily, fontSize).toString()
-        cls.helpDefaults.update({
-            "AutoLoadImages":
-            websettings.testAttribute(QWebSettings.AutoLoadImages),
-            "UserStyleSheet": "",
-            "SaveUrlColor": QColor(248, 248, 210),
-            "JavaEnabled":
-            websettings.testAttribute(QWebSettings.JavaEnabled),
-            "JavaScriptEnabled":
-            websettings.testAttribute(QWebSettings.JavascriptEnabled),
-            "JavaScriptCanOpenWindows":
-            websettings.testAttribute(
-                QWebSettings.JavascriptCanOpenWindows),
-            "JavaScriptCanCloseWindows":
-            websettings.testAttribute(
-                QWebSettings.JavascriptCanCloseWindows),
-            "JavaScriptCanAccessClipboard":
-            websettings.testAttribute(
-                QWebSettings.JavascriptCanAccessClipboard),
-            "PluginsEnabled":
-            websettings.testAttribute(QWebSettings.PluginsEnabled),
-            "OfflineStorageDatabaseEnabled":
-            websettings.testAttribute(
-                QWebSettings.OfflineStorageDatabaseEnabled),
-        })
-        if hasattr(QWebSettings, "OfflineWebApplicationCacheEnabled"):
-            cls.helpDefaults.update({
-                "OfflineWebApplicationCacheEnabled":
-                websettings.testAttribute(
-                    QWebSettings.OfflineWebApplicationCacheEnabled),
-                "OfflineWebApplicationCacheQuota": 50,     # 50 MB
-            })
-        if hasattr(QWebSettings, "LocalStorageEnabled"):
-            cls.helpDefaults["LocalStorageEnabled"] = \
-                websettings.testAttribute(QWebSettings.LocalStorageEnabled)
-        if hasattr(QWebSettings, "DnsPrefetchEnabled"):
-            cls.helpDefaults["DnsPrefetchEnabled"] = \
-                websettings.testAttribute(QWebSettings.DnsPrefetchEnabled)
-        if hasattr(QWebSettings, "defaultTextEncoding"):
-            cls.helpDefaults["DefaultTextEncoding"] = \
-                websettings.defaultTextEncoding()
-        if hasattr(QWebSettings, "SpatialNavigationEnabled"):
-            cls.helpDefaults["SpatialNavigationEnabled"] = \
-                websettings.testAttribute(
-                    QWebSettings.SpatialNavigationEnabled)
-        if hasattr(QWebSettings, "LinksIncludedInFocusChain"):
-            cls.helpDefaults["LinksIncludedInFocusChain"] = \
-                websettings.testAttribute(
-                    QWebSettings.LinksIncludedInFocusChain)
-        if hasattr(QWebSettings, "LocalContentCanAccessRemoteUrls"):
-            cls.helpDefaults["LocalContentCanAccessRemoteUrls"] = \
-                websettings.testAttribute(
-                    QWebSettings.LocalContentCanAccessRemoteUrls)
-        if hasattr(QWebSettings, "LocalContentCanAccessFileUrls"):
-            cls.helpDefaults["LocalContentCanAccessFileUrls"] = \
-                websettings.testAttribute(
-                    QWebSettings.LocalContentCanAccessFileUrls)
-        if hasattr(QWebSettings, "XSSAuditingEnabled"):
-            cls.helpDefaults["XSSAuditingEnabled"] = \
-                websettings.testAttribute(QWebSettings.XSSAuditingEnabled)
-        if hasattr(QWebSettings, "SiteSpecificQuirksEnabled"):
-            cls.helpDefaults["SiteSpecificQuirksEnabled"] = \
-                websettings.testAttribute(
-                    QWebSettings.SiteSpecificQuirksEnabled)
-        
-        cls.webSettingsIntitialized = True
-    
-    webSettingsIntitialized = False
     
     # defaults for the web browser settings
     webBrowserDefaults = {
@@ -1149,8 +968,8 @@
         "SpellCheckEnabled": False,
         "SpellCheckLanguages": [],
         "SpellCheckDictionariesUrl":
-        "https://eric-ide.python-projects.org/qwebengine_dictionaries/" \
-        "dictionaries.xml",
+        ("https://eric-ide.python-projects.org/qwebengine_dictionaries/"
+         "dictionaries.xml"),
         # Sync
         "SyncEnabled": False,
         "SyncBookmarks": True,
@@ -1176,9 +995,34 @@
         "AdBlockUpdatePeriod": 1,
         "AdBlockExceptions": [],
         "AdBlockUseLimitedEasyList": True,
-        # Flash Cookie Manager: identical to helpDefaults
+        # Flash Cookie Manager
+        "FlashCookiesDeleteOnStartExit": False,
+        "FlashCookieAutoRefresh": False,
+        "FlashCookieNotify": False,
+        "FlashCookiesWhitelist": [],
+        "FlashCookiesBlacklist": [],
+        "FlashCookiesDataPath": flashDataPathForOS(),
         # PIM:                  identical to helpDefaults
-        # VirusTotal:           identical to helpDefaults
+        "PimFullName": "",
+        "PimFirstName": "",
+        "PimLastName": "",
+        "PimEmail": "",
+        "PimPhone": "",
+        "PimMobile": "",
+        "PimAddress": "",
+        "PimCity": "",
+        "PimZip": "",
+        "PimState": "",
+        "PimCountry": "",
+        "PimHomePage": "",
+        "PimSpecial1": "",
+        "PimSpecial2": "",
+        "PimSpecial3": "",
+        "PimSpecial4": "",
+        # VirusTotal:
+        "VirusTotalEnabled": False,
+        "VirusTotalServiceKey": "",
+        "VirusTotalSecure": True,
         # Sessions
         "SessionAutoSave": True,
         "SessionAutoSaveInterval": 15,  # interval in seconds
@@ -1359,11 +1203,10 @@
 
     # defaults for Qt related stuff
     qtDefaults = {
-        "Qt4TranslationsDir": "",
         "Qt5TranslationsDir": "",
         "QtToolsDir": "",
-        "QtToolsPrefix4": "",
-        "QtToolsPostfix4": "",
+        "QtToolsPrefix": "",
+        "QtToolsPostfix": "",
         "PyuicIndent": 4,
         "PyuicFromImports": False,
         "PyQtToolsDir": "",
@@ -2210,6 +2053,13 @@
         elif value in ["false", "False"]:
             value = 0
         return QsciLexerPython.IndentationWarning(int(value))
+    elif key == "TabIndentOverride":
+        overrideStr = prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
+        if overrideStr:
+            return json.loads(overrideStr)
+        else:
+            return {}
     else:
         return toBool(prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key]))
@@ -2223,7 +2073,10 @@
     @param value the value to be set
     @param prefClass preferences class used as the storage area
     """
-    prefClass.settings.setValue("Editor/" + key, value)
+    if key == "TabIndentOverride":
+        prefClass.settings.setValue("Editor/" + key, json.dumps(value))
+    else:
+        prefClass.settings.setValue("Editor/" + key, value)
     
 
 def getEditorColour(key, prefClass=Prefs):
@@ -2754,7 +2607,7 @@
     Module function to retrieve the Qt5DocDir setting.
     
     @param prefClass preferences class used as the storage area
-    @return the requested Qt4DocDir setting (string)
+    @return the requested Qt5DocDir setting (string)
     """
     s = prefClass.settings.value(
         "Help/Qt5DocDir", prefClass.helpDefaults["Qt5DocDir"])
@@ -2774,124 +2627,9 @@
     @param prefClass preferences class used as the storage area
     @return the requested help setting
     """
-    if not prefClass.webSettingsIntitialized:
-        prefClass.initWebSettingsDefaults()
-    
-    if key in ["StandardFont", "FixedFont"]:
-        f = QFont()
-        f.fromString(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]))
-        return f
-    elif key in ["SaveUrlColor"]:
-        col = prefClass.settings.value("Help/" + key)
-        if col is not None:
-            return QColor(col)
-        else:
-            return prefClass.helpDefaults[key]
-    elif key in ["WebSearchKeywords"]:
-        # return a list of tuples of (keyword, engine name)
-        keywords = []
-        size = prefClass.settings.beginReadArray("Help/" + key)
-        for index in range(size):
-            prefClass.settings.setArrayIndex(index)
-            keyword = prefClass.settings.value("Keyword")
-            engineName = prefClass.settings.value("Engine")
-            keywords.append((keyword, engineName))
-        prefClass.settings.endArray()
-        return keywords
-    elif key == "DownloadManagerDownloads":
-        # return a list of tuples of (URL, save location, done flag, page url,
-        # date/time downloaded)
-        downloads = []
-        length = prefClass.settings.beginReadArray("Help/" + key)
-        for index in range(length):
-            prefClass.settings.setArrayIndex(index)
-            url = prefClass.settings.value("URL")
-            if url is None:
-                url = QUrl()
-            location = prefClass.settings.value("Location")
-            done = toBool(prefClass.settings.value("Done"))
-            pageUrl = prefClass.settings.value("PageURL")
-            if pageUrl is None:
-                pageUrl = QUrl()
-            downloaded = prefClass.settings.value("Downloaded")
-            if downloaded is None:
-                downloaded = QDateTime()
-            else:
-                downloaded = QDateTime.fromString(
-                    downloaded, "yyyy-MM-dd hh:mm:ss")
-            downloads.append((url, location, done, pageUrl, downloaded))
-        prefClass.settings.endArray()
-        return downloads
-    elif key == "RssFeeds":
-        # return a list of tuples of (URL, title, icon)
-        feeds = []
-        length = prefClass.settings.beginReadArray("Help/" + key)
-        for index in range(length):
-            prefClass.settings.setArrayIndex(index)
-            url = prefClass.settings.value("URL")
-            title = prefClass.settings.value("Title")
-            icon = prefClass.settings.value("Icon")
-            feeds.append((url, title, icon))
-        prefClass.settings.endArray()
-        return feeds
-    elif key in ["SyncFtpPassword", "SyncEncryptionKey"]:
-        from Utilities.crypto import pwConvert
-        return pwConvert(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]), encode=False)
-    elif key == "HelpViewerType":
-        # special treatment to adjust for missing QtWebKit if eric web browser
-        # was selected
-        value = int(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]))
-        if value == 1 and QWebSettings is None:
-            value = prefClass.helpDefaults[key]
-        return value
-    elif key in ["DiskCacheSize", "AcceptCookies",
-                 "KeepCookiesUntil", "StartupBehavior", "HistoryLimit",
-                 "OfflineStorageDatabaseQuota",
-                 "OfflineWebApplicationCacheQuota", "CachePolicy",
-                 "DownloadManagerRemovePolicy", "AdBlockUpdatePeriod",
-                 "SearchLanguage", "SyncType", "SyncFtpPort",
-                 "SyncFtpIdleTimeout", "SyncEncryptionKeyLength",
-                 ]:
-        return int(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]))
-    elif key in ["SingleHelpWindow", "SaveGeometry", "WebSearchSuggestions",
-                 "DiskCacheEnabled", "FilterTrackingCookies",
-                 "PrintBackgrounds", "AdBlockEnabled", "AutoLoadImages",
-                 "JavaEnabled", "JavaScriptEnabled",
-                 "JavaScriptCanOpenWindows", "JavaScriptCanCloseWindows",
-                 "JavaScriptCanAccessClipboard",
-                 "PluginsEnabled", "DnsPrefetchEnabled",
-                 "OfflineStorageDatabaseEnabled",
-                 "OfflineWebApplicationCacheEnabled", "LocalStorageEnabled",
-                 "ShowPreview", "AccessKeysEnabled", "VirusTotalEnabled",
-                 "VirusTotalSecure", "DoNotTrack", "SendReferer",
-                 "SpatialNavigationEnabled", "LinksIncludedInFocusChain",
-                 "LocalContentCanAccessRemoteUrls",
-                 "LocalContentCanAccessFileUrls", "XSSAuditingEnabled",
-                 "SiteSpecificQuirksEnabled", "SyncEnabled", "SyncBookmarks",
-                 "SyncHistory", "SyncPasswords", "SyncUserAgents",
-                 "SyncSpeedDial", "SyncEncryptData",
-                 "SyncEncryptPasswordsOnly",
-                 "WarnOnMultipleClose", "ClickToFlashEnabled",
-                 "FlashCookiesDeleteOnStartExit", "FlashCookieAutoRefresh",
-                 "FlashCookieNotify",
-                 ]:
-        return toBool(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]))
-    elif key in ["AdBlockSubscriptions", "AdBlockExceptions",
-                 "ClickToFlashWhitelist", "SendRefererWhitelist",
-                 "GreaseMonkeyDisabledScripts", "NoCacheHosts",
-                 "FlashCookiesWhitelist", "FlashCookiesBlacklist",
-                 ]:
-        return toList(prefClass.settings.value(
-            "Help/" + key, prefClass.helpDefaults[key]))
-    else:
-        return prefClass.settings.value("Help/" + key,
-                                        prefClass.helpDefaults[key])
-    
+    return prefClass.settings.value("Help/" + key,
+                                    prefClass.helpDefaults[key])
+
 
 def setHelp(key, value, prefClass=Prefs):
     """
@@ -2901,56 +2639,7 @@
     @param value the value to be set
     @param prefClass preferences class used as the storage area
     """
-    if key in ["StandardFont", "FixedFont"]:
-        prefClass.settings.setValue("Help/" + key, value.toString())
-    elif key == "SaveUrlColor":
-        prefClass.settings.setValue("Help/" + key, value.name())
-    elif key == "WebSearchKeywords":
-        # value is list of tuples of (keyword, engine name)
-        prefClass.settings.remove("Help/" + key)
-        prefClass.settings.beginWriteArray("Help/" + key, len(value))
-        index = 0
-        for v in value:
-            prefClass.settings.setArrayIndex(index)
-            prefClass.settings.setValue("Keyword", v[0])
-            prefClass.settings.setValue("Engine", v[1])
-            index += 1
-        prefClass.settings.endArray()
-    elif key == "DownloadManagerDownloads":
-        # value is list of tuples of (URL, save location, done flag, page url,
-        # date/time downloaded)
-        prefClass.settings.remove("Help/" + key)
-        prefClass.settings.beginWriteArray("Help/" + key, len(value))
-        index = 0
-        for v in value:
-            prefClass.settings.setArrayIndex(index)
-            prefClass.settings.setValue("URL", v[0])
-            prefClass.settings.setValue("Location", v[1])
-            prefClass.settings.setValue("Done", v[2])
-            prefClass.settings.setValue("PageURL", v[3])
-            prefClass.settings.setValue(
-                "Downloaded", v[4].toString("yyyy-MM-dd hh:mm:ss"))
-            index += 1
-        prefClass.settings.endArray()
-    elif key == "RssFeeds":
-        # value is list of tuples of (URL, title, icon)
-        prefClass.settings.remove("Help/" + key)
-        prefClass.settings.beginWriteArray("Help/" + key, len(value))
-        index = 0
-        for v in value:
-            prefClass.settings.setArrayIndex(index)
-            prefClass.settings.setValue("URL", v[0])
-            prefClass.settings.setValue("Title", v[1])
-            prefClass.settings.setValue("Icon", v[2])
-            prefClass.settings.setValue("Downloaded", v[4])
-            index += 1
-        prefClass.settings.endArray()
-    elif key in ["SyncFtpPassword", "SyncEncryptionKey"]:
-        from Utilities.crypto import pwConvert
-        prefClass.settings.setValue(
-            "Help/" + key, pwConvert(value, encode=True))
-    else:
-        prefClass.settings.setValue("Help/" + key, value)
+    prefClass.settings.setValue("Help/" + key, value)
 
 
 def getWebBrowser(key, prefClass=Prefs):
@@ -2961,11 +2650,6 @@
     @param prefClass preferences class used as the storage area
     @return the requested help setting
     """
-    # the following entries are identical to the ones of the QtWebKit based
-    # help viewer and are being redirected there
-    if key.startswith(("FlashCookie", "Pim", "VirusTotal")):
-        return getHelp(key, prefClass)
-    
     # Web inspector stuff must come before initializing web engine settings
     # because that starts the chromium web process
     if key == "WebInspectorPort":
@@ -3019,7 +2703,7 @@
             download["Downloaded"] = prefClass.settings.value("Downloaded")
             if download["Downloaded"] is None:
                 download["Downloaded"] = QDateTime()
-            elif isinstance(download["Downloaded"], basestring):
+            elif isinstance(download["Downloaded"], str):
                 download["Downloaded"] = QDateTime.fromString(
                     download["Downloaded"], "yyyy-MM-dd hh:mm:ss")
             downloads.append(download)
@@ -3093,11 +2777,14 @@
                  "DownloadManagerAutoOpen", "DownloadManagerAutoClose",
                  "PlaybackRequiresUserGesture", "JavaScriptCanPaste",
                  "WebRTCPublicInterfacesOnly", "DnsPrefetchEnabled",
+                 "FlashCookiesDeleteOnStartExit", "FlashCookieAutoRefresh",
+                 "FlashCookieNotify", "VirusTotalEnabled", "VirusTotalSecure",
                  ]:
         return toBool(prefClass.settings.value(
             "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
     elif key in ["GreaseMonkeyDisabledScripts", "SendRefererWhitelist",
                  "AdBlockSubscriptions", "AdBlockExceptions",
+                 "FlashCookiesWhitelist", "FlashCookiesBlacklist",
                  "SpellCheckLanguages",
                  ]:
         return toList(prefClass.settings.value(
@@ -3124,11 +2811,6 @@
     @param value the value to be set
     @param prefClass preferences class used as the storage area
     """
-    # the following entries are identical to the ones of the QtWebKit based
-    # help viewer and are being redirected there
-    if key.startswith(("FlashCookie", "Pim", "VirusTotal")):
-        setHelp(key, value, prefClass)
-    
     if key in ["StandardFont", "FixedFont"]:
         prefClass.settings.setValue("WebBrowser/" + key, value.toString())
     elif key == "SaveUrlColor":
@@ -3216,27 +2898,19 @@
 
 def getQtTranslationsDir(prefClass=Prefs):
     """
-    Module function to retrieve the Qt4TranslationsDir or Qt5TranslationsDir
+    Module function to retrieve the Qt5TranslationsDir
     setting depending on the current Qt version.
     
     @param prefClass preferences class used as the storage area
     @return the requested setting (string)
     """
-    if Globals.qVersionTuple() < (5, 0, 0):
-        s = prefClass.settings.value(
-            "Qt/Qt4TranslationsDir",
-            prefClass.qtDefaults["Qt4TranslationsDir"])
-    else:
-        s = prefClass.settings.value(
-            "Qt/Qt5TranslationsDir",
-            prefClass.qtDefaults["Qt5TranslationsDir"])
+    s = prefClass.settings.value(
+        "Qt/Qt5TranslationsDir",
+        prefClass.qtDefaults["Qt5TranslationsDir"])
     if s == "":
         s = os.getenv("QTTRANSLATIONSDIR", "")
     if s == "":
-        if Globals.qVersionTuple() < (5, 0, 0):
-            s = os.getenv("QT4TRANSLATIONSDIR", "")
-        else:
-            s = os.getenv("QT5TRANSLATIONSDIR", "")
+        s = os.getenv("QT5TRANSLATIONSDIR", "")
     if s == "":
         s = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
     if s == "" and Globals.isWindowsPlatform():
@@ -3255,7 +2929,7 @@
     @param prefClass preferences class used as the storage area
     @return the requested Qt setting
     """
-    if key in ["Qt4TranslationsDir", "Qt5TranslationsDir"]:
+    if key in ["Qt5TranslationsDir"]:
         return getQtTranslationsDir(prefClass)
     elif key in ["PyuicIndent"]:
         return int(prefClass.settings.value(

eric ide

mercurial