diff options
-rw-r--r-- | src/archive/base_archive.cpp | 4 | ||||
-rw-r--r-- | src/archive/base_archive.h | 1 | ||||
-rw-r--r-- | src/archive/mastodon.cpp | 5 | ||||
-rw-r--r-- | src/archive/mastodon.h | 1 | ||||
-rw-r--r-- | src/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/settingsdialog.cpp | 9 | ||||
-rw-r--r-- | src/settingsdialog.h | 3 |
7 files changed, 22 insertions, 3 deletions
diff --git a/src/archive/base_archive.cpp b/src/archive/base_archive.cpp index 14fa417..47cadf2 100644 --- a/src/archive/base_archive.cpp +++ b/src/archive/base_archive.cpp @@ -11,3 +11,7 @@ Archive* Archive::create_archive(ArchiveType archive_type, const QString& main_f } Archive::Archive(const QString& filename) : main_filename(filename) {} + +const QString Archive::get_instance_address() { + return ""; +} diff --git a/src/archive/base_archive.h b/src/archive/base_archive.h index fcabcf1..4fdf08c 100644 --- a/src/archive/base_archive.h +++ b/src/archive/base_archive.h @@ -29,6 +29,7 @@ public: virtual void update_status_list(ViewStatusTypes allowed_types, QListWidget *parent) = 0; virtual const QString get_html_status_info(int status_index, int text_zone_width, StatusType status_type, QLocale* locale) = 0; virtual const QString get_html_status_text(int status_index) = 0; + virtual const QString get_instance_address(); protected: Archive(const QString& main_filename); diff --git a/src/archive/mastodon.cpp b/src/archive/mastodon.cpp index 297383e..01d476d 100644 --- a/src/archive/mastodon.cpp +++ b/src/archive/mastodon.cpp @@ -70,6 +70,11 @@ bool MastodonArchive::is_status_type_allowed(StatusType status_type, ViewStatusT } } +const QString MastodonArchive::get_instance_address() { + // TODO: implement + return "https://example.com"; +} + // specific to Mastodon ActivityStreams archives StatusType MastodonArchive::get_status_type(QJsonObject obj) { /* diff --git a/src/archive/mastodon.h b/src/archive/mastodon.h index 48be1f3..15a89f2 100644 --- a/src/archive/mastodon.h +++ b/src/archive/mastodon.h @@ -19,6 +19,7 @@ public: void update_status_list(ViewStatusTypes allowed_types, QListWidget *parent); const QString get_html_status_info(int status_index, int text_zone_width, StatusType status_type, QLocale* locale); const QString get_html_status_text(int status_index); + const QString get_instance_address(); private: QDir archive_root_dir; QDir attachment_dir; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4943775..c6203d4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -61,6 +61,8 @@ void MainWindow::on_actionSettings_triggered(bool checked) { if (!settings_dialog) { settings_dialog = new SettingsDialog(this); connect(settings_dialog, &QDialog::finished, this, &MainWindow::settingsDialog_done); + if (data_archive) + settings_dialog->set_instance_address(data_archive->get_instance_address()); } settings_dialog->open(); } diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 0c64641..213859a 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -1,5 +1,4 @@ #include "settingsdialog.h" -#include "settings_interface.h" #include <QPushButton> #include <QDialogButtonBox> @@ -62,10 +61,10 @@ void SettingsDialog::on_tokenLineEdit_editingFinished() { void SettingsDialog::on_instanceActionsLabel_linkActivated(const QString& link) { if (link == "action:fill-address") { update_ui_in_progress = true; - // TODO + ui->instanceAddressLineEdit->setText(instance_address); update_ui_in_progress = false; } else if (link == "action:request-token") { - // TODO + // TODO: open browser with token request URL } } @@ -104,3 +103,7 @@ void SettingsDialog::update_ui() { ui->tokenLineEdit->setText(settings_interface.read_setting("net/instance/token").value<QString>()); update_ui_in_progress = false; } + +void SettingsDialog::set_instance_address(const QString &url) { + instance_address = url; +} diff --git a/src/settingsdialog.h b/src/settingsdialog.h index e320a08..47cfa38 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -17,6 +17,7 @@ public: static void initialize_default_settings(); public slots: + void set_instance_address(const QString &url); void defaults_button_clicked(); void apply_button_clicked(); void cancel_button_clicked(); @@ -39,5 +40,7 @@ private: SettingsInterface settings_interface; bool update_ui_in_progress = false; + QString instance_address; + void update_ui(); }; |