Add back device code flow

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-05-16 21:58:25 +03:00
parent 2a58fb0ac5
commit 09c0c11033
14 changed files with 481 additions and 36 deletions

View File

@ -40,6 +40,7 @@
#include <QItemSelectionModel>
#include <QMenu>
#include <QPushButton>
#include <QDebug>
@ -134,8 +135,16 @@ void AccountListPage::listChanged()
void AccountListPage::on_actionAddMicrosoft_triggered()
{
MinecraftAccountPtr account =
MSALoginDialog::newAccount(this, tr("Please enter your Mojang account email and password to add your account."));
QMessageBox box(this);
box.setWindowTitle(tr("Add account"));
box.setText(tr("How do you want to login?"));
box.setIcon(QMessageBox::Question);
auto deviceCode = box.addButton(tr("Using device code"), QMessageBox::ButtonRole::YesRole);
auto authCode = box.addButton(tr("Using auth code"), QMessageBox::ButtonRole::NoRole);
box.setDefaultButton(authCode);
box.exec();
MinecraftAccountPtr account = MSALoginDialog::newAccount(
this, tr("Please enter your Mojang account email and password to add your account."), box.clickedButton() == deviceCode);
if (account) {
m_accounts->addAccount(account);