aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2017-09-29 12:21:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-29 12:57:34 -0700
commita6aeaf897a445952b7e81542df00e0b9a77ce9b6 (patch)
treeac3770c4625d7c8c2a474366207b11a4e9dbea30 /desktop-widgets/plugins/facebook/facebookconnectwidget.cpp
parent689dcf105877f86e315a55c9d7a3aa04e071b2c2 (diff)
downloadsubsurface-a6aeaf897a445952b7e81542df00e0b9a77ce9b6.tar.gz
[Facebook] create userIdReceived slot
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/plugins/facebook/facebookconnectwidget.cpp')
-rw-r--r--desktop-widgets/plugins/facebook/facebookconnectwidget.cpp10
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)