Add proxy authentication

This commit is contained in:
Florian Bruhin 2014-05-19 16:18:01 +02:00
parent 77eb7d621a
commit d4c90b4a60
2 changed files with 15 additions and 0 deletions

View File

@ -368,6 +368,8 @@ class QuteBrowser(QApplication):
tabs.currentChanged.connect(self.mainwindow.update_inspector)
self.networkmanager.authenticationRequired.connect(
status.on_authentication_required)
self.networkmanager.proxyAuthenticationRequired.connect(
status.on_proxy_authentication_required)
# status bar
self.modeman.entered.connect(status.on_mode_entered)

View File

@ -329,6 +329,19 @@ class StatusBar(QWidget):
authenticator.setUser(user)
authenticator.setPassword(password)
@pyqtSlot('QNetworkProxy', 'QAuthenticator')
def on_proxy_authentication_required(self, proxy, authenticator):
q = Question()
q.mode = PromptMode.user_pwd
q.text = "Proxy username ({}):".format(authenticator.realm())
self.prompt.question = q
answer = self.prompt.exec_()
if answer is not None:
user, password = answer
logging.debug("user: {} / pwd: {}".format(user, password))
authenticator.setUser(user)
authenticator.setPassword(password)
def resizeEvent(self, e):
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.