diff options
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 10 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.h | 1 |
2 files changed, 7 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) diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.h b/desktop-widgets/plugins/facebook/facebookconnectwidget.h index e39286832..da87c0ecf 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.h +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.h @@ -38,6 +38,7 @@ public slots: void sendDive(); void uploadFinished(); void albumListReceived(); + void userIdReceived(); void createFacebookAlbum(); void facebookAlbumCreated(); private: |