diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/instance.cpp | 4 | ||||
-rw-r--r-- | src/widgets/tab_activity_list.cpp | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/net/instance.cpp b/src/net/instance.cpp index c3af86c..6982f64 100644 --- a/src/net/instance.cpp +++ b/src/net/instance.cpp @@ -1,5 +1,7 @@ #include "instance.h" +#ifdef MASTODONPP_BUILD #include "mastodon_instance.h" +#endif #include "src/settings_interface.h" Instance* Instance::create_instance() { @@ -8,8 +10,10 @@ Instance* Instance::create_instance() { Instance* Instance::create_instance(AppSettingsTypes::InstanceType type) { switch (type) { +#ifdef MASTODONPP_BUILD case AppSettingsTypes::InstanceType::MASTODON: return new MastodonInstance; +#endif default: return nullptr; } diff --git a/src/widgets/tab_activity_list.cpp b/src/widgets/tab_activity_list.cpp index faa6138..63d6fbf 100644 --- a/src/widgets/tab_activity_list.cpp +++ b/src/widgets/tab_activity_list.cpp @@ -9,6 +9,7 @@ #include <QRandomGenerator> #include <QClipboard> #include <QMimeData> +#include <QMessageBox> TabActivityList::TabActivityList(Archive** archive, QWidget* parent) : data_archive(archive), QWidget(parent), ui(new Ui::TabActivityList) @@ -91,11 +92,15 @@ void TabActivityList::actionOpen_URL_triggered(bool checked) { // Really hacky code but works as a PoC and allows testing if (ok and not url.isEmpty()) { Instance* instance = Instance::create_instance(); - APPost* post = instance->get_post_from_url(url); - // Activity will be freed by StatusInfoWidget - APActivity* activity = new APActivity({.object = post}); - status_info_widget->do_process_activity(activity); - delete instance; instance = nullptr; + if (instance) { + APPost* post = instance->get_post_from_url(url); + // Activity will be freed by StatusInfoWidget + APActivity* activity = new APActivity({.object = post}); + status_info_widget->do_process_activity(activity); + delete instance; instance = nullptr; + } else + // Best is to remove option from menu, should be douable if the preprocessor touches .ui files + QMessageBox::critical(this, tr("Open status from URL"), tr("Could not create Instance object.\nPerhaps network support was disabled at compile time?")); } } |