diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2017-09-29 11:14:40 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-29 12:43:45 -0700 |
commit | 73c242b6ebe786ee221ce0dfd878dba2a33cb2cd (patch) | |
tree | 96c23f5f0c8ae274f15b0e64fcee848341693fec /desktop-widgets | |
parent | 8ce4692b5c8f1792bd4d3feae08698ab4583328b (diff) | |
download | subsurface-73c242b6ebe786ee221ce0dfd878dba2a33cb2cd.tar.gz |
[Facebook] Use unblocking call for QNetworkRequest
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.h | 4 |
2 files changed, 8 insertions, 4 deletions
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<QNetworkReply*>(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; |