| 92 | |
| 93 | |
| 94 | void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString& code, int expiresIn) { |
| 95 | m_externalLoginElapsed = 0; |
| 96 | m_externalLoginTimeout = expiresIn; |
| 97 | |
| 98 | m_externalLoginTimer.setInterval(1000); |
| 99 | m_externalLoginTimer.setSingleShot(false); |
| 100 | m_externalLoginTimer.start(); |
| 101 | |
| 102 | ui->progressBar->setMaximum(expiresIn); |
| 103 | ui->progressBar->setValue(m_externalLoginElapsed); |
| 104 | |
| 105 | QString urlString = uri.toString(); |
| 106 | QString linkString = QString("<a href=\"%1\">%2</a>").arg(urlString, urlString); |
| 107 | ui->label->setText(tr("<p>Please open up %1 in a browser and put in the code <b>%2</b> to proceed with login.</p>").arg(linkString, code)); |
| 108 | ui->actionButton->setVisible(true); |
| 109 | connect(ui->actionButton, &QPushButton::clicked, [=]() { |
| 110 | DesktopServices::openUrl(uri); |
| 111 | QClipboard* cb = QApplication::clipboard(); |
| 112 | cb->setText(code); |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | void MSALoginDialog::hideVerificationUriAndCode() { |
| 117 | m_externalLoginTimer.stop(); |
nothing calls this directly
no test coverage detected