Handle cancelling of authentication
This commit is contained in:
parent
9ffc8d74c4
commit
77eb7d621a
@ -698,8 +698,8 @@ DATA = OrderedDict([
|
|||||||
|
|
||||||
('keybind.prompt', sect.ValueList(
|
('keybind.prompt', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
#('<Escape>', 'leave-mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
#('<Ctrl-N>', 'leave-mode'),
|
('<Ctrl-N>', 'leave-mode'),
|
||||||
('<Return>', 'prompt-accept'),
|
('<Return>', 'prompt-accept'),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class Prompt(TextBase):
|
|||||||
|
|
||||||
show_prompt = pyqtSignal()
|
show_prompt = pyqtSignal()
|
||||||
hide_prompt = pyqtSignal()
|
hide_prompt = pyqtSignal()
|
||||||
|
cancelled = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -77,6 +78,8 @@ class Prompt(TextBase):
|
|||||||
self._input.clear()
|
self._input.clear()
|
||||||
self._input.setEchoMode(QLineEdit.Normal)
|
self._input.setEchoMode(QLineEdit.Normal)
|
||||||
self.hide_prompt.emit()
|
self.hide_prompt.emit()
|
||||||
|
if self.question.answer is None:
|
||||||
|
self.cancelled.emit()
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.status.prompt', hide=True,
|
@cmdutils.register(instance='mainwindow.status.prompt', hide=True,
|
||||||
modes=['prompt'])
|
modes=['prompt'])
|
||||||
@ -129,6 +132,7 @@ class Prompt(TextBase):
|
|||||||
def exec_(self):
|
def exec_(self):
|
||||||
self.display()
|
self.display()
|
||||||
self.question.answered.connect(self.loop.quit)
|
self.question.answered.connect(self.loop.quit)
|
||||||
|
self.cancelled.connect(self.loop.quit)
|
||||||
self.loop.exec_()
|
self.loop.exec_()
|
||||||
return self.question.answer
|
return self.question.answer
|
||||||
|
|
||||||
|
@ -323,9 +323,11 @@ class StatusBar(QWidget):
|
|||||||
q.mode = PromptMode.user_pwd
|
q.mode = PromptMode.user_pwd
|
||||||
q.text = "Username ({}):".format(authenticator.realm())
|
q.text = "Username ({}):".format(authenticator.realm())
|
||||||
self.prompt.question = q
|
self.prompt.question = q
|
||||||
user, password = self.prompt.exec_()
|
answer = self.prompt.exec_()
|
||||||
authenticator.setUser(user)
|
if answer is not None:
|
||||||
authenticator.setPassword(password)
|
user, password = answer
|
||||||
|
authenticator.setUser(user)
|
||||||
|
authenticator.setPassword(password)
|
||||||
|
|
||||||
def resizeEvent(self, e):
|
def resizeEvent(self, e):
|
||||||
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.
|
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.
|
||||||
|
Loading…
Reference in New Issue
Block a user