GH-4299 Fix screenshot upload

This commit is contained in:
Janrupf 2021-12-29 17:08:15 +01:00
parent 6fe07561fe
commit be029ab360
2 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,11 @@ public:
}
virtual ~NetJob();
void setNetwork(shared_qobject_ptr<QNetworkAccessManager> network)
{
m_network = network;
}
bool addNetAction(NetAction::Ptr action);
NetAction::Ptr operator[](int index)

View File

@ -314,6 +314,8 @@ void ScreenshotsPage::on_actionUpload_triggered()
m_uploadActive = true;
ProgressDialog dialog(this);
job->setNetwork(APPLICATION->network());
if(dialog.execWithTask(job.get()) != QDialog::Accepted)
{
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"),
@ -348,7 +350,9 @@ void ScreenshotsPage::on_actionUpload_triggered()
auto albumTask = NetJob::Ptr(new NetJob("Imgur Album Creation"));
auto imgurAlbum = ImgurAlbumCreation::make(uploaded);
albumTask->addNetAction(imgurAlbum);
job->setNetwork(APPLICATION->network());
task.addTask(job);
albumTask->setNetwork(APPLICATION->network());
task.addTask(albumTask);
m_uploadActive = true;
ProgressDialog prog(this);