aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConfuSomu2024-05-11 20:22:30 -0400
committerConfuSomu2024-05-11 20:22:30 -0400
commitcd85a7d47ffe22ec2581adf88f9cb70a5537f5a9 (patch)
tree1376ba53bf5f90c0885573ee3df7b561c33c9390 /src
parent39a2aa5b99ffd2ee702236a696768efc4b9fa070 (diff)
downloadActorViewer-cd85a7d47ffe22ec2581adf88f9cb70a5537f5a9.tar
ActorViewer-cd85a7d47ffe22ec2581adf88f9cb70a5537f5a9.tar.gz
ActorViewer-cd85a7d47ffe22ec2581adf88f9cb70a5537f5a9.zip
Disable remote instance settings if no mastodonpp
Also fix a small bug in the request token flow.
Diffstat (limited to 'src')
-rw-r--r--src/settingsdialog.cpp11
-rw-r--r--src/settingsdialog.ui2
2 files changed, 10 insertions, 3 deletions
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 @@
</layout>
</item>
<item>
- <widget class="QGroupBox" name="groupBox">
+ <widget class="QGroupBox" name="remoteInstanceGroupBox">
<property name="title">
<string>Instance with whom to fetch posts with</string>
</property>