From a8811a27f78698f1ab2acad47e90f3b16274e221 Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Mon, 24 Feb 2014 10:34:51 +0100 Subject: Working screenshot upload --- gui/dialogs/ScreenshotDialog.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'gui/dialogs/ScreenshotDialog.cpp') diff --git a/gui/dialogs/ScreenshotDialog.cpp b/gui/dialogs/ScreenshotDialog.cpp index 02764fa3..33e93162 100644 --- a/gui/dialogs/ScreenshotDialog.cpp +++ b/gui/dialogs/ScreenshotDialog.cpp @@ -39,7 +39,7 @@ QList ScreenshotDialog::selected() const return list; } -void ScreenshotDialog::on_buttonBox_accepted() +void ScreenshotDialog::on_uploadBtn_clicked() { QList screenshots = selected(); if (screenshots.isEmpty()) @@ -50,17 +50,18 @@ void ScreenshotDialog::on_buttonBox_accepted() NetJob *job = new NetJob("Screenshot Upload"); for (ScreenShot *shot : screenshots) { - qDebug() << shot->file; job->addNetAction(ScreenShotUpload::make(shot)); } + m_uploaded = screenshots; ProgressDialog prog(this); - prog.exec(job); - connect(job, &NetJob::failed, [this] + if (prog.exec(job) == QDialog::Accepted) + { + accept(); + } + else { CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), tr("Unknown error"), QMessageBox::Warning)->exec(); reject(); - }); - m_uploaded = screenshots; - connect(job, &NetJob::succeeded, this, &ScreenshotDialog::accept); + } } -- cgit v1.2.3