示例#1
0
    def _loadSettings(self):
        settings = Settings()
        settings.beginGroup('Browser-Tabs-Settings')
        self._dontCloseWithOneTab = settings.value('dontCloseWithOneTab',
                                                   False,
                                                   type=bool)
        self._showClosedTabsButton = settings.value('showClosedTabsButton',
                                                    False,
                                                    type=bool)
        self._newTabAfterActive = settings.value('newTabAfterActive',
                                                 True,
                                                 type=bool)
        self._newEmptyTabAfterActive = settings.value('newEmptyTabAfterActive',
                                                      False,
                                                      type=bool)
        settings.endGroup()

        settings.beginGroup('Web-URL-Settings')
        self._urlOnNewTab = settings.value('newTabUrl',
                                           'app:speeddial',
                                           type=QUrl)
        settings.endGroup()

        self._tabBar.loadSettings()

        self._updateClosedTabsButton()
示例#2
0
    def loadSettings(self):
        settings = Settings()
        settings.beginGroup('Language')
        # TODO:
        #langs = settings.value('acceptLanguage', AcceptLanguage.defaultLanguage(), type=[])
        settings.endGroup()
        # TODO:
        #gVar.app.webProfile().setHttpAcceptLanguage(AcceptLanguage.generateHeader(langs))

        proxy = QNetworkProxy()
        settings.beginGroup('Web-Proxy')
        proxyType = settings.value('ProxyType', 2)
        proxy.setHostName(settings.value('HostName', ''))
        proxy.setPort(settings.value('Port', 8080))
        proxy.setUser(settings.value('Username', ''))
        proxy.setPassword(settings.value('Password', ''))
        settings.endGroup()

        if proxyType == 0:
            proxy.setType(QNetworkProxy.NoProxy)
        elif proxyType == 3:
            proxy.setType(QNetworkProxy.HttpProxy)
        elif proxyType == 4:
            proxy.setType(QNetworkProxy.Socks5Proxy)

        if proxyType == 2:
            QNetworkProxy.setApplicationProxy(QNetworkProxy())
            QNetworkProxyFactory.setUseSystemConfiguration(True)
        else:
            QNetworkProxy.setApplicationProxy(proxy)
            QNetworkProxyFactory.setUseSystemConfiguration(False)

        self._urlInterceptor.loadSettings()
    def saveSettings(self):
        sessionDir = QDir(DataPaths.path(DataPaths.Sessions))

        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        settings.setValue('lastActiveSessionPath', sessionDir.relativeFilePath(self._lastActiveSessionPath))
        settings.endGroup()
示例#4
0
    def getSaveFileName(self, name, parent=None, caption='', dir_='',
            filter_='', selectedFilter='', options=QFileDialog.Options()):
        '''
        @param: name QString
        @param: parent QWidget
        @param: caption QString
        @param: dir_ QString
        @param: filter_ QString
        @param: selectedFilter QString TODO: this is an output parameter
        @param: options QFileDialog::Options
        @return: QString
        '''
        settings = Settings()
        settings.beginGroup('FileDialogPaths')

        lastDir = settings.value(name, '')
        fileName = self.getFileName(dir_)

        if not lastDir:
            lastDir = dir_
        else:
            lastDir = pathjoin(lastDir, fileName)

        path, selectedFilter = QFileDialog.getSaveFileName(parent, caption,
            lastDir, filter_, selectedFilter, options)

        if path:
            settings.setValue(name, QFileInfo(path).absolutePath())

        settings.endGroup()
        return path
    def loadSettings(self):
        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        self._globalUserAgent = settings.value('UserAgent', '', type=str)
        settings.endGroup()

        settings.beginGroup('User-Agent-Settings')
        self._usePerDomainUserAgent = settings.value('UsePerDomainUA',
                                                     False,
                                                     type=bool)
        domainList = settings.value('DomainList', [], type=list)
        userAgentsList = settings.value('UserAgentsList', [], type=list)
        settings.endGroup()

        self._usePerDomainUserAgent = self._usePerDomainUserAgent and domainList.count(
        ) == userAgentsList.count()

        if self._usePerDomainUserAgent:
            for idx in range(domainList.count()):
                self._userAgentsList[domainList[idx]] = userAgentsList[idx]

        if not self._globalUserAgent:
            userAgent = self._defaultUserAgent
        else:
            userAgent = self._globalUserAgent

        QWebEngineProfile.defaultProfile().setHttpUserAgent(userAgent)
示例#6
0
    def closeEvent(self, event):
        '''
        @param event QCloseEvent
        '''
        whitelist = []
        blacklist = []

        for idx in range(self._ui.whiteList.count()):
            item = self._ui.whiteList.item(idx)
            whitelist.append(item.text())

        for idx in range(self._ui.blackList.count()):
            item = self._ui.blackList.item(idx)
            blacklist.append(item.text())

        settings = Settings()
        settings.beginGroup('Cookie-Settings')
        settings.setValue('allowCookies', self._ui.saveCookies.isChecked())
        settings.setValue('filterThirdPartyCookies',
                          self._ui.filter3rdParty.isChecked())
        settings.setValue('filterTrackingCookie',
                          self._ui.filterTracking.isChecked())
        settings.setValue('deleteCookiesOnClose',
                          self._ui.deleteCookiesOnClose.isChecked())
        settings.setValue('whitelist', whitelist)
        settings.setValue('blacklist', blacklist)
        settings.endGroup()

        gVar.app.cookieJar().loadSettings()

        event.accept()
 def _save(self):
     settings = Settings()
     settings.remove('ProtocolHandlers')
     settings.beginGroup('ProtocalHandlers')
     for key, val in self._protocolHandlers.items():
         settings.setValue(key, val)
     settings.endGroup()
示例#8
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self._ui = uic.loadUi('mc/preferences/AcceptLanguage.ui', self)

        self.setAttribute(Qt.WA_DeleteOnClose)

        self._ui.listWidget.setLayoutDirection(Qt.LeftToRight)

        settings = Settings()
        settings.beginGroup('Language')
        # QStringList
        langs = settings.value('acceptLanguage',
                               self.defaultLanguage(),
                               type=list)
        settings.endGroup()

        for code in langs:
            loc = QLocale(code.replace('-', '_'))
            label = ''

            if loc.language() == QLocale.C:
                label = _('Personal [%s]') % code
            else:
                label = '%s/%s [%s]' % (loc.languageToString(
                    loc.language()), loc.countryToString(loc.country()), code)
            self._ui.listWidget.addItem(label)

        self._ui.add.clicked.connect(self.addLanguage)
        self._ui.remove.clicked.connect(self.removeLanguage)
        self._ui.up.clicked.connect(self.upLanguage)
        self._ui.down.clicked.connect(self.downLanguage)
示例#9
0
    def _saveSettings(self):
        settings = Settings()
        settings.beginGroup('Bookmarks')
        settings.setValue('showOnlyIconsInToolbar',
                          self._showOnlyIconsInToolbar)
        settings.setValue('showOnlyTextInToolbar', self._showOnlyTextInToolbar)
        settings.endGroup()

        self._saveBookmarks()
示例#10
0
    def loadSettings(self):
        with self._mutex:
            settings = Settings()
            settings.beginGroup('Web-Browser-Settings')
            self._sendDNT = settings.value('DoNotTrack', False)
            settings.endGroup()

            self._usePerDomainUserAgent = gVar.app.userAgentManager().usePerDomainUserAgents()
            self._userAgentsList = gVar.app.userAgentManager().perDomainUserAgentsList()
 def _loadSettings(self):
     settings = Settings()
     settings.beginGroup('HTML5Notifications')
     for enumType, name in HTML5PermissionsManager.s_settingList:
         grantedName = '%sGranted' % name
         deniedName = '%sDenied' % name
         self._granted[enumType] = settings.value(grantedName, [])
         self._denied[enumType] = settings.value(deniedName, [])
     settings.endGroup()
示例#12
0
 def _saveSettings(self):
     settings = Settings()
     settings.beginGroup('HTML5Notifications')
     for enumType, name in self.s_settingList:
         grantedName = '%sGranted' % name
         deniedName = '%sDenied' % name
         settings.setValue(grantedName, self._granted[enumType])
         settings.setValue(deniedName, self._denied[enumType])
     settings.endGroup()
 def _init(self):
     settings = Settings()
     settings.beginGroup('ProtocolHandlers')
     keys = settings.childKeys()
     for scheme in keys:
         url = settings.value(scheme, type=QUrl)
         self._protocolHandlers[scheme] = url
         self._registerHandler(scheme, url)
     settings.endGroup()
示例#14
0
    def lastPathForFileDialog(self, dialogName, fallbackPath):
        settings = Settings()
        settings.beginGroup('LastFileDialogsPaths')
        path = settings.value('FileDialogs/' + dialogName)
        settings.endGroup()

        if not path:
            return fallbackPath
        return path
示例#15
0
    def save(self):
        currentItem = self._ui.listWidget.currentItem()
        if not currentItem:
            return

        settings = Settings()
        settings.beginGroup('Themes')
        settings.setValue('activeTheme', currentItem.data(Qt.UserRole))
        settings.endGroup()
示例#16
0
 def loadSettings(self):
     settings = Settings()
     settings.beginGroup('Cookie-Settings')
     self._allowCookies = settings.value('allowCookies', True)
     self._filterThirdParty = settings.value('filterThirdPartyCookies', False)
     self._filterTrackingCookie = settings.value('filterTrackingCookie', False)
     self._whitelist = settings.value('whitelist', [])
     self._blacklist = settings.value('blacklist', [])
     settings.endGroup()
    def _resetToDefaults(self):
        settings = Settings()
        settings.beginGroup('NavigationBar')
        settings.remove('Layout')
        settings.remove('ShowSearchBar')
        settings.endGroup()

        windows = gVar.app.windows()
        for window in windows:
            window.navigationBar()._loadSettings()
示例#18
0
    def saveSettings(self):
        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        settings.setValue('AutomaticallyOpenProtocols', self.autoOpenProtocols)
        settings.setValue('BlockOpeningProtocols', self.blockedProtocols)
        settings.endGroup()

        settings.beginGroup('Browser-Tabs-Settings')
        settings.setValue('TabsOnTop', self.tabsOnTop)
        settings.endGroup()
示例#19
0
 def loadSettings(self):
     settings = Settings()
     settings.beginGroup('Bookmarks')
     self._showOnlyIconsInToolbar = settings.value('showOnlyIconsInToolbar',
                                                   False,
                                                   type=bool)
     self._showOnlyTextInToolbar = settings.value('showOnlyTextInToolbar',
                                                  False,
                                                  type=bool)
     settings.endGroup()
示例#20
0
 def closeEvent(self, event):
     '''
     @param: event QCloseEvent
     '''
     settings = Settings()
     settings.beginGroup('BrowsingLibrary')
     settings.setValue('size', self.size())
     settings.setValue('historySize', self._historyManager.saveState())
     settings.endGroup()
     event.accept()
示例#21
0
    def closeEvent(self, event):
        '''
        @param: event QCloseEvent
        '''
        settings = Settings()
        settings.beginGroup('ClearPrivateData')
        settings.setValue('state', self._saveState())
        settings.endGroup()

        event.accept()
示例#22
0
    def saveLastPathForFileDialog(self, dialogName, path):
        '''
        @params: QString
        '''
        if not path:
            return

        settings = Settings()
        settings.beginGroup('LastFileDialogsPaths')
        settings.setValue('FileDialogs/' + dialogName, path)
        settings.endGroup()
    def _saveSettings(self):
        settings = Settings()
        settings.beginGroup('HTML5Notifications')
        for enumType, name in HTML5PermissionsManager.s_settingList:
            grantedName = '%sGranted' % name
            deniedName = '%sDenied' % name
            settings.setValue(grantedName, self._granted[enumType])
            settings.setValue(deniedName, self._denied[enumType])
        settings.endGroup()

        gVar.app.html5PermissionsManager().loadSettings()
示例#24
0
 def _loadSettings(self):
     settings = Settings()
     settings.beginGroup('AddressBar')
     self._progressStyle = settings.value('ProgressStyle', 0)
     customColor = settings.value('UseCustomProgressColor', False)
     if customColor:
         self._progressColor = settings.value(
             'CustomProgressColor',
             self.palette().color(QPalette.Highlight))
     else:
         self._progressColor = QColor()
     settings.endGroup()
示例#25
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self._ui = uic.loadUi('mc/other/ClearPrivateData.ui', self)
        self._ui.buttonBox.setFocus()
        self._ui.history.clicked.connect(self._historyClicked)
        self._ui.clear.clicked.connect(self._dialogAccepted)
        self._ui.optimizeDb.clicked.connect(self._optimizeDb)
        self._ui.editCookies.clicked.connect(self._showCookieManager)

        settings = Settings()
        settings.beginGroup('ClearPrivateData')
        self._restoreState(settings.value('state', QByteArray()))
        settings.endGroup()
示例#26
0
    def _saveSettings(self):
        if not self._loaded:
            self.loadSettings()

        settings = Settings()
        settings.beginGroup('SpeedDial')
        settings.setValue('pages', self._generateAllPages())
        settings.setValue('background', self._backgroundImageUrl)
        settings.setValue('backsize', self._backgroundImageSize)
        settings.setValue('pagesrow', self._maxPagesInRow)
        settings.setValue('sdsize', self._sizeOfSpeedDials)
        settings.setValue('sdcenter', self._sdcentered)
        settings.endGroup()
示例#27
0
    def loadSettings(self):
        sessionDir = QDir(DataPaths.path(DataPaths.Sessions))

        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        self._lastActiveSessionPath = settings.value('lastActiveSessionPath', self.defaultSessionPath())
        settings.endGroup()

        if QDir.isRelativePath(self._lastActiveSessionPath):
            self._lastActiveSessionPath = sessionDir.absoluteFilePath(self._lastActiveSessionPath)

        # Fallback to default session
        if not RestoreManager.validateFile(self._lastActiveSessionPath):
            self._lastActiveSessionPath = self.defaultSessionPath()
示例#28
0
    def accept(self):
        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        settings.setValue('allowJavaScriptOpenWindow',
                          self._ui.jscanOpenWindow.isChecked())
        settings.setValue('allowJavaScriptActivationWindow',
                          self._ui.jscanActivateWindow.isChecked())
        settings.setValue('allowJavaScriptAccessClipboard',
                          self._ui.jscanAccessClipboard.isChecked())
        settings.setValue('allowJavaScriptPaste',
                          self._ui.jscanPaste.isChecked())
        settings.endGroup()

        self.close()
示例#29
0
 def loadSettings(self):
     settings = Settings()
     settings.beginGroup('Notifications')
     self._enabled = settings.value('Enabled', True)
     self._timeout = settings.value('Timeout', 6000)
     if const.OS_UNIX:  # && !defined(DISABLE_DBUS)
         if settings.value('UseNativeDesktop', True):
             self._notifType = self.DesktopNative
         else:
             self._notifType = self.PopupWidget
     else:
         self._notifType = self.PopupWidget
     self._position = settings.value('Position', QPoint(10, 10), type=QPoint)
     settings.endGroup()
    def _saveSettings(self):
        ids = []
        for idx in range(self._ui.currentItems.count()):
            ids.append(self._ui.currentItems.item(idx).data(Qt.UserRole + 10))

        settings = Settings()
        settings.beginGroup('NavigationBar')
        settings.setValue('Layout', ids)
        settings.setValue('ShowSearchBar', self._ui.showSearchBar.isChecked())
        settings.endGroup()

        windows = gVar.app.windows()
        for window in windows:
            window.navigationBar()._loadSettings()