From d4c90b4a60e823ec5e6c727d4426ec4410ef3da5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 19 May 2014 16:18:01 +0200 Subject: [PATCH] Add proxy authentication --- qutebrowser/app.py | 2 ++ qutebrowser/widgets/statusbar/bar.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index a0c68287e..9927cab37 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -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) diff --git a/qutebrowser/widgets/statusbar/bar.py b/qutebrowser/widgets/statusbar/bar.py index ccd65d63b..6549efdf2 100644 --- a/qutebrowser/widgets/statusbar/bar.py +++ b/qutebrowser/widgets/statusbar/bar.py @@ -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.