MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / showVerificationUriAndCode

Method showVerificationUriAndCode

launcher/ui/dialogs/MSALoginDialog.cpp:94–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94void 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
116void MSALoginDialog::hideVerificationUriAndCode() {
117 m_externalLoginTimer.stop();

Callers

nothing calls this directly

Calls 7

QStringClass · 0.85
openUrlFunction · 0.85
setIntervalMethod · 0.80
setVisibleMethod · 0.80
startMethod · 0.45
toStringMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected