From 73c242b6ebe786ee221ce0dfd878dba2a33cb2cd Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 29 Sep 2017 11:14:40 +0200 Subject: [Facebook] Use unblocking call for QNetworkRequest Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 8 +++++--- desktop-widgets/plugins/facebook/facebookconnectwidget.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index e7b84d1cb..6ade8218f 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -205,10 +205,12 @@ void FacebookManager::sendDive() request.setRawHeader(QByteArray("Content-Length"), QString::number(data.length()).toLocal8Bit()); QNetworkReply *reply = am->post(request,data); - QEventLoop loop; - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); - loop.exec(); + connect(reply, &QNetworkReply::finished, this, &FacebookManager::uploadFinished); +} +void FacebookManager::uploadFinished() +{ + auto reply = qobject_cast(sender()); QByteArray response = reply->readAll(); QJsonDocument jsonDoc = QJsonDocument::fromJson(response); QJsonObject obj = jsonDoc.object(); diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.h b/desktop-widgets/plugins/facebook/facebookconnectwidget.h index d7714945e..1c6e40e07 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.h +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.h @@ -8,6 +8,8 @@ class QWebEngineView; #else class QWebView; #endif +class QNetworkReply; + namespace Ui { class FacebookConnectWidget; class SocialnetworksDialog; @@ -31,7 +33,7 @@ public slots: void logout(); void setDesiredAlbumName(const QString& albumName); void sendDive(); - + void uploadFinished(); private: explicit FacebookManager(QObject *parent = 0); QString albumName; -- cgit v1.2.3-70-g09d2