diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-12-24 21:34:23 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-24 15:54:28 -0800 |
commit | ee5d93e155ec58c82cb0f1225dc2f5b34f9e78ce (patch) | |
tree | cd69ebd7fa999ab7ae06d002543b38939cb8f9de /qt-ui/simplewidgets.cpp | |
parent | c8c17dc01ec66f8bc5641dbe93768aa8f4a9b364 (diff) | |
download | subsurface-ee5d93e155ec58c82cb0f1225dc2f5b34f9e78ce.tar.gz |
Changed Facebook stuff to socialnetworks.h/cpp
All Facebook related stuff now is on SocialNetworks.h/cpp
this makes it much easier to implement things and looking
for bugs.
working:
- logging in
- getting user id
- getting album id ( or creating it )
*much* more testing is needed, of course.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 6263e5521..76400ef41 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -661,49 +661,3 @@ void MultiFilter::closeFilter() MultiFilterSortModel::instance()->clearFilter(); hide(); } - -FacebookManager::FacebookManager() -{ -} - -bool FacebookManager::checkAlbumExists() -{ - QUrl albumListUrl("https://graph.facebook.com/me/albums?access_token=" + QString(prefs.facebook.access_token)); - QNetworkAccessManager *manager = new QNetworkAccessManager(); - QNetworkReply *reply = manager->get(QNetworkRequest(albumListUrl)); - - // Make this method synchronous. - QEventLoop loop; - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); - loop.exec(); - - QJsonDocument albumsDoc = QJsonDocument::fromJson(reply->readAll()); - QJsonArray albumObj = albumsDoc.object().value("data").toArray(); - foreach(const QJsonValue &v, albumObj){ - QJsonObject obj = v.toObject(); - if (obj.value("name").toString() == QString(prefs.facebook.album_name)) { - qDebug() << "Album already exists. Try to get the ID in the next commit."; - return false; - } - } - - qDebug() << "Album doesn't exists, let's create it."; - QUrlQuery params; - params.addQueryItem("name", prefs.facebook.album_name ); - params.addQueryItem("description", "Subsurface Album"); - params.addQueryItem("privacy", "{'value': 'SELF'}"); - - QNetworkRequest request(albumListUrl); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream"); - reply = manager->post(request, params.query().toLocal8Bit()); - connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); - loop.exec(); - - qDebug() << reply->readAll(); - -} - -void FacebookManager::createAlbum() -{ - -} |