Esempio n. 1
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()
Esempio n. 2
0
    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()
Esempio n. 3
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 _save(self):
     settings = Settings()
     settings.remove('ProtocolHandlers')
     settings.beginGroup('ProtocalHandlers')
     for key, val in self._protocolHandlers.items():
         settings.setValue(key, val)
     settings.endGroup()
Esempio n. 5
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()
Esempio n. 6
0
    def _saveSettings(self):
        settings = Settings()
        settings.beginGroup('Bookmarks')
        settings.setValue('showOnlyIconsInToolbar',
                          self._showOnlyIconsInToolbar)
        settings.setValue('showOnlyTextInToolbar', self._showOnlyTextInToolbar)
        settings.endGroup()

        self._saveBookmarks()
Esempio n. 7
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()
Esempio n. 8
0
    def closeEvent(self, event):
        '''
        @param: event QCloseEvent
        '''
        settings = Settings()
        settings.beginGroup('ClearPrivateData')
        settings.setValue('state', self._saveState())
        settings.endGroup()

        event.accept()
Esempio n. 9
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()
Esempio n. 10
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()
    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()
Esempio n. 13
0
    def accept(self):
        langs = []
        for idx in range(self._ui.listWidget.count()):
            t = self._ui.listWidget.item(idx).text()
            code = t[t.index('[') + 1:]
            code = code.replace(']', '')
            langs.append(code)

        settings = Settings()
        settings.beginGroup('Language')
        settings.setValue('acceptLanguage', langs)
        settings.endGroup()

        gVar.app.networkManager().loadSettings()

        self.close()
Esempio n. 14
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()
Esempio n. 15
0
    def getExistingDirectory(self, name, parent=None, caption='', dir_='',
            options=QFileDialog.ShowDirsOnly):
        '''
        @param: name QString
        @param: parent QWidget
        @param: caption QString
        @param: dir_ QString
        @param: options QFileDialog.Options
        @return: QString
        '''
        settings = Settings()
        settings.beginGroup('FileDialogPaths')

        lastDir = settings.value(name, dir_)

        path = QFileDialog.getExistingDirectory(parent, caption, lastDir, options)

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

        settings.endGroup()
        return path
Esempio n. 16
0
    def canCloseTabs(cls, settingsKey, title, description):
        settings = Settings()
        ask = settings.value('Browser-Tabs-Settings/' + settingsKey,
                             True,
                             type=bool)

        if ask:
            dialog = CheckBoxDialog(QMessageBox.Yes | QMessageBox.No,
                                    gVar.app.activeWindow())
            dialog.setDefaultButton(QMessageBox.No)
            dialog.setWindowTitle(title)
            dialog.setText(description)
            dialog.setCheckBoxText(_("Don't ask again"))
            dialog.setIcon(QMessageBox.Question)

            if dialog.exec_() != QMessageBox.Yes:
                return False

            if dialog.isChecked():
                settings.setValue('Browser-Tabs-Settings/' + settingsKey,
                                  False)

        return True
Esempio n. 17
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()
Esempio n. 18
0
    def accept(self):
        if self._ui.changeGlobal.isChecked():
            globalUserAgent = self._ui.globalComboBox.currentText()
        else:
            globalUserAgent = ''

        domainList = []
        userAgentsList = []

        for idx in range(self._ui.table.rowCount()):
            siteItem = self._ui.table.item(idx, 0)
            userAgentItem = self._ui.table.item(idx, 1)

            if not siteItem or not userAgentItem:
                continue

            domain = siteItem.text().strip()
            userAgent = userAgentItem.text().strip()

            if not domain or not userAgent:
                continue

            domainList.append(domain)
            userAgentsList.append(userAgent)

        settings = Settings()
        settings.beginGroup('Web-Browser-Settings')
        settings.setValue('UserAgent', globalUserAgent)
        settings.endGroup()

        settings.beginGroup('User-Agent-Settings')
        settings.setValue('UsePerDomainUA', self._ui.changePerSite.isChecked())
        settings.setValue('DomainList', domainList)
        settings.setValue('UserAgentsList', userAgentsList)
        settings.endGroup()

        self._manager.loadSettings()
        gVar.app.networkManager().loadSettings()
        self.close()
Esempio n. 19
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()