From cd85a7d47ffe22ec2581adf88f9cb70a5537f5a9 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Sat, 11 May 2024 20:22:30 -0400 Subject: Disable remote instance settings if no mastodonpp Also fix a small bug in the request token flow. --- src/settingsdialog.cpp | 11 +++++++++-- src/settingsdialog.ui | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index abb481e..387c1e9 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -20,6 +20,13 @@ SettingsDialog::SettingsDialog(QWidget* parent) connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &SettingsDialog::apply_button_clicked); connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &SettingsDialog::cancel_button_clicked); +#ifndef MASTODONPP_BUILD + // Disable unusable settings + // This should be more precise if we ever add other fedi APIs, as it would disable all of them and not only the Mastodon one + ui->remoteInstanceGroupBox->setDisabled(true); + ui->remoteInstanceGroupBox->setToolTip(tr("Setting disabled as not built with mastodonpp support")); +#endif + update_ui(); } @@ -76,12 +83,12 @@ void SettingsDialog::on_instanceActionsLabel_linkActivated(const QString& link) QString url = instance->oauth2_step1(); if (not QDesktopServices::openUrl(url)) - QMessageBox::information(this, tr("Navigate to this URL"), tr("Please open the following URL in your browser: %1").arg(1)); + QMessageBox::information(this, tr("Navigate to this URL"), tr("Please open the following URL in your browser: %1").arg(url)); Instance::OAuth2Step2 step2 = {.ok = false}; while (not step2.ok) { bool ok; - QString code = QInputDialog::getText(this, tr("Enter authorization code"), tr("Enter the code given during the authentification flow:"), QLineEdit::Normal, "", &ok); + QString code = QInputDialog::getText(this, tr("Enter authorization code"), tr("Enter the given authentification code:"), QLineEdit::Normal, "", &ok); if (code.isEmpty()) return; // User canceled if (ok) step2 = instance->oauth2_step2(code); diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index b2c1c69..9e17fab 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -104,7 +104,7 @@ - + Instance with whom to fetch posts with -- cgit v1.2.3-54-g00ecf