add tooltip to url button

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-06-13 08:51:11 +03:00
parent 2b229d7326
commit 7fdc65eda8
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 10 additions and 4 deletions

View File

@ -46,6 +46,8 @@
MSADeviceCodeStep::MSADeviceCodeStep(AccountData* data) : AuthStep(data) MSADeviceCodeStep::MSADeviceCodeStep(AccountData* data) : AuthStep(data)
{ {
m_clientId = APPLICATION->getMSAClientID(); m_clientId = APPLICATION->getMSAClientID();
connect(&m_expiration_timer, &QTimer::timeout, this, &MSADeviceCodeStep::abort);
connect(&m_pool_timer, &QTimer::timeout, this, &MSADeviceCodeStep::authenticateUser);
} }
QString MSADeviceCodeStep::describe() QString MSADeviceCodeStep::describe()
@ -133,11 +135,9 @@ void MSADeviceCodeStep::deviceAutorizationFinished()
m_expiration_timer.setTimerType(Qt::VeryCoarseTimer); m_expiration_timer.setTimerType(Qt::VeryCoarseTimer);
m_expiration_timer.setInterval(rsp.expires_in * 1000); m_expiration_timer.setInterval(rsp.expires_in * 1000);
m_expiration_timer.setSingleShot(true); m_expiration_timer.setSingleShot(true);
connect(&m_expiration_timer, &QTimer::timeout, this, &MSADeviceCodeStep::abort);
m_expiration_timer.start(); m_expiration_timer.start();
m_pool_timer.setTimerType(Qt::VeryCoarseTimer); m_pool_timer.setTimerType(Qt::VeryCoarseTimer);
m_pool_timer.setSingleShot(true); m_pool_timer.setSingleShot(true);
connect(&m_pool_timer, &QTimer::timeout, this, &MSADeviceCodeStep::authenticateUser);
startPoolTimer(); startPoolTimer();
} }

View File

@ -64,8 +64,11 @@ MSALoginDialog::MSALoginDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MS
ui->qr->setPixmap(QIcon((":/documents/login-qr.svg")).pixmap(QSize(150, 150))); ui->qr->setPixmap(QIcon((":/documents/login-qr.svg")).pixmap(QSize(150, 150)));
ui->title->setText(tr("Login to %1").arg(BuildConfig.LAUNCHER_DISPLAYNAME)); ui->title->setText(tr("Login to %1").arg(BuildConfig.LAUNCHER_DISPLAYNAME));
connect(ui->loginButton, &QPushButton::clicked, this, [this] { connect(ui->loginButton, &QPushButton::clicked, this, [this] {
if (m_url.isValid()) if (m_url.isValid()) {
DesktopServices::openUrl(m_url); if (!DesktopServices::openUrl(m_url)) {
QApplication::clipboard()->setText(m_url.toString());
}
}
}); });
} }
@ -104,6 +107,8 @@ MSALoginDialog::~MSALoginDialog()
void MSALoginDialog::onTaskFailed(QString reason) void MSALoginDialog::onTaskFailed(QString reason)
{ {
// Set message // Set message
m_authflow_task->disconnect();
m_devicecode_task->disconnect();
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
auto lines = reason.split('\n'); auto lines = reason.split('\n');
QString processed; QString processed;
@ -127,6 +132,7 @@ void MSALoginDialog::onTaskFailed(QString reason)
void MSALoginDialog::authorizeWithBrowser(const QUrl& url) void MSALoginDialog::authorizeWithBrowser(const QUrl& url)
{ {
ui->stackedWidget->setCurrentIndex(1); ui->stackedWidget->setCurrentIndex(1);
ui->loginButton->setToolTip(QString("<div style='width: 200px;'>%1</div>").arg(url.toString()));
m_url = url; m_url = url;
} }