Exemplo n.º 1
0
 def loadSettings(self):
     self.homepageEntry.setText(
         str(settings.settings.value("general/Homepage")))
     self.closeWindowToggle.setChecked(
         settings.setting_to_bool("general/CloseWindowWithLastTab"))
     self.reopenableTabCount.setValue(
         settings.setting_to_int("general/ReopenableTabCount"))
     self.reopenableWindowCount.setValue(
         settings.setting_to_int("general/ReopenableWindowCount"))
     self.pinnedTabCount.setValue(
         settings.setting_to_int("general/PinnedTabCount"))
     self.tabHotkeysToggle.setChecked(
         settings.setting_to_bool("general/TabHotkeysVisible"))
     self.retainHistoryToggle.setChecked(
         settings.setting_to_bool("general/NewTabsRetainHistory"))
     self.duplicateTabsToggle.setChecked(
         settings.setting_to_bool("general/DuplicateTabs"))
     self.navBarVisibleToggle.setChecked(
         settings.setting_to_bool("general/NavigationToolBarVisible"))
     self.statusBarVisibleToggle.setChecked(
         settings.setting_to_bool("general/StatusBarVisible"))
     self.homeButtonVisibleToggle.setChecked(
         settings.setting_to_bool("general/HomeButtonVisible"))
     self.upButtonVisibleToggle.setChecked(
         settings.setting_to_bool("general/UpButtonVisible"))
     self.feedButtonVisibleToggle.setChecked(
         settings.setting_to_bool("general/FeedButtonVisible"))
Exemplo n.º 2
0
 def loadSettings(self):
     self.maximumURLLength.setValue(settings.setting_to_int("data/MaximumURLLength"))
     #self.maximumCacheSize.setValue(settings.setting_to_int("data/MaximumCacheSize"))
     self.rememberHistoryToggle.setChecked(settings.setting_to_bool("data/RememberHistory"))
     self.geolocationToggle.setChecked(settings.setting_to_bool("network/GeolocationEnabled"))
     self.geolocationWhitelist.clear()
     for url in data.geolocation_whitelist:
         self.geolocationWhitelist.addItem(url)
     self.geolocationBlacklist.clear()
     for url in data.geolocation_blacklist:
         self.geolocationBlacklist.addItem(url)
Exemplo n.º 3
0
 def loadSettings(self):
     self.maximumURLLength.setValue(
         settings.setting_to_int("data/MaximumURLLength"))
     #self.maximumCacheSize.setValue(settings.setting_to_int("data/MaximumCacheSize"))
     self.rememberHistoryToggle.setChecked(
         settings.setting_to_bool("data/RememberHistory"))
     self.geolocationToggle.setChecked(
         settings.setting_to_bool("network/GeolocationEnabled"))
     self.geolocationWhitelist.clear()
     for url in data.geolocation_whitelist:
         self.geolocationWhitelist.addItem(url)
     self.geolocationBlacklist.clear()
     for url in data.geolocation_blacklist:
         self.geolocationBlacklist.addItem(url)
Exemplo n.º 4
0
 def loadSettings(self):
     self.hostNameEntry.setText(str(settings.settings.value("proxy/Hostname")))
     self.userEntry.setText(str(settings.settings.value("proxy/User")))
     self.passwordEntry.setText(str(settings.settings.value("proxy/Password")))
     self.xssAuditingToggle.setChecked(settings.setting_to_bool("network/XSSAuditingEnabled"))
     self.dnsPrefetchingToggle.setChecked(settings.setting_to_bool("network/DnsPrefetchingEnabled"))
     port = settings.setting_to_int("proxy/Port")
     if port == "None":
         port = str(settings.default_port)
     self.portEntry.setValue(port)
     for index in range(0, self.proxySelect.count()):
         if self.proxySelect.itemText(index) == settings.settings.value("proxy/Type"):
             self.proxySelect.setCurrentIndex(index)
             break
Exemplo n.º 5
0
 def loadSettings(self):
     self.homepageEntry.setText(str(settings.settings.value("general/Homepage")))
     self.closeWindowToggle.setChecked(settings.setting_to_bool("general/CloseWindowWithLastTab"))
     self.reopenableTabCount.setValue(settings.setting_to_int("general/ReopenableTabCount"))
     self.reopenableWindowCount.setValue(settings.setting_to_int("general/ReopenableWindowCount"))
     self.pinnedTabCount.setValue(settings.setting_to_int("general/PinnedTabCount"))
     self.tabHotkeysToggle.setChecked(settings.setting_to_bool("general/TabHotkeysVisible"))
     self.retainHistoryToggle.setChecked(settings.setting_to_bool("general/NewTabsRetainHistory"))
     self.duplicateTabsToggle.setChecked(settings.setting_to_bool("general/DuplicateTabs"))
     self.navBarVisibleToggle.setChecked(settings.setting_to_bool("general/NavigationToolBarVisible"))
     self.statusBarVisibleToggle.setChecked(settings.setting_to_bool("general/StatusBarVisible"))
     self.homeButtonVisibleToggle.setChecked(settings.setting_to_bool("general/HomeButtonVisible"))
     self.upButtonVisibleToggle.setChecked(settings.setting_to_bool("general/UpButtonVisible"))
     self.feedButtonVisibleToggle.setChecked(settings.setting_to_bool("general/FeedButtonVisible"))
Exemplo n.º 6
0
 def loadSettings(self):
     self.hostNameEntry.setText(
         str(settings.settings.value("proxy/Hostname")))
     self.userEntry.setText(str(settings.settings.value("proxy/User")))
     self.passwordEntry.setText(
         str(settings.settings.value("proxy/Password")))
     self.xssAuditingToggle.setChecked(
         settings.setting_to_bool("network/XSSAuditingEnabled"))
     self.dnsPrefetchingToggle.setChecked(
         settings.setting_to_bool("network/DnsPrefetchingEnabled"))
     port = settings.setting_to_int("proxy/Port")
     if port == "None":
         port = str(settings.default_port)
     self.portEntry.setValue(port)
     for index in range(0, self.proxySelect.count()):
         if self.proxySelect.itemText(index) == settings.settings.value(
                 "proxy/Type"):
             self.proxySelect.setCurrentIndex(index)
             break
Exemplo n.º 7
0
 def run(self):
     if settings.setting_to_bool("content/AdblockEnabled"):
         load_adblock_rules()
     else:
         global adblock_filter
         global shelved_filter
         if len(adblock_filter.index.keys()) > 0:
             shelved_filter = adblock_filter
         adblock_filter = abpy.Filter([])
     self.quit()
Exemplo n.º 8
0
 def run(self):
     if settings.setting_to_bool("content/AdblockEnabled"):
         load_adblock_rules()
     else:
         global adblock_filter
         global shelved_filter
         if len(adblock_filter.index.keys()) > 0:
             shelved_filter = adblock_filter
         adblock_filter = abpy.Filter([])
     self.quit()
Exemplo n.º 9
0
 def createRequest(self, op, request, device=None):
     url = request.url()
     ctype = str(request.header(QNetworkRequest.ContentTypeHeader))
     urlString = url.toString()
     lurlString = urlString.lower()
     x = filtering.adblock_filter.match(urlString)
     y = url.authority() in filtering.host_rules if settings.setting_to_bool("content/HostFilterEnabled") and url.authority() != "" else False
     z = (lurlString.endswith(".swf") or "flash" in ctype) and not settings.setting_to_bool("content/FlashEnabled")
     aa = (lurlString.endswith(".gif") or "image/gif" in ctype) and not settings.setting_to_bool("content/GIFsEnabled")
     if x != None or y or z or aa:
         return QNetworkAccessManager.createRequest(self, self.GetOperation, QNetworkRequest(QUrl(random.choice(("http://www.randomkittengenerator.com/images/cats/rotator.php", "http://thecatapi.com/api/images/get?format=src&type=png&size=small")) if settings.setting_to_bool("content/KittensEnabled") else "data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==")))
     if urlString in tuple(replacement_table.keys()):
         return QNetworkAccessManager.createRequest(self, op, QNetworkRequest(QUrl(replacement_table[urlString])), device)
     if url.scheme() == "file" and os.path.isdir(os.path.abspath(url.path())):
         try:
             html = directoryView % {"title": urlString, "heading": url.path(), "links": "".join(["<a href=\"%s\">%s</a><br/>" % (QUrl.fromUserInput(os.path.join(urlString, path)).toString(), path,) for path in [".."] + sorted(os.listdir(os.path.abspath(url.path())))])}
         except:
             html = directoryView % {"title": urlString, "heading": url.path(), "links": tr("The contents of this directory could not be loaded.")}
         return NetworkReply(self, url, self.GetOperation, html)
     if url.scheme() == "nimbus-extension":
         request.setUrl(QUrl("http://127.0.0.1:8133/" + stringfunctions.chop(url.toString(QUrl.RemoveScheme), "//")))
         return QNetworkAccessManager.createRequest(self, op, request, device)
     if url.scheme() == "nimbus":
         request.setUrl(QUrl("file://%s/" % (paths.app_folder,) + stringfunctions.chop(url.toString(QUrl.RemoveScheme), "//")))
         return self.createRequest(op, request, device)
     if url.scheme() == "nimbus-settings":
         request.setUrl(QUrl("file://%s/" % (settings.settings_folder,) + stringfunctions.chop(url.toString(QUrl.RemoveScheme), "//")))
         return self.createRequest(op, request, device)
     if url.scheme() == "apt":
         os.system("xterm -e \"sudo apt-get install %s\" &" % (stringfunctions.chop(url.toString(QUrl.RemoveScheme), "//").split("&")[0],))
         return QNetworkAccessManager.createRequest(self, self.GetOperation, QNetworkRequest(QUrl("")))
     if url.scheme() == "mailto":
         QDesktopServices.openUrl(url)
         return QNetworkAccessManager.createRequest(self, self.GetOperation, QNetworkRequest(QUrl("")))
     else:
         return QNetworkAccessManager.createRequest(self, op, request, device)
Exemplo n.º 10
0
def applyWebSettings():
    websettings = QWebSettings.globalSettings()
    websettings.setAttribute(websettings.XSSAuditingEnabled, settings.setting_to_bool("network/XSSAuditingEnabled"))
    websettings.setAttribute(websettings.DnsPrefetchEnabled, settings.setting_to_bool("network/DnsPrefetchEnabled"))
    websettings.setAttribute(websettings.AutoLoadImages, settings.setting_to_bool("content/AutoLoadImages"))
    websettings.setAttribute(websettings.JavascriptCanOpenWindows, settings.setting_to_bool("content/JavascriptCanOpenWindows"))
    websettings.setAttribute(websettings.JavascriptCanCloseWindows, settings.setting_to_bool("content/JavascriptCanCloseWindows"))
    websettings.setAttribute(websettings.JavascriptCanAccessClipboard, settings.setting_to_bool("content/JavascriptCanAccessClipboard"))
    websettings.setAttribute(websettings.JavaEnabled, settings.setting_to_bool("content/JavaEnabled"))
    websettings.setAttribute(websettings.PrintElementBackgrounds, settings.setting_to_bool("content/PrintElementBackgrounds"))
    websettings.setAttribute(websettings.FrameFlatteningEnabled, settings.setting_to_bool("content/FrameFlatteningEnabled"))
    websettings.setAttribute(websettings.PluginsEnabled, settings.setting_to_bool("content/PluginsEnabled"))
    websettings.setAttribute(websettings.TiledBackingStoreEnabled, settings.setting_to_bool("content/TiledBackingStoreEnabled"))
    websettings.setAttribute(websettings.SiteSpecificQuirksEnabled, settings.setting_to_bool("content/SiteSpecificQuirksEnabled"))
    try: websettings.setAttribute(websettings.SpatialNavigationEnabled, settings.setting_to_bool("navigation/SpatialNavigationEnabled"))
    except: pass
    try: websettings.setAttribute(websettings.CaretBrowsingEnabled, settings.setting_to_bool("navigation/CaretBrowsingEnabled"))
    except: pass
Exemplo n.º 11
0
 def loadSettings(self):
     self.jsExceptionsPanel.loadSettings()
     self.imagesToggle.setChecked(
         settings.setting_to_bool("content/AutoLoadImages"))
     self.javascriptToggle.setChecked(
         settings.setting_to_bool("content/JavascriptEnabled"))
     self.javascriptCanOpenWindowsToggle.setChecked(
         settings.setting_to_bool("content/JavascriptCanOpenWindows"))
     self.javascriptCanCloseWindowsToggle.setChecked(
         settings.setting_to_bool("content/JavascriptCanCloseWindows"))
     self.javascriptCanAccessClipboardToggle.setChecked(
         settings.setting_to_bool("content/JavascriptCanAccessClipboard"))
     self.javascriptCanEnterFullscreenToggle.setChecked(
         settings.setting_to_bool(
             "content/JavascriptCanEnterFullscreenMode"))
     self.javascriptCanExitFullscreenToggle.setChecked(
         settings.setting_to_bool(
             "content/JavascriptCanExitFullscreenMode"))
     self.javaToggle.setChecked(
         settings.setting_to_bool("content/JavaEnabled"))
     self.flashToggle.setChecked(
         settings.setting_to_bool("content/FlashEnabled"))
     self.elementBackgroundsToggle.setChecked(
         settings.setting_to_bool("content/PrintElementBackgrounds"))
     self.pluginsToggle.setChecked(
         settings.setting_to_bool("content/PluginsEnabled"))
     self.adblockToggle.setChecked(
         settings.setting_to_bool("content/AdblockEnabled"))
     self.gifsToggle.setChecked(
         not settings.setting_to_bool("content/GIFsEnabled"))
     self.hostFilterToggle.setChecked(
         settings.setting_to_bool("content/HostFilterEnabled"))
     self.kittensToggle.setChecked(
         settings.setting_to_bool("content/KittensEnabled"))
     self.mediaToggle.setChecked(
         settings.setting_to_bool(
             "content/ReplaceHTML5MediaTagsWithEmbedTags"))
     self.contentViewersToggle.setChecked(
         settings.setting_to_bool("content/UseOnlineContentViewers"))
     self.tiledBackingStoreToggle.setChecked(
         settings.setting_to_bool("content/TiledBackingStoreEnabled"))
     self.frameFlattenToggle.setChecked(
         settings.setting_to_bool("content/FrameFlatteningEnabled"))
     self.siteSpecificQuirksToggle.setChecked(
         settings.setting_to_bool("content/SiteSpecificQuirksEnabled"))
Exemplo n.º 12
0
def applyWebSettings():
    websettings = QWebSettings.globalSettings()
    websettings.setAttribute(
        websettings.XSSAuditingEnabled,
        settings.setting_to_bool("network/XSSAuditingEnabled"))
    websettings.setAttribute(
        websettings.DnsPrefetchEnabled,
        settings.setting_to_bool("network/DnsPrefetchEnabled"))
    websettings.setAttribute(
        websettings.AutoLoadImages,
        settings.setting_to_bool("content/AutoLoadImages"))
    websettings.setAttribute(
        websettings.JavascriptCanOpenWindows,
        settings.setting_to_bool("content/JavascriptCanOpenWindows"))
    websettings.setAttribute(
        websettings.JavascriptCanCloseWindows,
        settings.setting_to_bool("content/JavascriptCanCloseWindows"))
    websettings.setAttribute(
        websettings.JavascriptCanAccessClipboard,
        settings.setting_to_bool("content/JavascriptCanAccessClipboard"))
    websettings.setAttribute(websettings.JavaEnabled,
                             settings.setting_to_bool("content/JavaEnabled"))
    websettings.setAttribute(
        websettings.PrintElementBackgrounds,
        settings.setting_to_bool("content/PrintElementBackgrounds"))
    websettings.setAttribute(
        websettings.FrameFlatteningEnabled,
        settings.setting_to_bool("content/FrameFlatteningEnabled"))
    websettings.setAttribute(
        websettings.PluginsEnabled,
        settings.setting_to_bool("content/PluginsEnabled"))
    websettings.setAttribute(
        websettings.TiledBackingStoreEnabled,
        settings.setting_to_bool("content/TiledBackingStoreEnabled"))
    websettings.setAttribute(
        websettings.SiteSpecificQuirksEnabled,
        settings.setting_to_bool("content/SiteSpecificQuirksEnabled"))
    try:
        websettings.setAttribute(
            websettings.SpatialNavigationEnabled,
            settings.setting_to_bool("navigation/SpatialNavigationEnabled"))
    except:
        pass
    try:
        websettings.setAttribute(
            websettings.CaretBrowsingEnabled,
            settings.setting_to_bool("navigation/CaretBrowsingEnabled"))
    except:
        pass
Exemplo n.º 13
0
 def createRequest(self, op, request, device=None):
     url = request.url()
     ctype = str(request.header(QNetworkRequest.ContentTypeHeader))
     urlString = url.toString()
     lurlString = urlString.lower()
     x = filtering.adblock_filter.match(urlString)
     y = url.authority(
     ) in filtering.host_rules if settings.setting_to_bool(
         "content/HostFilterEnabled") and url.authority() != "" else False
     z = (lurlString.endswith(".swf") or "flash"
          in ctype) and not settings.setting_to_bool("content/FlashEnabled")
     aa = (lurlString.endswith(".gif") or "image/gif"
           in ctype) and not settings.setting_to_bool("content/GIFsEnabled")
     if x != None or y or z or aa:
         return QNetworkAccessManager.createRequest(
             self, self.GetOperation,
             QNetworkRequest(
                 QUrl(
                     random.choice((
                         "http://www.randomkittengenerator.com/images/cats/rotator.php",
                         "http://thecatapi.com/api/images/get?format=src&type=png&size=small"
                     )) if settings.setting_to_bool("content/KittensEnabled"
                                                    ) else
                     "data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw=="
                 )))
     if urlString in tuple(replacement_table.keys()):
         return QNetworkAccessManager.createRequest(
             self, op, QNetworkRequest(QUrl(replacement_table[urlString])),
             device)
     if url.scheme() == "file" and os.path.isdir(os.path.abspath(
             url.path())):
         try:
             html = directoryView % {
                 "title":
                 urlString,
                 "heading":
                 url.path(),
                 "links":
                 "".join([
                     "<a href=\"%s\">%s</a><br/>" % (
                         QUrl.fromUserInput(os.path.join(urlString,
                                                         path)).toString(),
                         path,
                     ) for path in [".."] +
                     sorted(os.listdir(os.path.abspath(url.path())))
                 ])
             }
         except:
             html = directoryView % {
                 "title":
                 urlString,
                 "heading":
                 url.path(),
                 "links":
                 tr("The contents of this directory could not be loaded.")
             }
         return NetworkReply(self, url, self.GetOperation, html)
     if url.scheme() == "nimbus-extension":
         request.setUrl(
             QUrl("http://127.0.0.1:8133/" + stringfunctions.chop(
                 url.toString(QUrl.RemoveScheme), "//")))
         return QNetworkAccessManager.createRequest(self, op, request,
                                                    device)
     if url.scheme() == "nimbus":
         request.setUrl(
             QUrl("file://%s/" %
                  (paths.app_folder, ) + stringfunctions.chop(
                      url.toString(QUrl.RemoveScheme), "//")))
         return self.createRequest(op, request, device)
     if url.scheme() == "nimbus-settings":
         request.setUrl(
             QUrl("file://%s/" %
                  (settings.settings_folder, ) + stringfunctions.chop(
                      url.toString(QUrl.RemoveScheme), "//")))
         return self.createRequest(op, request, device)
     if url.scheme() == "apt":
         os.system("xterm -e \"sudo apt-get install %s\" &" %
                   (stringfunctions.chop(url.toString(QUrl.RemoveScheme),
                                         "//").split("&")[0], ))
         return QNetworkAccessManager.createRequest(
             self, self.GetOperation, QNetworkRequest(QUrl("")))
     if url.scheme() == "mailto":
         QDesktopServices.openUrl(url)
         return QNetworkAccessManager.createRequest(
             self, self.GetOperation, QNetworkRequest(QUrl("")))
     else:
         return QNetworkAccessManager.createRequest(self, op, request,
                                                    device)
Exemplo n.º 14
0
 def loadSettings(self):
     self.jsExceptionsPanel.loadSettings()
     self.imagesToggle.setChecked(settings.setting_to_bool("content/AutoLoadImages"))
     self.javascriptToggle.setChecked(settings.setting_to_bool("content/JavascriptEnabled"))
     self.javascriptCanOpenWindowsToggle.setChecked(settings.setting_to_bool("content/JavascriptCanOpenWindows"))
     self.javascriptCanCloseWindowsToggle.setChecked(settings.setting_to_bool("content/JavascriptCanCloseWindows"))
     self.javascriptCanAccessClipboardToggle.setChecked(settings.setting_to_bool("content/JavascriptCanAccessClipboard"))
     self.javascriptCanEnterFullscreenToggle.setChecked(settings.setting_to_bool("content/JavascriptCanEnterFullscreenMode"))
     self.javascriptCanExitFullscreenToggle.setChecked(settings.setting_to_bool("content/JavascriptCanExitFullscreenMode"))
     self.javaToggle.setChecked(settings.setting_to_bool("content/JavaEnabled"))
     self.flashToggle.setChecked(settings.setting_to_bool("content/FlashEnabled"))
     self.elementBackgroundsToggle.setChecked(settings.setting_to_bool("content/PrintElementBackgrounds"))
     self.pluginsToggle.setChecked(settings.setting_to_bool("content/PluginsEnabled"))
     self.adblockToggle.setChecked(settings.setting_to_bool("content/AdblockEnabled"))
     self.gifsToggle.setChecked(not settings.setting_to_bool("content/GIFsEnabled"))
     self.hostFilterToggle.setChecked(settings.setting_to_bool("content/HostFilterEnabled"))
     self.kittensToggle.setChecked(settings.setting_to_bool("content/KittensEnabled"))
     self.mediaToggle.setChecked(settings.setting_to_bool("content/ReplaceHTML5MediaTagsWithEmbedTags"))
     self.contentViewersToggle.setChecked(settings.setting_to_bool("content/UseOnlineContentViewers"))
     self.tiledBackingStoreToggle.setChecked(settings.setting_to_bool("content/TiledBackingStoreEnabled"))
     self.frameFlattenToggle.setChecked(settings.setting_to_bool("content/FrameFlatteningEnabled"))
     self.siteSpecificQuirksToggle.setChecked(settings.setting_to_bool("content/SiteSpecificQuirksEnabled"))