From b955da5f281ef95fbb8b96b936c1cade50a1e842 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 29 Nov 2012 17:53:37 +0100 Subject: [PATCH] Parse out the Dropbox user's name. --- src/internet/dropboxauthenticator.cpp | 6 +++++- src/internet/dropboxauthenticator.h | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/internet/dropboxauthenticator.cpp b/src/internet/dropboxauthenticator.cpp index 800bcb0f8..e31277a6a 100644 --- a/src/internet/dropboxauthenticator.cpp +++ b/src/internet/dropboxauthenticator.cpp @@ -2,6 +2,8 @@ #include +#include + #include #include #include @@ -189,5 +191,7 @@ void DropboxAuthenticator::RequestAccountInformation() { void DropboxAuthenticator::RequestAccountInformationFinished(QNetworkReply* reply) { reply->deleteLater(); - qLog(Debug) << reply->readAll(); + QJson::Parser parser; + QVariantMap response = parser.parse(reply).toMap(); + name_ = response["display_name"].toString(); } diff --git a/src/internet/dropboxauthenticator.h b/src/internet/dropboxauthenticator.h index 0c86b9315..ca1ddc96f 100644 --- a/src/internet/dropboxauthenticator.h +++ b/src/internet/dropboxauthenticator.h @@ -34,12 +34,14 @@ class DropboxAuthenticator : public QObject { QString token_; QString secret_; - // User's Dropbox uid. - QString uid_; // Permanent OAuth access tokens. QString access_token_; QString access_token_secret_; + + // User's Dropbox uid & name. + QString uid_; + QString name_; }; #endif // DROPBOXAUTHENTICATOR_H