diff options
Diffstat (limited to 'desktop-widgets/plugins/facebook/facebookconnectwidget.cpp')
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index 83fa25d28..b2e5f96f2 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -162,16 +162,18 @@ void FacebookManager::requestUserId() QUrl userIdRequest("https://graph.facebook.com/me?fields=id&access_token=" + QString(prefs.facebook.access_token)); QNetworkReply *reply = manager->get(QNetworkRequest(userIdRequest)); - QEventLoop loop; - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); - loop.exec(); + connect(reply, &QNetworkReply::finished, this, &FacebookManager::userIdReceived); +} +void FacebookManager::userIdReceived() +{ + QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll()); QJsonObject obj = jsonDoc.object(); if (obj.keys().contains("id")){ SettingsObjectWrapper::instance()->facebook->setUserId(obj.value("id").toString()); - return; } + reply->deleteLater(); } void FacebookManager::setDesiredAlbumName(const QString& a) |