diff options
author | Christian Kamm <mail@ckamm.de> | 2019-01-10 12:08:03 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2019-01-10 12:08:03 +0300 |
commit | e87660ba28c95fe2462d58f901b8d2492521c57d (patch) | |
tree | 2d3372c940f699b6d85f120ca01a26708db2623d /src/gui/creds | |
parent | 0dd48d3a06134a96a70c4591ad9123af6261f541 (diff) | |
parent | e953ec82f9618e6b581419d80e6aa0b4e15be018 (diff) |
Merge remote-tracking branch 'origin/2.5'
Diffstat (limited to 'src/gui/creds')
-rw-r--r-- | src/gui/creds/httpcredentialsgui.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index f6f2a9f53..88c5a01b3 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -56,9 +56,7 @@ void HttpCredentialsGui::askFromUserAsync() _asyncAuth->start(); emit authorisationLinkChanged(); } else if (type == DetermineAuthTypeJob::Basic) { - // Show the dialog - // We will re-enter the event loop, so better wait the next iteration - QMetaObject::invokeMethod(this, "showDialog", Qt::QueuedConnection); + showDialog(); } else { // Shibboleth? qCWarning(lcHttpCredentialsGui) << "Bad http auth type:" << type; @@ -73,8 +71,7 @@ void HttpCredentialsGui::asyncAuthResult(OAuth::Result r, const QString &user, { switch (r) { case OAuth::NotSupported: - // We will re-enter the event loop, so better wait the next iteration - QMetaObject::invokeMethod(this, "showDialog", Qt::QueuedConnection); + showDialog(); _asyncAuth.reset(0); return; case OAuth::Error: @@ -116,24 +113,27 @@ void HttpCredentialsGui::showDialog() + QLatin1String("<br>"); } - QInputDialog dialog; - dialog.setWindowTitle(tr("Enter Password")); - dialog.setLabelText(msg); - dialog.setTextValue(_previousPassword); - dialog.setTextEchoMode(QLineEdit::Password); - if (QLabel *dialogLabel = dialog.findChild<QLabel *>()) { + QInputDialog *dialog = new QInputDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose, true); + dialog->setWindowTitle(tr("Enter Password")); + dialog->setLabelText(msg); + dialog->setTextValue(_previousPassword); + dialog->setTextEchoMode(QLineEdit::Password); + if (QLabel *dialogLabel = dialog->findChild<QLabel *>()) { dialogLabel->setOpenExternalLinks(true); dialogLabel->setTextFormat(Qt::RichText); } - bool ok = dialog.exec(); - if (ok) { - _password = dialog.textValue(); - _refreshToken.clear(); - _ready = true; - persist(); - } - emit asked(); + dialog->open(); + connect(dialog, &QDialog::finished, this, [this, dialog](int result) { + if (result == QDialog::Accepted) { + _password = dialog->textValue(); + _refreshToken.clear(); + _ready = true; + persist(); + } + emit asked(); + }); } QString HttpCredentialsGui::requestAppPasswordText(const Account *account) |